Typing for try-expression

This commit is contained in:
Andrey Breslav
2011-02-03 15:32:12 +03:00
parent 2e2c31ea00
commit 7b15eea98a
7 changed files with 70 additions and 13 deletions
@@ -99,6 +99,15 @@ public class JetTypeCheckerTest extends LightDaemonAnalyzerTestCase {
assertType("when (1) { is 1 => 2; is 1 => '2'; is 1 => when(e) {is 1 => null}} ", "Any?");
}
public void testTry() throws Exception {
assertType("try {1} finally{2}", "Int");
assertType("try {1} catch (e : e) {'a'} finally{2}", "Int");
assertType("try {1} catch (e : e) {'a'} finally{'2'}", "Any");
assertType("try {1} catch (e : e) {'a'}", "Any");
assertType("try {1} catch (e : e) {'a'} catch (e : e) {null}", "Any?");
assertType("try {} catch (e : e) {}", "Unit");
}
public void testCommonSupertypes() throws Exception {
assertCommonSupertype("Int", "Int", "Int");