@@ -118,8 +118,20 @@ public static List<String> getParamNames(WParameters parameters) {
118118
119119 public static FunctionSignature fromNameLink (FuncLink f ) {
120120 VariableBinding mapping = f .getVariableBinding ();
121- mapping = mapping .withTypeVariables (f .getTypeParams ());
122- return new FunctionSignature (f .getDef (), mapping , f .getReceiverType (), f .getName (), f .getParameterTypes (), getParamNames (f .getDef ().getParameters ()), f .getReturnType ());
121+ FunctionDefinition def = f .getDef ();
122+ // Only add the function's own type params that are still unbound (i.e., still in
123+ // f.getTypeParams() — withTypeArgBinding removes them as they get resolved).
124+ // We must NOT add enclosing structure (module/class) type params, which would
125+ // appear as spurious unbound inference variables.
126+ if (def instanceof AstElementWithTypeParameters ) {
127+ java .util .Set <TypeParamDef > ownParams = new java .util .HashSet <>(
128+ ((AstElementWithTypeParameters ) def ).getTypeParameters ());
129+ List <TypeParamDef > unboundOwn = f .getTypeParams ().stream ()
130+ .filter (ownParams ::contains )
131+ .collect (Collectors .toList ());
132+ mapping = mapping .withTypeVariables (unboundOwn );
133+ }
134+ return new FunctionSignature (def , mapping , f .getReceiverType (), f .getName (), f .getParameterTypes (), getParamNames (def .getParameters ()), f .getReturnType ());
123135 }
124136
125137
@@ -234,7 +246,6 @@ public WurstType getVarargType() {
234246 for (int i = 0 ; i < argTypes .size (); i ++) {
235247 WurstType pt = getParamType (i );
236248 WurstType at = argTypes .get (i );
237- mapping = at .matchAgainstSupertype (pt , location , mapping , VariablePosition .RIGHT );
238249 VariableBinding before = mapping ;
239250 VariableBinding after = at .matchAgainstSupertype (pt , location , mapping , VariablePosition .RIGHT );
240251 WLogger .trace (() -> "[IMPLCONV] vb " + System .identityHashCode (before )
0 commit comments