A test for nesting implicitly labeled calls
The actual error message should be "return not allowed", but due to a bug in label resolution it is "unresolved reference"
This commit is contained in:
@@ -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<!UNRESOLVED_REFERENCE!>@foo<!> 1
|
||||
}
|
||||
return@foo 1
|
||||
}
|
||||
}
|
||||
|
||||
fun foo(<!UNUSED_PARAMETER!>a<!>: Any) {}
|
||||
fun bar(<!UNUSED_PARAMETER!>a<!>: Any) {}
|
||||
@@ -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");
|
||||
|
||||
Reference in New Issue
Block a user