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"),