mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-05-09 00:21:47 +00:00
JS: fix translation of augmented assignment when RHS changes value of LHS
This commit is contained in:
23
compiler/testData/codegen/box/increment/augmentedAssignmentWithComplexRhs.kt
vendored
Normal file
23
compiler/testData/codegen/box/increment/augmentedAssignmentWithComplexRhs.kt
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
// WITH_RUNTIME
|
||||
import kotlin.test.*
|
||||
|
||||
var log = ""
|
||||
var result = 20
|
||||
|
||||
fun <T> id(value: T) = value
|
||||
|
||||
fun box(): String {
|
||||
result += if (id("true") == "true") {
|
||||
result += 10
|
||||
log += "true chosen"
|
||||
3
|
||||
}
|
||||
else {
|
||||
4
|
||||
}
|
||||
|
||||
assertEquals(23, result)
|
||||
assertEquals("true chosen", log)
|
||||
|
||||
return "OK"
|
||||
}
|
||||
Reference in New Issue
Block a user