[NI-TESTS] Add regression tests

^KT-33638 Obsolete

Add test for case mentioned in KT-33629.
Used to be runtime failure instead of error diagnostic.
This commit is contained in:
Pavel Kirpichenkov
2020-02-12 18:51:17 +03:00
parent dc42b20ae3
commit ac5c255c20
13 changed files with 130 additions and 0 deletions
@@ -24708,6 +24708,11 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
runTest("compiler/testData/codegen/box/regressions/kt32949.kt"); 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") @TestMetadata("kt3421.kt")
public void testKt3421() throws Exception { public void testKt3421() throws Exception {
runTest("compiler/testData/codegen/box/regressions/kt3421.kt"); runTest("compiler/testData/codegen/box/regressions/kt3421.kt");
@@ -11383,6 +11383,11 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirOldFronte
runTest("compiler/testData/diagnostics/tests/inference/regressions/kt3344.kt"); 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") @TestMetadata("kt34029.kt")
public void testKt34029() throws Exception { public void testKt34029() throws Exception {
runTest("compiler/testData/diagnostics/tests/inference/regressions/kt34029.kt"); runTest("compiler/testData/diagnostics/tests/inference/regressions/kt34029.kt");
+14
View File
@@ -0,0 +1,14 @@
// !LANGUAGE: +NewInference
// WITH_RUNTIME
// KJS_WITH_FULL_RUNTIME
// IGNORE_BACKEND_FIR: JVM_IR
class Holder(val list: List<String>?)
fun box(): String {
val holder1 = Holder(emptyList()) // No problem
val holder2 = Holder(if(true) emptyList<String>() 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"
}
@@ -0,0 +1,21 @@
// !WITH_NEW_INFERENCE
// !DIAGNOSTICS: -UNUSED_PARAMETER
fun <E> emptyList(): List<E> = TODO()
data class IntervalTree(
val left: IntervalTree?,
val right: IntervalTree?,
val intervals: List<Interval>,
val median: Float
)
class Interval
fun buildTree(segments: List<Interval>): IntervalTree? = TODO()
fun acquireIntervals(): List<Interval> = TODO()
fun main() {
buildTree(acquireIntervals())
?: emptyList()
}
@@ -0,0 +1,21 @@
// !WITH_NEW_INFERENCE
// !DIAGNOSTICS: -UNUSED_PARAMETER
fun <E> emptyList(): List<E> = TODO()
data class IntervalTree(
val left: IntervalTree?,
val right: IntervalTree?,
val intervals: List<Interval>,
val median: Float
)
class Interval
fun buildTree(segments: List<Interval>): IntervalTree? = TODO()
fun acquireIntervals(): List<Interval> = TODO()
fun main() {
buildTree(acquireIntervals())
?: <!OI;TYPE_INFERENCE_EXPECTED_TYPE_MISMATCH!><!NI;NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>emptyList<!>()<!>
}
@@ -0,0 +1,29 @@
package
public fun acquireIntervals(): kotlin.collections.List<Interval>
public fun buildTree(/*0*/ segments: kotlin.collections.List<Interval>): IntervalTree?
public fun </*0*/ E> emptyList(): kotlin.collections.List<E>
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<Interval>, /*3*/ median: kotlin.Float)
public final val intervals: kotlin.collections.List<Interval>
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<Interval>
public final operator /*synthesized*/ fun component4(): kotlin.Float
public final /*synthesized*/ fun copy(/*0*/ left: IntervalTree? = ..., /*1*/ right: IntervalTree? = ..., /*2*/ intervals: kotlin.collections.List<Interval> = ..., /*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
}
@@ -11390,6 +11390,11 @@ public class DiagnosticsTestGenerated extends AbstractDiagnosticsTestWithFirVali
runTest("compiler/testData/diagnostics/tests/inference/regressions/kt3344.kt"); 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") @TestMetadata("kt34029.kt")
public void testKt34029() throws Exception { public void testKt34029() throws Exception {
runTest("compiler/testData/diagnostics/tests/inference/regressions/kt34029.kt"); runTest("compiler/testData/diagnostics/tests/inference/regressions/kt34029.kt");
@@ -11385,6 +11385,11 @@ public class DiagnosticsUsingJavacTestGenerated extends AbstractDiagnosticsUsing
runTest("compiler/testData/diagnostics/tests/inference/regressions/kt3344.kt"); 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") @TestMetadata("kt34029.kt")
public void testKt34029() throws Exception { public void testKt34029() throws Exception {
runTest("compiler/testData/diagnostics/tests/inference/regressions/kt34029.kt"); runTest("compiler/testData/diagnostics/tests/inference/regressions/kt34029.kt");
@@ -26224,6 +26224,11 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
runTest("compiler/testData/codegen/box/regressions/kt32949.kt"); 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") @TestMetadata("kt3421.kt")
public void testKt3421() throws Exception { public void testKt3421() throws Exception {
runTest("compiler/testData/codegen/box/regressions/kt3421.kt"); runTest("compiler/testData/codegen/box/regressions/kt3421.kt");
@@ -25041,6 +25041,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
runTest("compiler/testData/codegen/box/regressions/kt32949.kt"); 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") @TestMetadata("kt3421.kt")
public void testKt3421() throws Exception { public void testKt3421() throws Exception {
runTest("compiler/testData/codegen/box/regressions/kt3421.kt"); runTest("compiler/testData/codegen/box/regressions/kt3421.kt");
@@ -24708,6 +24708,11 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
runTest("compiler/testData/codegen/box/regressions/kt32949.kt"); 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") @TestMetadata("kt3421.kt")
public void testKt3421() throws Exception { public void testKt3421() throws Exception {
runTest("compiler/testData/codegen/box/regressions/kt3421.kt"); runTest("compiler/testData/codegen/box/regressions/kt3421.kt");
@@ -20294,6 +20294,11 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest {
runTest("compiler/testData/codegen/box/regressions/kt32949.kt"); 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") @TestMetadata("kt3421.kt")
public void testKt3421() throws Exception { public void testKt3421() throws Exception {
runTest("compiler/testData/codegen/box/regressions/kt3421.kt"); runTest("compiler/testData/codegen/box/regressions/kt3421.kt");
@@ -20354,6 +20354,11 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
runTest("compiler/testData/codegen/box/regressions/kt32949.kt"); 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") @TestMetadata("kt3421.kt")
public void testKt3421() throws Exception { public void testKt3421() throws Exception {
runTest("compiler/testData/codegen/box/regressions/kt3421.kt"); runTest("compiler/testData/codegen/box/regressions/kt3421.kt");