Do not mix expect/non-expect overloads of minOf/maxOf

Workaround for KT-22520
This commit is contained in:
Ilya Gorbunov
2018-01-25 19:05:36 +03:00
parent 912c69aaa3
commit f7b2eba680
4 changed files with 114 additions and 18 deletions
@@ -179,6 +179,7 @@ object ComparableOps : TemplateGroupBase() {
}
}
}
on(Platform.JS) { /* just to make expect, KT-22520 */ }
body(Generic) {
"return if (a <= b) a else b"
}
@@ -203,6 +204,7 @@ object ComparableOps : TemplateGroupBase() {
body {
"return minOf(a, minOf(b, c))"
}
on(Platform.JS) { /* just to make expect, KT-22520 */ }
specialFor(Primitives) {
if (primitive in shortIntPrimitives) {
body { "return Math.min(a.toInt(), Math.min(b.toInt(), c.toInt())).to$primitive()" }
@@ -291,6 +293,7 @@ object ComparableOps : TemplateGroupBase() {
}
}
}
on(Platform.JS) { /* just to make expect, KT-22520 */ }
body(Generic) {
"return if (a >= b) a else b"
}
@@ -315,6 +318,7 @@ object ComparableOps : TemplateGroupBase() {
body {
"return maxOf(a, maxOf(b, c))"
}
on(Platform.JS) { /* just to make expect, KT-22520 */ }
specialFor(Primitives) {
if (primitive in shortIntPrimitives) {
body { "return Math.max(a.toInt(), Math.max(b.toInt(), c.toInt())).to$primitive()" }