mirror of
https://github.com/enso-org/enso.git
synced 2024-08-16 08:20:32 +03:00
Don't NPE on op ._
when translating tree to IR (#8381)
Encountered a random NPE when playing with bookclubs. Test case demonstrating the problem is attached. Threw in a bunch of minor tweaks to logs to make life of the person debugging code more pleasant.
This commit is contained in:
parent
76fb9f5c4b
commit
36996c8938
@ -40,6 +40,7 @@ logging-service {
|
|||||||
org.enso.languageserver.protocol.json.JsonConnectionController = debug
|
org.enso.languageserver.protocol.json.JsonConnectionController = debug
|
||||||
org.enso.jsonrpc.JsonRpcServer = debug
|
org.enso.jsonrpc.JsonRpcServer = debug
|
||||||
org.enso.languageserver.runtime.RuntimeConnector = debug
|
org.enso.languageserver.runtime.RuntimeConnector = debug
|
||||||
|
org.enso.interpreter.runtime.HostClassLoader = error
|
||||||
}
|
}
|
||||||
appenders = [
|
appenders = [
|
||||||
{
|
{
|
||||||
|
@ -43,6 +43,8 @@ public interface CompilerContext extends CompilerStub {
|
|||||||
|
|
||||||
void log(Level level, String msg, Object... args);
|
void log(Level level, String msg, Object... args);
|
||||||
|
|
||||||
|
void log(Level level, String msg, Throwable ex);
|
||||||
|
|
||||||
void logSerializationManager(Level level, String msg, Object... args);
|
void logSerializationManager(Level level, String msg, Object... args);
|
||||||
|
|
||||||
void notifySerializeModule(QualifiedName moduleName);
|
void notifySerializeModule(QualifiedName moduleName);
|
||||||
|
@ -26,7 +26,7 @@ class AttachVisualizationCmd(
|
|||||||
): Future[Unit] = {
|
): Future[Unit] = {
|
||||||
ctx.executionService.getLogger.log(
|
ctx.executionService.getLogger.log(
|
||||||
Level.FINE,
|
Level.FINE,
|
||||||
"Attach visualization cmd for request id [{}] and visualization id [{}]",
|
"Attach visualization cmd for request id [{0}] and visualization id [{1}]",
|
||||||
Array(maybeRequestId, request.visualizationId)
|
Array(maybeRequestId, request.visualizationId)
|
||||||
)
|
)
|
||||||
ctx.endpoint.sendToClient(
|
ctx.endpoint.sendToClient(
|
||||||
|
@ -139,7 +139,7 @@ class UpsertVisualizationJob(
|
|||||||
)(implicit ctx: RuntimeContext): Unit = {
|
)(implicit ctx: RuntimeContext): Unit = {
|
||||||
ctx.executionService.getLogger.log(
|
ctx.executionService.getLogger.log(
|
||||||
Level.SEVERE,
|
Level.SEVERE,
|
||||||
"Visualization for expression {0} failed: {1} (evaluation result: {2}",
|
"Visualization for expression {0} failed: {1} (evaluation result: {2})",
|
||||||
Array(expressionId, message, executionResult)
|
Array(expressionId, message, executionResult)
|
||||||
)
|
)
|
||||||
ctx.endpoint.sendToClient(
|
ctx.endpoint.sendToClient(
|
||||||
|
@ -1438,7 +1438,11 @@ final class TreeToIr {
|
|||||||
} else {
|
} else {
|
||||||
throw translateEntity(app, Syntax.UnexpectedExpression$.MODULE$);
|
throw translateEntity(app, Syntax.UnexpectedExpression$.MODULE$);
|
||||||
}
|
}
|
||||||
list = app.getLhs();
|
if (app.getLhs() != null) {
|
||||||
|
list = app.getLhs();
|
||||||
|
} else {
|
||||||
|
throw translateEntity(app, Syntax.UnexpectedExpression$.MODULE$);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
segments.add(list);
|
segments.add(list);
|
||||||
java.util.Collections.reverse(segments);
|
java.util.Collections.reverse(segments);
|
||||||
|
@ -93,6 +93,11 @@ final class TruffleCompilerContext implements CompilerContext {
|
|||||||
loggerCompiler.log(level, msg, args);
|
loggerCompiler.log(level, msg, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void log(Level level, String msg, Throwable ex) {
|
||||||
|
loggerCompiler.log(level, msg, ex);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void logSerializationManager(Level level, String msg, Object... args) {
|
public void logSerializationManager(Level level, String msg, Object... args) {
|
||||||
loggerSerializationManager.log(level, msg, args);
|
loggerSerializationManager.log(level, msg, args);
|
||||||
|
@ -30,6 +30,16 @@ public class ErrorCompilerTest extends CompilerTest {
|
|||||||
assertSingleSyntaxError(ir, Syntax.InvalidUnderscore$.MODULE$, "Invalid use of _", 14, 15);
|
assertSingleSyntaxError(ir, Syntax.InvalidUnderscore$.MODULE$, "Invalid use of _", 14, 15);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void spaceDotUnderscore() throws Exception {
|
||||||
|
var ir = parse("""
|
||||||
|
run op =
|
||||||
|
op ._
|
||||||
|
""");
|
||||||
|
|
||||||
|
assertSingleSyntaxError(ir, Syntax.UnexpectedExpression$.MODULE$, "Unexpected expression", 14, 16);
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void unaryMinus() throws Exception {
|
public void unaryMinus() throws Exception {
|
||||||
var ir = parse("""
|
var ir = parse("""
|
||||||
|
Loading…
Reference in New Issue
Block a user