[K/N] Fix extracting local classes from lambda in cached inline function

^KT-52540
This commit is contained in:
Pavel Kunyavskiy
2022-06-24 11:42:46 +02:00
committed by Space
parent 649910863c
commit dfcf2cfa84
11 changed files with 69 additions and 5 deletions
@@ -832,10 +832,10 @@ internal class CodeGeneratorVisitor(val context: Context, val lifetimes: Map<IrE
|| body == null)
return
val isNotInlinedLambda = declaration.origin == IrDeclarationOrigin.LOCAL_FUNCTION_FOR_LAMBDA
val file = ((declaration as? IrSimpleFunction)?.attributeOwnerId as? IrSimpleFunction)?.file.takeIf {
it ?: return@takeIf false
(currentCodeContext.fileScope() as FileScope).file != it && isNotInlinedLambda
}
val file = ((declaration as? IrSimpleFunction)?.attributeOwnerId as? IrSimpleFunction)
.takeIf { isNotInlinedLambda }
?.file
.takeIf { (currentCodeContext.fileScope() as FileScope).file != it }
val scope = file?.let {
FileScope(it)
}