From d6df4f8b2126fe1c642149a6fce79dea93abaf71 Mon Sep 17 00:00:00 2001 From: Nikolay Igotti Date: Thu, 30 Jan 2020 18:44:47 +0300 Subject: [PATCH] Fix mutation attempts for primitive globals. (#3796) --- .../kotlin/backend/konan/llvm/IrToBitcode.kt | 2 +- .../tests/runtime/workers/worker6.kt | 32 ++++++++++++++----- 2 files changed, 25 insertions(+), 9 deletions(-) diff --git a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/IrToBitcode.kt b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/IrToBitcode.kt index e5e8f2465e6..b6b0a9188ed 100644 --- a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/IrToBitcode.kt +++ b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/IrToBitcode.kt @@ -1600,7 +1600,7 @@ internal class CodeGeneratorVisitor(val context: Context, val lifetimes: Map input.toString() +@Test fun runTest1() { + withWorker { + val future = execute(TransferMode.SAFE, { 42 }) { input -> + input.toString() + } + future.consume { result -> + println("Got $result") + } } - future.consume { - result -> println("Got $result") - } - worker.requestTermination().result println("OK") +} + +var int1 = 1 +val int2 = 77 + +@Test fun runTest2() { + int1++ + withWorker { + executeAfter(0, { + assertFailsWith { + int1++ + } + assertEquals(2, int1) + assertEquals(77, int2) + }.freeze()) + } } \ No newline at end of file