KT-11425: convert a.compareTo(b) to binary comparison if possible
(cherry picked from commit 7219904)
This commit is contained in:
committed by
Mikhail Glukhikh
parent
f309021c9f
commit
fc13b25ca4
Vendored
+3
@@ -0,0 +1,3 @@
|
||||
// IS_APPLICABLE: false
|
||||
|
||||
val x = 2.compareTo<caret>(2) == 0
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
// INTENTION_TEXT: Replace with '>' operator
|
||||
|
||||
val x = 3.compareTo<caret>(2) > 0
|
||||
Vendored
+3
@@ -0,0 +1,3 @@
|
||||
// INTENTION_TEXT: Replace with '>' operator
|
||||
|
||||
val x = 3 > 2
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
// INTENTION_TEXT: Replace with '<=' operator
|
||||
|
||||
val x = 0 >= 4.compareTo<caret>(5)
|
||||
Vendored
+3
@@ -0,0 +1,3 @@
|
||||
// INTENTION_TEXT: Replace with '<=' operator
|
||||
|
||||
val x = 4 <= 5
|
||||
Vendored
+5
@@ -0,0 +1,5 @@
|
||||
// IS_APPLICABLE: false
|
||||
// ERROR: Infix call corresponds to a dot-qualified call 'nullable?.compareTo(1).compareTo(0)' which is not allowed on a nullable receiver 'nullable?.compareTo(1)'. Use '?.'-qualified call instead
|
||||
|
||||
val nullable: Int? = null
|
||||
val x = nullable?.compareTo<caret>(1) >= 0
|
||||
Reference in New Issue
Block a user