[K/N] Disable scope initialization on constant access
^KT-57098
This commit is contained in:
committed by
Space Team
parent
e6297f92fa
commit
62fb3df7f0
+1
-1
@@ -552,8 +552,8 @@ private fun PhaseEngine<NativeGenerationState>.getAllLowerings() = listOfNotNull
|
||||
coroutinesPhase,
|
||||
typeOperatorPhase,
|
||||
expressionBodyTransformPhase,
|
||||
objectClassesPhase,
|
||||
constantInliningPhase,
|
||||
objectClassesPhase,
|
||||
staticInitializersPhase,
|
||||
builtinOperatorPhase,
|
||||
bridgesPhase,
|
||||
|
||||
-3
@@ -32,7 +32,4 @@ private class NativeInlineConstTransformer : InlineConstTransformer() {
|
||||
?.takeUnless { it.kind == IrConstKind.Float && IrConstKind.Float.valueOf(it).isNaN() }
|
||||
|
||||
override fun reportInlineConst(field: IrField, value: IrConst<*>) {}
|
||||
// on jvm IrGetObjectValue is also dropped. This would be breaking change for native.
|
||||
// Some design work is required to decide what is correct, let just keep current behaviour for now
|
||||
override fun IrExpression.shouldDropConstReceiver() = this is IrConst<*> || this is IrGetValue
|
||||
}
|
||||
@@ -57,8 +57,12 @@ object ClassWithConstructor {
|
||||
@Test fun checkConstructor() {
|
||||
assertEquals(0, ClassWithConstructorInitialized)
|
||||
assertEquals(1, ClassWithConstructor.A)
|
||||
assertEquals(0, ClassWithConstructorInitialized)
|
||||
val unused1 = ClassWithConstructor
|
||||
assertEquals(1, unused1.A)
|
||||
assertEquals(1, ClassWithConstructorInitialized)
|
||||
assertEquals(1, ClassWithConstructor.A)
|
||||
val unused2 = ClassWithConstructor
|
||||
assertEquals(1, unused2.A)
|
||||
assertEquals(1, ClassWithConstructorInitialized)
|
||||
assertFalse(ClassWithConstructor.isPermanent())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user