mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-05-16 15:53:55 +00:00
In super class constructor arguments, 'this' can be resolved as a reference to a companion object of a superclass. This breaks an assumption in psi2ir that 'this' can only refer to some receiver from the current scope. If 'this' refers to an 'object' (including 'companion obejct'), and we are not inside the corresponding class scope, then 'this' represents a reference to a singleton instance "by name" (represented as IrGetObjectValue).
13 lines
248 B
Kotlin
Vendored
13 lines
248 B
Kotlin
Vendored
fun WithCompanion.test(): String {
|
|
object : WithCompanion(this) {}
|
|
return "OK"
|
|
}
|
|
|
|
open class WithCompanion(a: WithCompanion.Companion) {
|
|
companion object
|
|
}
|
|
|
|
fun box(): String {
|
|
return WithCompanion(WithCompanion.Companion).test()
|
|
}
|