diff --git a/compiler/frontend/builtins/jet/.kotlin_class_names b/compiler/frontend/builtins/jet/.kotlin_class_names index cc20324b6db..82757a402dc 100644 Binary files a/compiler/frontend/builtins/jet/.kotlin_class_names and b/compiler/frontend/builtins/jet/.kotlin_class_names differ diff --git a/compiler/frontend/builtins/jet/.kotlin_name_table b/compiler/frontend/builtins/jet/.kotlin_name_table index 20ce8ec5116..150001fb61d 100644 Binary files a/compiler/frontend/builtins/jet/.kotlin_name_table and b/compiler/frontend/builtins/jet/.kotlin_name_table differ diff --git a/compiler/frontend/builtins/jet/.kotlin_package b/compiler/frontend/builtins/jet/.kotlin_package index 297ac989735..4cb36d0170a 100644 Binary files a/compiler/frontend/builtins/jet/.kotlin_package and b/compiler/frontend/builtins/jet/.kotlin_package differ diff --git a/compiler/frontend/builtins/jet/Boolean.kotlin_class b/compiler/frontend/builtins/jet/Boolean.kotlin_class index 058a85afa03..6ffba3bca58 100644 Binary files a/compiler/frontend/builtins/jet/Boolean.kotlin_class and b/compiler/frontend/builtins/jet/Boolean.kotlin_class differ diff --git a/compiler/frontend/builtins/jet/BooleanArray.kotlin_class b/compiler/frontend/builtins/jet/BooleanArray.kotlin_class index 68ba918bf24..83abca5284a 100644 Binary files a/compiler/frontend/builtins/jet/BooleanArray.kotlin_class and b/compiler/frontend/builtins/jet/BooleanArray.kotlin_class differ diff --git a/compiler/frontend/builtins/jet/BooleanIterator.kotlin_class b/compiler/frontend/builtins/jet/BooleanIterator.kotlin_class index e431fb41a6e..25e99a6c3fa 100644 --- a/compiler/frontend/builtins/jet/BooleanIterator.kotlin_class +++ b/compiler/frontend/builtins/jet/BooleanIterator.kotlin_class @@ -1,9 +1,9 @@ -& 2 +& 2   Z -0B +0B  Z -&0B +&0B  j Æ0B - \ No newline at end of file + \ No newline at end of file diff --git a/compiler/frontend/builtins/jet/Byte.kotlin_class b/compiler/frontend/builtins/jet/Byte.kotlin_class index 0c44f575e17..e626bb17a8f 100644 Binary files a/compiler/frontend/builtins/jet/Byte.kotlin_class and b/compiler/frontend/builtins/jet/Byte.kotlin_class differ diff --git a/compiler/frontend/builtins/jet/ByteArray.kotlin_class b/compiler/frontend/builtins/jet/ByteArray.kotlin_class index 7fce5a2dcc9..859d1e325fc 100644 Binary files a/compiler/frontend/builtins/jet/ByteArray.kotlin_class and b/compiler/frontend/builtins/jet/ByteArray.kotlin_class differ diff --git a/compiler/frontend/builtins/jet/ByteIterator.kotlin_class b/compiler/frontend/builtins/jet/ByteIterator.kotlin_class index 0c5f9e97d81..07b35b70681 100644 --- a/compiler/frontend/builtins/jet/ByteIterator.kotlin_class +++ b/compiler/frontend/builtins/jet/ByteIterator.kotlin_class @@ -1,9 +1,9 @@ &2  - Z -0B - Z + Z +0B + Z &0?B - j + j Æ0B  \ No newline at end of file diff --git a/compiler/frontend/builtins/jet/ByteProgression.kotlin_class b/compiler/frontend/builtins/jet/ByteProgression.kotlin_class index 62b452e2106..b50a483494e 100644 Binary files a/compiler/frontend/builtins/jet/ByteProgression.kotlin_class and b/compiler/frontend/builtins/jet/ByteProgression.kotlin_class differ diff --git a/compiler/frontend/builtins/jet/ByteRange.kotlin_class b/compiler/frontend/builtins/jet/ByteRange.kotlin_class index 6cccfad1f35..2406f9720a3 100644 Binary files a/compiler/frontend/builtins/jet/ByteRange.kotlin_class and b/compiler/frontend/builtins/jet/ByteRange.kotlin_class differ diff --git a/compiler/frontend/builtins/jet/Char.kotlin_class b/compiler/frontend/builtins/jet/Char.kotlin_class index 83234cc77b8..b0a45762637 100644 Binary files a/compiler/frontend/builtins/jet/Char.kotlin_class and b/compiler/frontend/builtins/jet/Char.kotlin_class differ diff --git a/compiler/frontend/builtins/jet/CharIterator.kotlin_class b/compiler/frontend/builtins/jet/CharIterator.kotlin_class index 189e544112b..e0a08ddfd7b 100644 --- a/compiler/frontend/builtins/jet/CharIterator.kotlin_class +++ b/compiler/frontend/builtins/jet/CharIterator.kotlin_class @@ -1,7 +1,7 @@ &"2  Z -0B +0B Z &0MB j diff --git a/compiler/frontend/builtins/jet/Comparable.kotlin_class b/compiler/frontend/builtins/jet/Comparable.kotlin_class index cd90405868a..4a9a354d136 100644 Binary files a/compiler/frontend/builtins/jet/Comparable.kotlin_class and b/compiler/frontend/builtins/jet/Comparable.kotlin_class differ diff --git a/compiler/frontend/builtins/jet/Double.kotlin_class b/compiler/frontend/builtins/jet/Double.kotlin_class index eae62d73918..c89dff37ea1 100644 Binary files a/compiler/frontend/builtins/jet/Double.kotlin_class and b/compiler/frontend/builtins/jet/Double.kotlin_class differ diff --git a/compiler/frontend/builtins/jet/DoubleIterator.kotlin_class b/compiler/frontend/builtins/jet/DoubleIterator.kotlin_class index 5846b220330..2e7ff71083f 100644 --- a/compiler/frontend/builtins/jet/DoubleIterator.kotlin_class +++ b/compiler/frontend/builtins/jet/DoubleIterator.kotlin_class @@ -1,7 +1,7 @@ &*2  Z -0B +0B Z &0]B j diff --git a/compiler/frontend/builtins/jet/Float.kotlin_class b/compiler/frontend/builtins/jet/Float.kotlin_class index 2e34a417402..d4722832ac0 100644 Binary files a/compiler/frontend/builtins/jet/Float.kotlin_class and b/compiler/frontend/builtins/jet/Float.kotlin_class differ diff --git a/compiler/frontend/builtins/jet/FloatIterator.kotlin_class b/compiler/frontend/builtins/jet/FloatIterator.kotlin_class index 6e99cfb6f1c..b72890c10fa 100644 --- a/compiler/frontend/builtins/jet/FloatIterator.kotlin_class +++ b/compiler/frontend/builtins/jet/FloatIterator.kotlin_class @@ -1,7 +1,7 @@ &F2  Z -0B +0B Z &0ªB j Æ0B diff --git a/compiler/frontend/builtins/jet/Hashable.kotlin_class b/compiler/frontend/builtins/jet/Hashable.kotlin_class index 0c6f281d938..a6f45978d03 100644 Binary files a/compiler/frontend/builtins/jet/Hashable.kotlin_class and b/compiler/frontend/builtins/jet/Hashable.kotlin_class differ diff --git a/compiler/frontend/builtins/jet/Int.kotlin_class b/compiler/frontend/builtins/jet/Int.kotlin_class index b15e5f19f46..e37fa64b80c 100644 Binary files a/compiler/frontend/builtins/jet/Int.kotlin_class and b/compiler/frontend/builtins/jet/Int.kotlin_class differ diff --git a/compiler/frontend/builtins/jet/IntIterator.kotlin_class b/compiler/frontend/builtins/jet/IntIterator.kotlin_class index 2b574834e62..4e30b956bc8 100644 --- a/compiler/frontend/builtins/jet/IntIterator.kotlin_class +++ b/compiler/frontend/builtins/jet/IntIterator.kotlin_class @@ -1,7 +1,7 @@ &f2  Z -0B +0B Z &0ÒB j Æ0B diff --git a/compiler/frontend/builtins/jet/Iterator.kotlin_class b/compiler/frontend/builtins/jet/Iterator.kotlin_class index c8d7cc08428..383ac8e81dc 100644 Binary files a/compiler/frontend/builtins/jet/Iterator.kotlin_class and b/compiler/frontend/builtins/jet/Iterator.kotlin_class differ diff --git a/compiler/frontend/builtins/jet/ListIterator.kotlin_class b/compiler/frontend/builtins/jet/ListIterator.kotlin_class index 479ac8ae48e..a85e8318521 100644 Binary files a/compiler/frontend/builtins/jet/ListIterator.kotlin_class and b/compiler/frontend/builtins/jet/ListIterator.kotlin_class differ diff --git a/compiler/frontend/builtins/jet/Long.kotlin_class b/compiler/frontend/builtins/jet/Long.kotlin_class index 68a24b9c81b..bacb9f91aff 100644 Binary files a/compiler/frontend/builtins/jet/Long.kotlin_class and b/compiler/frontend/builtins/jet/Long.kotlin_class differ diff --git a/compiler/frontend/builtins/jet/LongIterator.kotlin_class b/compiler/frontend/builtins/jet/LongIterator.kotlin_class index 400da673b30..4913eb955b5 100644 --- a/compiler/frontend/builtins/jet/LongIterator.kotlin_class +++ b/compiler/frontend/builtins/jet/LongIterator.kotlin_class @@ -1,7 +1,7 @@ &±2  Z -0B +0B Z &0©B j Æ0B diff --git a/compiler/frontend/builtins/jet/MutableListIterator.kotlin_class b/compiler/frontend/builtins/jet/MutableListIterator.kotlin_class index 1952847b159..06fe7988073 100644 Binary files a/compiler/frontend/builtins/jet/MutableListIterator.kotlin_class and b/compiler/frontend/builtins/jet/MutableListIterator.kotlin_class differ diff --git a/compiler/frontend/builtins/jet/Number.kotlin_class b/compiler/frontend/builtins/jet/Number.kotlin_class index c9533d9b1f4..99075f126cd 100644 --- a/compiler/frontend/builtins/jet/Number.kotlin_class +++ b/compiler/frontend/builtins/jet/Number.kotlin_class @@ -1,7 +1,7 @@ -& 2 +&2  Z &06B - Z + Z &07B Z &08B @@ -15,4 +15,4 @@ &0 { public final fun set(/*0*/ index: jet.Int, /*1*/ value: T): jet.Unit } -public final class Boolean { +public final class Boolean : jet.Comparable { /*primary*/ private constructor Boolean() public final fun and(/*0*/ other: jet.Boolean): jet.Boolean + public open override /*1*/ fun compareTo(/*0*/ other: jet.Boolean): jet.Int public final fun equals(/*0*/ other: jet.Any?): jet.Boolean public final fun not(): jet.Boolean public final fun or(/*0*/ other: jet.Boolean): jet.Boolean diff --git a/compiler/testData/codegen/box/operatorConventions/compareTo/boolean.kt b/compiler/testData/codegen/box/operatorConventions/compareTo/boolean.kt new file mode 100644 index 00000000000..67a344bf1ec --- /dev/null +++ b/compiler/testData/codegen/box/operatorConventions/compareTo/boolean.kt @@ -0,0 +1,11 @@ +fun checkLess(x: Boolean, y: Boolean) = when { + x >= y -> "Fail $x >= $y" + !(x < y) -> "Fail !($x < $y)" + !(x <= y) -> "Fail !($x <= $y)" + x > y -> "Fail $x > $y" + x.compareTo(y) >= 0 -> "Fail $x.compareTo($y) >= 0" + x compareTo y >= 0 -> "Fail $x compareTo $y >= 0" + else -> "OK" +} + +fun box() = checkLess(false, true) diff --git a/compiler/testData/diagnostics/tests/library/BooleanIsNotComparable.kt b/compiler/testData/diagnostics/tests/library/BooleanIsNotComparable.kt deleted file mode 100644 index 02a6b985fea..00000000000 --- a/compiler/testData/diagnostics/tests/library/BooleanIsNotComparable.kt +++ /dev/null @@ -1,8 +0,0 @@ -fun foo(x: Boolean) { - x < x - x <= x - x > x - x >= x - x == x - x.compareTo(x) -} diff --git a/compiler/tests/org/jetbrains/jet/checkers/JetDiagnosticsTestGenerated.java b/compiler/tests/org/jetbrains/jet/checkers/JetDiagnosticsTestGenerated.java index 59956d12b0d..d90aaef30c2 100644 --- a/compiler/tests/org/jetbrains/jet/checkers/JetDiagnosticsTestGenerated.java +++ b/compiler/tests/org/jetbrains/jet/checkers/JetDiagnosticsTestGenerated.java @@ -4614,11 +4614,6 @@ public class JetDiagnosticsTestGenerated extends AbstractJetDiagnosticsTest { JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.TestsPackage", new File("compiler/testData/diagnostics/tests/library"), Pattern.compile("^(.+)\\.kt$"), true); } - @TestMetadata("BooleanIsNotComparable.kt") - public void testBooleanIsNotComparable() throws Exception { - doTest("compiler/testData/diagnostics/tests/library/BooleanIsNotComparable.kt"); - } - @TestMetadata("Collections.kt") public void testCollections() throws Exception { doTest("compiler/testData/diagnostics/tests/library/Collections.kt"); diff --git a/compiler/tests/org/jetbrains/jet/codegen/generated/BlackBoxCodegenTestGenerated.java b/compiler/tests/org/jetbrains/jet/codegen/generated/BlackBoxCodegenTestGenerated.java index d7704d1c0a1..a4975a83296 100644 --- a/compiler/tests/org/jetbrains/jet/codegen/generated/BlackBoxCodegenTestGenerated.java +++ b/compiler/tests/org/jetbrains/jet/codegen/generated/BlackBoxCodegenTestGenerated.java @@ -4051,6 +4051,11 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.TestsPackage", new File("compiler/testData/codegen/box/operatorConventions/compareTo"), Pattern.compile("^(.+)\\.kt$"), true); } + @TestMetadata("boolean.kt") + public void testBoolean() throws Exception { + doTest("compiler/testData/codegen/box/operatorConventions/compareTo/boolean.kt"); + } + @TestMetadata("comparable.kt") public void testComparable() throws Exception { doTest("compiler/testData/codegen/box/operatorConventions/compareTo/comparable.kt"); diff --git a/idea/builtinsSrc/jet/Library.kt b/idea/builtinsSrc/jet/Library.kt index 391fb2b24a8..ee9f69f4504 100644 --- a/idea/builtinsSrc/jet/Library.kt +++ b/idea/builtinsSrc/jet/Library.kt @@ -37,7 +37,7 @@ public trait Hashable { public fun equals(other : Any?) : Boolean } -public class Boolean private () { +public class Boolean private () : Comparable { public fun not() : Boolean public fun and(other : Boolean) : Boolean @@ -46,6 +46,8 @@ public class Boolean private () { public fun xor(other : Boolean) : Boolean + public override fun compareTo(other : Boolean) : Int + public fun equals(other : Any?) : Boolean }