mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-04-05 00:21:31 +00:00
Don't use term "Static import" + refer quickfix by class name in negative tests
This commit is contained in:
@@ -375,9 +375,9 @@ internal class MissingComponentsAutoImportFix(element: KtExpression, override va
|
||||
}
|
||||
}
|
||||
|
||||
internal class AutoImportStaticFix(expression: KtSimpleNameExpression) : AutoImportFixBase<KtSimpleNameExpression>(expression) {
|
||||
internal class AutoImportMemberFix(expression: KtSimpleNameExpression) : AutoImportFixBase<KtSimpleNameExpression>(expression) {
|
||||
|
||||
override fun getText() = "Static import"
|
||||
override fun getText() = "Import member"
|
||||
|
||||
override fun fillCandidates(
|
||||
name: String,
|
||||
@@ -426,7 +426,7 @@ internal class AutoImportStaticFix(expression: KtSimpleNameExpression) : AutoImp
|
||||
|
||||
companion object : KotlinSingleIntentionActionFactory() {
|
||||
override fun createAction(diagnostic: Diagnostic) =
|
||||
(diagnostic.psiElement as? KtSimpleNameExpression)?.let(::AutoImportStaticFix)
|
||||
(diagnostic.psiElement as? KtSimpleNameExpression)?.let(::AutoImportMemberFix)
|
||||
|
||||
override fun isApplicableForCodeFragment() = true
|
||||
|
||||
|
||||
@@ -128,7 +128,7 @@ class QuickFixRegistrar : QuickFixContributor {
|
||||
NON_PRIVATE_CONSTRUCTOR_IN_ENUM.registerFactory(removeModifierFactory)
|
||||
NON_PRIVATE_CONSTRUCTOR_IN_SEALED.registerFactory(removeModifierFactory)
|
||||
|
||||
UNRESOLVED_REFERENCE.registerFactory(AutoImportStaticFix)
|
||||
UNRESOLVED_REFERENCE.registerFactory(AutoImportMemberFix)
|
||||
UNRESOLVED_REFERENCE.registerFactory(AutoImportFix)
|
||||
|
||||
UNRESOLVED_REFERENCE.registerFactory(AddTestLibQuickFix)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// FILE: main.before.kt
|
||||
// "Static import" "true"
|
||||
// "Import member" "true"
|
||||
// ERROR: Unresolved reference: foobar
|
||||
|
||||
//KT-9009
|
||||
@@ -20,7 +20,7 @@ object Foo {
|
||||
}
|
||||
|
||||
// FILE: main.after.kt
|
||||
// "Static import" "true"
|
||||
// "Import member" "true"
|
||||
// ERROR: Unresolved reference: foobar
|
||||
|
||||
//KT-9009
|
||||
@@ -1,5 +1,5 @@
|
||||
// FILE: first.before.kt
|
||||
// "Static import" "true"
|
||||
// "Import member" "true"
|
||||
// ERROR: Unresolved reference: foobar
|
||||
|
||||
//KT-9009
|
||||
@@ -18,7 +18,7 @@ public class Bar {
|
||||
// FILE: first.after.kt
|
||||
import Bar.foobar
|
||||
|
||||
// "Static import" "true"
|
||||
// "Import member" "true"
|
||||
// ERROR: Unresolved reference: foobar
|
||||
|
||||
//KT-9009
|
||||
@@ -1,5 +1,5 @@
|
||||
// FILE: first.before.kt
|
||||
// "Static import" "true"
|
||||
// "Import member" "true"
|
||||
// ERROR: Unresolved reference: foobar
|
||||
|
||||
//KT-9009
|
||||
@@ -21,7 +21,7 @@ public class Bar {
|
||||
// FILE: first.after.kt
|
||||
import Bar.foobar
|
||||
|
||||
// "Static import" "true"
|
||||
// "Import member" "true"
|
||||
// ERROR: Unresolved reference: foobar
|
||||
|
||||
//KT-9009
|
||||
@@ -1,5 +1,5 @@
|
||||
// FILE: main.before.kt
|
||||
// "Static import" "false"
|
||||
// "class org.jetbrains.kotlin.idea.quickfix.AutoImportMemberFix" "false"
|
||||
// ERROR: Unresolved reference: foobar
|
||||
// ACTION: Create function 'foobar'
|
||||
// ACTION: Rename reference
|
||||
@@ -20,7 +20,7 @@ class Foo {
|
||||
}
|
||||
|
||||
//FILE: main.after.kt
|
||||
// "Static import" "false"
|
||||
// "class org.jetbrains.kotlin.idea.quickfix.AutoImportMemberFix" "false"
|
||||
// ERROR: Unresolved reference: foobar
|
||||
// ACTION: Create function 'foobar'
|
||||
// ACTION: Rename reference
|
||||
@@ -1,5 +1,5 @@
|
||||
// FILE: main.before.kt
|
||||
// "Static import" "false"
|
||||
// "class org.jetbrains.kotlin.idea.quickfix.AutoImportMemberFix" "false"
|
||||
// ERROR: Unresolved reference: foobar
|
||||
// ACTION: Create local variable 'foobar'
|
||||
// ACTION: Create property 'foobar'
|
||||
@@ -21,7 +21,7 @@ class Foo {
|
||||
}
|
||||
|
||||
//FILE: main.after.kt
|
||||
// "Static import" "false"
|
||||
// "class org.jetbrains.kotlin.idea.quickfix.AutoImportMemberFix" "false"
|
||||
// ERROR: Unresolved reference: foobar
|
||||
// ACTION: Create local variable 'foobar'
|
||||
// ACTION: Create property 'foobar'
|
||||
@@ -1,5 +1,5 @@
|
||||
// FILE: main.before.kt
|
||||
// "Static import" "false"
|
||||
// "class org.jetbrains.kotlin.idea.quickfix.AutoImportMemberFix" "false"
|
||||
// ERROR: Unresolved reference: foobar
|
||||
// ACTION: Create local variable 'foobar'
|
||||
// ACTION: Create property 'foobar'
|
||||
@@ -21,7 +21,7 @@ public class Foo {
|
||||
}
|
||||
|
||||
//FILE: main.after.kt
|
||||
// "Static import" "false"
|
||||
// "class org.jetbrains.kotlin.idea.quickfix.AutoImportMemberFix" "false"
|
||||
// ERROR: Unresolved reference: foobar
|
||||
// ACTION: Create local variable 'foobar'
|
||||
// ACTION: Create property 'foobar'
|
||||
@@ -1,5 +1,5 @@
|
||||
// FILE: main.before.kt
|
||||
// "Static import" "false"
|
||||
// "class org.jetbrains.kotlin.idea.quickfix.AutoImportMemberFix" "false"
|
||||
// ERROR: Unresolved reference: foobar
|
||||
// ACTION: Create function 'foobar'
|
||||
// ACTION: Rename reference
|
||||
@@ -21,7 +21,7 @@ public class Foo {
|
||||
}
|
||||
|
||||
//FILE: main.after.kt
|
||||
// "Static import" "false"
|
||||
// "class org.jetbrains.kotlin.idea.quickfix.AutoImportMemberFix" "false"
|
||||
// ERROR: Unresolved reference: foobar
|
||||
// ACTION: Create function 'foobar'
|
||||
// ACTION: Rename reference
|
||||
@@ -1,5 +1,5 @@
|
||||
// FILE: main.before.kt
|
||||
// "Static import" "false"
|
||||
// "class org.jetbrains.kotlin.idea.quickfix.AutoImportMemberFix" "false"
|
||||
// ERROR: Unresolved reference: foobar
|
||||
// ACTION: Create function 'foobar'
|
||||
// ACTION: Import
|
||||
@@ -19,7 +19,7 @@ fun foobar() {
|
||||
}
|
||||
|
||||
//FILE: main.after.kt
|
||||
// "Static import" "false"
|
||||
// "class org.jetbrains.kotlin.idea.quickfix.AutoImportMemberFix" "false"
|
||||
// ERROR: Unresolved reference: foobar
|
||||
// ACTION: Create function 'foobar'
|
||||
// ACTION: Rename reference
|
||||
@@ -1,5 +1,5 @@
|
||||
// FILE: main.before.kt
|
||||
// "Static import" "true"
|
||||
// "Import member" "true"
|
||||
// ERROR: Unresolved reference: foobar
|
||||
|
||||
//KT-9009
|
||||
@@ -19,7 +19,7 @@ object Foo {
|
||||
}
|
||||
|
||||
// FILE: main.after.kt
|
||||
// "Static import" "true"
|
||||
// "Import member" "true"
|
||||
// ERROR: Unresolved reference: foobar
|
||||
|
||||
//KT-9009
|
||||
@@ -239,6 +239,60 @@ public class QuickFixMultiFileTestGenerated extends AbstractQuickFixMultiFileTes
|
||||
doTestWithExtraFile(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("memberImportFunction.test")
|
||||
public void testMemberImportFunction() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/quickfix/autoImports/memberImportFunction.test");
|
||||
doTestWithExtraFile(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("memberImportJavaField.test")
|
||||
public void testMemberImportJavaField() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/quickfix/autoImports/memberImportJavaField.test");
|
||||
doTestWithExtraFile(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("memberImportJavaMethod.test")
|
||||
public void testMemberImportJavaMethod() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/quickfix/autoImports/memberImportJavaMethod.test");
|
||||
doTestWithExtraFile(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("memberImportNotForClassFunction.test")
|
||||
public void testMemberImportNotForClassFunction() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/quickfix/autoImports/memberImportNotForClassFunction.test");
|
||||
doTestWithExtraFile(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("memberImportNotForClassProperty.test")
|
||||
public void testMemberImportNotForClassProperty() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/quickfix/autoImports/memberImportNotForClassProperty.test");
|
||||
doTestWithExtraFile(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("memberImportNotForJavaNonStaticField.test")
|
||||
public void testMemberImportNotForJavaNonStaticField() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/quickfix/autoImports/memberImportNotForJavaNonStaticField.test");
|
||||
doTestWithExtraFile(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("memberImportNotForJavaNonStaticMethod.test")
|
||||
public void testMemberImportNotForJavaNonStaticMethod() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/quickfix/autoImports/memberImportNotForJavaNonStaticMethod.test");
|
||||
doTestWithExtraFile(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("memberImportNotForTopLevelFunction.test")
|
||||
public void testMemberImportNotForTopLevelFunction() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/quickfix/autoImports/memberImportNotForTopLevelFunction.test");
|
||||
doTestWithExtraFile(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("memberImportProperty.test")
|
||||
public void testMemberImportProperty() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/quickfix/autoImports/memberImportProperty.test");
|
||||
doTestWithExtraFile(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("minusOperator.before.Main.kt")
|
||||
public void testMinusOperator() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/quickfix/autoImports/minusOperator.before.Main.kt");
|
||||
@@ -353,36 +407,6 @@ public class QuickFixMultiFileTestGenerated extends AbstractQuickFixMultiFileTes
|
||||
doTestWithExtraFile(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("noStaticImportForClassFunction.test")
|
||||
public void testNoStaticImportForClassFunction() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/quickfix/autoImports/noStaticImportForClassFunction.test");
|
||||
doTestWithExtraFile(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("noStaticImportForClassProperty.test")
|
||||
public void testNoStaticImportForClassProperty() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/quickfix/autoImports/noStaticImportForClassProperty.test");
|
||||
doTestWithExtraFile(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("noStaticImportForJavaNonStaticField.test")
|
||||
public void testNoStaticImportForJavaNonStaticField() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/quickfix/autoImports/noStaticImportForJavaNonStaticField.test");
|
||||
doTestWithExtraFile(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("noStaticImportForJavaNonStaticMethod.test")
|
||||
public void testNoStaticImportForJavaNonStaticMethod() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/quickfix/autoImports/noStaticImportForJavaNonStaticMethod.test");
|
||||
doTestWithExtraFile(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("noStaticImportForTopLevelFunction.test")
|
||||
public void testNoStaticImportForTopLevelFunction() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/quickfix/autoImports/noStaticImportForTopLevelFunction.test");
|
||||
doTestWithExtraFile(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("notExcludedClass.before.Main.kt")
|
||||
public void testNotExcludedClass() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/quickfix/autoImports/notExcludedClass.before.Main.kt");
|
||||
@@ -443,30 +467,6 @@ public class QuickFixMultiFileTestGenerated extends AbstractQuickFixMultiFileTes
|
||||
doTestWithExtraFile(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("staticImportFunction.test")
|
||||
public void testStaticImportFunction() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/quickfix/autoImports/staticImportFunction.test");
|
||||
doTestWithExtraFile(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("staticImportJavaField.test")
|
||||
public void testStaticImportJavaField() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/quickfix/autoImports/staticImportJavaField.test");
|
||||
doTestWithExtraFile(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("staticImportJavaMethod.test")
|
||||
public void testStaticImportJavaMethod() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/quickfix/autoImports/staticImportJavaMethod.test");
|
||||
doTestWithExtraFile(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("staticImportProperty.test")
|
||||
public void testStaticImportProperty() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/quickfix/autoImports/staticImportProperty.test");
|
||||
doTestWithExtraFile(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("timesAssign.before.Main.kt")
|
||||
public void testTimesAssign() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/quickfix/autoImports/timesAssign.before.Main.kt");
|
||||
|
||||
Reference in New Issue
Block a user