wyvern icon indicating copy to clipboard operation
wyvern copied to clipboard

NullPointerException on `if` with syntax error in arm

Open hcnelson99 opened this issue 6 years ago • 1 comments

Test case:

require stdout
if (true)
        stdout.print(error")
    else
        unit

Observed behavior:

Exception in thread "main" java.lang.NullPointerException
	at wyvern.tools.parsing.DSLLit.generateIL(DSLLit.java:104)
	at wyvern.tools.parsing.DSLLit.generateIL(DSLLit.java:30)
	at wyvern.tools.typedAST.core.expressions.Application.generateILForTuples(Application.java:173)
	at wyvern.tools.typedAST.core.expressions.Application.generateIL(Application.java:115)
	at wyvern.tools.typedAST.interfaces.ExpressionAST.genTopLevel(ExpressionAST.java:28)
	at wyvern.tools.typedAST.core.Sequence.genTopLevel(Sequence.java:288)
	at wyvern.tools.typedAST.core.Script.generateIL(Script.java:49)
	at wyvern.target.corewyvernIL.support.ModuleResolver.load(ModuleResolver.java:238)
	at wyvern.tools.Interpreter.main(Interpreter.java:61)

Expected behavior: error message with line number

hcnelson99 avatar Jun 02 '18 00:06 hcnelson99

Similar test case:

require stdout
if (true)
    stdout.print("good")
    stdout.print("good")
    stdout.print("good")
    stdout.print("good")
    stdout.print("error"),
    stdout.print("good")
    stdout.print("good")
    stdout.print("good")
    stdout.print("good")
  else
    unit

Observed behavior:

Error when running parseExpression on input "stdout.print("good")
stdout.print("good")
stdout.print("good")
stdout.print("good")
stdout.print("error"),
stdout.print("good")
stdout.print("good")
stdout.print("good")
stdout.print("good")
"
Exception in thread "main" java.lang.NullPointerException
	at wyvern.tools.parsing.DSLLit.generateIL(DSLLit.java:104)
	at wyvern.tools.parsing.DSLLit.generateIL(DSLLit.java:30)
	at wyvern.tools.typedAST.core.expressions.Application.generateILForTuples(Application.java:173)
	at wyvern.tools.typedAST.core.expressions.Application.generateIL(Application.java:115)
	at wyvern.tools.typedAST.interfaces.ExpressionAST.genTopLevel(ExpressionAST.java:28)
	at wyvern.tools.typedAST.core.Sequence.genTopLevel(Sequence.java:288)
	at wyvern.tools.typedAST.core.Script.generateIL(Script.java:49)
	at wyvern.target.corewyvernIL.support.ModuleResolver.load(ModuleResolver.java:238)
	at wyvern.tools.Interpreter.main(Interpreter.java:61)

This one prints the body of the if but doesn't give the line number of the error.

hcnelson99 avatar Jun 02 '18 00:06 hcnelson99