diff --git a/compiler/testData/codegen/box/involvesIrInterpreter/booleanOperations.kt b/compiler/testData/codegen/box/involvesIrInterpreter/booleanOperations.kt index ff5742b9d97..947bdad0716 100644 --- a/compiler/testData/codegen/box/involvesIrInterpreter/booleanOperations.kt +++ b/compiler/testData/codegen/box/involvesIrInterpreter/booleanOperations.kt @@ -3,6 +3,7 @@ // TARGET_BACKEND: NATIVE // `Boolean.equals(Boolean)` will not be evaluated in K1 // IGNORE_BACKEND_K1: NATIVE +fun T.id() = this const val trueVal = true const val falseVal = false @@ -39,35 +40,35 @@ const val toString1 = trueVal.toString() const val toString2 = falseVal.toString() fun box(): String { - if (not1 != false) return "Fail 1.1" - if (not2 != true) return "Fail 1.2" + if (not1.id() != false) return "Fail 1.1" + if (not2.id() != true) return "Fail 1.2" - if (and1 != true) return "Fail 2.1" - if (and2 != false) return "Fail 2.2" - if (and3 != false) return "Fail 2.3" - if (and4 != false) return "Fail 2.4" + if (and1.id() != true) return "Fail 2.1" + if (and2.id() != false) return "Fail 2.2" + if (and3.id() != false) return "Fail 2.3" + if (and4.id() != false) return "Fail 2.4" - if (or1 != true) return "Fail 3.1" - if (or2 != true) return "Fail 3.2" - if (or3 != true) return "Fail 3.3" - if (or4 != false) return "Fail 3.4" + if (or1.id() != true) return "Fail 3.1" + if (or2.id() != true) return "Fail 3.2" + if (or3.id() != true) return "Fail 3.3" + if (or4.id() != false) return "Fail 3.4" - if (xor1 != false) return "Fail 4.1" - if (xor2 != true) return "Fail 4.2" - if (xor3 != true) return "Fail 4.3" - if (xor4 != false) return "Fail 4.4" + if (xor1.id() != false) return "Fail 4.1" + if (xor2.id() != true) return "Fail 4.2" + if (xor3.id() != true) return "Fail 4.3" + if (xor4.id() != false) return "Fail 4.4" - if (compareTo1 != 0) return "Fail 5.1" - if (compareTo2 != 1) return "Fail 5.2" - if (compareTo3 != -1) return "Fail 5.3" - if (compareTo4 != 0) return "Fail 5.4" + if (compareTo1.id() != 0) return "Fail 5.1" + if (compareTo2.id() != 1) return "Fail 5.2" + if (compareTo3.id() != -1) return "Fail 5.3" + if (compareTo4.id() != 0) return "Fail 5.4" - if (equals1 != true) return "Fail 6.1" - if (equals2 != false) return "Fail 6.2" - if (equals3 != false) return "Fail 6.3" - if (equals4 != true) return "Fail 6.4" + if (equals1.id() != true) return "Fail 6.1" + if (equals2.id() != false) return "Fail 6.2" + if (equals3.id() != false) return "Fail 6.3" + if (equals4.id() != true) return "Fail 6.4" - if (toString1 != "true") return "Fail 7.1" - if (toString2 != "false") return "Fail 7.2" + if (toString1.id() != "true") return "Fail 7.1" + if (toString2.id() != "false") return "Fail 7.2" return "OK" } diff --git a/compiler/testData/codegen/box/involvesIrInterpreter/byteOperations.kt b/compiler/testData/codegen/box/involvesIrInterpreter/byteOperations.kt index 94817892948..8495e9b841a 100644 --- a/compiler/testData/codegen/box/involvesIrInterpreter/byteOperations.kt +++ b/compiler/testData/codegen/box/involvesIrInterpreter/byteOperations.kt @@ -2,6 +2,7 @@ // TARGET_BACKEND: NATIVE // TARGET_BACKEND: JS_IR // IGNORE_BACKEND_K1: NATIVE +fun T.id() = this const val minusOneVal = (-1).toByte() const val oneVal = 1.toByte() @@ -92,80 +93,80 @@ const val toString1 = oneVal.toString() const val toString2 = twoVal.toString() fun box(): String { - if (compareTo1 != -1) return "Fail 1.1" - if (compareTo2 != 0) return "Fail 1.2" - if (compareTo3 != 1) return "Fail 1.3" - if (compareTo4 != 0) return "Fail 1.4" - if (compareTo5 != 0) return "Fail 1.5" - if (compareTo6 != 0) return "Fail 1.6" - if (compareTo7 != 0) return "Fail 1.7" - if (compareTo8 != 0) return "Fail 1.8" + if (compareTo1.id() != -1) return "Fail 1.1" + if (compareTo2.id() != 0) return "Fail 1.2" + if (compareTo3.id() != 1) return "Fail 1.3" + if (compareTo4.id() != 0) return "Fail 1.4" + if (compareTo5.id() != 0) return "Fail 1.5" + if (compareTo6.id() != 0) return "Fail 1.6" + if (compareTo7.id() != 0) return "Fail 1.7" + if (compareTo8.id() != 0) return "Fail 1.8" - if (plus1 != 3) return "Fail 2.1" - if (plus2 != 4) return "Fail 2.2" - if (plus3 != 5) return "Fail 2.3" - if (plus4 != 4) return "Fail 2.4" - if (plus5 != 4) return "Fail 2.5" - if (plus6 != 4L) return "Fail 2.6" - if (plus7 != 4.0f) return "Fail 2.7" - if (plus8 != 4.0) return "Fail 2.8" + if (plus1.id() != 3) return "Fail 2.1" + if (plus2.id() != 4) return "Fail 2.2" + if (plus3.id() != 5) return "Fail 2.3" + if (plus4.id() != 4) return "Fail 2.4" + if (plus5.id() != 4) return "Fail 2.5" + if (plus6.id() != 4L) return "Fail 2.6" + if (plus7.id() != 4.0f) return "Fail 2.7" + if (plus8.id() != 4.0) return "Fail 2.8" - if (minus1 != -1) return "Fail 3.1" - if (minus2 != 0) return "Fail 3.2" - if (minus3 != 1) return "Fail 3.3" - if (minus4 != 0) return "Fail 3.4" - if (minus5 != 0) return "Fail 3.5" - if (minus6 != 0L) return "Fail 3.6" - if (minus7 != 0.0f) return "Fail 3.7" - if (minus8 != 0.0) return "Fail 3.8" + if (minus1.id() != -1) return "Fail 3.1" + if (minus2.id() != 0) return "Fail 3.2" + if (minus3.id() != 1) return "Fail 3.3" + if (minus4.id() != 0) return "Fail 3.4" + if (minus5.id() != 0) return "Fail 3.5" + if (minus6.id() != 0L) return "Fail 3.6" + if (minus7.id() != 0.0f) return "Fail 3.7" + if (minus8.id() != 0.0) return "Fail 3.8" - if (times1 != 2) return "Fail 4.1" - if (times2 != 4) return "Fail 4.2" - if (times3 != 6) return "Fail 4.3" - if (times4 != 4) return "Fail 4.4" - if (times5 != 4) return "Fail 4.5" - if (times6 != 4L) return "Fail 4.6" - if (times7 != 4.0f) return "Fail 4.7" - if (times8 != 4.0) return "Fail 4.8" + if (times1.id() != 2) return "Fail 4.1" + if (times2.id() != 4) return "Fail 4.2" + if (times3.id() != 6) return "Fail 4.3" + if (times4.id() != 4) return "Fail 4.4" + if (times5.id() != 4) return "Fail 4.5" + if (times6.id() != 4L) return "Fail 4.6" + if (times7.id() != 4.0f) return "Fail 4.7" + if (times8.id() != 4.0) return "Fail 4.8" - if (div1 != 0) return "Fail 5.1" - if (div2 != 1) return "Fail 5.2" - if (div3 != 1) return "Fail 5.3" - if (div4 != 1) return "Fail 5.4" - if (div5 != 1) return "Fail 5.5" - if (div6 != 1L) return "Fail 5.6" - if (div7 != 1.0f) return "Fail 5.7" - if (div8 != 1.0) return "Fail 5.8" + if (div1.id() != 0) return "Fail 5.1" + if (div2.id() != 1) return "Fail 5.2" + if (div3.id() != 1) return "Fail 5.3" + if (div4.id() != 1) return "Fail 5.4" + if (div5.id() != 1) return "Fail 5.5" + if (div6.id() != 1L) return "Fail 5.6" + if (div7.id() != 1.0f) return "Fail 5.7" + if (div8.id() != 1.0) return "Fail 5.8" - if (rem1 != 1) return "Fail 6.1" - if (rem2 != 0) return "Fail 6.2" - if (rem3 != 1) return "Fail 6.3" - if (rem4 != 0) return "Fail 6.4" - if (rem5 != 0) return "Fail 6.5" - if (rem6 != 0L) return "Fail 6.6" - if (rem7 != 0.0f) return "Fail 6.7" - if (rem8 != 0.0) return "Fail 6.8" + if (rem1.id() != 1) return "Fail 6.1" + if (rem2.id() != 0) return "Fail 6.2" + if (rem3.id() != 1) return "Fail 6.3" + if (rem4.id() != 0) return "Fail 6.4" + if (rem5.id() != 0) return "Fail 6.5" + if (rem6.id() != 0L) return "Fail 6.6" + if (rem7.id() != 0.0f) return "Fail 6.7" + if (rem8.id() != 0.0) return "Fail 6.8" - if (unaryPlus1 != 1) return "Fail 7.1" - if (unaryPlus2 != -1) return "Fail 7.2" - if (unaryMinus1 != -1) return "Fail 7.3" - if (unaryMinus2 != 1) return "Fail 7.4" + if (unaryPlus1.id() != 1) return "Fail 7.1" + if (unaryPlus2.id() != -1) return "Fail 7.2" + if (unaryMinus1.id() != -1) return "Fail 7.3" + if (unaryMinus2.id() != 1) return "Fail 7.4" - if (convert1 != 1.toByte()) return "Fail 8.1" - if (convert2 != '') return "Fail 8.2" - if (convert3 != 1.toShort()) return "Fail 8.3" - if (convert4 != 1) return "Fail 8.4" - if (convert5 != 1L) return "Fail 8.5" - if (convert6 != 1.0f) return "Fail 8.6" - if (convert7 != 1.0) return "Fail 8.7" + if (convert1.id() != 1.toByte()) return "Fail 8.1" + if (convert2.id() != '') return "Fail 8.2" + if (convert3.id() != 1.toShort()) return "Fail 8.3" + if (convert4.id() != 1) return "Fail 8.4" + if (convert5.id() != 1L) return "Fail 8.5" + if (convert6.id() != 1.0f) return "Fail 8.6" + if (convert7.id() != 1.0) return "Fail 8.7" - if (equals1 != false) return "Fail 9.1" - if (equals2 != true) return "Fail 9.2" - if (equals3 != false) return "Fail 9.3" - if (equals4 != false) return "Fail 9.4" + if (equals1.id() != false) return "Fail 9.1" + if (equals2.id() != true) return "Fail 9.2" + if (equals3.id() != false) return "Fail 9.3" + if (equals4.id() != false) return "Fail 9.4" - if (toString1 != "1") return "Fail 10.1" - if (toString2 != "2") return "Fail 10.2" + if (toString1.id() != "1") return "Fail 10.1" + if (toString2.id() != "2") return "Fail 10.2" return "OK" } diff --git a/compiler/testData/codegen/box/involvesIrInterpreter/charOperations.kt b/compiler/testData/codegen/box/involvesIrInterpreter/charOperations.kt index 4308752aeba..47d8803fc1a 100644 --- a/compiler/testData/codegen/box/involvesIrInterpreter/charOperations.kt +++ b/compiler/testData/codegen/box/involvesIrInterpreter/charOperations.kt @@ -4,6 +4,7 @@ // `Char.equals(Char)` will not be evaluated in K1 // IGNORE_BACKEND_K1: NATIVE // WITH_STDLIB +fun T.id() = this const val oneVal = '1' const val twoVal = '2' @@ -54,45 +55,45 @@ const val code3 = threeVal.code const val code4 = fourVal.code fun box(): String { - if (compareTo1 != -1) return "Fail 1.1" - if (compareTo2 != 0) return "Fail 1.2" - if (compareTo3 != 1) return "Fail 1.3" - if (compareTo4 != 1) return "Fail 1.4" + if (compareTo1.id() != -1) return "Fail 1.1" + if (compareTo2.id() != 0) return "Fail 1.2" + if (compareTo3.id() != 1) return "Fail 1.3" + if (compareTo4.id() != 1) return "Fail 1.4" - if (plus1 != '6') return "Fail 2.1" - if (plus2 != '7') return "Fail 2.2" - if (plus3 != '8') return "Fail 2.3" - if (plus4 != '9') return "Fail 2.4" + if (plus1.id() != '6') return "Fail 2.1" + if (plus2.id() != '7') return "Fail 2.2" + if (plus3.id() != '8') return "Fail 2.3" + if (plus4.id() != '9') return "Fail 2.4" - if (minusChar1 != -1) return "Fail 3.1" - if (minusChar2 != 0) return "Fail 3.2" - if (minusChar3 != 1) return "Fail 3.3" - if (minusChar4 != 2) return "Fail 3.4" + if (minusChar1.id() != -1) return "Fail 3.1" + if (minusChar2.id() != 0) return "Fail 3.2" + if (minusChar3.id() != 1) return "Fail 3.3" + if (minusChar4.id() != 2) return "Fail 3.4" - if (minusInt1 != ',') return "Fail 4.1" - if (minusInt2 != '-') return "Fail 4.2" - if (minusInt3 != '.') return "Fail 4.3" - if (minusInt4 != '/') return "Fail 4.4" + if (minusInt1.id() != ',') return "Fail 4.1" + if (minusInt2.id() != '-') return "Fail 4.2" + if (minusInt3.id() != '.') return "Fail 4.3" + if (minusInt4.id() != '/') return "Fail 4.4" - if (convert1 != 49.toByte()) return "Fail 5.1" - if (convert2 != '1') return "Fail 5.2" - if (convert3 != 49.toShort()) return "Fail 5.3" - if (convert4 != 49) return "Fail 5.4" - if (convert5 != 49L) return "Fail 5.5" - if (convert6 != 49.0f) return "Fail 5.6" - if (convert7 != 49.0) return "Fail 5.7" + if (convert1.id() != 49.toByte()) return "Fail 5.1" + if (convert2.id() != '1') return "Fail 5.2" + if (convert3.id() != 49.toShort()) return "Fail 5.3" + if (convert4.id() != 49) return "Fail 5.4" + if (convert5.id() != 49L) return "Fail 5.5" + if (convert6.id() != 49.0f) return "Fail 5.6" + if (convert7.id() != 49.0) return "Fail 5.7" - if (equals1 != false) return "Fail 6.1" - if (equals2 != true) return "Fail 6.2" - if (equals3 != false) return "Fail 6.3" - if (equals4 != false) return "Fail 6.4" + if (equals1.id() != false) return "Fail 6.1" + if (equals2.id() != true) return "Fail 6.2" + if (equals3.id() != false) return "Fail 6.3" + if (equals4.id() != false) return "Fail 6.4" - if (toString1 != "1") return "Fail 7.1" - if (toString2 != "2") return "Fail 7.2" + if (toString1.id() != "1") return "Fail 7.1" + if (toString2.id() != "2") return "Fail 7.2" - if (code1 != 49) return "Fail 8.1" - if (code2 != 50) return "Fail 8.2" - if (code3 != 51) return "Fail 8.3" - if (code4 != 52) return "Fail 8.4" + if (code1.id() != 49) return "Fail 8.1" + if (code2.id() != 50) return "Fail 8.2" + if (code3.id() != 51) return "Fail 8.3" + if (code4.id() != 52) return "Fail 8.4" return "OK" } diff --git a/compiler/testData/codegen/box/involvesIrInterpreter/doubleOperations.kt b/compiler/testData/codegen/box/involvesIrInterpreter/doubleOperations.kt index d1223421502..41ed10cf0aa 100644 --- a/compiler/testData/codegen/box/involvesIrInterpreter/doubleOperations.kt +++ b/compiler/testData/codegen/box/involvesIrInterpreter/doubleOperations.kt @@ -2,6 +2,7 @@ // TARGET_BACKEND: NATIVE // TARGET_BACKEND: JS_IR // IGNORE_BACKEND_K1: NATIVE +fun T.id() = this const val minusOneVal = -1.0 const val oneVal = 1.0 @@ -88,75 +89,75 @@ const val equals3 = threeVal == twoVal const val equals4 = fourVal == twoVal fun box(): String { - if (compareTo1 != -1) return "Fail 1.1" - if (compareTo2 != 0) return "Fail 1.2" - if (compareTo3 != 1) return "Fail 1.3" - if (compareTo4 != 0) return "Fail 1.4" - if (compareTo5 != 0) return "Fail 1.5" - if (compareTo6 != 0) return "Fail 1.6" - if (compareTo7 != 0) return "Fail 1.7" - if (compareTo8 != 0) return "Fail 1.8" + if (compareTo1.id() != -1) return "Fail 1.1" + if (compareTo2.id() != 0) return "Fail 1.2" + if (compareTo3.id() != 1) return "Fail 1.3" + if (compareTo4.id() != 0) return "Fail 1.4" + if (compareTo5.id() != 0) return "Fail 1.5" + if (compareTo6.id() != 0) return "Fail 1.6" + if (compareTo7.id() != 0) return "Fail 1.7" + if (compareTo8.id() != 0) return "Fail 1.8" - if (plus1 != 3.0) return "Fail 2.1" - if (plus2 != 4.0) return "Fail 2.2" - if (plus3 != 5.0) return "Fail 2.3" - if (plus4 != 4.0) return "Fail 2.4" - if (plus5 != 4.0) return "Fail 2.5" - if (plus6 != 4.0) return "Fail 2.6" - if (plus7 != 4.0) return "Fail 2.7" - if (plus8 != 4.0) return "Fail 2.8" + if (plus1.id() != 3.0) return "Fail 2.1" + if (plus2.id() != 4.0) return "Fail 2.2" + if (plus3.id() != 5.0) return "Fail 2.3" + if (plus4.id() != 4.0) return "Fail 2.4" + if (plus5.id() != 4.0) return "Fail 2.5" + if (plus6.id() != 4.0) return "Fail 2.6" + if (plus7.id() != 4.0) return "Fail 2.7" + if (plus8.id() != 4.0) return "Fail 2.8" - if (minus1 != -1.0) return "Fail 3.1" - if (minus2 != 0.0) return "Fail 3.2" - if (minus3 != 1.0) return "Fail 3.3" - if (minus4 != 0.0) return "Fail 3.4" - if (minus5 != 0.0) return "Fail 3.5" - if (minus6 != 0.0) return "Fail 3.6" - if (minus7 != 0.0) return "Fail 3.7" - if (minus8 != 0.0) return "Fail 3.8" + if (minus1.id() != -1.0) return "Fail 3.1" + if (minus2.id() != 0.0) return "Fail 3.2" + if (minus3.id() != 1.0) return "Fail 3.3" + if (minus4.id() != 0.0) return "Fail 3.4" + if (minus5.id() != 0.0) return "Fail 3.5" + if (minus6.id() != 0.0) return "Fail 3.6" + if (minus7.id() != 0.0) return "Fail 3.7" + if (minus8.id() != 0.0) return "Fail 3.8" - if (times1 != 2.0) return "Fail 4.1" - if (times2 != 4.0) return "Fail 4.2" - if (times3 != 6.0) return "Fail 4.3" - if (times4 != 4.0) return "Fail 4.4" - if (times5 != 4.0) return "Fail 4.5" - if (times6 != 4.0) return "Fail 4.6" - if (times7 != 4.0) return "Fail 4.7" - if (times8 != 4.0) return "Fail 4.8" + if (times1.id() != 2.0) return "Fail 4.1" + if (times2.id() != 4.0) return "Fail 4.2" + if (times3.id() != 6.0) return "Fail 4.3" + if (times4.id() != 4.0) return "Fail 4.4" + if (times5.id() != 4.0) return "Fail 4.5" + if (times6.id() != 4.0) return "Fail 4.6" + if (times7.id() != 4.0) return "Fail 4.7" + if (times8.id() != 4.0) return "Fail 4.8" - if (div1 != 0.5) return "Fail 5.1" - if (div2 != 1.0) return "Fail 5.2" - if (div3 != 1.5) return "Fail 5.3" - if (div4 != 1.0) return "Fail 5.4" - if (div5 != 1.0) return "Fail 5.5" - if (div6 != 1.0) return "Fail 5.6" - if (div7 != 1.0) return "Fail 5.7" - if (div8 != 1.0) return "Fail 5.8" + if (div1.id() != 0.5) return "Fail 5.1" + if (div2.id() != 1.0) return "Fail 5.2" + if (div3.id() != 1.5) return "Fail 5.3" + if (div4.id() != 1.0) return "Fail 5.4" + if (div5.id() != 1.0) return "Fail 5.5" + if (div6.id() != 1.0) return "Fail 5.6" + if (div7.id() != 1.0) return "Fail 5.7" + if (div8.id() != 1.0) return "Fail 5.8" - if (rem1 != 1.0) return "Fail 6.1" - if (rem2 != 0.0) return "Fail 6.2" - if (rem3 != 1.0) return "Fail 6.3" - if (rem4 != 0.0) return "Fail 6.4" - if (rem5 != 0.0) return "Fail 6.5" - if (rem6 != 0.0) return "Fail 6.6" - if (rem7 != 0.0) return "Fail 6.7" - if (rem8 != 0.0) return "Fail 6.8" + if (rem1.id() != 1.0) return "Fail 6.1" + if (rem2.id() != 0.0) return "Fail 6.2" + if (rem3.id() != 1.0) return "Fail 6.3" + if (rem4.id() != 0.0) return "Fail 6.4" + if (rem5.id() != 0.0) return "Fail 6.5" + if (rem6.id() != 0.0) return "Fail 6.6" + if (rem7.id() != 0.0) return "Fail 6.7" + if (rem8.id() != 0.0) return "Fail 6.8" - if (unaryPlus1 != 1.0) return "Fail 7.1" - if (unaryPlus2 != -1.0) return "Fail 7.2" - if (unaryMinus1 != -1.0) return "Fail 7.3" - if (unaryMinus2 != 1.0) return "Fail 7.4" + if (unaryPlus1.id() != 1.0) return "Fail 7.1" + if (unaryPlus2.id() != -1.0) return "Fail 7.2" + if (unaryMinus1.id() != -1.0) return "Fail 7.3" + if (unaryMinus2.id() != 1.0) return "Fail 7.4" - if (convert1 != '') return "Fail 8.1" - if (convert2 != 1) return "Fail 8.2" - if (convert3 != 1L) return "Fail 8.3" - if (convert4 != 1.0f) return "Fail 8.4" - if (convert5 != 1.0) return "Fail 8.5" + if (convert1.id() != '') return "Fail 8.1" + if (convert2.id() != 1) return "Fail 8.2" + if (convert3.id() != 1L) return "Fail 8.3" + if (convert4.id() != 1.0f) return "Fail 8.4" + if (convert5.id() != 1.0) return "Fail 8.5" - if (equals1 != false) return "Fail 9.1" - if (equals2 != true) return "Fail 9.2" - if (equals3 != false) return "Fail 9.3" - if (equals4 != false) return "Fail 9.4" + if (equals1.id() != false) return "Fail 9.1" + if (equals2.id() != true) return "Fail 9.2" + if (equals3.id() != false) return "Fail 9.3" + if (equals4.id() != false) return "Fail 9.4" return "OK" } diff --git a/compiler/testData/codegen/box/involvesIrInterpreter/floatOperations.kt b/compiler/testData/codegen/box/involvesIrInterpreter/floatOperations.kt index e40b5993b1d..4f2cdb9d87f 100644 --- a/compiler/testData/codegen/box/involvesIrInterpreter/floatOperations.kt +++ b/compiler/testData/codegen/box/involvesIrInterpreter/floatOperations.kt @@ -2,6 +2,7 @@ // TARGET_BACKEND: NATIVE // TARGET_BACKEND: JS_IR // IGNORE_BACKEND_K1: NATIVE +fun T.id() = this const val minusOneVal = -1.0f const val oneVal = 1.0f @@ -88,75 +89,75 @@ const val equals3 = threeVal == twoVal const val equals4 = fourVal == twoVal fun box(): String { - if (compareTo1 != -1) return "Fail 1.1" - if (compareTo2 != 0) return "Fail 1.2" - if (compareTo3 != 1) return "Fail 1.3" - if (compareTo4 != 0) return "Fail 1.4" - if (compareTo5 != 0) return "Fail 1.5" - if (compareTo6 != 0) return "Fail 1.6" - if (compareTo7 != 0) return "Fail 1.7" - if (compareTo8 != 0) return "Fail 1.8" + if (compareTo1.id() != -1) return "Fail 1.1" + if (compareTo2.id() != 0) return "Fail 1.2" + if (compareTo3.id() != 1) return "Fail 1.3" + if (compareTo4.id() != 0) return "Fail 1.4" + if (compareTo5.id() != 0) return "Fail 1.5" + if (compareTo6.id() != 0) return "Fail 1.6" + if (compareTo7.id() != 0) return "Fail 1.7" + if (compareTo8.id() != 0) return "Fail 1.8" - if (plus1 != 3f) return "Fail 2.1" - if (plus2 != 4f) return "Fail 2.2" - if (plus3 != 5f) return "Fail 2.3" - if (plus4 != 4f) return "Fail 2.4" - if (plus5 != 4f) return "Fail 2.5" - if (plus6 != 4f) return "Fail 2.6" - if (plus7 != 4.0f) return "Fail 2.7" - if (plus8 != 4.0) return "Fail 2.8" + if (plus1.id() != 3f) return "Fail 2.1" + if (plus2.id() != 4f) return "Fail 2.2" + if (plus3.id() != 5f) return "Fail 2.3" + if (plus4.id() != 4f) return "Fail 2.4" + if (plus5.id() != 4f) return "Fail 2.5" + if (plus6.id() != 4f) return "Fail 2.6" + if (plus7.id() != 4.0f) return "Fail 2.7" + if (plus8.id() != 4.0) return "Fail 2.8" - if (minus1 != -1f) return "Fail 3.1" - if (minus2 != 0f) return "Fail 3.2" - if (minus3 != 1f) return "Fail 3.3" - if (minus4 != 0f) return "Fail 3.4" - if (minus5 != 0f) return "Fail 3.5" - if (minus6 != 0f) return "Fail 3.6" - if (minus7 != 0.0f) return "Fail 3.7" - if (minus8 != 0.0) return "Fail 3.8" + if (minus1.id() != -1f) return "Fail 3.1" + if (minus2.id() != 0f) return "Fail 3.2" + if (minus3.id() != 1f) return "Fail 3.3" + if (minus4.id() != 0f) return "Fail 3.4" + if (minus5.id() != 0f) return "Fail 3.5" + if (minus6.id() != 0f) return "Fail 3.6" + if (minus7.id() != 0.0f) return "Fail 3.7" + if (minus8.id() != 0.0) return "Fail 3.8" - if (times1 != 2f) return "Fail 4.1" - if (times2 != 4f) return "Fail 4.2" - if (times3 != 6f) return "Fail 4.3" - if (times4 != 4f) return "Fail 4.4" - if (times5 != 4f) return "Fail 4.5" - if (times6 != 4f) return "Fail 4.6" - if (times7 != 4.0f) return "Fail 4.7" - if (times8 != 4.0) return "Fail 4.8" + if (times1.id() != 2f) return "Fail 4.1" + if (times2.id() != 4f) return "Fail 4.2" + if (times3.id() != 6f) return "Fail 4.3" + if (times4.id() != 4f) return "Fail 4.4" + if (times5.id() != 4f) return "Fail 4.5" + if (times6.id() != 4f) return "Fail 4.6" + if (times7.id() != 4.0f) return "Fail 4.7" + if (times8.id() != 4.0) return "Fail 4.8" - if (div1 != 0.5f) return "Fail 5.1" - if (div2 != 1.0f) return "Fail 5.2" - if (div3 != 1.5f) return "Fail 5.3" - if (div4 != 1f) return "Fail 5.4" - if (div5 != 1f) return "Fail 5.5" - if (div6 != 1f) return "Fail 5.6" - if (div7 != 1.0f) return "Fail 5.7" - if (div8 != 1.0) return "Fail 5.8" + if (div1.id() != 0.5f) return "Fail 5.1" + if (div2.id() != 1.0f) return "Fail 5.2" + if (div3.id() != 1.5f) return "Fail 5.3" + if (div4.id() != 1f) return "Fail 5.4" + if (div5.id() != 1f) return "Fail 5.5" + if (div6.id() != 1f) return "Fail 5.6" + if (div7.id() != 1.0f) return "Fail 5.7" + if (div8.id() != 1.0) return "Fail 5.8" - if (rem1 != 1f) return "Fail 6.1" - if (rem2 != 0f) return "Fail 6.2" - if (rem3 != 1f) return "Fail 6.3" - if (rem4 != 0f) return "Fail 6.4" - if (rem5 != 0f) return "Fail 6.5" - if (rem6 != 0f) return "Fail 6.6" - if (rem7 != 0.0f) return "Fail 6.7" - if (rem8 != 0.0) return "Fail 6.8" + if (rem1.id() != 1f) return "Fail 6.1" + if (rem2.id() != 0f) return "Fail 6.2" + if (rem3.id() != 1f) return "Fail 6.3" + if (rem4.id() != 0f) return "Fail 6.4" + if (rem5.id() != 0f) return "Fail 6.5" + if (rem6.id() != 0f) return "Fail 6.6" + if (rem7.id() != 0.0f) return "Fail 6.7" + if (rem8.id() != 0.0) return "Fail 6.8" - if (unaryPlus1 != 1f) return "Fail 7.1" - if (unaryPlus2 != -1f) return "Fail 7.2" - if (unaryMinus1 != -1f) return "Fail 7.3" - if (unaryMinus2 != 1f) return "Fail 7.4" + if (unaryPlus1.id() != 1f) return "Fail 7.1" + if (unaryPlus2.id() != -1f) return "Fail 7.2" + if (unaryMinus1.id() != -1f) return "Fail 7.3" + if (unaryMinus2.id() != 1f) return "Fail 7.4" - if (convert1 != '') return "Fail 8.1" - if (convert2 != 1) return "Fail 8.2" - if (convert3 != 1L) return "Fail 8.3" - if (convert4 != 1.0f) return "Fail 8.4" - if (convert5 != 1.0) return "Fail 8.5" + if (convert1.id() != '') return "Fail 8.1" + if (convert2.id() != 1) return "Fail 8.2" + if (convert3.id() != 1L) return "Fail 8.3" + if (convert4.id() != 1.0f) return "Fail 8.4" + if (convert5.id() != 1.0) return "Fail 8.5" - if (equals1 != false) return "Fail 9.1" - if (equals2 != true) return "Fail 9.2" - if (equals3 != false) return "Fail 9.3" - if (equals4 != false) return "Fail 9.4" + if (equals1.id() != false) return "Fail 9.1" + if (equals2.id() != true) return "Fail 9.2" + if (equals3.id() != false) return "Fail 9.3" + if (equals4.id() != false) return "Fail 9.4" return "OK" } diff --git a/compiler/testData/codegen/box/involvesIrInterpreter/intOperations.kt b/compiler/testData/codegen/box/involvesIrInterpreter/intOperations.kt index 944b349c16b..609e5fd906b 100644 --- a/compiler/testData/codegen/box/involvesIrInterpreter/intOperations.kt +++ b/compiler/testData/codegen/box/involvesIrInterpreter/intOperations.kt @@ -2,6 +2,7 @@ // TARGET_BACKEND: NATIVE // TARGET_BACKEND: JS_IR // IGNORE_BACKEND_K1: NATIVE +fun T.id() = this const val minusOneVal = -1 const val oneVal = 1 @@ -92,80 +93,80 @@ const val toString1 = oneVal.toString() const val toString2 = twoVal.toString() fun box(): String { - if (compareTo1 != -1) return "Fail 1.1" - if (compareTo2 != 0) return "Fail 1.2" - if (compareTo3 != 1) return "Fail 1.3" - if (compareTo4 != 0) return "Fail 1.4" - if (compareTo5 != 0) return "Fail 1.5" - if (compareTo6 != 0) return "Fail 1.6" - if (compareTo7 != 0) return "Fail 1.7" - if (compareTo8 != 0) return "Fail 1.8" + if (compareTo1.id() != -1) return "Fail 1.1" + if (compareTo2.id() != 0) return "Fail 1.2" + if (compareTo3.id() != 1) return "Fail 1.3" + if (compareTo4.id() != 0) return "Fail 1.4" + if (compareTo5.id() != 0) return "Fail 1.5" + if (compareTo6.id() != 0) return "Fail 1.6" + if (compareTo7.id() != 0) return "Fail 1.7" + if (compareTo8.id() != 0) return "Fail 1.8" - if (plus1 != 3) return "Fail 2.1" - if (plus2 != 4) return "Fail 2.2" - if (plus3 != 5) return "Fail 2.3" - if (plus4 != 4) return "Fail 2.4" - if (plus5 != 4) return "Fail 2.5" - if (plus6 != 4L) return "Fail 2.6" - if (plus7 != 4.0f) return "Fail 2.7" - if (plus8 != 4.0) return "Fail 2.8" + if (plus1.id() != 3) return "Fail 2.1" + if (plus2.id() != 4) return "Fail 2.2" + if (plus3.id() != 5) return "Fail 2.3" + if (plus4.id() != 4) return "Fail 2.4" + if (plus5.id() != 4) return "Fail 2.5" + if (plus6.id() != 4L) return "Fail 2.6" + if (plus7.id() != 4.0f) return "Fail 2.7" + if (plus8.id() != 4.0) return "Fail 2.8" - if (minus1 != -1) return "Fail 3.1" - if (minus2 != 0) return "Fail 3.2" - if (minus3 != 1) return "Fail 3.3" - if (minus4 != 0) return "Fail 3.4" - if (minus5 != 0) return "Fail 3.5" - if (minus6 != 0L) return "Fail 3.6" - if (minus7 != 0.0f) return "Fail 3.7" - if (minus8 != 0.0) return "Fail 3.8" + if (minus1.id() != -1) return "Fail 3.1" + if (minus2.id() != 0) return "Fail 3.2" + if (minus3.id() != 1) return "Fail 3.3" + if (minus4.id() != 0) return "Fail 3.4" + if (minus5.id() != 0) return "Fail 3.5" + if (minus6.id() != 0L) return "Fail 3.6" + if (minus7.id() != 0.0f) return "Fail 3.7" + if (minus8.id() != 0.0) return "Fail 3.8" - if (times1 != 2) return "Fail 4.1" - if (times2 != 4) return "Fail 4.2" - if (times3 != 6) return "Fail 4.3" - if (times4 != 4) return "Fail 4.4" - if (times5 != 4) return "Fail 4.5" - if (times6 != 4L) return "Fail 4.6" - if (times7 != 4.0f) return "Fail 4.7" - if (times8 != 4.0) return "Fail 4.8" + if (times1.id() != 2) return "Fail 4.1" + if (times2.id() != 4) return "Fail 4.2" + if (times3.id() != 6) return "Fail 4.3" + if (times4.id() != 4) return "Fail 4.4" + if (times5.id() != 4) return "Fail 4.5" + if (times6.id() != 4L) return "Fail 4.6" + if (times7.id() != 4.0f) return "Fail 4.7" + if (times8.id() != 4.0) return "Fail 4.8" - if (div1 != 0) return "Fail 5.1" - if (div2 != 1) return "Fail 5.2" - if (div3 != 1) return "Fail 5.3" - if (div4 != 1) return "Fail 5.4" - if (div5 != 1) return "Fail 5.5" - if (div6 != 1L) return "Fail 5.6" - if (div7 != 1.0f) return "Fail 5.7" - if (div8 != 1.0) return "Fail 5.8" + if (div1.id() != 0) return "Fail 5.1" + if (div2.id() != 1) return "Fail 5.2" + if (div3.id() != 1) return "Fail 5.3" + if (div4.id() != 1) return "Fail 5.4" + if (div5.id() != 1) return "Fail 5.5" + if (div6.id() != 1L) return "Fail 5.6" + if (div7.id() != 1.0f) return "Fail 5.7" + if (div8.id() != 1.0) return "Fail 5.8" - if (rem1 != 1) return "Fail 6.1" - if (rem2 != 0) return "Fail 6.2" - if (rem3 != 1) return "Fail 6.3" - if (rem4 != 0) return "Fail 6.4" - if (rem5 != 0) return "Fail 6.5" - if (rem6 != 0L) return "Fail 6.6" - if (rem7 != 0.0f) return "Fail 6.7" - if (rem8 != 0.0) return "Fail 6.8" + if (rem1.id() != 1) return "Fail 6.1" + if (rem2.id() != 0) return "Fail 6.2" + if (rem3.id() != 1) return "Fail 6.3" + if (rem4.id() != 0) return "Fail 6.4" + if (rem5.id() != 0) return "Fail 6.5" + if (rem6.id() != 0L) return "Fail 6.6" + if (rem7.id() != 0.0f) return "Fail 6.7" + if (rem8.id() != 0.0) return "Fail 6.8" - if (unaryPlus1 != 1) return "Fail 7.1" - if (unaryPlus2 != -1) return "Fail 7.2" - if (unaryMinus1 != -1) return "Fail 7.3" - if (unaryMinus2 != 1) return "Fail 7.4" + if (unaryPlus1.id() != 1) return "Fail 7.1" + if (unaryPlus2.id() != -1) return "Fail 7.2" + if (unaryMinus1.id() != -1) return "Fail 7.3" + if (unaryMinus2.id() != 1) return "Fail 7.4" - if (convert1 != 1.toByte()) return "Fail 8.1" - if (convert2 != '') return "Fail 8.2" - if (convert3 != 1.toShort()) return "Fail 8.3" - if (convert4 != 1) return "Fail 8.4" - if (convert5 != 1L) return "Fail 8.5" - if (convert6 != 1.0f) return "Fail 8.6" - if (convert7 != 1.0) return "Fail 8.7" + if (convert1.id() != 1.toByte()) return "Fail 8.1" + if (convert2.id() != '') return "Fail 8.2" + if (convert3.id() != 1.toShort()) return "Fail 8.3" + if (convert4.id() != 1) return "Fail 8.4" + if (convert5.id() != 1L) return "Fail 8.5" + if (convert6.id() != 1.0f) return "Fail 8.6" + if (convert7.id() != 1.0) return "Fail 8.7" - if (equals1 != false) return "Fail 9.1" - if (equals2 != true) return "Fail 9.2" - if (equals3 != false) return "Fail 9.3" - if (equals4 != false) return "Fail 9.4" + if (equals1.id() != false) return "Fail 9.1" + if (equals2.id() != true) return "Fail 9.2" + if (equals3.id() != false) return "Fail 9.3" + if (equals4.id() != false) return "Fail 9.4" - if (toString1 != "1") return "Fail 10.1" - if (toString2 != "2") return "Fail 10.2" + if (toString1.id() != "1") return "Fail 10.1" + if (toString2.id() != "2") return "Fail 10.2" return "OK" } diff --git a/compiler/testData/codegen/box/involvesIrInterpreter/intrinsicConst/constTrimIndent.kt b/compiler/testData/codegen/box/involvesIrInterpreter/intrinsicConst/constTrimIndent.kt index c3347353a8a..b3b9c682d6b 100644 --- a/compiler/testData/codegen/box/involvesIrInterpreter/intrinsicConst/constTrimIndent.kt +++ b/compiler/testData/codegen/box/involvesIrInterpreter/intrinsicConst/constTrimIndent.kt @@ -2,6 +2,7 @@ // TARGET_BACKEND: JVM_IR // IGNORE_BACKEND_K1: JVM_IR // WITH_STDLIB +fun T.id() = this const val trimIndent = "123".trimIndent() const val complexTrimIndent = @@ -12,7 +13,7 @@ const val complexTrimIndent = """.trimIndent() fun box(): String { - if (trimIndent != "123") return "Fail 1" - if (complexTrimIndent != "ABC\n123\n456") return "Fail 2" + if (trimIndent.id() != "123") return "Fail 1" + if (complexTrimIndent.id() != "ABC\n123\n456") return "Fail 2" return "OK" } diff --git a/compiler/testData/codegen/box/involvesIrInterpreter/intrinsicConst/constTrimMargin.kt b/compiler/testData/codegen/box/involvesIrInterpreter/intrinsicConst/constTrimMargin.kt index 38dd9f7f187..acc39ea7e37 100644 --- a/compiler/testData/codegen/box/involvesIrInterpreter/intrinsicConst/constTrimMargin.kt +++ b/compiler/testData/codegen/box/involvesIrInterpreter/intrinsicConst/constTrimMargin.kt @@ -2,6 +2,7 @@ // TARGET_BACKEND: JVM_IR // IGNORE_BACKEND_K1: JVM_IR // WITH_STDLIB +fun T.id() = this const val trimMargin = "123".trimMargin() @@ -16,8 +17,8 @@ const val withoutMargin = """ """.trimMargin("#") fun box(): String { - if (trimMargin != "123") return "Fail 1" - if (trimMarginDefault != "ABC\n123\n456") return "Fail 2" - if (withoutMargin != "XYZ\nfoo\nbar") return "Fail 3" + if (trimMargin.id() != "123") return "Fail 1" + if (trimMarginDefault.id() != "ABC\n123\n456") return "Fail 2" + if (withoutMargin.id() != "XYZ\nfoo\nbar") return "Fail 3" return "OK" } diff --git a/compiler/testData/codegen/box/involvesIrInterpreter/intrinsicConst/enumName.kt b/compiler/testData/codegen/box/involvesIrInterpreter/intrinsicConst/enumName.kt index 6395ffb5fb4..484291eb1b6 100644 --- a/compiler/testData/codegen/box/involvesIrInterpreter/intrinsicConst/enumName.kt +++ b/compiler/testData/codegen/box/involvesIrInterpreter/intrinsicConst/enumName.kt @@ -1,6 +1,7 @@ // !LANGUAGE: +IntrinsicConstEvaluation // TARGET_BACKEND: JVM_IR // IGNORE_BACKEND_K1: JVM_IR +fun T.id() = this enum class EnumClass { OK, VALUE, anotherValue, WITH_UNDERSCORE @@ -12,9 +13,9 @@ const val name3 = EnumClass.anotherValue.name const val name4 = EnumClass.WITH_UNDERSCORE.name fun box(): String { - if (EnumClass.OK.name != "OK") return "Fail 1" - if (name2 != "VALUE") return "Fail 2" - if (name3 != "anotherValue") return "Fail 3" - if (name4 != "WITH_UNDERSCORE") return "Fail 4" - return name1 + if (EnumClass.OK.name.id() != "OK") return "Fail 1" + if (name2.id() != "VALUE") return "Fail 2" + if (name3.id() != "anotherValue") return "Fail 3" + if (name4.id() != "WITH_UNDERSCORE") return "Fail 4" + return name1.id() } diff --git a/compiler/testData/codegen/box/involvesIrInterpreter/intrinsicConst/equals_after.kt b/compiler/testData/codegen/box/involvesIrInterpreter/intrinsicConst/equals_after.kt index 2aae565f13a..2c9ea588637 100644 --- a/compiler/testData/codegen/box/involvesIrInterpreter/intrinsicConst/equals_after.kt +++ b/compiler/testData/codegen/box/involvesIrInterpreter/intrinsicConst/equals_after.kt @@ -1,5 +1,6 @@ // !LANGUAGE: +IntrinsicConstEvaluation // TARGET_BACKEND: JVM_IR +fun T.id() = this const val trueVal = true const val falseVal = false @@ -93,49 +94,49 @@ const val equalsString3 = otherStr == someStr const val equalsString4 = someStr.equals(1) fun box(): String { - if (equalsBoolean1 != true) return "Fail 1.1" - if (equalsBoolean2 != false) return "Fail 1.2" - if (equalsBoolean3 != false) return "Fail 1.3" + if (equalsBoolean1.id() != true) return "Fail 1.1" + if (equalsBoolean2.id() != false) return "Fail 1.2" + if (equalsBoolean3.id() != false) return "Fail 1.3" - if (equalsChar1 != false) return "Fail 2.1" - if (equalsChar2 != true) return "Fail 2.2" - if (equalsChar3 != false) return "Fail 2.3" - if (equalsChar4 != false) return "Fail 2.3" + if (equalsChar1.id() != false) return "Fail 2.1" + if (equalsChar2.id() != true) return "Fail 2.2" + if (equalsChar3.id() != false) return "Fail 2.3" + if (equalsChar4.id() != false) return "Fail 2.3" - if (equalsByte1 != false) return "Fail 3.1" - if (equalsByte2 != true) return "Fail 3.2" - if (equalsByte3 != false) return "Fail 3.3" - if (equalsByte4 != false) return "Fail 3.3" + if (equalsByte1.id() != false) return "Fail 3.1" + if (equalsByte2.id() != true) return "Fail 3.2" + if (equalsByte3.id() != false) return "Fail 3.3" + if (equalsByte4.id() != false) return "Fail 3.3" - if (equalsShort1 != false) return "Fail 4.1" - if (equalsShort2 != true) return "Fail 4.2" - if (equalsShort3 != false) return "Fail 4.3" - if (equalsShort4 != false) return "Fail 4.3" + if (equalsShort1.id() != false) return "Fail 4.1" + if (equalsShort2.id() != true) return "Fail 4.2" + if (equalsShort3.id() != false) return "Fail 4.3" + if (equalsShort4.id() != false) return "Fail 4.3" - if (equalsInt1 != false) return "Fail 5.1" - if (equalsInt2 != true) return "Fail 5.2" - if (equalsInt3 != false) return "Fail 5.3" - if (equalsInt4 != false) return "Fail 5.3" + if (equalsInt1.id() != false) return "Fail 5.1" + if (equalsInt2.id() != true) return "Fail 5.2" + if (equalsInt3.id() != false) return "Fail 5.3" + if (equalsInt4.id() != false) return "Fail 5.3" - if (equalsLong1 != false) return "Fail 6.1" - if (equalsLong2 != true) return "Fail 6.2" - if (equalsLong3 != false) return "Fail 6.3" - if (equalsLong4 != false) return "Fail 6.3" + if (equalsLong1.id() != false) return "Fail 6.1" + if (equalsLong2.id() != true) return "Fail 6.2" + if (equalsLong3.id() != false) return "Fail 6.3" + if (equalsLong4.id() != false) return "Fail 6.3" - if (equalsFloat1 != false) return "Fail 7.1" - if (equalsFloat2 != true) return "Fail 7.2" - if (equalsFloat3 != false) return "Fail 7.3" - if (equalsFloat4 != false) return "Fail 7.3" + if (equalsFloat1.id() != false) return "Fail 7.1" + if (equalsFloat2.id() != true) return "Fail 7.2" + if (equalsFloat3.id() != false) return "Fail 7.3" + if (equalsFloat4.id() != false) return "Fail 7.3" - if (equalsDouble1 != false) return "Fail 8.1" - if (equalsDouble2 != true) return "Fail 8.2" - if (equalsDouble3 != false) return "Fail 8.3" - if (equalsDouble4 != false) return "Fail 8.3" + if (equalsDouble1.id() != false) return "Fail 8.1" + if (equalsDouble2.id() != true) return "Fail 8.2" + if (equalsDouble3.id() != false) return "Fail 8.3" + if (equalsDouble4.id() != false) return "Fail 8.3" - if (equalsString1 != false) return "Fail 9.1" - if (equalsString2 != true) return "Fail 9.2" - if (equalsString3 != false) return "Fail 9.3" - if (equalsString4 != false) return "Fail 9.3" + if (equalsString1.id() != false) return "Fail 9.1" + if (equalsString2.id() != true) return "Fail 9.2" + if (equalsString3.id() != false) return "Fail 9.3" + if (equalsString4.id() != false) return "Fail 9.3" return "OK" } diff --git a/compiler/testData/codegen/box/involvesIrInterpreter/intrinsicConst/ifConstVal.kt b/compiler/testData/codegen/box/involvesIrInterpreter/intrinsicConst/ifConstVal.kt index f68a46204d8..cdc6c0fcdf5 100644 --- a/compiler/testData/codegen/box/involvesIrInterpreter/intrinsicConst/ifConstVal.kt +++ b/compiler/testData/codegen/box/involvesIrInterpreter/intrinsicConst/ifConstVal.kt @@ -3,6 +3,7 @@ // TARGET_BACKEND: NATIVE // TARGET_BACKEND: JS_IR // IGNORE_BACKEND_K1: JVM_IR, NATIVE, JS_IR, JS_IR_ES6 +fun T.id() = this const val flag = true const val value = 10 @@ -13,10 +14,10 @@ const val withWhen3 = when(value) { 10 -> "1"; 100 -> "2"; els const val multibranchIf = if (value == 100) 1 else if (value == 1000) 2 else 3 fun box(): String { - if (condition != "True") return "Fail 1" - if (withWhen != "True") return "Fail 2" - if (withWhen2 != "True") return "Fail 3" - if (withWhen3 != "1") return "Fail 4" - if (multibranchIf != 3) return "Fail 5" + if (condition.id() != "True") return "Fail 1" + if (withWhen.id() != "True") return "Fail 2" + if (withWhen2.id() != "True") return "Fail 3" + if (withWhen3.id() != "1") return "Fail 4" + if (multibranchIf.id() != 3) return "Fail 5" return "OK" } diff --git a/compiler/testData/codegen/box/involvesIrInterpreter/intrinsicConst/kCallableName.kt b/compiler/testData/codegen/box/involvesIrInterpreter/intrinsicConst/kCallableName.kt index 0829a681f09..5c1b1ca2c97 100644 --- a/compiler/testData/codegen/box/involvesIrInterpreter/intrinsicConst/kCallableName.kt +++ b/compiler/testData/codegen/box/involvesIrInterpreter/intrinsicConst/kCallableName.kt @@ -1,6 +1,7 @@ // !LANGUAGE: +IntrinsicConstEvaluation // TARGET_BACKEND: JVM_IR // IGNORE_BACKEND_K1: JVM_IR +fun T.id() = this class A(val OK: Int, val somePropertyWithLongName: String) { fun foo() {} @@ -16,11 +17,11 @@ const val className = ::A.")!>name const val topLevelPropName = ::topLevelProp.name fun box(): String { - if (propertyName1 != "OK") return "Fail 1" - if (propertyName2 != "somePropertyWithLongName") return "Fail 2" - if (methodName != "foo") return "Fail 3.1" - if (suspendMethodName != "bar") return "Fail 3.2" - if (className != "") return "Fail 4" - if (topLevelPropName != "topLevelProp") return "Fail 5" + if (propertyName1.id() != "OK") return "Fail 1" + if (propertyName2.id() != "somePropertyWithLongName") return "Fail 2" + if (methodName.id() != "foo") return "Fail 3" + if (suspendMethodName.id() != "bar") return "Fail 3.2" + if (")!>className.id() != "") return "Fail 4" + if (topLevelPropName.id() != "topLevelProp") return "Fail 5" return "OK" } diff --git a/compiler/testData/codegen/box/involvesIrInterpreter/jsFloatDoubleToString.kt b/compiler/testData/codegen/box/involvesIrInterpreter/jsFloatDoubleToString.kt index 5a9f20de636..e6dd1b70b45 100644 --- a/compiler/testData/codegen/box/involvesIrInterpreter/jsFloatDoubleToString.kt +++ b/compiler/testData/codegen/box/involvesIrInterpreter/jsFloatDoubleToString.kt @@ -1,5 +1,6 @@ // TARGET_BACKEND: JS_IR // IGNORE_BACKEND_K1: JS_IR, JS_IR_ES6 +fun T.id() = this const val toStringDouble1 = 1.0.toString() const val toStringDouble2 = 2.0.toString() @@ -10,18 +11,18 @@ const val toStringFloat2 = 2.0f.toString() const val toStringFloat3 = 1.5f.toString() fun box(): String { - if (toStringDouble1 != "1") return "Fail 1.1" - if (toStringDouble2 != "2") return "Fail 1.2" - if (toStringDouble3 != "1.5") return "Fail 1.3" + if (toStringDouble1.id() != "1") return "Fail 1.1" + if (toStringDouble2.id() != "2") return "Fail 1.2" + if (toStringDouble3.id() != "1.5") return "Fail 1.3" - if (toStringFloat1 != "1") return "Fail 2.1" - if (toStringFloat2 != "2") return "Fail 2.2" - if (toStringFloat3 != "1.5") return "Fail 2.3" + if (toStringFloat1.id() != "1") return "Fail 2.1" + if (toStringFloat2.id() != "2") return "Fail 2.2" + if (toStringFloat3.id() != "1.5") return "Fail 2.3" val localDoubleToString = 1.0.toString() val localFloatToString = 1.0f.toString() - if (localDoubleToString != toStringDouble1) return "Fail 3.1" - if (localFloatToString != toStringFloat1) return "Fail 3.2" + if (localDoubleToString.id() != toStringDouble1) return "Fail 3.1" + if (localFloatToString.id() != toStringFloat1) return "Fail 3.2" return "OK" } diff --git a/compiler/testData/codegen/box/involvesIrInterpreter/jvmFloatDoubleToString.kt b/compiler/testData/codegen/box/involvesIrInterpreter/jvmFloatDoubleToString.kt index 739a4e588cf..4bba06f3d7f 100644 --- a/compiler/testData/codegen/box/involvesIrInterpreter/jvmFloatDoubleToString.kt +++ b/compiler/testData/codegen/box/involvesIrInterpreter/jvmFloatDoubleToString.kt @@ -1,5 +1,6 @@ // TARGET_BACKEND: JVM_IR // TARGET_BACKEND: NATIVE +fun T.id() = this const val toStringDouble1 = 1.0.toString() const val toStringDouble2 = 2.0.toString() @@ -10,18 +11,18 @@ const val toStringFloat2 = 2.0f.toString() const val toStringFloat3 = 1.5f.toString() fun box(): String { - if (toStringDouble1 != "1.0") return "Fail 1.1" - if (toStringDouble2 != "2.0") return "Fail 1.2" - if (toStringDouble3 != "1.5") return "Fail 1.3" + if (toStringDouble1.id() != "1.0") return "Fail 1.1" + if (toStringDouble2.id() != "2.0") return "Fail 1.2" + if (toStringDouble3.id() != "1.5") return "Fail 1.3" - if (toStringFloat1 != "1.0") return "Fail 2.1" - if (toStringFloat2 != "2.0") return "Fail 2.2" - if (toStringFloat3 != "1.5") return "Fail 2.3" + if (toStringFloat1.id() != "1.0") return "Fail 2.1" + if (toStringFloat2.id() != "2.0") return "Fail 2.2" + if (toStringFloat3.id() != "1.5") return "Fail 2.3" val localDoubleToString = 1.0.toString() val localFloatToString = 1.0f.toString() - if (localDoubleToString != toStringDouble1) return "Fail 3.1" - if (localFloatToString != toStringFloat1) return "Fail 3.2" + if (localDoubleToString.id() != toStringDouble1) return "Fail 3.1" + if (localFloatToString.id() != toStringFloat1) return "Fail 3.2" return "OK" } diff --git a/compiler/testData/codegen/box/involvesIrInterpreter/longOperations.kt b/compiler/testData/codegen/box/involvesIrInterpreter/longOperations.kt index 10e9403efbb..784177639b5 100644 --- a/compiler/testData/codegen/box/involvesIrInterpreter/longOperations.kt +++ b/compiler/testData/codegen/box/involvesIrInterpreter/longOperations.kt @@ -2,6 +2,7 @@ // TARGET_BACKEND: NATIVE // TARGET_BACKEND: JS_IR // IGNORE_BACKEND_K1: NATIVE +fun T.id() = this const val minusOneVal = -1L const val oneVal = 1L @@ -92,80 +93,80 @@ const val toString1 = oneVal.toString() const val toString2 = twoVal.toString() fun box(): String { - if (compareTo1 != -1) return "Fail 1.1" - if (compareTo2 != 0) return "Fail 1.2" - if (compareTo3 != 1) return "Fail 1.3" - if (compareTo4 != 0) return "Fail 1.4" - if (compareTo5 != 0) return "Fail 1.5" - if (compareTo6 != 0) return "Fail 1.6" - if (compareTo7 != 0) return "Fail 1.7" - if (compareTo8 != 0) return "Fail 1.8" + if (compareTo1.id() != -1) return "Fail 1.1" + if (compareTo2.id() != 0) return "Fail 1.2" + if (compareTo3.id() != 1) return "Fail 1.3" + if (compareTo4.id() != 0) return "Fail 1.4" + if (compareTo5.id() != 0) return "Fail 1.5" + if (compareTo6.id() != 0) return "Fail 1.6" + if (compareTo7.id() != 0) return "Fail 1.7" + if (compareTo8.id() != 0) return "Fail 1.8" - if (plus1 != 3L) return "Fail 2.1" - if (plus2 != 4L) return "Fail 2.2" - if (plus3 != 5L) return "Fail 2.3" - if (plus4 != 4L) return "Fail 2.4" - if (plus5 != 4L) return "Fail 2.5" - if (plus6 != 4L) return "Fail 2.6" - if (plus7 != 4.0f) return "Fail 2.7" - if (plus8 != 4.0) return "Fail 2.8" + if (plus1.id() != 3L) return "Fail 2.1" + if (plus2.id() != 4L) return "Fail 2.2" + if (plus3.id() != 5L) return "Fail 2.3" + if (plus4.id() != 4L) return "Fail 2.4" + if (plus5.id() != 4L) return "Fail 2.5" + if (plus6.id() != 4L) return "Fail 2.6" + if (plus7.id() != 4.0f) return "Fail 2.7" + if (plus8.id() != 4.0) return "Fail 2.8" - if (minus1 != -1L) return "Fail 3.1" - if (minus2 != 0L) return "Fail 3.2" - if (minus3 != 1L) return "Fail 3.3" - if (minus4 != 0L) return "Fail 3.4" - if (minus5 != 0L) return "Fail 3.5" - if (minus6 != 0L) return "Fail 3.6" - if (minus7 != 0.0f) return "Fail 3.7" - if (minus8 != 0.0) return "Fail 3.8" + if (minus1.id() != -1L) return "Fail 3.1" + if (minus2.id() != 0L) return "Fail 3.2" + if (minus3.id() != 1L) return "Fail 3.3" + if (minus4.id() != 0L) return "Fail 3.4" + if (minus5.id() != 0L) return "Fail 3.5" + if (minus6.id() != 0L) return "Fail 3.6" + if (minus7.id() != 0.0f) return "Fail 3.7" + if (minus8.id() != 0.0) return "Fail 3.8" - if (times1 != 2L) return "Fail 4.1" - if (times2 != 4L) return "Fail 4.2" - if (times3 != 6L) return "Fail 4.3" - if (times4 != 4L) return "Fail 4.4" - if (times5 != 4L) return "Fail 4.5" - if (times6 != 4L) return "Fail 4.6" - if (times7 != 4.0f) return "Fail 4.7" - if (times8 != 4.0) return "Fail 4.8" + if (times1.id() != 2L) return "Fail 4.1" + if (times2.id() != 4L) return "Fail 4.2" + if (times3.id() != 6L) return "Fail 4.3" + if (times4.id() != 4L) return "Fail 4.4" + if (times5.id() != 4L) return "Fail 4.5" + if (times6.id() != 4L) return "Fail 4.6" + if (times7.id() != 4.0f) return "Fail 4.7" + if (times8.id() != 4.0) return "Fail 4.8" - if (div1 != 0L) return "Fail 5.1" - if (div2 != 1L) return "Fail 5.2" - if (div3 != 1L) return "Fail 5.3" - if (div4 != 1L) return "Fail 5.4" - if (div5 != 1L) return "Fail 5.5" - if (div6 != 1L) return "Fail 5.6" - if (div7 != 1.0f) return "Fail 5.7" - if (div8 != 1.0) return "Fail 5.8" + if (div1.id() != 0L) return "Fail 5.1" + if (div2.id() != 1L) return "Fail 5.2" + if (div3.id() != 1L) return "Fail 5.3" + if (div4.id() != 1L) return "Fail 5.4" + if (div5.id() != 1L) return "Fail 5.5" + if (div6.id() != 1L) return "Fail 5.6" + if (div7.id() != 1.0f) return "Fail 5.7" + if (div8.id() != 1.0) return "Fail 5.8" - if (rem1 != 1L) return "Fail 6.1" - if (rem2 != 0L) return "Fail 6.2" - if (rem3 != 1L) return "Fail 6.3" - if (rem4 != 0L) return "Fail 6.4" - if (rem5 != 0L) return "Fail 6.5" - if (rem6 != 0L) return "Fail 6.6" - if (rem7 != 0.0f) return "Fail 6.7" - if (rem8 != 0.0) return "Fail 6.8" + if (rem1.id() != 1L) return "Fail 6.1" + if (rem2.id() != 0L) return "Fail 6.2" + if (rem3.id() != 1L) return "Fail 6.3" + if (rem4.id() != 0L) return "Fail 6.4" + if (rem5.id() != 0L) return "Fail 6.5" + if (rem6.id() != 0L) return "Fail 6.6" + if (rem7.id() != 0.0f) return "Fail 6.7" + if (rem8.id() != 0.0) return "Fail 6.8" - if (unaryPlus1 != 1L) return "Fail 7.1" - if (unaryPlus2 != -1L) return "Fail 7.2" - if (unaryMinus1 != -1L) return "Fail 7.3" - if (unaryMinus2 != 1L) return "Fail 7.4" + if (unaryPlus1.id() != 1L) return "Fail 7.1" + if (unaryPlus2.id() != -1L) return "Fail 7.2" + if (unaryMinus1.id() != -1L) return "Fail 7.3" + if (unaryMinus2.id() != 1L) return "Fail 7.4" - if (convert1 != 1.toByte()) return "Fail 8.1" - if (convert2 != '') return "Fail 8.2" - if (convert3 != 1.toShort()) return "Fail 8.3" - if (convert4 != 1) return "Fail 8.4" - if (convert5 != 1L) return "Fail 8.5" - if (convert6 != 1.0f) return "Fail 8.6" - if (convert7 != 1.0) return "Fail 8.7" + if (convert1.id() != 1.toByte()) return "Fail 8.1" + if (convert2.id() != '') return "Fail 8.2" + if (convert3.id() != 1.toShort()) return "Fail 8.3" + if (convert4.id() != 1) return "Fail 8.4" + if (convert5.id() != 1L) return "Fail 8.5" + if (convert6.id() != 1.0f) return "Fail 8.6" + if (convert7.id() != 1.0) return "Fail 8.7" - if (equals1 != false) return "Fail 9.1" - if (equals2 != true) return "Fail 9.2" - if (equals3 != false) return "Fail 9.3" - if (equals4 != false) return "Fail 9.4" + if (equals1.id() != false) return "Fail 9.1" + if (equals2.id() != true) return "Fail 9.2" + if (equals3.id() != false) return "Fail 9.3" + if (equals4.id() != false) return "Fail 9.4" - if (toString1 != "1") return "Fail 10.1" - if (toString2 != "2") return "Fail 10.2" + if (toString1.id() != "1") return "Fail 10.1" + if (toString2.id() != "2") return "Fail 10.2" return "OK" } diff --git a/compiler/testData/codegen/box/involvesIrInterpreter/shortOperations.kt b/compiler/testData/codegen/box/involvesIrInterpreter/shortOperations.kt index 0b85aa04116..b3fbb5f6471 100644 --- a/compiler/testData/codegen/box/involvesIrInterpreter/shortOperations.kt +++ b/compiler/testData/codegen/box/involvesIrInterpreter/shortOperations.kt @@ -2,6 +2,7 @@ // TARGET_BACKEND: NATIVE // TARGET_BACKEND: JS_IR // IGNORE_BACKEND_K1: NATIVE +fun T.id() = this const val minusOneVal = (-1).toShort() const val oneVal = 1.toShort() @@ -92,80 +93,80 @@ const val toString1 = oneVal.toString() const val toString2 = twoVal.toString() fun box(): String { - if (compareTo1 != -1) return "Fail 1.1" - if (compareTo2 != 0) return "Fail 1.2" - if (compareTo3 != 1) return "Fail 1.3" - if (compareTo4 != 0) return "Fail 1.4" - if (compareTo5 != 0) return "Fail 1.5" - if (compareTo6 != 0) return "Fail 1.6" - if (compareTo7 != 0) return "Fail 1.7" - if (compareTo8 != 0) return "Fail 1.8" + if (compareTo1.id() != -1) return "Fail 1.1" + if (compareTo2.id() != 0) return "Fail 1.2" + if (compareTo3.id() != 1) return "Fail 1.3" + if (compareTo4.id() != 0) return "Fail 1.4" + if (compareTo5.id() != 0) return "Fail 1.5" + if (compareTo6.id() != 0) return "Fail 1.6" + if (compareTo7.id() != 0) return "Fail 1.7" + if (compareTo8.id() != 0) return "Fail 1.8" - if (plus1 != 3) return "Fail 2.1" - if (plus2 != 4) return "Fail 2.2" - if (plus3 != 5) return "Fail 2.3" - if (plus4 != 4) return "Fail 2.4" - if (plus5 != 4) return "Fail 2.5" - if (plus6 != 4L) return "Fail 2.6" - if (plus7 != 4.0f) return "Fail 2.7" - if (plus8 != 4.0) return "Fail 2.8" + if (plus1.id() != 3) return "Fail 2.1" + if (plus2.id() != 4) return "Fail 2.2" + if (plus3.id() != 5) return "Fail 2.3" + if (plus4.id() != 4) return "Fail 2.4" + if (plus5.id() != 4) return "Fail 2.5" + if (plus6.id() != 4L) return "Fail 2.6" + if (plus7.id() != 4.0f) return "Fail 2.7" + if (plus8.id() != 4.0) return "Fail 2.8" - if (minus1 != -1) return "Fail 3.1" - if (minus2 != 0) return "Fail 3.2" - if (minus3 != 1) return "Fail 3.3" - if (minus4 != 0) return "Fail 3.4" - if (minus5 != 0) return "Fail 3.5" - if (minus6 != 0L) return "Fail 3.6" - if (minus7 != 0.0f) return "Fail 3.7" - if (minus8 != 0.0) return "Fail 3.8" + if (minus1.id() != -1) return "Fail 3.1" + if (minus2.id() != 0) return "Fail 3.2" + if (minus3.id() != 1) return "Fail 3.3" + if (minus4.id() != 0) return "Fail 3.4" + if (minus5.id() != 0) return "Fail 3.5" + if (minus6.id() != 0L) return "Fail 3.6" + if (minus7.id() != 0.0f) return "Fail 3.7" + if (minus8.id() != 0.0) return "Fail 3.8" - if (times1 != 2) return "Fail 4.1" - if (times2 != 4) return "Fail 4.2" - if (times3 != 6) return "Fail 4.3" - if (times4 != 4) return "Fail 4.4" - if (times5 != 4) return "Fail 4.5" - if (times6 != 4L) return "Fail 4.6" - if (times7 != 4.0f) return "Fail 4.7" - if (times8 != 4.0) return "Fail 4.8" + if (times1.id() != 2) return "Fail 4.1" + if (times2.id() != 4) return "Fail 4.2" + if (times3.id() != 6) return "Fail 4.3" + if (times4.id() != 4) return "Fail 4.4" + if (times5.id() != 4) return "Fail 4.5" + if (times6.id() != 4L) return "Fail 4.6" + if (times7.id() != 4.0f) return "Fail 4.7" + if (times8.id() != 4.0) return "Fail 4.8" - if (div1 != 0) return "Fail 5.1" - if (div2 != 1) return "Fail 5.2" - if (div3 != 1) return "Fail 5.3" - if (div4 != 1) return "Fail 5.4" - if (div5 != 1) return "Fail 5.5" - if (div6 != 1L) return "Fail 5.6" - if (div7 != 1.0f) return "Fail 5.7" - if (div8 != 1.0) return "Fail 5.8" + if (div1.id() != 0) return "Fail 5.1" + if (div2.id() != 1) return "Fail 5.2" + if (div3.id() != 1) return "Fail 5.3" + if (div4.id() != 1) return "Fail 5.4" + if (div5.id() != 1) return "Fail 5.5" + if (div6.id() != 1L) return "Fail 5.6" + if (div7.id() != 1.0f) return "Fail 5.7" + if (div8.id() != 1.0) return "Fail 5.8" - if (rem1 != 1) return "Fail 6.1" - if (rem2 != 0) return "Fail 6.2" - if (rem3 != 1) return "Fail 6.3" - if (rem4 != 0) return "Fail 6.4" - if (rem5 != 0) return "Fail 6.5" - if (rem6 != 0L) return "Fail 6.6" - if (rem7 != 0.0f) return "Fail 6.7" - if (rem8 != 0.0) return "Fail 6.8" + if (rem1.id() != 1) return "Fail 6.1" + if (rem2.id() != 0) return "Fail 6.2" + if (rem3.id() != 1) return "Fail 6.3" + if (rem4.id() != 0) return "Fail 6.4" + if (rem5.id() != 0) return "Fail 6.5" + if (rem6.id() != 0L) return "Fail 6.6" + if (rem7.id() != 0.0f) return "Fail 6.7" + if (rem8.id() != 0.0) return "Fail 6.8" - if (unaryPlus1 != 1) return "Fail 7.1" - if (unaryPlus2 != -1) return "Fail 7.2" - if (unaryMinus1 != -1) return "Fail 7.3" - if (unaryMinus2 != 1) return "Fail 7.4" + if (unaryPlus1.id() != 1) return "Fail 7.1" + if (unaryPlus2.id() != -1) return "Fail 7.2" + if (unaryMinus1.id() != -1) return "Fail 7.3" + if (unaryMinus2.id() != 1) return "Fail 7.4" - if (convert1 != 1.toByte()) return "Fail 8.1" - if (convert2 != '') return "Fail 8.2" - if (convert3 != 1.toShort()) return "Fail 8.3" - if (convert4 != 1) return "Fail 8.4" - if (convert5 != 1L) return "Fail 8.5" - if (convert6 != 1.0f) return "Fail 8.6" - if (convert7 != 1.0) return "Fail 8.7" + if (convert1.id() != 1.toByte()) return "Fail 8.1" + if (convert2.id() != '') return "Fail 8.2" + if (convert3.id() != 1.toShort()) return "Fail 8.3" + if (convert4.id() != 1) return "Fail 8.4" + if (convert5.id() != 1L) return "Fail 8.5" + if (convert6.id() != 1.0f) return "Fail 8.6" + if (convert7.id() != 1.0) return "Fail 8.7" - if (equals1 != false) return "Fail 9.1" - if (equals2 != true) return "Fail 9.2" - if (equals3 != false) return "Fail 9.3" - if (equals4 != false) return "Fail 9.4" + if (equals1.id() != false) return "Fail 9.1" + if (equals2.id() != true) return "Fail 9.2" + if (equals3.id() != false) return "Fail 9.3" + if (equals4.id() != false) return "Fail 9.4" - if (toString1 != "1") return "Fail 10.1" - if (toString2 != "2") return "Fail 10.2" + if (toString1.id() != "1") return "Fail 10.1" + if (toString2.id() != "2") return "Fail 10.2" return "OK" } diff --git a/compiler/testData/codegen/box/involvesIrInterpreter/stdlibConst.kt b/compiler/testData/codegen/box/involvesIrInterpreter/stdlibConst.kt index 606aef6d9b2..029dc8d4338 100644 --- a/compiler/testData/codegen/box/involvesIrInterpreter/stdlibConst.kt +++ b/compiler/testData/codegen/box/involvesIrInterpreter/stdlibConst.kt @@ -2,15 +2,16 @@ // TARGET_BACKEND: NATIVE // TARGET_BACKEND: JS_IR // WITH_STDLIB +fun T.id() = this const val code = '1'.code const val floorDiv = 10.floorDiv(2) const val mod = 5.mod(3) fun box(): String { - if (code != 49) return "Fail 1" - if (floorDiv != 5) return "Fail 2" - if (mod != 2) return "Fail 3" + if (code.id() != 49) return "Fail 1" + if (floorDiv.id() != 5) return "Fail 2" + if (mod.id() != 2) return "Fail 3" return "OK" } diff --git a/compiler/testData/codegen/box/involvesIrInterpreter/stringConcatenation.kt b/compiler/testData/codegen/box/involvesIrInterpreter/stringConcatenation.kt index 6ffecd7ac5c..1124b1df24f 100644 --- a/compiler/testData/codegen/box/involvesIrInterpreter/stringConcatenation.kt +++ b/compiler/testData/codegen/box/involvesIrInterpreter/stringConcatenation.kt @@ -2,15 +2,16 @@ // TARGET_BACKEND: NATIVE // TARGET_BACKEND: JS_IR // WITH_STDLIB +fun T.id() = this const val simple = "O${'K'} ${1.toLong() + 2.5}" const val withInnerConcatenation = "1 ${"2 ${3} ${4} 5"} 6" const val withNull = "1 ${null}" // but `"1" + null` is invalid fun box(): String { - if (simple != "OK 3.5") return "Fail 1" - if (withInnerConcatenation != "1 2 3 4 5 6") return "Fail 2" - if (withNull != "1 null") return "Fail 3" + if (simple.id() != "OK 3.5") return "Fail 1" + if (withInnerConcatenation.id() != "1 2 3 4 5 6") return "Fail 2" + if (withNull.id() != "1 null") return "Fail 3" return "OK" } diff --git a/compiler/testData/codegen/box/involvesIrInterpreter/stringOperations.kt b/compiler/testData/codegen/box/involvesIrInterpreter/stringOperations.kt index 63e85660f95..55093864567 100644 --- a/compiler/testData/codegen/box/involvesIrInterpreter/stringOperations.kt +++ b/compiler/testData/codegen/box/involvesIrInterpreter/stringOperations.kt @@ -1,6 +1,7 @@ // TARGET_BACKEND: JVM_IR // TARGET_BACKEND: NATIVE // TARGET_BACKEND: JS_IR +fun T.id() = this const val someStr = "123" const val otherStr = "other" @@ -27,23 +28,23 @@ const val equals3 = otherStr == someStr const val toString1 = someStr.toString() fun box(): String { - if (plus1 != "123other") return "Fail 1.1" - if (plus2 != "1231") return "Fail 1.2" + if (plus1.id() != "123other") return "Fail 1.1" + if (plus2.id() != "1231") return "Fail 1.2" - if (length1 != 3) return "Fail 2.1" - if (length2 != 5) return "Fail 2.2" + if (length1.id() != 3) return "Fail 2.1" + if (length2.id() != 5) return "Fail 2.2" - if (get1 != '1') return "Fail 3.1" - if (get2 != 't') return "Fail 3.2" + if (get1.id() != '1') return "Fail 3.1" + if (get2.id() != 't') return "Fail 3.2" - if (compareTo1 != 0) return "Fail 4.1" + if (compareTo1.id() != 0) return "Fail 4.1" if (compareTo2 >= 0) return "Fail 4.2" if (compareTo3 <= 0) return "Fail 4.3" - if (equals1 != true) return "Fail 5.1" - if (equals2 != false) return "Fail 5.2" - if (equals3 != false) return "Fail 5.3" + if (equals1.id() != true) return "Fail 5.1" + if (equals2.id() != false) return "Fail 5.2" + if (equals3.id() != false) return "Fail 5.3" - if (toString1 != "123") return "Fail 6.1" + if (toString1.id() != "123") return "Fail 6.1" return "OK" } diff --git a/compiler/testData/codegen/box/involvesIrInterpreter/unsignedConst.kt b/compiler/testData/codegen/box/involvesIrInterpreter/unsignedConst.kt index f33d2e64f9d..5abfdc3936d 100644 --- a/compiler/testData/codegen/box/involvesIrInterpreter/unsignedConst.kt +++ b/compiler/testData/codegen/box/involvesIrInterpreter/unsignedConst.kt @@ -2,6 +2,7 @@ // TARGET_BACKEND: NATIVE // TARGET_BACKEND: JS_IR // WITH_STDLIB +fun T.id() = this const val byteVal: UByte = 1u const val shortVal: UShort = 2u @@ -9,9 +10,9 @@ const val intVal: UInt = 3u const val longVal: ULong = 4uL fun box(): String { - if (byteVal != 1u.toUByte()) return "Fail 1" - if (shortVal != 2u.toUShort()) return "Fail 2" - if (intVal != 3u.toUInt()) return "Fail 3" - if (longVal != 4u.toULong()) return "Fail 4" + if (byteVal.id() != 1u.toUByte()) return "Fail 1" + if (shortVal.id() != 2u.toUShort()) return "Fail 2" + if (intVal.id() != 3u.toUInt()) return "Fail 3" + if (longVal.id() != 4u.toULong()) return "Fail 4" return "OK" }