K2: reproduce KT-65057

This commit is contained in:
Mikhail Glukhikh
2024-02-01 09:38:45 +01:00
committed by Space Team
parent 0a07f16896
commit c4d6554493
8 changed files with 111 additions and 0 deletions
@@ -19641,6 +19641,12 @@ public class DiagnosticCompilerTestFE10TestdataTestGenerated extends AbstractDia
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/tests/inference/recursiveTypes"), Pattern.compile("^(.+)\\.(kt|kts)$"), Pattern.compile("^(.+)\\.(reversed|fir|ll)\\.kts?$"), true);
}
@Test
@TestMetadata("complexTypeUnwrapping.kt")
public void testComplexTypeUnwrapping() throws Exception {
runTest("compiler/testData/diagnostics/tests/inference/recursiveTypes/complexTypeUnwrapping.kt");
}
@Test
@TestMetadata("kt61717.kt")
public void testKt61717() throws Exception {
@@ -19641,6 +19641,12 @@ public class LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/tests/inference/recursiveTypes"), Pattern.compile("^(.+)\\.(kt|kts)$"), Pattern.compile("^(.+)\\.(reversed|fir|ll)\\.kts?$"), true);
}
@Test
@TestMetadata("complexTypeUnwrapping.kt")
public void testComplexTypeUnwrapping() throws Exception {
runTest("compiler/testData/diagnostics/tests/inference/recursiveTypes/complexTypeUnwrapping.kt");
}
@Test
@TestMetadata("kt61717.kt")
public void testKt61717() throws Exception {
@@ -19635,6 +19635,12 @@ public class FirLightTreeOldFrontendDiagnosticsTestGenerated extends AbstractFir
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/tests/inference/recursiveTypes"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.(reversed|fir|ll)\\.kts?$"), true, "multiplatform");
}
@Test
@TestMetadata("complexTypeUnwrapping.kt")
public void testComplexTypeUnwrapping() throws Exception {
runTest("compiler/testData/diagnostics/tests/inference/recursiveTypes/complexTypeUnwrapping.kt");
}
@Test
@TestMetadata("kt61717.kt")
public void testKt61717() throws Exception {
@@ -19641,6 +19641,12 @@ public class FirPsiOldFrontendDiagnosticsTestGenerated extends AbstractFirPsiDia
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/tests/inference/recursiveTypes"), Pattern.compile("^(.*)\\.kts?$"), Pattern.compile("^(.+)\\.(reversed|fir|ll)\\.kts?$"), true, "multiplatform");
}
@Test
@TestMetadata("complexTypeUnwrapping.kt")
public void testComplexTypeUnwrapping() throws Exception {
runTest("compiler/testData/diagnostics/tests/inference/recursiveTypes/complexTypeUnwrapping.kt");
}
@Test
@TestMetadata("kt61717.kt")
public void testKt61717() throws Exception {
@@ -0,0 +1,29 @@
FILE: complexTypeUnwrapping.kt
public abstract class AbstractField<out F : R|AbstractField<F>|> : R|kotlin/Any| {
public constructor<out F : R|AbstractField<F>|>(): R|AbstractField<F>| {
super<R|kotlin/Any|>()
}
}
public abstract class AbstractElement<EE : R|AbstractElement<EE, EF>|, EF : R|AbstractField<EF>|> : R|kotlin/Any| {
public constructor<EE : R|AbstractElement<EE, EF>|, EF : R|AbstractField<EF>|>(): R|AbstractElement<EE, EF>| {
super<R|kotlin/Any|>()
}
}
public abstract interface ElementOrRef<RE : R|AbstractElement<RE, RF>|, RF : R|AbstractField<RF>|> : R|kotlin/Any| {
public abstract val element: R|RE|
public get(): R|RE|
}
public final fun foo(x: R|ElementOrRef<*, *>|): R|AbstractElement<out AbstractElement<out AbstractElement<out AbstractElement<out AbstractElement<out kotlin/Any?, out kotlin/Any?>, out AbstractField<kotlin/Any?>>, out AbstractField<AbstractField<kotlin/Any?>>>, out AbstractField<AbstractField<AbstractField<kotlin/Any?>>>>, out AbstractField<AbstractField<AbstractField<AbstractField<kotlin/Any?>>>>>| {
^foo R|<local>/x|.R|SubstitutionOverride</ElementOrRef.element: R|CapturedType(*)|>|
}
public abstract interface FieldOrRef<FF : R|AbstractField<FF>|> : R|kotlin/Any| {
public abstract val field: R|FF|
public get(): R|FF|
}
public final fun bar(y: R|FieldOrRef<*>|): R|AbstractField<AbstractField<AbstractField<AbstractField<AbstractField<kotlin/Any?>>>>>| {
^bar R|<local>/y|.R|SubstitutionOverride</FieldOrRef.field: R|CapturedType(*)|>|
}
@@ -0,0 +1,19 @@
// FIR_IDENTICAL
// ISSUE: KT-65057
// FIR_DUMP
abstract class AbstractField<out F : AbstractField<F>>
abstract class AbstractElement<EE : AbstractElement<EE, EF>, EF : AbstractField<EF>>
interface ElementOrRef<RE : AbstractElement<RE, RF>, RF : AbstractField<RF>> {
val element: RE
}
fun foo(x: ElementOrRef<*, *>) = x.element
interface FieldOrRef<FF : AbstractField<FF>> {
val field: FF
}
fun bar(y: FieldOrRef<*>) = y.field
@@ -0,0 +1,33 @@
package
public fun bar(/*0*/ y: FieldOrRef<*>): AbstractField<*>
public fun foo(/*0*/ x: ElementOrRef<*, *>): AbstractElement<*, *>
public abstract class AbstractElement</*0*/ EE : AbstractElement<EE, EF>, /*1*/ EF : AbstractField<EF>> {
public constructor AbstractElement</*0*/ EE : AbstractElement<EE, EF>, /*1*/ EF : AbstractField<EF>>()
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 AbstractField</*0*/ out F : AbstractField<F>> {
public constructor AbstractField</*0*/ out F : AbstractField<F>>()
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 interface ElementOrRef</*0*/ RE : AbstractElement<RE, RF>, /*1*/ RF : AbstractField<RF>> {
public abstract val element: RE
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 interface FieldOrRef</*0*/ FF : AbstractField<FF>> {
public abstract val field: FF
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
}
@@ -19641,6 +19641,12 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/tests/inference/recursiveTypes"), Pattern.compile("^(.*)\\.kts?$"), Pattern.compile("^(.+)\\.(reversed|fir|ll)\\.kts?$"), true);
}
@Test
@TestMetadata("complexTypeUnwrapping.kt")
public void testComplexTypeUnwrapping() throws Exception {
runTest("compiler/testData/diagnostics/tests/inference/recursiveTypes/complexTypeUnwrapping.kt");
}
@Test
@TestMetadata("kt61717.kt")
public void testKt61717() throws Exception {