Properly handle top level properties of inline classes. (#3627)

This commit is contained in:
Nikolay Igotti
2019-11-29 17:20:05 +03:00
committed by GitHub
parent f6f02a69c4
commit 45953f03a5
2 changed files with 16 additions and 2 deletions
@@ -58,7 +58,7 @@ internal val IrField.storageClass: FieldStorage get() {
}
val IrField.isMainOnlyNonPrimitive get() = when {
KotlinBuiltIns.isPrimitiveType(descriptor.type) -> false
descriptor.type.computePrimitiveBinaryTypeOrNull() != null -> false
else -> storageClass == FieldStorage.MAIN_THREAD
}
@@ -18,7 +18,9 @@ object Mutable {
var x = 2
}
@Test fun runTest() {
val topLevelInline: ULong = 0xc3a5c85c97cb3127U
@Test fun runTest1() {
assertEquals(1, AnObject.x)
if (Platform.memoryModel == MemoryModel.STRICT) {
assertFailsWith<InvalidMutabilityException> {
@@ -34,3 +36,15 @@ object Mutable {
assertEquals(3, Mutable.x)
println("OK")
}
@Test fun runTest2() {
val ok = AtomicInt(0)
withWorker() {
executeAfter(0, {
assertEquals(0xc3a5c85c97cb3127U, topLevelInline)
ok.increment()
}.freeze())
}
assertEquals(1, ok.value)
}