Test that local return has type Nothing

This commit is contained in:
Andrey Breslav
2013-08-21 18:07:58 +04:00
parent aa99c29d8d
commit 3f3ee378f3
2 changed files with 12 additions and 0 deletions
@@ -0,0 +1,7 @@
fun test() {
run1 @f{(): Int ->
(return@f 1): Nothing
}
}
fun run1<T>(f: () -> T): T { return f() }
@@ -2452,6 +2452,11 @@ public class JetDiagnosticsTestGenerated extends AbstractDiagnosticsTestWithEage
doTest("compiler/testData/diagnostics/tests/functionLiterals/return/LocalReturnExplicitLabelParens.kt");
}
@TestMetadata("LocalReturnHasTypeNothing.kt")
public void testLocalReturnHasTypeNothing() throws Exception {
doTest("compiler/testData/diagnostics/tests/functionLiterals/return/LocalReturnHasTypeNothing.kt");
}
@TestMetadata("LocalReturnInNestedFunction.kt")
public void testLocalReturnInNestedFunction() throws Exception {
doTest("compiler/testData/diagnostics/tests/functionLiterals/return/LocalReturnInNestedFunction.kt");