wyvernlang / wyvern

The Wyvern programming language.
http://wyvernlang.github.io/
GNU General Public License v2.0
556 stars 65 forks source link

NullPointerException on `if` with syntax error in arm #220

Open hcnelson99 opened 6 years ago

hcnelson99 commented 6 years ago

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 commented 6 years ago

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.