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 @@ -582,12 +582,12 @@ public void visit(ImTypeArgument ta) {
@Override
public void visit(ImNull e) {
ImType newT = transformType(e.getType(), generics, typeVars);
newT = specializeType(newT);
e.setType(newT);

ImExpr safe = specializeNullInitializer(e, newT);
if (safe != e) {
e.replaceBy(safe);
return;
}
super.visit(e);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2023,5 +2023,35 @@ public void fullArrayListTest() throws IOException {
testAssertOkFileWithStdLib(new File(TEST_DIR + "arrayList.wurst"), true);
}

@Test
public void genericNullComparison() {
testAssertOkLinesWithStdLib(true,
"package test",
"import NoWurst",
"import ClosureTimers",
"native testSuccess()",
"public class Reference<T:>",
" T val",
" construct(T val)",
" this.val = val",
" function into() returns T",
" let rval = val",
" destroy this",
" return rval",
"",
"var r = new Reference(0.0)",
"",
"init",
" // force member access on the global",
" doAfter(.1) ->",
" r.val = 1.0",
" if r != null and not r == null and r.into() == 1.0",
" testSuccess()",
" testSuccess() // to make compiler happy",
"endpackage"
);
}



}
Loading