Files
kotlin-fork/compiler/fir/analysis-tests/testData/resolve/localClasses/implicitInLocalClasses.fir.txt
T
Roman Golyshev 9b9c51bc8d [FIR] Fix dispatch receivers on inner classes' constructors
1. Inner class constructor should have its outer class as a dispatch
receiver, since it is necessary for the call. Before it was null
2. Substituted inner class constructor should have its original dispatch
 receiver type with the proper substitution. Before it was set to the
 class itself (since the class was usually passed as a new dispatch
 receiver)

Also, modify FIR renderer, so it properly renders the dispatch receiver
of the constructors
2021-10-05 12:17:08 +00:00

76 lines
2.7 KiB
Plaintext
Vendored

FILE: implicitInLocalClasses.kt
public final fun useBoolean(b: R|kotlin/Boolean|): R|kotlin/Unit| {
}
public final fun main(): R|kotlin/Unit| {
local final class A : R|kotlin/Any| {
public constructor(): R|A| {
super<R|kotlin/Any|>()
}
public final fun foo(x: R|kotlin/Int|): R|kotlin/Boolean| {
^foo this@R|/A|.R|<local>/bar|(R|<local>/x|)
}
public final fun bar(y: R|kotlin/Int|): R|kotlin/Boolean| {
^bar CMP(>, this@R|/A|.R|kotlin/Any.hashCode|().R|kotlin/Int.plus|(R|<local>/y|).R|kotlin/Int.compareTo|(Int(0)))
}
public final val w: R|kotlin/Boolean|
public get(): R|kotlin/Boolean| {
^ this@R|/A|.R|<local>/z|
}
public final val z: R|kotlin/Boolean|
public get(): R|kotlin/Boolean| {
^ ==(this@R|/A|.R|kotlin/Any.hashCode|(), Int(0))
}
}
lval a: R|A| = R|/A.A|()
R|/useBoolean|(R|<local>/a|.R|<local>/foo|(Int(1)))
R|/useBoolean|(R|<local>/a|.R|<local>/bar|(Int(1)))
R|/useBoolean|(R|<local>/a|.R|<local>/w|)
R|/useBoolean|(R|<local>/a|.R|<local>/z|)
local final class B : R|kotlin/Any| {
public constructor(): R|B| {
super<R|kotlin/Any|>()
}
public final fun foo(x: R|kotlin/Int|): R|kotlin/Boolean| {
^foo this@R|/B|.R|<local>/inner|.R|<local>/w|
}
public final fun bar(y: R|kotlin/Int|): R|kotlin/Boolean| {
^bar CMP(>, this@R|/B|.R|kotlin/Any.hashCode|().R|kotlin/Int.plus|(R|<local>/y|).R|kotlin/Int.compareTo|(Int(0)))
}
public final val inner: R|B.Inner| = this@R|/B|.R|/B.Inner.Inner|()
public get(): R|B.Inner|
local final inner class Inner : R|kotlin/Any| {
public B.constructor(): R|B.Inner| {
super<R|kotlin/Any|>()
}
public final val w: R|kotlin/Boolean|
public get(): R|kotlin/Boolean| {
^ this@R|/B.Inner|.R|<local>/z|
}
public final val z: R|kotlin/Boolean|
public get(): R|kotlin/Boolean| {
^ this@R|/B|.R|<local>/bar|(Int(1))
}
}
}
lval b: R|B| = R|/B.B|()
R|/useBoolean|(R|<local>/b|.R|<local>/foo|(Int(1)))
R|/useBoolean|(R|<local>/b|.R|<local>/bar|(Int(1)))
R|/useBoolean|(R|<local>/b|.R|<local>/inner|.R|<local>/w|)
R|/useBoolean|(R|<local>/b|.R|<local>/inner|.R|<local>/z|)
}