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 @@ -37,7 +37,7 @@ public class AttrExprExpectedType {
} else if (parent instanceof StmtSet) {
StmtSet stmtSet = (StmtSet) parent;
if (stmtSet.getRight() == expr) {
return stmtSet.getUpdatedExpr().attrTyp();
return stmtSet.getUpdatedExpr().attrTypRaw();
} else if (stmtSet.getUpdatedExpr() == expr) {
return WurstTypeUnknown.instance();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -958,6 +958,25 @@ public void genericFunctionOverload() { // #628
);
}

@Test
public void genericToIndexFieldAssignment() { // #647
testAssertOkLines(true,
"package test",
"native testSuccess()",
"class C<T>",
" T x",
"function stringToIndex(string s) returns int",
" return 42",
"function stringFromIndex(int i) returns string",
" return \"42\"",
"init",
" C<string> c = new C<string>",
" c.x = \"42\"",
" if c.x == \"42\"",
" testSuccess()"
);
}

@Test
public void extensionFunc() { // #718
testAssertOkLines(false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1373,6 +1373,25 @@ public void newGenericsStringFieldAssignmentRoundTripsInLua() throws IOException
assertFunctionBodyContains(compiled, "testGenericStringField", "__wurst_stringFromIndex", false);
}

@Test
public void legacyGenericToIndexFieldAssignmentRoundTripsInLua() {
test().testLua(true).executeProg().lines(
"package test",
"native testSuccess()",
"class C<T>",
" T x",
"function stringToIndex(string s) returns int",
" return 42",
"function stringFromIndex(int i) returns string",
" return \"42\"",
"init",
" C<string> c = new C<string>",
" c.x = \"42\"",
" if c.x == \"42\"",
" testSuccess()"
);
}

@Test
public void genericOverrideChainBindsRootSlotToMostSpecificImplInLua() throws IOException {
test().testLua(true).compilationUnits(genericOverrideReproUnits());
Expand Down
Loading