JS: don't fail when generating signature for function which refers to undefined type
This commit is contained in:
@@ -82,14 +82,14 @@ private fun StringBuilder.encodeForSignature(
|
||||
|
||||
append(DescriptorUtils.getFqName(declaration).asString())
|
||||
|
||||
if (type.arguments.isNotEmpty()) {
|
||||
val parameters = declaration.typeConstructor.parameters
|
||||
val parameters = declaration.typeConstructor.parameters
|
||||
if (type.arguments.isNotEmpty() && parameters.isNotEmpty()) {
|
||||
append("<")
|
||||
for ((index, argument) in type.arguments.withIndex()) {
|
||||
if (index > 0) {
|
||||
for ((argument, parameter) in type.arguments.zip(parameters)) {
|
||||
if (parameter.index > 0) {
|
||||
append(",")
|
||||
}
|
||||
encodeForSignature(argument, parameters[index], typeParameterNamer)
|
||||
encodeForSignature(argument, parameter, typeParameterNamer)
|
||||
}
|
||||
append(">")
|
||||
}
|
||||
|
||||
@@ -184,6 +184,12 @@ class EncodeSignatureTest {
|
||||
""")
|
||||
}
|
||||
|
||||
@Test
|
||||
fun missingType() {
|
||||
assertSignature(",kotlin.Int", "fun test(a: WrongClass, b: Int) {}")
|
||||
assertSignature(",kotlin.Int", "fun test(a: WrongClass<String>, b: Int) {}")
|
||||
}
|
||||
|
||||
@Suppress("ObjectLiteralToLambda")
|
||||
private fun assertSignature(expectedEncoding: String, codeSnippet: String, name: String = "test") {
|
||||
val disposable = object : Disposable {
|
||||
|
||||
Reference in New Issue
Block a user