Auto-import: add quickfix for overloaded generic function
#KT-34667 Fixed
This commit is contained in:
@@ -168,6 +168,8 @@ class QuickFixRegistrar : QuickFixContributor {
|
|||||||
NAMED_PARAMETER_NOT_FOUND.registerFactory(ImportForMismatchingArgumentsFix)
|
NAMED_PARAMETER_NOT_FOUND.registerFactory(ImportForMismatchingArgumentsFix)
|
||||||
NONE_APPLICABLE.registerFactory(ImportForMismatchingArgumentsFix)
|
NONE_APPLICABLE.registerFactory(ImportForMismatchingArgumentsFix)
|
||||||
WRONG_NUMBER_OF_TYPE_ARGUMENTS.registerFactory(ImportForMismatchingArgumentsFix)
|
WRONG_NUMBER_OF_TYPE_ARGUMENTS.registerFactory(ImportForMismatchingArgumentsFix)
|
||||||
|
NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER.registerFactory(ImportForMismatchingArgumentsFix)
|
||||||
|
TYPE_INFERENCE_NO_INFORMATION_FOR_PARAMETER.registerFactory(ImportForMismatchingArgumentsFix)
|
||||||
|
|
||||||
UNRESOLVED_REFERENCE_WRONG_RECEIVER.registerFactory(ImportFix)
|
UNRESOLVED_REFERENCE_WRONG_RECEIVER.registerFactory(ImportFix)
|
||||||
|
|
||||||
|
|||||||
+33
@@ -0,0 +1,33 @@
|
|||||||
|
// FILE: first.before.kt
|
||||||
|
// "Import" "true"
|
||||||
|
// ERROR: Type inference failed: Not enough information to infer parameter T in fun <T> foo(): Unit<br>Please specify it explicitly.<br>
|
||||||
|
// ACTION: Create type parameter in function 'shade'
|
||||||
|
// COMPILER_ARGUMENTS: -XXLanguage:-NewInference
|
||||||
|
|
||||||
|
package pack_one
|
||||||
|
|
||||||
|
fun <T> foo() {}
|
||||||
|
fun main() {
|
||||||
|
foo<caret>()
|
||||||
|
}
|
||||||
|
|
||||||
|
// FILE: second.kt
|
||||||
|
package pack_one.sub
|
||||||
|
|
||||||
|
fun foo() {}
|
||||||
|
|
||||||
|
// FILE: first.after.kt
|
||||||
|
// "Import" "true"
|
||||||
|
// ERROR: Type inference failed: Not enough information to infer parameter T in fun <T> foo(): Unit<br>Please specify it explicitly.<br>
|
||||||
|
// ACTION: Create type parameter in function 'shade'
|
||||||
|
// COMPILER_ARGUMENTS: -XXLanguage:-NewInference
|
||||||
|
|
||||||
|
package pack_one
|
||||||
|
|
||||||
|
import pack_one.sub.foo
|
||||||
|
|
||||||
|
fun <T> foo() {}
|
||||||
|
fun main() {
|
||||||
|
foo<caret>()
|
||||||
|
}
|
||||||
|
|
||||||
+31
@@ -0,0 +1,31 @@
|
|||||||
|
// FILE: first.before.kt
|
||||||
|
// "Import" "true"
|
||||||
|
// ERROR: Not enough information to infer type variable T
|
||||||
|
// COMPILER_ARGUMENTS: -XXLanguage:+NewInference
|
||||||
|
|
||||||
|
package pack_one
|
||||||
|
|
||||||
|
fun <T> foo() {}
|
||||||
|
fun main() {
|
||||||
|
foo<caret>()
|
||||||
|
}
|
||||||
|
|
||||||
|
// FILE: second.kt
|
||||||
|
package pack_one.sub
|
||||||
|
|
||||||
|
fun foo() {}
|
||||||
|
|
||||||
|
// FILE: first.after.kt
|
||||||
|
// "Import" "true"
|
||||||
|
// ERROR: Not enough information to infer type variable T
|
||||||
|
// COMPILER_ARGUMENTS: -XXLanguage:+NewInference
|
||||||
|
|
||||||
|
package pack_one
|
||||||
|
|
||||||
|
import pack_one.sub.foo
|
||||||
|
|
||||||
|
fun <T> foo() {}
|
||||||
|
fun main() {
|
||||||
|
foo<caret>()
|
||||||
|
}
|
||||||
|
|
||||||
+10
@@ -1130,6 +1130,16 @@ public class QuickFixMultiFileTestGenerated extends AbstractQuickFixMultiFileTes
|
|||||||
runTest("idea/testData/quickfix/autoImports/mismatchingArgs/extensionWrongTypeParam.test");
|
runTest("idea/testData/quickfix/autoImports/mismatchingArgs/extensionWrongTypeParam.test");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("extensionWrongTypeParam2.test")
|
||||||
|
public void testExtensionWrongTypeParam2() throws Exception {
|
||||||
|
runTest("idea/testData/quickfix/autoImports/mismatchingArgs/extensionWrongTypeParam2.test");
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("extensionWrongTypeParam3.test")
|
||||||
|
public void testExtensionWrongTypeParam3() throws Exception {
|
||||||
|
runTest("idea/testData/quickfix/autoImports/mismatchingArgs/extensionWrongTypeParam3.test");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("ignoreErrorsOutsideCall.test")
|
@TestMetadata("ignoreErrorsOutsideCall.test")
|
||||||
public void testIgnoreErrorsOutsideCall() throws Exception {
|
public void testIgnoreErrorsOutsideCall() throws Exception {
|
||||||
runTest("idea/testData/quickfix/autoImports/mismatchingArgs/ignoreErrorsOutsideCall.test");
|
runTest("idea/testData/quickfix/autoImports/mismatchingArgs/ignoreErrorsOutsideCall.test");
|
||||||
|
|||||||
Reference in New Issue
Block a user