fix type parameter migration for extension functions
This commit is contained in:
@@ -141,6 +141,7 @@ fun createSpacingBuilder(settings: CodeStyleSettings): KotlinSpacingBuilder {
|
||||
|
||||
betweenInside(FUN_KEYWORD, IDENTIFIER, FUN).spaces(1)
|
||||
betweenInside(FUN_KEYWORD, TYPE_REFERENCE, FUN).spaces(1)
|
||||
betweenInside(TYPE_PARAMETER_LIST, TYPE_REFERENCE, FUN).spaces(1)
|
||||
betweenInside(TYPE_PARAMETER_LIST, IDENTIFIER, FUN).spaces(1)
|
||||
betweenInside(FUN_KEYWORD, VALUE_PARAMETER_LIST, FUN).spacing(0, 0, 0, false, 0)
|
||||
betweenInside(TYPE_REFERENCE, DOT, FUN).spacing(0, 0, 0, false, 0)
|
||||
|
||||
+1
-1
@@ -36,7 +36,7 @@ class MigrateTypeParameterListFix(typeParameterList: JetTypeParameterList)
|
||||
|
||||
override fun invoke(project: Project, editor: Editor?, file: JetFile) {
|
||||
val function = element.getStrictParentOfType<JetNamedFunction>() ?: return
|
||||
function.addBefore(element, function.nameIdentifier)
|
||||
function.addBefore(element, function.receiverTypeReference ?: function.nameIdentifier)
|
||||
element.delete()
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
// "Migrate type parameter list syntax" "true"
|
||||
|
||||
class Foo
|
||||
|
||||
fun Foo.f<caret><T>() {}
|
||||
@@ -0,0 +1,5 @@
|
||||
// "Migrate type parameter list syntax" "true"
|
||||
|
||||
class Foo
|
||||
|
||||
fun <T> Foo.f() {}
|
||||
@@ -4356,6 +4356,12 @@ public class QuickFixTestGenerated extends AbstractQuickFixTest {
|
||||
String fileName = JetTestUtils.navigationMetadata("idea/testData/quickfix/migration/typeParameterList/basic.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("extension.kt")
|
||||
public void testExtension() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("idea/testData/quickfix/migration/typeParameterList/extension.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user