JVM_IR: fix NPE in interface companion initializers
* When referencing the companion itself, they should use the $$INSTANCE field, not the (null until <clinit> returns) Companion field of the interface. * Interface companion init blocks should be made static.
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
// Inside of the companion we have to access the instance through the local Companion field,
|
||||
// not by indirection through the Companion field of the enclosing class.
|
||||
// Class initialization might not have finished yet.
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
// !LANGUAGE: +NestedClassesInAnnotations
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
// WITH_RUNTIME
|
||||
|
||||
import kotlin.test.*
|
||||
|
||||
-1
@@ -1,5 +1,4 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
interface Test {
|
||||
companion object {
|
||||
fun ok() = "OK"
|
||||
|
||||
Reference in New Issue
Block a user