diff --git a/compiler/testData/diagnostics/tests/functionLiterals/return/AutoLabelsNonLocal.kt b/compiler/testData/diagnostics/tests/functionLiterals/return/AutoLabelsNonLocal.kt new file mode 100644 index 00000000000..a13a41fe6f5 --- /dev/null +++ b/compiler/testData/diagnostics/tests/functionLiterals/return/AutoLabelsNonLocal.kt @@ -0,0 +1,14 @@ +fun f() { + foo {(): Int -> + bar { + (): Int -> + // The actual error message should be "return not allowed", + // but due to a bug in label resolution it is "unresolved reference" + return@foo 1 + } + return@foo 1 + } +} + +fun foo(a: Any) {} +fun bar(a: Any) {} \ 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 4afcba8d7b8..848f8cc9661 100644 --- a/compiler/tests/org/jetbrains/jet/checkers/JetDiagnosticsTestGenerated.java +++ b/compiler/tests/org/jetbrains/jet/checkers/JetDiagnosticsTestGenerated.java @@ -2437,6 +2437,11 @@ public class JetDiagnosticsTestGenerated extends AbstractDiagnosticsTestWithEage doTest("compiler/testData/diagnostics/tests/functionLiterals/return/AutoLabels.kt"); } + @TestMetadata("AutoLabelsNonLocal.kt") + public void testAutoLabelsNonLocal() throws Exception { + doTest("compiler/testData/diagnostics/tests/functionLiterals/return/AutoLabelsNonLocal.kt"); + } + @TestMetadata("ForbiddenNonLocalReturnNoType.kt") public void testForbiddenNonLocalReturnNoType() throws Exception { doTest("compiler/testData/diagnostics/tests/functionLiterals/return/ForbiddenNonLocalReturnNoType.kt");