Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -68,4 +68,9 @@ public boolean isCastableToInt() {
return true;
}

@Override
protected boolean isNullable() {
return false;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -67,4 +67,59 @@ public void enum_to_int_test() {
);
}

@Test
public void enumCannotBeAssignedNull() {
testAssertErrorsLines(false, "Cannot assign null to Blub",
"package test",
"enum Blub",
" A",
" B",
"init",
" Blub value = null"
);
}

@Test
public void enumCannotBeComparedWithNull() {
testAssertErrorsLines(false, "Cannot compare types Blub with null",
"package test",
"enum Blub",
" A",
" B",
"init",
" if Blub.A == null",
" skip"
);
}

@Test
public void nullCannotBeComparedWithEnum() {
testAssertErrorsLines(false, "Cannot compare types null with Blub",
"package test",
"enum Blub",
" A",
" B",
"init",
" if null != Blub.B",
" skip"
);
}

@Test
public void enumDefaultValueRemainsFirstMember() {
test().testLua(true).executeProg().lines(
"package test",
"native testSuccess()",
"enum Blub",
" A",
" B",
"class Holder",
" Blub value",
"init",
" let holder = new Holder()",
" if holder.value == Blub.A",
" testSuccess()"
);
}

}
Loading