FIR2IR: don't declare dispatch receiver for local functions

This commit is contained in:
Jinseong Jeon
2020-07-28 00:05:58 -07:00
committed by Mikhail Glukhikh
parent 5a3367e09c
commit da6e96f4f1
8 changed files with 3 additions and 9 deletions
@@ -306,7 +306,9 @@ class Fir2IrDeclarationStorage(
)
}
}
if (function !is FirAnonymousFunction && containingClass != null && !isStatic) {
// See [LocalDeclarationsLowering]: "local function must not have dispatch receiver."
val isLocal = function is FirSimpleFunction && function.isLocal
if (function !is FirAnonymousFunction && containingClass != null && !isStatic && !isLocal) {
dispatchReceiverParameter = declareThisReceiverParameter(
symbolTable,
thisType = containingClass.thisReceiver?.type ?: error("No this receiver"),
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
//adopted snippet from kdoc
open class KModel {
val sourcesInfo: String
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
class A {
val result: String
init {
@@ -1,5 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
lateinit var result1: String
lateinit var result2: String
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
enum class X {
B {
val value2 = "K"
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
class Test {
val property:Int
@@ -1,5 +1,4 @@
// !LANGUAGE: +NestedClassesInAnnotations
// IGNORE_BACKEND_FIR: JVM_IR
// WITH_RUNTIME
import kotlin.test.*
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
// KJS_WITH_FULL_RUNTIME
object O {