FIR resolve: add handling of companions as objects
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
open class A {
|
||||
companion object {
|
||||
fun foo() {}
|
||||
}
|
||||
|
||||
fun bar() {
|
||||
foo()
|
||||
}
|
||||
}
|
||||
|
||||
class B {
|
||||
companion object : A() {
|
||||
fun baz() {}
|
||||
}
|
||||
}
|
||||
|
||||
fun test() {
|
||||
A.foo()
|
||||
B.bar()
|
||||
B.baz()
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
FILE: companion.kt
|
||||
public open class A : R|kotlin/Any| {
|
||||
public constructor(): R|A| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
public final companion object Companion : R|kotlin/Any| {
|
||||
private constructor(): R|A.Companion| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
public final fun foo(): R|kotlin/Unit| {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public final fun bar(): R|kotlin/Unit| {
|
||||
R|/A.Companion.foo|()
|
||||
}
|
||||
|
||||
}
|
||||
public final class B : R|kotlin/Any| {
|
||||
public constructor(): R|B| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
public final companion object Companion : R|A| {
|
||||
private constructor(): R|B.Companion| {
|
||||
super<R|A|>()
|
||||
}
|
||||
|
||||
public final fun baz(): R|kotlin/Unit| {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
public final fun test(): R|kotlin/Unit| {
|
||||
R|/A|.R|/A.Companion.foo|()
|
||||
R|/B|.<Inapplicable(WRONG_RECEIVER): [/A.bar]>#()
|
||||
R|/B|.R|/B.Companion.baz|()
|
||||
}
|
||||
@@ -70,7 +70,7 @@ FILE: enums.kt
|
||||
|
||||
}
|
||||
|
||||
public final val g: R|kotlin/Double| = <Unresolved name: G>#.<Unresolved name: times>#(R|/Planet.m|).<Unresolved name: div>#(R|/Planet.r|.R|kotlin/Double.times|(R|/Planet.r|))
|
||||
public final val g: R|kotlin/Double| = R|/Planet.Companion.G|.R|kotlin/Double.times|(R|/Planet.m|).R|kotlin/Double.div|(R|/Planet.r|.R|kotlin/Double.times|(R|/Planet.r|))
|
||||
public get(): R|kotlin/Double|
|
||||
|
||||
public abstract fun sayHello(): R|kotlin/Unit|
|
||||
|
||||
Reference in New Issue
Block a user