Returns forbidden outside functions

This commit is contained in:
Andrey Breslav
2011-06-17 18:20:24 +04:00
parent 94f00509e2
commit 03460e2bcc
3 changed files with 10 additions and 4 deletions
@@ -92,8 +92,8 @@ public class JetTypeCheckerTest extends LightDaemonAnalyzerTestCase {
public void testJumps() throws Exception {
assertType("throw e", JetStandardClasses.getNothingType());
assertType("return", JetStandardClasses.getNothingType());
assertType("return 1", JetStandardClasses.getNothingType());
// assertType("return", JetStandardClasses.getNothingType());
// assertType("return 1", JetStandardClasses.getNothingType());
assertType("continue", JetStandardClasses.getNothingType());
assertType("continue \"foo\"", JetStandardClasses.getNothingType());
assertType("break", JetStandardClasses.getNothingType());
@@ -105,7 +105,7 @@ public class JetTypeCheckerTest extends LightDaemonAnalyzerTestCase {
assertType("if (true) 1 else 1", "Int");
assertType("if (true) 1 else return", "Int");
assertType("if (true) return else 1", "Int");
assertType("if (true) return else return", "Nothing");
assertType("if (true) throw Exception() else throw Exception()", "Nothing");
assertType("if (true) 1 else null", "Int?");
assertType("if (true) null else null", "Nothing?");