forked from JetBrains/kotlin
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix comparison of boolean values in JS BE
See KT-16984
- Loading branch information
Alexey Andreev
authored and
Alexey Andreev
committed
May 26, 2017
1 parent
f5510b8
commit dde50a3
Showing
8 changed files
with
42 additions
and
18 deletions.
There are no files selected for viewing
3 changes: 0 additions & 3 deletions
3
compiler/testData/codegen/box/operatorConventions/compareTo/boolean.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
js/js.translator/testData/box/expression/compareTo/booleanCompareTo.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// EXPECTED_REACHABLE_NODES: 489 | ||
fun box(): String { | ||
val r1 = trueFun() > falseFun() | ||
if (!r1) return "fail1" | ||
|
||
if (falseFun() > trueFun()) return "fail2" | ||
|
||
if (trueFun() > trueFun()) return "fail3" | ||
|
||
if (trueFun() < falseFun()) return "fail4" | ||
|
||
val x: Comparable<Boolean> = trueFun() | ||
val y: Comparable<Boolean> = falseFun() | ||
|
||
if (x.compareTo(false) <= 0) return "fail5" | ||
if (y.compareTo(true) >= 0) return "fail6" | ||
if (y.compareTo(false) != 0) return "fail7" | ||
|
||
if ((true).compareTo(false) <= 0) return "fail8" | ||
|
||
return "OK" | ||
} | ||
|
||
fun trueFun() = true | ||
|
||
fun falseFun() = false |