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:
Denis.Zharkov
2022-05-12 15:19:50 +03:00
committed by teamcity
parent 9f7876efb6
commit c018270462
8 changed files with 60 additions and 2 deletions
@@ -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 {
@@ -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 {
@@ -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 {
@@ -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()
)
}
File diff suppressed because one or more lines are too long
@@ -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