[JVM_IR] Avoid using special names in static inline class replacements.

Fixes KT-46952
This commit is contained in:
Mads Ager
2021-05-27 15:55:39 +02:00
committed by Alexander Udalov
parent b1ab597616
commit f846dd8ea2
12 changed files with 64 additions and 7 deletions
@@ -785,9 +785,6 @@ class LocalDeclarationsLowering(
}
}
private fun Name.stripSpecialMarkers(): String =
if (isSpecial) asString().substring(1, asString().length - 1) else asString()
private fun suggestNameForCapturedValue(declaration: IrValueDeclaration, usedNames: MutableSet<String>, isExplicitLocalFunction: Boolean = false): Name {
if (declaration is IrValueParameter) {
if (declaration.name.asString() == "<this>" && declaration.isDispatchReceiver()) {
@@ -808,7 +805,7 @@ class LocalDeclarationsLowering(
}
val base = if (declaration.name.isSpecial) {
declaration.name.stripSpecialMarkers()
declaration.name.asStringStripSpecialMarkers()
} else {
declaration.name.asString()
}
@@ -859,9 +856,9 @@ class LocalDeclarationsLowering(
val correspondingProperty = parentFun.safeAs<IrSimpleFunction>()?.correspondingPropertySymbol?.owner
return when {
correspondingProperty != null ->
correspondingProperty.name.stripSpecialMarkers()
correspondingProperty.name.asStringStripSpecialMarkers()
else ->
parentFun.name.stripSpecialMarkers()
parentFun.name.asStringStripSpecialMarkers()
}
}