K2: Fix false-positive RETURN_TYPE_MISMATCH_ON_OVERRIDE
The reason was that `substitutorByMap` ignored the difference between `T` and `T?` ^KT-57001 Fixed
This commit is contained in:
committed by
Space Team
parent
ac8cbcafb4
commit
d9ca77f716
+6
@@ -12564,6 +12564,12 @@ public class FirLightTreeOldFrontendDiagnosticsTestGenerated extends AbstractFir
|
||||
runTest("compiler/testData/diagnostics/tests/generics/localClassTypeRefWithTypeParameterFromFunction.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("nullableTypeParameterScope.kt")
|
||||
public void testNullableTypeParameterScope() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/generics/nullableTypeParameterScope.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("outerTypeParametersInNestedClasses.kt")
|
||||
public void testOuterTypeParametersInNestedClasses() throws Exception {
|
||||
|
||||
+6
@@ -12570,6 +12570,12 @@ public class FirPsiOldFrontendDiagnosticsTestGenerated extends AbstractFirPsiDia
|
||||
runTest("compiler/testData/diagnostics/tests/generics/localClassTypeRefWithTypeParameterFromFunction.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("nullableTypeParameterScope.kt")
|
||||
public void testNullableTypeParameterScope() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/generics/nullableTypeParameterScope.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("outerTypeParametersInNestedClasses.kt")
|
||||
public void testOuterTypeParametersInNestedClasses() throws Exception {
|
||||
|
||||
+1
-1
@@ -173,7 +173,7 @@ abstract class AbstractConeSubstitutor(protected val typeContext: ConeTypeContex
|
||||
fun substitutorByMap(substitution: Map<FirTypeParameterSymbol, ConeKotlinType>, useSiteSession: FirSession): ConeSubstitutor {
|
||||
// If all arguments match parameters, then substitutor isn't needed
|
||||
if (substitution.all { (parameterSymbol, argumentType) ->
|
||||
(argumentType as? ConeTypeParameterType)?.lookupTag?.typeParameterSymbol == parameterSymbol
|
||||
(argumentType as? ConeTypeParameterType)?.lookupTag?.typeParameterSymbol == parameterSymbol && !argumentType.isMarkedNullable
|
||||
}
|
||||
) return ConeSubstitutor.Empty
|
||||
return ConeSubstitutorByMap(substitution, useSiteSession)
|
||||
|
||||
Reference in New Issue
Block a user