[IR BE] Remap references in default arg value in inner class constructor
Make sure that there is no reference into zombie declarations. - fix KT-40771 - add test
This commit is contained in:
+2
-1
@@ -46,10 +46,11 @@ class InnerClassesLowering(val context: BackendContext, private val innerClasses
|
||||
|
||||
val newConstructor = lowerConstructor(declaration)
|
||||
val oldConstructorParameterToNew = innerClassesSupport.primaryConstructorParameterMap(declaration)
|
||||
val variableRemapper = VariableRemapper(oldConstructorParameterToNew)
|
||||
for ((oldParam, newParam) in oldConstructorParameterToNew.entries) {
|
||||
newParam.defaultValue = oldParam.defaultValue?.let { oldDefault ->
|
||||
context.irFactory.createExpressionBody(oldDefault.startOffset, oldDefault.endOffset) {
|
||||
expression = oldDefault.expression.patchDeclarationParents(newConstructor)
|
||||
expression = oldDefault.expression.transform(variableRemapper, null).patchDeclarationParents(newConstructor)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user