Revert "[FE 1.0] Build captured type's supertypes in an alternative way: use own projection type as a first supertype, then supertypes from the corresponding type parameter's upper bounds"
This reverts commit eb19d39cbf.
This commit is contained in:
-6
@@ -14795,12 +14795,6 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirDiagnosti
|
||||
runTest("compiler/testData/diagnostics/tests/inference/capturedTypes/kt49101.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt52782.kt")
|
||||
public void testKt52782() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/inference/capturedTypes/kt52782.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("memberScopeOfCaptured.kt")
|
||||
public void testMemberScopeOfCaptured() throws Exception {
|
||||
|
||||
-6
@@ -14795,12 +14795,6 @@ public class FirOldFrontendDiagnosticsWithLightTreeTestGenerated extends Abstrac
|
||||
runTest("compiler/testData/diagnostics/tests/inference/capturedTypes/kt49101.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt52782.kt")
|
||||
public void testKt52782() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/inference/capturedTypes/kt52782.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("memberScopeOfCaptured.kt")
|
||||
public void testMemberScopeOfCaptured() throws Exception {
|
||||
|
||||
+3
-3
@@ -106,8 +106,8 @@ interface NewTypeSubstitutor : TypeSubstitutorMarker {
|
||||
|
||||
val innerType = capturedType.lowerType ?: capturedType.constructor.projection.type.unwrap()
|
||||
val substitutedInnerType = substitute(innerType, keepAnnotation, runCapturedChecks = false)
|
||||
val (projectionSupertype, boundSupertypes) =
|
||||
capturedType.constructor.transformSupertypes { substitute(it, keepAnnotation, runCapturedChecks = false) ?: it }
|
||||
val substitutedSuperTypes =
|
||||
capturedType.constructor.supertypes.map { substitute(it, keepAnnotation, runCapturedChecks = false) ?: it }
|
||||
|
||||
if (substitutedInnerType != null) {
|
||||
return if (substitutedInnerType.isCaptured()) substitutedInnerType else {
|
||||
@@ -116,7 +116,7 @@ interface NewTypeSubstitutor : TypeSubstitutorMarker {
|
||||
NewCapturedTypeConstructor(
|
||||
TypeProjectionImpl(typeConstructor.projection.projectionKind, substitutedInnerType),
|
||||
typeParameter = typeConstructor.typeParameter
|
||||
).also { it.initializeSupertypes(projectionSupertype, boundSupertypes) },
|
||||
).also { it.initializeSupertypes(substitutedSuperTypes) },
|
||||
lowerType = if (capturedType.lowerType != null) substitutedInnerType else null
|
||||
)
|
||||
}
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
// FIR_IDENTICAL
|
||||
// FILE: Foo.java
|
||||
public abstract class Foo<K extends Bar<? extends Foo<K>>> {
|
||||
abstract String getTest();
|
||||
}
|
||||
|
||||
// FILE: Bar.java
|
||||
public abstract class Bar<T extends Foo<? extends Bar<T>>> {}
|
||||
|
||||
// FILE: main.kt
|
||||
fun box(foo: Foo<*>) {
|
||||
foo.test // unresolved in 1.7.0, OK before
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
package
|
||||
|
||||
public fun box(/*0*/ foo: Foo<*>): kotlin.Unit
|
||||
|
||||
public abstract class Bar</*0*/ T : Foo<out Bar<T!>!>!> {
|
||||
public constructor Bar</*0*/ T : Foo<out Bar<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 class Foo</*0*/ K : Bar<out Foo<K!>!>!> {
|
||||
public constructor Foo</*0*/ K : Bar<out Foo<K!>!>!>()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public/*package*/ abstract fun getTest(): kotlin.String!
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
@@ -30,7 +30,7 @@ fun String.asFsdAddress(): String {
|
||||
fun box(): String {
|
||||
val state = Test().state
|
||||
if (state is GoBuildingRunningState<*>) {
|
||||
<!DEBUG_INFO_SMARTCAST!>state<!>.buildingWorkingDirectory.asFsdAddress()
|
||||
state.<!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>buildingWorkingDirectory<!>.<!DEBUG_INFO_MISSING_UNRESOLVED!>asFsdAddress<!>()
|
||||
}
|
||||
return "OK"
|
||||
}
|
||||
|
||||
Generated
-6
@@ -14801,12 +14801,6 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest {
|
||||
runTest("compiler/testData/diagnostics/tests/inference/capturedTypes/kt49101.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt52782.kt")
|
||||
public void testKt52782() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/inference/capturedTypes/kt52782.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("memberScopeOfCaptured.kt")
|
||||
public void testMemberScopeOfCaptured() throws Exception {
|
||||
|
||||
Reference in New Issue
Block a user