diff --git a/compiler/testData/diagnostics/tests/inference/possibleCycleOnConstraints.kt b/compiler/testData/diagnostics/tests/inference/possibleCycleOnConstraints.kt new file mode 100644 index 00000000000..8e61222f43c --- /dev/null +++ b/compiler/testData/diagnostics/tests/inference/possibleCycleOnConstraints.kt @@ -0,0 +1,13 @@ +package a + +import java.util.* + +fun g (f: () -> List) : T {} + +fun test() { + //here possibly can be a cycle on constraints + val x = g { Collections.emptyList() } + + val y = g { Collections.emptyList()!! } + val z : List = g { Collections.emptyList()!! } +} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/inference/regressions/kt2200.kt b/compiler/testData/diagnostics/tests/inference/regressions/kt2200.kt new file mode 100644 index 00000000000..f5e0fc6d331 --- /dev/null +++ b/compiler/testData/diagnostics/tests/inference/regressions/kt2200.kt @@ -0,0 +1,14 @@ +//KT-2200 array(array()) breaks compiler +package n + +fun main(args: Array) { + val a = array(array()) + val a0 : Array> = array(array()) + val a1 = array(array()) + a1 : Array> + val a2 = array>(array()) + a2 : Array> +} + +//from library +fun array(vararg t : T) : Array = t \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/inference/regressions/kt2283.kt b/compiler/testData/diagnostics/tests/inference/regressions/kt2283.kt new file mode 100644 index 00000000000..edf1d078551 --- /dev/null +++ b/compiler/testData/diagnostics/tests/inference/regressions/kt2283.kt @@ -0,0 +1,13 @@ +//KT-2283 Bad diagnostics of failed type inference +package a + + +trait Foo + +fun Foo.map(f: (A) -> B): Foo = object : Foo {} + + +fun foo() { + val l: Foo = object : Foo {} + val m: Foo = l.map { ppp -> 1 } +} \ No newline at end of file diff --git a/compiler/tests/org/jetbrains/jet/checkers/JetDiagnosticsTestGenerated.java b/compiler/tests/org/jetbrains/jet/checkers/JetDiagnosticsTestGenerated.java index e5f1d433c60..59bfdeeda34 100644 --- a/compiler/tests/org/jetbrains/jet/checkers/JetDiagnosticsTestGenerated.java +++ b/compiler/tests/org/jetbrains/jet/checkers/JetDiagnosticsTestGenerated.java @@ -1365,6 +1365,16 @@ public class JetDiagnosticsTestGenerated extends AbstractDiagnosticsTestWithEage doTest("compiler/testData/diagnostics/tests/inference/regressions/kt2179.kt"); } + @TestMetadata("kt2200.kt") + public void testKt2200() throws Exception { + doTest("compiler/testData/diagnostics/tests/inference/regressions/kt2200.kt"); + } + + @TestMetadata("kt2283.kt") + public void testKt2283() throws Exception { + doTest("compiler/testData/diagnostics/tests/inference/regressions/kt2283.kt"); + } + @TestMetadata("kt2294.kt") public void testKt2294() throws Exception { doTest("compiler/testData/diagnostics/tests/inference/regressions/kt2294.kt");