[NI] Preserve nullability of resulting type from CST if it's possible
Consider common supertype of `S` and `Nothing`, where `S` has nullable upper bound or it's flexible. Before the fix, result was `S?`, which is correct but too conservative. Now, we'll preserve nullability of resulting type if it's already nullable. This happened because we were failing to find path of not-nullable types from `Nothing` to `S`, which should obviously exists by semantics of Nothing
This commit is contained in:
@@ -9823,6 +9823,11 @@ public class DiagnosticsTestGenerated extends AbstractDiagnosticsTest {
|
||||
runTest("compiler/testData/diagnostics/tests/inference/commonSystem/boundOnNullableVariable.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("cstFromNullableChildAndNonParameterizedType.kt")
|
||||
public void testCstFromNullableChildAndNonParameterizedType() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/inference/commonSystem/cstFromNullableChildAndNonParameterizedType.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("dontCaptureTypeVariable.kt")
|
||||
public void testDontCaptureTypeVariable() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/inference/commonSystem/dontCaptureTypeVariable.kt");
|
||||
|
||||
Generated
+5
@@ -9818,6 +9818,11 @@ public class DiagnosticsUsingJavacTestGenerated extends AbstractDiagnosticsUsing
|
||||
runTest("compiler/testData/diagnostics/tests/inference/commonSystem/boundOnNullableVariable.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("cstFromNullableChildAndNonParameterizedType.kt")
|
||||
public void testCstFromNullableChildAndNonParameterizedType() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/inference/commonSystem/cstFromNullableChildAndNonParameterizedType.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("dontCaptureTypeVariable.kt")
|
||||
public void testDontCaptureTypeVariable() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/inference/commonSystem/dontCaptureTypeVariable.kt");
|
||||
|
||||
Reference in New Issue
Block a user