ImportFix: add support for WRONG_NUMBER_OF_TYPE_ARGUMENTS
#KT-23834 Fixed
This commit is contained in:
@@ -567,7 +567,8 @@ internal class ImportForMismatchingArgumentsFix(
|
||||
callExpression.valueArguments.mapNotNull { it.getArgumentName()?.referenceExpression } +
|
||||
listOfNotNull(
|
||||
callExpression.valueArgumentList,
|
||||
callExpression.referenceExpression()
|
||||
callExpression.referenceExpression(),
|
||||
callExpression.typeArgumentList
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -165,6 +165,7 @@ class QuickFixRegistrar : QuickFixContributor {
|
||||
CONSTANT_EXPECTED_TYPE_MISMATCH.registerFactory(ImportForMismatchingArgumentsFix)
|
||||
NAMED_PARAMETER_NOT_FOUND.registerFactory(ImportForMismatchingArgumentsFix)
|
||||
NONE_APPLICABLE.registerFactory(ImportForMismatchingArgumentsFix)
|
||||
WRONG_NUMBER_OF_TYPE_ARGUMENTS.registerFactory(ImportForMismatchingArgumentsFix)
|
||||
|
||||
UNRESOLVED_REFERENCE_WRONG_RECEIVER.registerFactory(ImportFix)
|
||||
|
||||
|
||||
+42
@@ -0,0 +1,42 @@
|
||||
// FILE: first.before.kt
|
||||
// "Import" "true"
|
||||
// ERROR: No type arguments expected for fun shade(): Unit
|
||||
// ACTION: Create type parameter in function 'shade'
|
||||
// COMPILER_ARGUMENTS: -XXLanguage:-NewInference
|
||||
|
||||
package pack_one
|
||||
|
||||
class Shadow {
|
||||
fun shade() {}
|
||||
}
|
||||
|
||||
fun main() {
|
||||
Shadow().shade<caret><Shadow>()
|
||||
}
|
||||
|
||||
// FILE: second.kt
|
||||
package pack_one.sub
|
||||
|
||||
import pack_one.Shadow
|
||||
|
||||
fun <X> Shadow.shade() {}
|
||||
|
||||
|
||||
// FILE: first.after.kt
|
||||
// "Import" "true"
|
||||
// ERROR: No type arguments expected for fun shade(): Unit
|
||||
// ACTION: Create type parameter in function 'shade'
|
||||
// COMPILER_ARGUMENTS: -XXLanguage:-NewInference
|
||||
|
||||
package pack_one
|
||||
|
||||
import pack_one.sub.shade
|
||||
|
||||
class Shadow {
|
||||
fun shade() {}
|
||||
}
|
||||
|
||||
fun main() {
|
||||
Shadow().shade<caret><Shadow>()
|
||||
}
|
||||
|
||||
+5
@@ -1115,6 +1115,11 @@ public class QuickFixMultiFileTestGenerated extends AbstractQuickFixMultiFileTes
|
||||
runTest("idea/testData/quickfix/autoImports/mismatchingArgs/extensionWrongReceiver.test");
|
||||
}
|
||||
|
||||
@TestMetadata("extensionWrongTypeParam.test")
|
||||
public void testExtensionWrongTypeParam() throws Exception {
|
||||
runTest("idea/testData/quickfix/autoImports/mismatchingArgs/extensionWrongTypeParam.test");
|
||||
}
|
||||
|
||||
@TestMetadata("ignoreErrorsOutsideCall.test")
|
||||
public void testIgnoreErrorsOutsideCall() throws Exception {
|
||||
runTest("idea/testData/quickfix/autoImports/mismatchingArgs/ignoreErrorsOutsideCall.test");
|
||||
|
||||
Reference in New Issue
Block a user