[JS IR] Fix clash between generic extension overloads

Type parameter constraints are used for calculating JS signature hash.

^KT-51151 Fixed
This commit is contained in:
Alexander Korepanov
2022-07-14 20:01:06 +02:00
committed by Space
parent 9f5cbea0fa
commit 0982872959
6 changed files with 181 additions and 1 deletions
@@ -139,7 +139,13 @@ fun jsFunctionSignature(declaration: IrFunction, context: JsIrBackendContext): S
// TODO should we skip type parameters and use upper bound of type parameter when print type of value parameters?
declaration.typeParameters.ifNotEmpty {
nameBuilder.append("_\$t")
joinTo(nameBuilder, "") { "_${it.name.asString()}" }
forEach { typeParam ->
nameBuilder.append("_").append(typeParam.name.asString())
typeParam.superTypes.ifNotEmpty {
nameBuilder.append("$")
joinTo(nameBuilder, "") { type -> type.asString() }
}
}
}
declaration.extensionReceiverParameter?.let {
nameBuilder.append("_r$${it.type.asString()}")