Support DNN types in approximator
Mostly, it's relevant to FIR since there we started loading type parameter based types as (T & Any..T?)
This commit is contained in:
+6
@@ -18464,6 +18464,12 @@ public class DiagnosisCompilerTestFE10TestdataTestGenerated extends AbstractDiag
|
||||
runTest("compiler/testData/diagnostics/tests/j+k/recursiveRawUpperBound3.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("recursiveSelfTypes.kt")
|
||||
public void testRecursiveSelfTypes() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/j+k/recursiveSelfTypes.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("safeCallDefinitelyNotNull.kt")
|
||||
public void testSafeCallDefinitelyNotNull() throws Exception {
|
||||
|
||||
+6
@@ -18464,6 +18464,12 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirDiagnosti
|
||||
runTest("compiler/testData/diagnostics/tests/j+k/recursiveRawUpperBound3.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("recursiveSelfTypes.kt")
|
||||
public void testRecursiveSelfTypes() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/j+k/recursiveSelfTypes.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("safeCallDefinitelyNotNull.kt")
|
||||
public void testSafeCallDefinitelyNotNull() throws Exception {
|
||||
|
||||
+6
@@ -18464,6 +18464,12 @@ public class FirOldFrontendDiagnosticsWithLightTreeTestGenerated extends Abstrac
|
||||
runTest("compiler/testData/diagnostics/tests/j+k/recursiveRawUpperBound3.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("recursiveSelfTypes.kt")
|
||||
public void testRecursiveSelfTypes() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/j+k/recursiveSelfTypes.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("safeCallDefinitelyNotNull.kt")
|
||||
public void testSafeCallDefinitelyNotNull() throws Exception {
|
||||
|
||||
+1
-1
@@ -414,7 +414,7 @@ abstract class AbstractTypeApproximator(
|
||||
|
||||
val argumentType = newArguments[index]?.getType() ?: argument.getType()
|
||||
|
||||
val capturedType = argumentType.lowerBoundIfFlexible().asCapturedType()
|
||||
val capturedType = argumentType.lowerBoundIfFlexible().originalIfDefinitelyNotNullable().asCapturedType()
|
||||
val capturedStarProjectionOrNull =
|
||||
capturedType?.typeConstructorProjection()?.takeIf { it.isStarProjection() }
|
||||
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
// FIR_IDENTICAL
|
||||
// SKIP_TXT
|
||||
// FILE: TSFBuilder.java
|
||||
public abstract class TSFBuilder<F extends CharSequence, B extends TSFBuilder<F,B>> {
|
||||
public B configure() { return null; }
|
||||
public abstract F build();
|
||||
|
||||
public static TSFBuilder<?, ?> start() { return null; }
|
||||
}
|
||||
|
||||
// FILE: test.kt
|
||||
|
||||
fun foo(x: CharSequence?) {}
|
||||
|
||||
fun main() {
|
||||
foo(
|
||||
TSFBuilder.start()
|
||||
.configure()
|
||||
.configure()
|
||||
.configure()
|
||||
.configure()
|
||||
.configure()
|
||||
.configure()
|
||||
.configure()
|
||||
.configure()
|
||||
.configure()
|
||||
.configure()
|
||||
.configure()
|
||||
.build()
|
||||
)
|
||||
}
|
||||
+1
-1
File diff suppressed because one or more lines are too long
Generated
+6
@@ -18470,6 +18470,12 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest {
|
||||
runTest("compiler/testData/diagnostics/tests/j+k/recursiveRawUpperBound3.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("recursiveSelfTypes.kt")
|
||||
public void testRecursiveSelfTypes() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/j+k/recursiveSelfTypes.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("safeCallDefinitelyNotNull.kt")
|
||||
public void testSafeCallDefinitelyNotNull() throws Exception {
|
||||
|
||||
@@ -584,6 +584,9 @@ interface TypeSystemContext : TypeSystemOptimizationContext {
|
||||
|
||||
fun SimpleTypeMarker.asDefinitelyNotNullType(): DefinitelyNotNullTypeMarker?
|
||||
fun DefinitelyNotNullTypeMarker.original(): SimpleTypeMarker
|
||||
|
||||
fun SimpleTypeMarker.originalIfDefinitelyNotNullable(): SimpleTypeMarker = asDefinitelyNotNullType()?.original() ?: this
|
||||
|
||||
fun KotlinTypeMarker.makeDefinitelyNotNullOrNotNull(): KotlinTypeMarker
|
||||
fun SimpleTypeMarker.makeSimpleTypeDefinitelyNotNullOrNotNull(): SimpleTypeMarker
|
||||
fun SimpleTypeMarker.isMarkedNullable(): Boolean
|
||||
|
||||
Reference in New Issue
Block a user