[FIR] Fix handling of type parameters in FIR mangling

#KT-57429 Fixed
This commit is contained in:
Kirill Rakhman
2023-06-05 17:31:27 +02:00
committed by Space Team
parent 938dd65881
commit 67fc46a190
48 changed files with 199 additions and 141 deletions
@@ -219,7 +219,7 @@ abstract class BaseKotlinMangleComputer<Declaration, Type, TypeParameter, ValueP
protected fun StringBuilder.mangleTypeParameterReference(typeParameter: TypeParameter) {
val parent = getEffectiveParent(typeParameter)
val containerIndex = typeParameterContainers.indexOf(parent)
val containerIndex = getContainerIndex(parent)
require(allowOutOfScopeTypeParameters || containerIndex >= 0) {
"No container found for type parameter '${getTypeParameterName(typeParameter)}' of '${renderDeclaration(parent)}'"
}
@@ -228,6 +228,9 @@ abstract class BaseKotlinMangleComputer<Declaration, Type, TypeParameter, ValueP
appendSignature(getIndexOfTypeParameter(typeParameter, parent))
}
protected open fun getContainerIndex(parent: TypeParameterContainer): Int {
return typeParameterContainers.indexOf(parent)
}
protected fun mangleTypeParameter(
tpBuilder: StringBuilder,