Delete Hashable, pull up its members to Any

Extensions on nullable types remain in Library.kt

 #KT-1741 Obsolete
 #KT-2805 Obsolete
 #KT-1365 Fixed
 #KT-4517 In Progress
This commit is contained in:
Alexander Udalov
2014-02-04 19:54:06 +04:00
parent 9efdd136ba
commit ec30d52978
46 changed files with 210 additions and 416 deletions
@@ -5106,11 +5106,6 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.TestsPackage", new File("compiler/testData/codegen/box/typeMapping"), Pattern.compile("^(.+)\\.kt$"), true);
}
@TestMetadata("hashable.kt")
public void testHashable() throws Exception {
doTest("compiler/testData/codegen/box/typeMapping/hashable.kt");
}
@TestMetadata("kt2831.kt")
public void testKt2831() throws Exception {
doTest("compiler/testData/codegen/box/typeMapping/kt2831.kt");
@@ -908,11 +908,6 @@ public class BlackBoxWithStdlibCodegenTestGenerated extends AbstractBlackBoxCode
doTestWithStdlib("compiler/testData/codegen/boxWithStdlib/regressions/getGenericInterfaces.kt");
}
@TestMetadata("implicitlyCastToHashable.kt")
public void testImplicitlyCastToHashable() throws Exception {
doTestWithStdlib("compiler/testData/codegen/boxWithStdlib/regressions/implicitlyCastToHashable.kt");
}
@TestMetadata("kt1406.kt")
public void testKt1406() throws Exception {
doTestWithStdlib("compiler/testData/codegen/boxWithStdlib/regressions/kt1406.kt");
@@ -150,7 +150,7 @@ public class JetTypeCheckerTest extends JetLiteFixture {
assertType("if (true) 1 else null", "Int?");
assertType("if (true) null else null", "Nothing?");
assertType("if (true) 1 else '1'", "Any");
assertType("if (true) 1 else '1'", "Comparable<out Any?>");
assertType("if (true) else '1'", "Unit");
assertType("if (true) else { var a = 0; a = 1 }", "Unit");
@@ -158,19 +158,19 @@ public class JetTypeCheckerTest extends JetLiteFixture {
public void testWhen() throws Exception {
assertType("when (1) { is 1 -> 2; } ", "Int");
assertType("when (1) { is 1 -> 2; is 1 -> '2'} ", "Any");
assertType("when (1) { is 1 -> 2; is 1 -> '2'; is 1 -> null} ", "Any?");
assertType("when (1) { is 1 -> 2; is 1 -> '2'; else -> null} ", "Any?");
assertType("when (1) { is 1 -> 2; is 1 -> '2'; is 1 -> when(2) {is 1 -> null}} ", "Any?");
assertType("when (1) { is 1 -> 2; is 1 -> '2'} ", "Comparable<out Any?>");
assertType("when (1) { is 1 -> 2; is 1 -> '2'; is 1 -> null} ", "Comparable<out Any?>?");
assertType("when (1) { is 1 -> 2; is 1 -> '2'; else -> null} ", "Comparable<out Any?>?");
assertType("when (1) { is 1 -> 2; is 1 -> '2'; is 1 -> when(2) {is 1 -> null}} ", "Comparable<out Any?>?");
}
public void testTry() throws Exception {
assertType("try {1} finally{2}", "Int");
assertType("try {1} catch (e : Exception) {'a'} finally{2}", "Any");
assertType("try {1} catch (e : Exception) {'a'} finally{2}", "Comparable<out Any?>");
assertType("try {1} catch (e : Exception) {2} finally{'a'}", "Int");
assertType("try {1} catch (e : Exception) {'a'} finally{'2'}", "Any");
assertType("try {1} catch (e : Exception) {'a'}", "Any");
assertType("try {1} catch (e : Exception) {'a'} catch (e : Exception) {null}", "Any?");
assertType("try {1} catch (e : Exception) {'a'} finally{'2'}", "Comparable<out Any?>");
assertType("try {1} catch (e : Exception) {'a'}", "Comparable<out Any?>");
assertType("try {1} catch (e : Exception) {'a'} catch (e : Exception) {null}", "Comparable<out Any?>?");
assertType("try {} catch (e : Exception) {}", "Unit");
}
@@ -184,7 +184,8 @@ public class JetTypeCheckerTest extends JetLiteFixture {
assertCommonSupertype("Int?", "Int", "Nothing?");
assertCommonSupertype("Nothing?", "Nothing?", "Nothing?");
assertCommonSupertype("Any", "Int", "Char");
assertCommonSupertype("Any", "Char", "Number");
assertCommonSupertype("Comparable<out Any?>", "Int", "Char");
assertCommonSupertype("Base_T<*>", "Base_T<*>", "Derived_T<*>");
assertCommonSupertype("Any", "Base_inT<*>", "Derived_T<*>");
@@ -200,9 +201,9 @@ public class JetTypeCheckerTest extends JetLiteFixture {
}
public void testIntersect() throws Exception {
assertIntersection("Number", "Number?", "Hashable");
assertIntersection("Number", "Hashable", "Number?");
assertIntersection("Hashable", "Hashable?", "Hashable");
assertIntersection("Long", "Long?", "Number");
assertIntersection("Long", "Number", "Long?");
assertIntersection("Number", "Number?", "Number");
assertIntersection("Int?", "Int?", "Int?");
assertIntersection("Int", "Int?", "Int");