diff --git a/compiler/fir/fir2ir/tests/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java b/compiler/fir/fir2ir/tests/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java index e94d4b314ff..a1443759ef0 100644 --- a/compiler/fir/fir2ir/tests/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java +++ b/compiler/fir/fir2ir/tests/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java @@ -24708,6 +24708,11 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT runTest("compiler/testData/codegen/box/regressions/kt32949.kt"); } + @TestMetadata("kt33638.kt") + public void testKt33638() throws Exception { + runTest("compiler/testData/codegen/box/regressions/kt33638.kt"); + } + @TestMetadata("kt3421.kt") public void testKt3421() throws Exception { runTest("compiler/testData/codegen/box/regressions/kt3421.kt"); diff --git a/compiler/fir/resolve/tests/org/jetbrains/kotlin/fir/FirOldFrontendDiagnosticsTestGenerated.java b/compiler/fir/resolve/tests/org/jetbrains/kotlin/fir/FirOldFrontendDiagnosticsTestGenerated.java index c6ca1b3d0ee..d98ea1d8816 100644 --- a/compiler/fir/resolve/tests/org/jetbrains/kotlin/fir/FirOldFrontendDiagnosticsTestGenerated.java +++ b/compiler/fir/resolve/tests/org/jetbrains/kotlin/fir/FirOldFrontendDiagnosticsTestGenerated.java @@ -11383,6 +11383,11 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirOldFronte runTest("compiler/testData/diagnostics/tests/inference/regressions/kt3344.kt"); } + @TestMetadata("kt33629.kt") + public void testKt33629() throws Exception { + runTest("compiler/testData/diagnostics/tests/inference/regressions/kt33629.kt"); + } + @TestMetadata("kt34029.kt") public void testKt34029() throws Exception { runTest("compiler/testData/diagnostics/tests/inference/regressions/kt34029.kt"); diff --git a/compiler/testData/codegen/box/regressions/kt33638.kt b/compiler/testData/codegen/box/regressions/kt33638.kt new file mode 100644 index 00000000000..463dbdbb9b9 --- /dev/null +++ b/compiler/testData/codegen/box/regressions/kt33638.kt @@ -0,0 +1,14 @@ +// !LANGUAGE: +NewInference +// WITH_RUNTIME +// KJS_WITH_FULL_RUNTIME +// IGNORE_BACKEND_FIR: JVM_IR + +class Holder(val list: List?) + +fun box(): String { + val holder1 = Holder(emptyList()) // No problem + val holder2 = Holder(if(true) emptyList() else null) // No problem + val holder3 = Holder(if(true) emptyList() else mutableListOf()) // No problem + val holder4 = Holder(if(true) emptyList() else null) // Compile error + return "OK" +} diff --git a/compiler/testData/diagnostics/tests/inference/regressions/kt33629.fir.kt b/compiler/testData/diagnostics/tests/inference/regressions/kt33629.fir.kt new file mode 100644 index 00000000000..fd4634bfece --- /dev/null +++ b/compiler/testData/diagnostics/tests/inference/regressions/kt33629.fir.kt @@ -0,0 +1,21 @@ +// !WITH_NEW_INFERENCE +// !DIAGNOSTICS: -UNUSED_PARAMETER + +fun emptyList(): List = TODO() + +data class IntervalTree( + val left: IntervalTree?, + val right: IntervalTree?, + val intervals: List, + val median: Float +) + +class Interval + +fun buildTree(segments: List): IntervalTree? = TODO() +fun acquireIntervals(): List = TODO() + +fun main() { + buildTree(acquireIntervals()) + ?: emptyList() +} diff --git a/compiler/testData/diagnostics/tests/inference/regressions/kt33629.kt b/compiler/testData/diagnostics/tests/inference/regressions/kt33629.kt new file mode 100644 index 00000000000..065b0801b11 --- /dev/null +++ b/compiler/testData/diagnostics/tests/inference/regressions/kt33629.kt @@ -0,0 +1,21 @@ +// !WITH_NEW_INFERENCE +// !DIAGNOSTICS: -UNUSED_PARAMETER + +fun emptyList(): List = TODO() + +data class IntervalTree( + val left: IntervalTree?, + val right: IntervalTree?, + val intervals: List, + val median: Float +) + +class Interval + +fun buildTree(segments: List): IntervalTree? = TODO() +fun acquireIntervals(): List = TODO() + +fun main() { + buildTree(acquireIntervals()) + ?: emptyList() +} diff --git a/compiler/testData/diagnostics/tests/inference/regressions/kt33629.txt b/compiler/testData/diagnostics/tests/inference/regressions/kt33629.txt new file mode 100644 index 00000000000..44bfd815b64 --- /dev/null +++ b/compiler/testData/diagnostics/tests/inference/regressions/kt33629.txt @@ -0,0 +1,29 @@ +package + +public fun acquireIntervals(): kotlin.collections.List +public fun buildTree(/*0*/ segments: kotlin.collections.List): IntervalTree? +public fun emptyList(): kotlin.collections.List +public fun main(): kotlin.Unit + +public final class Interval { + public constructor Interval() + 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 final data class IntervalTree { + public constructor IntervalTree(/*0*/ left: IntervalTree?, /*1*/ right: IntervalTree?, /*2*/ intervals: kotlin.collections.List, /*3*/ median: kotlin.Float) + public final val intervals: kotlin.collections.List + public final val left: IntervalTree? + public final val median: kotlin.Float + public final val right: IntervalTree? + public final operator /*synthesized*/ fun component1(): IntervalTree? + public final operator /*synthesized*/ fun component2(): IntervalTree? + public final operator /*synthesized*/ fun component3(): kotlin.collections.List + public final operator /*synthesized*/ fun component4(): kotlin.Float + public final /*synthesized*/ fun copy(/*0*/ left: IntervalTree? = ..., /*1*/ right: IntervalTree? = ..., /*2*/ intervals: kotlin.collections.List = ..., /*3*/ median: kotlin.Float = ...): IntervalTree + public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String +} diff --git a/compiler/tests/org/jetbrains/kotlin/checkers/DiagnosticsTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/checkers/DiagnosticsTestGenerated.java index 9aa24574e2c..da181d9f8d6 100644 --- a/compiler/tests/org/jetbrains/kotlin/checkers/DiagnosticsTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/checkers/DiagnosticsTestGenerated.java @@ -11390,6 +11390,11 @@ public class DiagnosticsTestGenerated extends AbstractDiagnosticsTestWithFirVali runTest("compiler/testData/diagnostics/tests/inference/regressions/kt3344.kt"); } + @TestMetadata("kt33629.kt") + public void testKt33629() throws Exception { + runTest("compiler/testData/diagnostics/tests/inference/regressions/kt33629.kt"); + } + @TestMetadata("kt34029.kt") public void testKt34029() throws Exception { runTest("compiler/testData/diagnostics/tests/inference/regressions/kt34029.kt"); diff --git a/compiler/tests/org/jetbrains/kotlin/checkers/javac/DiagnosticsUsingJavacTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/checkers/javac/DiagnosticsUsingJavacTestGenerated.java index 30f30d15932..2588099bd4c 100644 --- a/compiler/tests/org/jetbrains/kotlin/checkers/javac/DiagnosticsUsingJavacTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/checkers/javac/DiagnosticsUsingJavacTestGenerated.java @@ -11385,6 +11385,11 @@ public class DiagnosticsUsingJavacTestGenerated extends AbstractDiagnosticsUsing runTest("compiler/testData/diagnostics/tests/inference/regressions/kt3344.kt"); } + @TestMetadata("kt33629.kt") + public void testKt33629() throws Exception { + runTest("compiler/testData/diagnostics/tests/inference/regressions/kt33629.kt"); + } + @TestMetadata("kt34029.kt") public void testKt34029() throws Exception { runTest("compiler/testData/diagnostics/tests/inference/regressions/kt34029.kt"); diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java index 3a2ce3705a4..087c891deb2 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java @@ -26224,6 +26224,11 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { runTest("compiler/testData/codegen/box/regressions/kt32949.kt"); } + @TestMetadata("kt33638.kt") + public void testKt33638() throws Exception { + runTest("compiler/testData/codegen/box/regressions/kt33638.kt"); + } + @TestMetadata("kt3421.kt") public void testKt3421() throws Exception { runTest("compiler/testData/codegen/box/regressions/kt3421.kt"); diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java index 42892a65cd0..3c18e68c329 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java @@ -25041,6 +25041,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes runTest("compiler/testData/codegen/box/regressions/kt32949.kt"); } + @TestMetadata("kt33638.kt") + public void testKt33638() throws Exception { + runTest("compiler/testData/codegen/box/regressions/kt33638.kt"); + } + @TestMetadata("kt3421.kt") public void testKt3421() throws Exception { runTest("compiler/testData/codegen/box/regressions/kt3421.kt"); diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java index 2c6ca7c33b3..b436eeb0c14 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java @@ -24708,6 +24708,11 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes runTest("compiler/testData/codegen/box/regressions/kt32949.kt"); } + @TestMetadata("kt33638.kt") + public void testKt33638() throws Exception { + runTest("compiler/testData/codegen/box/regressions/kt33638.kt"); + } + @TestMetadata("kt3421.kt") public void testKt3421() throws Exception { runTest("compiler/testData/codegen/box/regressions/kt3421.kt"); diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java b/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java index 4f3562e0ffb..4ad5ba98053 100644 --- a/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java +++ b/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java @@ -20294,6 +20294,11 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest { runTest("compiler/testData/codegen/box/regressions/kt32949.kt"); } + @TestMetadata("kt33638.kt") + public void testKt33638() throws Exception { + runTest("compiler/testData/codegen/box/regressions/kt33638.kt"); + } + @TestMetadata("kt3421.kt") public void testKt3421() throws Exception { runTest("compiler/testData/codegen/box/regressions/kt3421.kt"); diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java b/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java index 057c478e0fe..791b3035011 100644 --- a/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java +++ b/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java @@ -20354,6 +20354,11 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest { runTest("compiler/testData/codegen/box/regressions/kt32949.kt"); } + @TestMetadata("kt33638.kt") + public void testKt33638() throws Exception { + runTest("compiler/testData/codegen/box/regressions/kt33638.kt"); + } + @TestMetadata("kt3421.kt") public void testKt3421() throws Exception { runTest("compiler/testData/codegen/box/regressions/kt3421.kt");