Booleans are no longer Comparable
This commit is contained in:
@@ -51,9 +51,6 @@ public class CompareTo implements IntrinsicMethod {
|
|||||||
else if (receiver.type == Type.INT_TYPE) {
|
else if (receiver.type == Type.INT_TYPE) {
|
||||||
v.invokestatic("jet/runtime/Intrinsics", "compare", "(II)I");
|
v.invokestatic("jet/runtime/Intrinsics", "compare", "(II)I");
|
||||||
}
|
}
|
||||||
else if (receiver.type == Type.BOOLEAN_TYPE) {
|
|
||||||
v.invokestatic("jet/runtime/Intrinsics", "compare", "(ZZ)I");
|
|
||||||
}
|
|
||||||
else if (receiver.type == Type.LONG_TYPE) {
|
else if (receiver.type == Type.LONG_TYPE) {
|
||||||
v.invokestatic("jet/runtime/Intrinsics", "compare", "(JJ)I");
|
v.invokestatic("jet/runtime/Intrinsics", "compare", "(JJ)I");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ public trait Hashable {
|
|||||||
public fun equals(other : Any?) : Boolean
|
public fun equals(other : Any?) : Boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
public class Boolean : Comparable<Boolean> {
|
public class Boolean {
|
||||||
public fun not() : Boolean
|
public fun not() : Boolean
|
||||||
|
|
||||||
public fun and(other : Boolean) : Boolean
|
public fun and(other : Boolean) : Boolean
|
||||||
@@ -38,8 +38,6 @@ public class Boolean : Comparable<Boolean> {
|
|||||||
public fun xor(other : Boolean) : Boolean
|
public fun xor(other : Boolean) : Boolean
|
||||||
|
|
||||||
public fun equals(other : Any?) : Boolean
|
public fun equals(other : Any?) : Boolean
|
||||||
|
|
||||||
public override fun compareTo(that : Boolean) : Int
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public trait CharSequence {
|
public trait CharSequence {
|
||||||
|
|||||||
@@ -13,10 +13,9 @@ public final class jet.Array</*0,r*/ T : jet.Any?> : jet.Any {
|
|||||||
public final fun set(/*0*/ index: jet.Int, /*1*/ value: T): jet.Tuple0
|
public final fun set(/*0*/ index: jet.Int, /*1*/ value: T): jet.Tuple0
|
||||||
public final val size: jet.Int
|
public final val size: jet.Int
|
||||||
}
|
}
|
||||||
public final class jet.Boolean : jet.Comparable<jet.Boolean> {
|
public final class jet.Boolean : jet.Any {
|
||||||
public final /*constructor*/ fun <init>(): jet.Boolean
|
public final /*constructor*/ fun <init>(): jet.Boolean
|
||||||
public final fun and(/*0*/ other: jet.Boolean): jet.Boolean
|
public final fun and(/*0*/ other: jet.Boolean): jet.Boolean
|
||||||
public open override /*1*/ fun compareTo(/*0*/ that: jet.Boolean): jet.Int
|
|
||||||
public final fun equals(/*0*/ other: jet.Any?): jet.Boolean
|
public final fun equals(/*0*/ other: jet.Any?): jet.Boolean
|
||||||
public final fun not(): jet.Boolean
|
public final fun not(): jet.Boolean
|
||||||
public final fun or(/*0*/ other: jet.Boolean): jet.Boolean
|
public final fun or(/*0*/ other: jet.Boolean): jet.Boolean
|
||||||
|
|||||||
@@ -0,0 +1,8 @@
|
|||||||
|
fun foo(x: Boolean) {
|
||||||
|
x <!UNRESOLVED_REFERENCE!><<!> x
|
||||||
|
x <!UNRESOLVED_REFERENCE!><=<!> x
|
||||||
|
x <!UNRESOLVED_REFERENCE!>><!> x
|
||||||
|
x <!UNRESOLVED_REFERENCE!>>=<!> x
|
||||||
|
x == x
|
||||||
|
x.<!UNRESOLVED_REFERENCE!>compareTo<!>(x)
|
||||||
|
}
|
||||||
@@ -2386,6 +2386,11 @@ public class JetDiagnosticsTestGenerated extends AbstractDiagnosticsTestWithEage
|
|||||||
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.GenerateTests", new File("compiler/testData/diagnostics/tests/library"), "kt", true);
|
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.GenerateTests", new File("compiler/testData/diagnostics/tests/library"), "kt", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("BooleanIsNotComparable.kt")
|
||||||
|
public void testBooleanIsNotComparable() throws Exception {
|
||||||
|
doTest("compiler/testData/diagnostics/tests/library/BooleanIsNotComparable.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("Collections.kt")
|
@TestMetadata("Collections.kt")
|
||||||
public void testCollections() throws Exception {
|
public void testCollections() throws Exception {
|
||||||
doTest("compiler/testData/diagnostics/tests/library/Collections.kt");
|
doTest("compiler/testData/diagnostics/tests/library/Collections.kt");
|
||||||
|
|||||||
@@ -207,7 +207,7 @@ public class JetTypeCheckerTest extends JetLiteFixture {
|
|||||||
assertCommonSupertype("Derived_T<Int>", "DDerived_T<Int>", "DDerived1_T<Int>");
|
assertCommonSupertype("Derived_T<Int>", "DDerived_T<Int>", "DDerived1_T<Int>");
|
||||||
|
|
||||||
assertCommonSupertype("Comparable<*>", "Comparable<Int>", "Comparable<Boolean>");
|
assertCommonSupertype("Comparable<*>", "Comparable<Int>", "Comparable<Boolean>");
|
||||||
assertCommonSupertype("Base_T<out Comparable<*>>", "Base_T<Int>", "Base_T<Boolean>");
|
assertCommonSupertype("Base_T<out Comparable<*>>", "Base_T<Int>", "Base_T<String>");
|
||||||
assertCommonSupertype("Base_T<in Int>", "Base_T<Int>", "Base_T<in Int>");
|
assertCommonSupertype("Base_T<in Int>", "Base_T<Int>", "Base_T<in Int>");
|
||||||
assertCommonSupertype("Base_T<in Int>", "Derived_T<Int>", "Base_T<in Int>");
|
assertCommonSupertype("Base_T<in Int>", "Derived_T<Int>", "Base_T<in Int>");
|
||||||
assertCommonSupertype("Base_T<in Int>", "Derived_T<in Int>", "Base_T<Int>");
|
assertCommonSupertype("Base_T<in Int>", "Derived_T<in Int>", "Base_T<Int>");
|
||||||
|
|||||||
@@ -80,10 +80,6 @@ public class Intrinsics {
|
|||||||
return (thisVal<anotherVal ? -1 : (thisVal==anotherVal ? 0 : 1));
|
return (thisVal<anotherVal ? -1 : (thisVal==anotherVal ? 0 : 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int compare(boolean thisVal, boolean anotherVal) {
|
|
||||||
return (thisVal == anotherVal ? 0 : (anotherVal ? 1 : -1));
|
|
||||||
}
|
|
||||||
|
|
||||||
public static <R> R stupidSync(Object lock, Function0<R> block) {
|
public static <R> R stupidSync(Object lock, Function0<R> block) {
|
||||||
synchronized (lock) {
|
synchronized (lock) {
|
||||||
return block.invoke();
|
return block.invoke();
|
||||||
|
|||||||
Reference in New Issue
Block a user