diff --git a/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/DiagnosticCompilerTestFE10TestdataTestGenerated.java b/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/DiagnosticCompilerTestFE10TestdataTestGenerated.java index 3e95bd4ac61..d99064b8492 100644 --- a/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/DiagnosticCompilerTestFE10TestdataTestGenerated.java +++ b/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/DiagnosticCompilerTestFE10TestdataTestGenerated.java @@ -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() { diff --git a/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated.java b/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated.java index 6ef24c2686a..13b2a3cc796 100644 --- a/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated.java +++ b/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated.java @@ -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() { diff --git a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirLightTreeOldFrontendDiagnosticsTestGenerated.java b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirLightTreeOldFrontendDiagnosticsTestGenerated.java index 1bf816f1701..36d7a15308a 100644 --- a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirLightTreeOldFrontendDiagnosticsTestGenerated.java +++ b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirLightTreeOldFrontendDiagnosticsTestGenerated.java @@ -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() { diff --git a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirPsiOldFrontendDiagnosticsTestGenerated.java b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirPsiOldFrontendDiagnosticsTestGenerated.java index b7f2c53f6d5..663f228adf4 100644 --- a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirPsiOldFrontendDiagnosticsTestGenerated.java +++ b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirPsiOldFrontendDiagnosticsTestGenerated.java @@ -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() { diff --git a/compiler/testData/diagnostics/tests/inference/recursiveTypes/complexTypeUnwrapping2.fir.txt b/compiler/testData/diagnostics/tests/inference/recursiveTypes/complexTypeUnwrapping2.fir.txt new file mode 100644 index 00000000000..82f03545a10 --- /dev/null +++ b/compiler/testData/diagnostics/tests/inference/recursiveTypes/complexTypeUnwrapping2.fir.txt @@ -0,0 +1,23 @@ +FILE: complexTypeUnwrapping2.kt + public abstract class AbstractField|> : R|kotlin/Any| { + public constructor|>(): R|AbstractField| { + super() + } + + } + public abstract class AbstractElement|, Field : R|AbstractField|> : R|kotlin/Any| { + public constructor|, Field : R|AbstractField|>(): R|AbstractElement| { + super() + } + + } + public abstract interface ElementOrRef|, Field : R|AbstractField|> : 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 AbstractField<*>>?| = R|/x|?.{ $subj$.R|SubstitutionOverride| } + lval yElement: R|AbstractElement>, out AbstractField<*>>?| = R|/y|?.{ $subj$.R|SubstitutionOverride| } + lval e: R|AbstractElement<*, out AbstractField<*>>?| = R|/xElement| ?: R|/yElement| + } diff --git a/compiler/testData/diagnostics/tests/inference/recursiveTypes/complexTypeUnwrapping2.kt b/compiler/testData/diagnostics/tests/inference/recursiveTypes/complexTypeUnwrapping2.kt new file mode 100644 index 00000000000..f51f10d650f --- /dev/null +++ b/compiler/testData/diagnostics/tests/inference/recursiveTypes/complexTypeUnwrapping2.kt @@ -0,0 +1,17 @@ +// FIR_IDENTICAL +// ISSUE: KT-63487 +// FIR_DUMP + +abstract class AbstractField> + +abstract class AbstractElement, Field : AbstractField> + +interface ElementOrRef, Field : AbstractField> { + val element: Element +} + +fun elvis(x: ElementOrRef<*, *>?, y: ElementOrRef<*, *>?) { + val xElement = x?.element + val yElement = y?.element + val e = xElement ?: yElement +} diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/DiagnosticTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/DiagnosticTestGenerated.java index c75139c5a22..57f51342fb1 100644 --- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/DiagnosticTestGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/DiagnosticTestGenerated.java @@ -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() {