Update generator template to match manually edited _URanges.kt file

This commit is contained in:
Ilya Gorbunov
2018-09-02 07:00:22 +03:00
parent 64996618b3
commit 3e38bbcb07
@@ -131,6 +131,7 @@ object RangeOps : TemplateGroupBase() {
}
val fromExpr = if (elementType == fromType) "this" else "this.to$elementType()"
val u = if (elementType in PrimitiveType.unsignedPrimitives) "u" else ""
if (elementType == toType) {
// hack to work around incorrect char overflow behavior in JVM and int overflow behavior in JS
@@ -143,11 +144,11 @@ object RangeOps : TemplateGroupBase() {
// <= instead of == for JS
"""
if (to <= $minValue) return $progressionType.EMPTY
return $fromExpr .. (to - 1).to$elementType()
return $fromExpr .. (to - 1$u).to$elementType()
"""
}
} else {
body { "return $fromExpr .. (to.to$elementType() - 1).to$elementType()" }
body { "return $fromExpr .. (to.to$elementType() - 1$u).to$elementType()" }
}
}