When I compile the following code:
import oak.io.*;
class foo {
static final int CAT = 1;
static final int DOG = 2;
boolean broken(int i) {
switch (i) {
case CAT: return true;
case DAWG: return true;
default: return false;
}
}
}
I get the following error:
pan:/tmp[1031] oakc foo.oak
oak.lang.NullPointerException
at oak.tools.tree.IdentifierExpression.inlineValue(IdentifierExpression.oak)
at oak.tools.tree.CaseStatement.check(CaseStatement.oak)
at oak.tools.tree.SwitchStatement.check(SwitchStatement.oak)
at oak.tools.tree.CompoundStatement.check(CompoundStatement.oak)
at oak.tools.tree.Statement.checkMethod(Statement.oak)
at oak.tools.oakc.SourceField.check(SourceField.oak)
at oak.tools.oakc.SourceClass.check(SourceClass.oak)
at oak.tools.oakc.SourceClass.compile(SourceClass.oak)
at oak.tools.oakc.Main.main(Main.oak)
oakc: an exception has occurred, please contact x47242.
foo.oak:10: Undefined variable: DAWG
foo.oak:10: case DAWG: return true;
^
import oak.io.*;
class foo {
static final int CAT = 1;
static final int DOG = 2;
boolean broken(int i) {
switch (i) {
case CAT: return true;
case DAWG: return true;
default: return false;
}
}
}
I get the following error:
pan:/tmp[1031] oakc foo.oak
oak.lang.NullPointerException
at oak.tools.tree.IdentifierExpression.inlineValue(IdentifierExpression.oak)
at oak.tools.tree.CaseStatement.check(CaseStatement.oak)
at oak.tools.tree.SwitchStatement.check(SwitchStatement.oak)
at oak.tools.tree.CompoundStatement.check(CompoundStatement.oak)
at oak.tools.tree.Statement.checkMethod(Statement.oak)
at oak.tools.oakc.SourceField.check(SourceField.oak)
at oak.tools.oakc.SourceClass.check(SourceClass.oak)
at oak.tools.oakc.SourceClass.compile(SourceClass.oak)
at oak.tools.oakc.Main.main(Main.oak)
oakc: an exception has occurred, please contact x47242.
foo.oak:10: Undefined variable: DAWG
foo.oak:10: case DAWG: return true;
^