Check implicitly inferred Nothing inside special calls properly: compare constructors instead of types

^KT-41176 Open
This commit is contained in:
Victor Petukhov
2020-09-24 16:12:03 +03:00
parent 051d64742c
commit 076eacb3d1
7 changed files with 116 additions and 1 deletions
@@ -97,7 +97,9 @@ object ImplicitNothingAsTypeParameterCallChecker : CallChecker {
val resolvedCallAtom = resolvedAtom.getResolvedCallAtom(context.trace.bindingContext) ?: continue
val candidateDescriptor = resolvedCallAtom.candidateDescriptor
val isReturnTypeOwnTypeParameter = candidateDescriptor.typeParameters.any { it.defaultType == candidateDescriptor.returnType }
val isReturnTypeOwnTypeParameter = candidateDescriptor.typeParameters.any {
it.typeConstructor == candidateDescriptor.returnType?.constructor
}
val isSpecialCall = candidateDescriptor.name in SPECIAL_FUNCTION_NAMES
val hasExplicitTypeArguments = resolvedCallAtom.atom.psiKotlinCall.typeArguments.isNotEmpty() // not required