diff --git a/compiler/testData/diagnostics/tests/resolve/resolveWithFunctionLiteralWithId.kt b/compiler/testData/diagnostics/tests/resolve/resolveWithFunctionLiteralWithId.kt new file mode 100644 index 00000000000..8d5764c8064 --- /dev/null +++ b/compiler/testData/diagnostics/tests/resolve/resolveWithFunctionLiteralWithId.kt @@ -0,0 +1,31 @@ +object A { + val iii = 42 +} + +//inappropriate but participating in resolve functions +fun foo(s: String, a: Any) = s + a +fun foo(a: Any) = a +fun foo(i: Int) = i +fun foo(a: Any, i: Int, f: ()-> Int) = "$a$i${f()}" +fun foo(f: (Int)->Int, i: Int) = f(i) +fun foo(f: (String)->Int, s: String) = f(s) +fun foo(f: (Any)->Int, a: Any) = f(a) +fun foo(s: String, f: (String, String)->Int) = f(s, s) +//appropriate function +fun foo(i: Int, f: (Int)->Int) = f(i) + +fun id(t: T) = t + +fun test() { + foo(1, id { x1 -> + foo(2, id { x2 -> + foo(3, id { x3 -> + foo(4, id { x4 -> + foo(5, id { x5 -> + x1 + x2 + x3 + x4 + x5 + A.iii + }) + }) + }) + }) + }) +} diff --git a/compiler/testData/diagnostics/tests/resolve/resolveWithSpecifiedFunctionLiteralWithId.kt b/compiler/testData/diagnostics/tests/resolve/resolveWithSpecifiedFunctionLiteralWithId.kt new file mode 100644 index 00000000000..5492951f845 --- /dev/null +++ b/compiler/testData/diagnostics/tests/resolve/resolveWithSpecifiedFunctionLiteralWithId.kt @@ -0,0 +1,34 @@ +package a + +object A { + val iii = 42 +} + +//inappropriate but participating in resolve functions +fun foo(s: String, a: Any) = s + a +fun foo(a: Any, s: String) = s + a +fun foo(i: Int, j: Int) = i + j +fun foo(a: Any, i: Int) = "$a$i" +fun foo(f: (Int)->Int, i: Int) = f(i) +fun foo(f: (String)->Int, s: String) = f(s) +fun foo(f: (Any)->Int, a: Any) = f(a) +fun foo(s: String, f: (String)->Int) = f(s) +fun foo(a: Any, f: (Any)->Int) = f(a) +//appropriate function +fun foo(i: Int, f: (Int)->Int) = f(i) + +fun id(t: T) = t + +fun test() { + foo(1, id { (x1: Int):Int -> + foo(2, id { (x2: Int): Int -> + foo(3, id { (x3: Int): Int -> + foo(4, id { (x4: Int): Int -> + foo(5, id { (x5: Int): Int -> + x1 + x2 + x3 + x4 + x5 + A.iii + }) + }) + }) + }) + }) +} diff --git a/compiler/tests/org/jetbrains/jet/checkers/JetDiagnosticsTestGenerated.java b/compiler/tests/org/jetbrains/jet/checkers/JetDiagnosticsTestGenerated.java index 4c7bae87690..65ed371d44a 100644 --- a/compiler/tests/org/jetbrains/jet/checkers/JetDiagnosticsTestGenerated.java +++ b/compiler/tests/org/jetbrains/jet/checkers/JetDiagnosticsTestGenerated.java @@ -3826,6 +3826,11 @@ public class JetDiagnosticsTestGenerated extends AbstractDiagnosticsTestWithEage JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.GenerateTests", new File("compiler/testData/diagnostics/tests/resolve"), Pattern.compile("^(.+)\\.kt$"), true); } + @TestMetadata("resolveWithFunctionLiteralWithId.kt") + public void testResolveWithFunctionLiteralWithId() throws Exception { + doTest("compiler/testData/diagnostics/tests/resolve/resolveWithFunctionLiteralWithId.kt"); + } + @TestMetadata("resolveWithFunctionLiterals.kt") public void testResolveWithFunctionLiterals() throws Exception { doTest("compiler/testData/diagnostics/tests/resolve/resolveWithFunctionLiterals.kt"); @@ -3841,6 +3846,11 @@ public class JetDiagnosticsTestGenerated extends AbstractDiagnosticsTestWithEage doTest("compiler/testData/diagnostics/tests/resolve/resolveWithGenerics.kt"); } + @TestMetadata("resolveWithSpecifiedFunctionLiteralWithId.kt") + public void testResolveWithSpecifiedFunctionLiteralWithId() throws Exception { + doTest("compiler/testData/diagnostics/tests/resolve/resolveWithSpecifiedFunctionLiteralWithId.kt"); + } + @TestMetadata("resolveWithoutGenerics.kt") public void testResolveWithoutGenerics() throws Exception { doTest("compiler/testData/diagnostics/tests/resolve/resolveWithoutGenerics.kt");