Skip to content
Closed
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
6 changes: 0 additions & 6 deletions BACKLOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,6 @@ Notes; finished-work narrative does not.
functions) has no Lua path in the harness at all. `-PallBackends=full`, which adds
`-inline -localOptimizations`, found nothing the plain run did not (October 2026), so CI runs only that.

- **`EliminateGenerics.fillMissingTypeArgsFromScope` matches type variables by name.** On the Jass path it
completed the owner type arguments of a static inner class's type, which the IM translation now gives
itself (`WurstTypeClassOrInterface.imTranslateType`). Made to throw whenever it fills one, it is reached by
none of the generics, closure, module, class and Lua audit test classes (October 2026). Check the whole
suite and remove it.

- **The `Reflection` natives answer otherwise on Jass for a number which is no type id, and in the
interpreter.** `EliminateClasses` searches the type ids without bounds, so on Jass
`typeIdToTypeName(0)` is the first class's name and a number above `maxTypeId()` answers for the last
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1843,21 +1843,6 @@ private void moveFunctionsOutOfClass(ImClass c) {
typeArgs.add(JassIm.ImTypeArgument(JassIm.ImTypeVarRef(ta), Collections.emptyMap()));
}
rewriteGenerics(f, new GenericTypes(typeArgs), c.getTypeVariables());

// NEW: fill implicit type args for captured generics (Inner -> Inner<T>)
Map<String, ImTypeVar> scope = new HashMap<>();
for (ImTypeVar tv : f.getTypeVariables()) {
scope.put(tv.getName(), tv);
}

f.setReturnType(fillMissingTypeArgsFromScope(f.getReturnType(), scope));

for (ImVar p : f.getParameters()) {
p.setType(fillMissingTypeArgsFromScope(p.getType(), scope));
}
for (ImVar l : f.getLocals()) {
l.setType(fillMissingTypeArgsFromScope(l.getType(), scope));
}
}
}

Expand Down Expand Up @@ -3608,63 +3593,6 @@ public void eliminate() {
}
}

private ImType fillMissingTypeArgsFromScope(ImType t, Map<String, ImTypeVar> scope) {
return t.match(new ImType.Matcher<ImType>() {

@Override
public ImType case_ImClassType(ImClassType ct) {
int need = ct.getClassDef().getTypeVariables().size();
int have = ct.getTypeArguments().size();
if (need == 0 || have >= need) {
return ct;
}

ImTypeArguments newArgs = JassIm.ImTypeArguments();
// keep existing args
for (ImTypeArgument a : ct.getTypeArguments()) {
newArgs.add(a.copy());
}

// fill missing args by name from scope
for (int i = have; i < need; i++) {
ImTypeVar tv = ct.getClassDef().getTypeVariables().get(i);
ImTypeVar inScope = scope.get(tv.getName());
if (inScope == null) {
// no suitable type var in scope -> cannot fill
return ct;
}
newArgs.add(JassIm.ImTypeArgument(JassIm.ImTypeVarRef(inScope), Collections.emptyMap()));
}

return JassIm.ImClassType(ct.getClassDef(), newArgs);
}

@Override
public ImType case_ImArrayType(ImArrayType at) {
return JassIm.ImArrayType(fillMissingTypeArgsFromScope(at.getEntryType(), scope));
}

@Override
public ImType case_ImArrayTypeMulti(ImArrayTypeMulti at) {
return JassIm.ImArrayTypeMulti(fillMissingTypeArgsFromScope(at.getEntryType(), scope), at.getArraySize());
}

@Override
public ImType case_ImTupleType(ImTupleType tt) {
List<ImType> ts = new ArrayList<>();
for (ImType x : tt.getTypes()) {
ts.add(fillMissingTypeArgsFromScope(x, scope));
}
return JassIm.ImTupleType(ts, tt.getNames());
}

@Override public ImType case_ImVoid(ImVoid v) { return v; }
@Override public ImType case_ImAnyType(ImAnyType a) { return a; }
@Override public ImType case_ImSimpleType(ImSimpleType s) { return s; }
@Override public ImType case_ImTypeVarRef(ImTypeVarRef r) { return r; }
});
}

private static String id(Object o) {
return o == null ? "null" : (o.getClass().getSimpleName() + "@" + System.identityHashCode(o));
}
Expand Down