JS: fix FE crashing when type argument count less than parameter count
See KT-20908
This commit is contained in:
+5
@@ -0,0 +1,5 @@
|
||||
inline fun <T, reified K> bar() {}
|
||||
|
||||
fun foo() {
|
||||
bar<!WRONG_NUMBER_OF_TYPE_ARGUMENTS!><Int><!>()
|
||||
}
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
package
|
||||
|
||||
public inline fun </*0*/ T, /*1*/ reified K> bar(): kotlin.Unit
|
||||
public fun foo(): kotlin.Unit
|
||||
@@ -434,6 +434,12 @@ public class DiagnosticsTestWithJsStdLibGenerated extends AbstractDiagnosticsTes
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("incompleteReifiedArg.kt")
|
||||
public void testIncompleteReifiedArg() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/testsWithJsStdLib/module/incompleteReifiedArg.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("jsModuleNonExternal.kt")
|
||||
public void testJsModuleNonExternal() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/testsWithJsStdLib/module/jsModuleNonExternal.kt");
|
||||
|
||||
+3
-1
@@ -49,7 +49,9 @@ object JsModuleCallChecker : CallChecker {
|
||||
val containingDescriptor = context.scope.ownerDescriptor
|
||||
val typeParams = call.candidateDescriptor.typeParameters.map { it.original }.withIndex().filter { (_, param) -> param.isReified }
|
||||
val typeArguments = call.call.typeArgumentList
|
||||
?.let { args -> typeParams.associate { (index, param) -> param.original to args.arguments[index].typeReference }}
|
||||
?.let { args ->
|
||||
typeParams.associate { (index, param) -> param.original to args.arguments.getOrNull(index)?.typeReference }
|
||||
}
|
||||
.orEmpty()
|
||||
for (typeParam in typeParams.map { (_, param) -> param.original }) {
|
||||
val argPsi = typeArguments[typeParam] ?: reportOn
|
||||
|
||||
Reference in New Issue
Block a user