KT-4349 Make jet.Boolean implement Comparable
#KT-4349
This commit is contained in:
@@ -26,9 +26,10 @@ public final class Array</*0*/ reified T> {
|
||||
public final fun set(/*0*/ index: jet.Int, /*1*/ value: T): jet.Unit
|
||||
}
|
||||
|
||||
public final class Boolean {
|
||||
public final class Boolean : jet.Comparable<jet.Boolean> {
|
||||
/*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
|
||||
|
||||
@@ -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)
|
||||
@@ -1,8 +0,0 @@
|
||||
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)
|
||||
}
|
||||
Reference in New Issue
Block a user