K1/K2: add test confirming correct work of KT-63487 case

This commit is contained in:
Mikhail Glukhikh
2024-03-05 11:56:24 +01:00
committed by Space Team
parent 9a7d7483a3
commit a77a1cf3db
7 changed files with 70 additions and 0 deletions
@@ -19807,6 +19807,12 @@ public class DiagnosticCompilerTestFE10TestdataTestGenerated extends AbstractDia
runTest("compiler/testData/diagnostics/tests/inference/recursiveTypes/complexTypeUnwrapping.kt");
}
@Test
@TestMetadata("complexTypeUnwrapping2.kt")
public void testComplexTypeUnwrapping2() {
runTest("compiler/testData/diagnostics/tests/inference/recursiveTypes/complexTypeUnwrapping2.kt");
}
@Test
@TestMetadata("kt61717.kt")
public void testKt61717() {
@@ -19807,6 +19807,12 @@ public class LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated
runTest("compiler/testData/diagnostics/tests/inference/recursiveTypes/complexTypeUnwrapping.kt");
}
@Test
@TestMetadata("complexTypeUnwrapping2.kt")
public void testComplexTypeUnwrapping2() {
runTest("compiler/testData/diagnostics/tests/inference/recursiveTypes/complexTypeUnwrapping2.kt");
}
@Test
@TestMetadata("kt61717.kt")
public void testKt61717() {
@@ -19801,6 +19801,12 @@ public class FirLightTreeOldFrontendDiagnosticsTestGenerated extends AbstractFir
runTest("compiler/testData/diagnostics/tests/inference/recursiveTypes/complexTypeUnwrapping.kt");
}
@Test
@TestMetadata("complexTypeUnwrapping2.kt")
public void testComplexTypeUnwrapping2() {
runTest("compiler/testData/diagnostics/tests/inference/recursiveTypes/complexTypeUnwrapping2.kt");
}
@Test
@TestMetadata("kt61717.kt")
public void testKt61717() {
@@ -19807,6 +19807,12 @@ public class FirPsiOldFrontendDiagnosticsTestGenerated extends AbstractFirPsiDia
runTest("compiler/testData/diagnostics/tests/inference/recursiveTypes/complexTypeUnwrapping.kt");
}
@Test
@TestMetadata("complexTypeUnwrapping2.kt")
public void testComplexTypeUnwrapping2() {
runTest("compiler/testData/diagnostics/tests/inference/recursiveTypes/complexTypeUnwrapping2.kt");
}
@Test
@TestMetadata("kt61717.kt")
public void testKt61717() {
@@ -0,0 +1,23 @@
FILE: complexTypeUnwrapping2.kt
public abstract class AbstractField<out Field : R|AbstractField<Field>|> : R|kotlin/Any| {
public constructor<out Field : R|AbstractField<Field>|>(): R|AbstractField<Field>| {
super<R|kotlin/Any|>()
}
}
public abstract class AbstractElement<Element : R|AbstractElement<Element, Field>|, Field : R|AbstractField<Field>|> : R|kotlin/Any| {
public constructor<Element : R|AbstractElement<Element, Field>|, Field : R|AbstractField<Field>|>(): R|AbstractElement<Element, Field>| {
super<R|kotlin/Any|>()
}
}
public abstract interface ElementOrRef<Element : R|AbstractElement<Element, Field>|, Field : R|AbstractField<Field>|> : R|kotlin/Any| {
public abstract val element: R|Element|
public get(): R|Element|
}
public final fun elvis(x: R|ElementOrRef<*, *>?|, y: R|ElementOrRef<*, *>?|): R|kotlin/Unit| {
lval xElement: R|AbstractElement<out AbstractElement<*, out AbstractField<*>>, out AbstractField<*>>?| = R|<local>/x|?.{ $subj$.R|SubstitutionOverride</ElementOrRef.element: R|CapturedType(*)|>| }
lval yElement: R|AbstractElement<out AbstractElement<*, out AbstractField<*>>, out AbstractField<*>>?| = R|<local>/y|?.{ $subj$.R|SubstitutionOverride</ElementOrRef.element: R|CapturedType(*)|>| }
lval e: R|AbstractElement<*, out AbstractField<*>>?| = R|<local>/xElement| ?: R|<local>/yElement|
}
@@ -0,0 +1,17 @@
// FIR_IDENTICAL
// ISSUE: KT-63487
// FIR_DUMP
abstract class AbstractField<out Field : AbstractField<Field>>
abstract class AbstractElement<Element : AbstractElement<Element, Field>, Field : AbstractField<Field>>
interface ElementOrRef<Element : AbstractElement<Element, Field>, Field : AbstractField<Field>> {
val element: Element
}
fun elvis(x: ElementOrRef<*, *>?, y: ElementOrRef<*, *>?) {
val xElement = x?.element
val yElement = y?.element
val e = xElement ?: yElement
}
@@ -19807,6 +19807,12 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest {
runTest("compiler/testData/diagnostics/tests/inference/recursiveTypes/complexTypeUnwrapping.kt");
}
@Test
@TestMetadata("complexTypeUnwrapping2.kt")
public void testComplexTypeUnwrapping2() {
runTest("compiler/testData/diagnostics/tests/inference/recursiveTypes/complexTypeUnwrapping2.kt");
}
@Test
@TestMetadata("kt61717.kt")
public void testKt61717() {