Files
kotlin-fork/compiler/testData/codegen/box/volatile/volatileShort.kt
T
2023-08-10 17:46:08 +00:00

18 lines
428 B
Kotlin
Vendored

// WITH_STDLIB
// IGNORE_BACKEND: JS, JS_IR, JS_IR_ES6, WASM
// !API_VERSION: 1.9
import kotlin.concurrent.*
@OptIn(kotlin.ExperimentalStdlibApi::class)
class ShortWrapper(@Volatile var x: Short)
val global = ShortWrapper(1)
fun box() : String {
val local = ShortWrapper(2)
if (global.x + local.x != 3) return "FAIL"
global.x = 5
local.x = 6
return if (global.x + local.x != 11) return "FAIL" else "OK"
}