Skip to content

Commit c695eff

Browse files
committed
fix donach error
1 parent 5cb29f2 commit c695eff

2 files changed

Lines changed: 17 additions & 1 deletion

File tree

de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/types/FunctionSignature.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,6 @@ public WurstType getVarargType() {
234234
for (int i = 0; i < argTypes.size(); i++) {
235235
WurstType pt = getParamType(i);
236236
WurstType at = argTypes.get(i);
237-
mapping = at.matchAgainstSupertype(pt, location, mapping, VariablePosition.RIGHT);
238237
VariableBinding before = mapping;
239238
VariableBinding after = at.matchAgainstSupertype(pt, location, mapping, VariablePosition.RIGHT);
240239
WLogger.trace(() -> "[IMPLCONV] vb " + System.identityHashCode(before)

de.peeeq.wurstscript/src/test/java/tests/wurstscript/tests/GenericsTests.java

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1212,4 +1212,21 @@ public void nestedList2() {
12121212
);
12131213
}
12141214

1215+
@Test
1216+
public void conflictingTypeArgsMemberMethod() {
1217+
// Regression test: calling a generic method via dot notation with conflicting type arguments
1218+
// used to cause a NullPointerException instead of a proper type error.
1219+
// The two arguments infer conflicting types for T (int vs string), which should produce
1220+
// a "Wrong parameter type" compile error, not a compiler crash.
1221+
testAssertErrorsLines(false, "Wrong parameter type",
1222+
"package test",
1223+
"class C",
1224+
" function combine<T>(T x, T y) returns T",
1225+
" return x",
1226+
"init",
1227+
" let c = new C()",
1228+
" c.combine(1, \"hello\")"
1229+
);
1230+
}
1231+
12151232
}

0 commit comments

Comments
 (0)