Auto-import: add quickfix for overloaded generic function

#KT-34667 Fixed
This commit is contained in:
Dmitry Gridin
2019-11-29 18:40:19 +07:00
parent 4b98430058
commit 37371edb8c
4 changed files with 76 additions and 0 deletions
@@ -168,6 +168,8 @@ class QuickFixRegistrar : QuickFixContributor {
NAMED_PARAMETER_NOT_FOUND.registerFactory(ImportForMismatchingArgumentsFix)
NONE_APPLICABLE.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)
@@ -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>()
}
@@ -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>()
}
@@ -1130,6 +1130,16 @@ public class QuickFixMultiFileTestGenerated extends AbstractQuickFixMultiFileTes
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")
public void testIgnoreErrorsOutsideCall() throws Exception {
runTest("idea/testData/quickfix/autoImports/mismatchingArgs/ignoreErrorsOutsideCall.test");