#617 Compiler bug - traceback in switch with missing case expression

KevinKelley Sat 30 May 2009

This test case:

class bug
{
  Void main()
  {
    str := "a"
    switch (str)
    {
      case "a":
    }
  }
}

generates this compiler stack trace:

ERROR: cannot compile script
sys::NullErr: Coerce to non-null
  fan.sys.NullErr.makeCoerce (NullErr.java:38)
  compiler::Parser.switchBlock (Parser.fan:1115)
  compiler::Parser.switchStmt (Parser.fan:1086)
  compiler::Parser.stmt (Parser.fan:805)
  compiler::Parser.stmtOrBlock (Parser.fan:779)
  compiler::Parser.block (Parser.fan:760)
  compiler::Parser.methodDef (Parser.fan:671)
  compiler::Parser.slotDef (Parser.fan:403)
  compiler::Parser.typeDef (Parser.fan:206)
  compiler::Parser.parse (Parser.fan:49)
  compiler::Parse.run (Parse.fan:46)
  More...

I'm not sure if that should be legal or not; if not it needs an error message instead of a walkback.

brian Sat 30 May 2009

Promoted to ticket #617 and assigned to brian

Thanks for reporting that

brian Tue 2 Jun 2009

Ticket resolved in 1.0.44

Login or Signup to reply.