Exception in thread "main" java.lang.NullPointerException
at com.stuffwithstuff.magpie.interpreter.PatternTester.test(PatternTester.java:15)
at com.stuffwithstuff.magpie.interpreter.ExprEvaluator.evaluateCases(ExprEvaluator.java:334)
at com.stuffwithstuff.magpie.interpreter.ExprEvaluator.visit(ExprEvaluator.java:202)
at com.stuffwithstuff.magpie.interpreter.ExprEvaluator.visit(ExprEvaluator.java:20)
at com.stuffwithstuff.magpie.ast.MatchExpr.accept(MatchExpr.java:21)
at com.stuffwithstuff.magpie.interpreter.ExprEvaluator.evaluate(ExprEvaluator.java:33)
at com.stuffwithstuff.magpie.interpreter.Interpreter.evaluate(Interpreter.java:55)
at com.stuffwithstuff.magpie.interpreter.Interpreter.interpret(Interpreter.java:50)
at com.stuffwithstuff.magpie.Repl.readAndEvaluate(Repl.java:24)
at com.stuffwithstuff.magpie.app.ConsoleRepl.run(ConsoleRepl.java:31)
at com.stuffwithstuff.magpie.app.MagpieApp.main(MagpieApp.java:38)
Ouch. Both of those are actually syntax errors but were slipping through the parser. I fixed it to catch that and also improved how it reports syntax errors to the user a bit.
Evaluating the code:
def foo(()) end foo()
or
match "foo" case () then print("yay") end
causes the following exception:
Exception in thread "main" java.lang.NullPointerException at com.stuffwithstuff.magpie.interpreter.PatternTester.test(PatternTester.java:15) at com.stuffwithstuff.magpie.interpreter.ExprEvaluator.evaluateCases(ExprEvaluator.java:334) at com.stuffwithstuff.magpie.interpreter.ExprEvaluator.visit(ExprEvaluator.java:202) at com.stuffwithstuff.magpie.interpreter.ExprEvaluator.visit(ExprEvaluator.java:20) at com.stuffwithstuff.magpie.ast.MatchExpr.accept(MatchExpr.java:21) at com.stuffwithstuff.magpie.interpreter.ExprEvaluator.evaluate(ExprEvaluator.java:33) at com.stuffwithstuff.magpie.interpreter.Interpreter.evaluate(Interpreter.java:55) at com.stuffwithstuff.magpie.interpreter.Interpreter.interpret(Interpreter.java:50) at com.stuffwithstuff.magpie.Repl.readAndEvaluate(Repl.java:24) at com.stuffwithstuff.magpie.app.ConsoleRepl.run(ConsoleRepl.java:31) at com.stuffwithstuff.magpie.app.MagpieApp.main(MagpieApp.java:38)