Common supertypes found correctly for simple cases

This commit is contained in:
Andrey Breslav
2011-01-27 20:02:23 +03:00
parent 90eb9c443b
commit 7f74b8380f
3 changed files with 85 additions and 13 deletions
@@ -76,6 +76,14 @@ public class JetTypeCheckerTest extends LightDaemonAnalyzerTestCase {
assertType("break \"foo\"", JetStandardClasses.getNothingType());
}
public void testIf() throws Exception {
assertType("if (true) 1", JetStandardClasses.getUnitType());
assertType("if (true) 1 else 1", JetStandardClasses.getIntType());
assertType("if (true) 1 else return", JetStandardClasses.getIntType());
assertType("if (true) return else 1", JetStandardClasses.getIntType());
assertType("if (true) return else return", JetStandardClasses.getNothingType());
}
public void testBasicSubtyping() throws Exception {
assertSubtype("Boolean", "Boolean");
assertSubtype("Byte", "Byte");