[FIR] Display actual type for argument type mismatch error
Previously the argument type was being used for the actual type error display. However, safe-call arguments are unwrapped which causes nullable types to be displayed as non-null. Change to use the actual type provided by the diagnostic instead of extracting the type from the argument. #KT-58844 Fixed
This commit is contained in:
+6
@@ -22744,6 +22744,12 @@ public class FirLightTreeOldFrontendDiagnosticsTestGenerated extends AbstractFir
|
||||
runTest("compiler/testData/diagnostics/tests/nullableTypes/inferenceFlexibleTToNullable.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt58844.kt")
|
||||
public void testKt58844() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/nullableTypes/kt58844.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("nullAssertOnTypeWithNullableUpperBound.kt")
|
||||
public void testNullAssertOnTypeWithNullableUpperBound() throws Exception {
|
||||
|
||||
+6
@@ -22750,6 +22750,12 @@ public class FirPsiOldFrontendDiagnosticsTestGenerated extends AbstractFirPsiDia
|
||||
runTest("compiler/testData/diagnostics/tests/nullableTypes/inferenceFlexibleTToNullable.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt58844.kt")
|
||||
public void testKt58844() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/nullableTypes/kt58844.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("nullAssertOnTypeWithNullableUpperBound.kt")
|
||||
public void testNullAssertOnTypeWithNullableUpperBound() throws Exception {
|
||||
|
||||
+1
-1
@@ -223,7 +223,7 @@ private fun mapInapplicableCandidateError(
|
||||
FirErrors.ARGUMENT_TYPE_MISMATCH.createOn(
|
||||
rootCause.argument.source ?: source,
|
||||
rootCause.expectedType.removeTypeVariableTypes(typeContext),
|
||||
rootCause.argument.typeRef.coneType.removeTypeVariableTypes(typeContext),
|
||||
rootCause.actualType.removeTypeVariableTypes(typeContext),
|
||||
rootCause.isMismatchDueToNullability
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user