Extract function: add default name for parameter
This commit is contained in:
+1
-1
@@ -610,7 +610,7 @@ private fun ExtractionData.inferParametersInfo(
|
||||
|
||||
with (parameter) {
|
||||
if (currentName == null) {
|
||||
currentName = JetNameSuggester.suggestNames(parameterType, varNameValidator, null).first()
|
||||
currentName = JetNameSuggester.suggestNames(parameterType, varNameValidator, "p").first()
|
||||
}
|
||||
mirrorVarName = if (descriptorToExtract in modifiedVarDescriptors) varNameValidator.validateName(name) else null
|
||||
info.parameters.add(this)
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
// PARAM_TYPES: kotlin.Array<T>, kotlin.Cloneable, Any
|
||||
// PARAM_DESCRIPTOR: internal fun <T> kotlin.Array<T>.test(): kotlin.Unit defined in root package
|
||||
// SIBLING:
|
||||
fun <T> Array<T>.test() {
|
||||
<selection>this.isEmpty()</selection>
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
// PARAM_TYPES: kotlin.Array<T>, kotlin.Cloneable, Any
|
||||
// PARAM_DESCRIPTOR: internal fun <T> kotlin.Array<T>.test(): kotlin.Unit defined in root package
|
||||
// SIBLING:
|
||||
fun <T> Array<T>.test() {
|
||||
unit()
|
||||
}
|
||||
|
||||
private fun <T> Array<T>.unit() {
|
||||
this.isEmpty()
|
||||
}
|
||||
+6
@@ -354,6 +354,12 @@ public class JetExtractionTestGenerated extends AbstractJetExtractionTest {
|
||||
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/refactoring/extractFunction/basic"), Pattern.compile("^(.+)\\.kt$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("extensionFunForArray.kt")
|
||||
public void testExtensionFunForArray() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("idea/testData/refactoring/extractFunction/basic/extensionFunForArray.kt");
|
||||
doExtractFunctionTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("fragmentWithComment.kt")
|
||||
public void testFragmentWithComment() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("idea/testData/refactoring/extractFunction/basic/fragmentWithComment.kt");
|
||||
|
||||
Reference in New Issue
Block a user