FIR: Correctly handle nullable/flexible captured types
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
// FILE: main.kt
|
||||
|
||||
fun foo(p: Processor<in CharSequence>, s: String?) {
|
||||
p.process(s)
|
||||
}
|
||||
|
||||
// FILE: Processor.java
|
||||
public interface Processor<T> {
|
||||
boolean process(T t);
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
FILE: main.kt
|
||||
public final fun foo(p: R|Processor<in kotlin/CharSequence>|, s: R|kotlin/String?|): R|kotlin/Unit| {
|
||||
R|<local>/p|.R|SubstitutionOverride</Processor.process: R|kotlin/Boolean|>|(R|<local>/s|)
|
||||
}
|
||||
Generated
+5
@@ -183,6 +183,11 @@ public class FirDiagnosticsTestGenerated extends AbstractFirDiagnosticsTest {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/fib.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("flexibleCapturedType.kt")
|
||||
public void testFlexibleCapturedType() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/flexibleCapturedType.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("ft.kt")
|
||||
public void testFt() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/ft.kt");
|
||||
|
||||
+5
@@ -183,6 +183,11 @@ public class FirDiagnosticsWithLightTreeTestGenerated extends AbstractFirDiagnos
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/fib.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("flexibleCapturedType.kt")
|
||||
public void testFlexibleCapturedType() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/flexibleCapturedType.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("ft.kt")
|
||||
public void testFt() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/ft.kt");
|
||||
|
||||
+5
@@ -183,6 +183,11 @@ public class LazyBodyIsNotTouchedTilContractsPhaseTestGenerated extends Abstract
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/fib.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("flexibleCapturedType.kt")
|
||||
public void testFlexibleCapturedType() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/flexibleCapturedType.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("ft.kt")
|
||||
public void testFt() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/ft.kt");
|
||||
|
||||
@@ -168,7 +168,8 @@ interface ConeTypeContext : TypeSystemContext, TypeSystemOptimizationContext, Ty
|
||||
|
||||
override fun CapturedTypeMarker.lowerType(): KotlinTypeMarker? {
|
||||
require(this is ConeCapturedType)
|
||||
return this.lowerType
|
||||
if (!this.isMarkedNullable) return this.lowerType
|
||||
return this.lowerType?.makeNullable()
|
||||
}
|
||||
|
||||
override fun TypeArgumentMarker.isStarProjection(): Boolean {
|
||||
|
||||
Reference in New Issue
Block a user