Skip to content

Commit

Permalink
apply substitution to method type
Browse files Browse the repository at this point in the history
  • Loading branch information
msridhar committed Nov 11, 2024
1 parent be9c657 commit 24ca5a1
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -626,8 +626,7 @@ public static void compareGenericTypeParameterNullabilityForCall(
invokedMethodType = state.getTypes().memberType(enclosingType, methodSymbol);
}
}
// TODO handle generic methods, by calling state.getTypes().subst on invokedMethodType
List<Type> formalParamTypes = invokedMethodType.getParameterTypes();
// Handle generic methods
if (tree instanceof MethodInvocationTree && methodSymbol.type instanceof Type.ForAll) {
MethodInvocationTree methodInvocationTree = (MethodInvocationTree) tree;

Expand All @@ -636,9 +635,10 @@ public static void compareGenericTypeParameterNullabilityForCall(

Type.ForAll forAllType = (Type.ForAll) methodSymbol.type;
Type.MethodType underlyingMethodType = (Type.MethodType) forAllType.qtype;
formalParamTypes =
state.getTypes().subst(underlyingMethodType.argtypes, forAllType.tvars, explicitTypeArgs);
invokedMethodType =
state.getTypes().subst(underlyingMethodType, forAllType.tvars, explicitTypeArgs);
}
List<Type> formalParamTypes = invokedMethodType.getParameterTypes();
int n = formalParamTypes.size();
if (isVarArgs) {
// If the last argument is var args, don't check it now, it will be checked against
Expand Down

0 comments on commit 24ca5a1

Please sign in to comment.