Continue processing not builder inference stub variables in the type checker during computing common super type
^KT-47148 Fixed
This commit is contained in:
+6
@@ -28177,6 +28177,12 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirDiagnosti
|
||||
runTest("compiler/testData/diagnostics/tests/subtyping/kt3159.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt47148.kt")
|
||||
public void testKt47148() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/subtyping/kt47148.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt-1457.kt")
|
||||
public void testKt_1457() throws Exception {
|
||||
|
||||
+6
@@ -28177,6 +28177,12 @@ public class FirOldFrontendDiagnosticsWithLightTreeTestGenerated extends Abstrac
|
||||
runTest("compiler/testData/diagnostics/tests/subtyping/kt3159.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt47148.kt")
|
||||
public void testKt47148() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/subtyping/kt47148.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt-1457.kt")
|
||||
public void testKt_1457() throws Exception {
|
||||
|
||||
+1
-1
@@ -175,7 +175,7 @@ object NewCommonSuperTypeCalculator {
|
||||
"There should be at least one non-stub type to compute common supertype but there are: $types"
|
||||
}
|
||||
|
||||
val nonStubTypeVariables = types.filter { !it.isStubType() }
|
||||
val nonStubTypeVariables = types.filter { !it.isStubTypeForBuilderInference() }
|
||||
val areAllNonStubTypesNothing = nonStubTypeVariables.isNotEmpty() && nonStubTypeVariables.all { it.isNothing() }
|
||||
if (nonStubTypeVariables.size == 1 && !areAllNonStubTypesNothing) return nonStubTypeVariables.single()
|
||||
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
interface Visitor<T> {
|
||||
fun visit(key: String): T
|
||||
}
|
||||
val str1: String? = null
|
||||
val str2: String? = null
|
||||
fun <T> visit(arg: Visitor<T>): T = str1?.let { return@visit arg.visit(it) }
|
||||
?: str2?.let { return@visit arg.visit(it) }
|
||||
?: error("error")
|
||||
@@ -0,0 +1,10 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
interface Visitor<T> {
|
||||
fun visit(key: String): T
|
||||
}
|
||||
val str1: String? = null
|
||||
val str2: String? = null
|
||||
fun <T> visit(arg: Visitor<T>): T = str1?.<!IMPLICIT_NOTHING_TYPE_ARGUMENT_AGAINST_NOT_NOTHING_EXPECTED_TYPE!>let<!> { return@visit arg.visit(it) }
|
||||
?: str2?.<!IMPLICIT_NOTHING_TYPE_ARGUMENT_AGAINST_NOT_NOTHING_EXPECTED_TYPE!>let<!> { return@visit arg.visit(it) }
|
||||
?: error("error")
|
||||
@@ -0,0 +1,12 @@
|
||||
package
|
||||
|
||||
public val str1: kotlin.String? = null
|
||||
public val str2: kotlin.String? = null
|
||||
public fun </*0*/ T> visit(/*0*/ arg: Visitor<T>): T
|
||||
|
||||
public interface Visitor</*0*/ T> {
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
public abstract fun visit(/*0*/ key: kotlin.String): T
|
||||
}
|
||||
Generated
+6
@@ -28273,6 +28273,12 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest {
|
||||
runTest("compiler/testData/diagnostics/tests/subtyping/kt3159.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt47148.kt")
|
||||
public void testKt47148() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/subtyping/kt47148.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt-1457.kt")
|
||||
public void testKt_1457() throws Exception {
|
||||
|
||||
+5
@@ -24638,6 +24638,11 @@ public class DiagnosisCompilerTestFE10TestdataTestGenerated extends AbstractDiag
|
||||
runTest("compiler/testData/diagnostics/tests/subtyping/kt3159.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt47148.kt")
|
||||
public void testKt47148() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/subtyping/kt47148.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt-1457.kt")
|
||||
public void testKt_1457() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/subtyping/kt-1457.kt");
|
||||
|
||||
Reference in New Issue
Block a user