"Add parameter to constructor": fix for enum entry
#KT-28995 Fixed #KT-29051 Fixed #KT-29052 Fixed
This commit is contained in:
committed by
Mikhail Glukhikh
parent
2c74796b0b
commit
7cad0052d9
+1
-1
@@ -101,7 +101,7 @@ class KotlinFunctionCallUsage(
|
||||
if (resolvedCall == null || resolvedCall.isReallySuccess()) return false
|
||||
|
||||
// TODO: investigate why arguments are not recorded for enum constructor call
|
||||
if (element is KtSuperTypeCallEntry && element.parent.parent is KtEnumEntry) return false
|
||||
if (element is KtSuperTypeCallEntry && element.parent.parent is KtEnumEntry && element.valueArguments.isEmpty()) return false
|
||||
|
||||
if (skipUnmatchedArgumentsCheck) return false
|
||||
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
// "Add parameter to constructor 'Foo'" "true"
|
||||
// DISABLE-ERRORS
|
||||
enum class Foo {
|
||||
A("A"<caret>),
|
||||
B("B")
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
// "Add parameter to constructor 'Foo'" "true"
|
||||
// DISABLE-ERRORS
|
||||
enum class Foo(s: String) {
|
||||
A("A"),
|
||||
B("B")
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
// "Add parameter to constructor 'Foo'" "true"
|
||||
// DISABLE-ERRORS
|
||||
enum class Foo {
|
||||
A("A"),
|
||||
B("B"<caret>)
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
// "Add parameter to constructor 'Foo'" "true"
|
||||
// DISABLE-ERRORS
|
||||
enum class Foo(s: String) {
|
||||
A("A"),
|
||||
B("B")
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
// "Add parameter to constructor 'Foo'" "true"
|
||||
// DISABLE-ERRORS
|
||||
enum class Foo(n: Int) {
|
||||
A(1, 2<caret>),
|
||||
B(3),
|
||||
C(3, 4),
|
||||
D(),
|
||||
E
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
// "Add parameter to constructor 'Foo'" "true"
|
||||
// DISABLE-ERRORS
|
||||
enum class Foo(n: Int, i: Int) {
|
||||
A(1, 2),
|
||||
B(3, 2),
|
||||
C(3, 4),
|
||||
D(, 2),
|
||||
E
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
// "Add parameters to constructor 'Foo'" "true"
|
||||
// DISABLE-ERRORS
|
||||
enum class Foo {
|
||||
A(1, 2<caret>),
|
||||
B(3),
|
||||
C(3, 4),
|
||||
D(),
|
||||
E
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
// "Add parameters to constructor 'Foo'" "true"
|
||||
// DISABLE-ERRORS
|
||||
enum class Foo(i: Int, i1: Int) {
|
||||
A(1, 2),
|
||||
B(3),
|
||||
C(3, 4),
|
||||
D(1, 2),
|
||||
E(1, 2)
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
// "Add parameter to constructor 'Foo'" "true"
|
||||
// DISABLE-ERRORS
|
||||
enum class Foo {
|
||||
A(1<caret>),
|
||||
B(2),
|
||||
C(),
|
||||
D,
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
// "Add parameter to constructor 'Foo'" "true"
|
||||
// DISABLE-ERRORS
|
||||
enum class Foo(i: Int) {
|
||||
A(1),
|
||||
B(2),
|
||||
C(1),
|
||||
D(1),
|
||||
}
|
||||
@@ -1730,6 +1730,31 @@ public class QuickFixTestGenerated extends AbstractQuickFixTest {
|
||||
runTest("idea/testData/quickfix/changeSignature/addConstructorParameter.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("addEnumConstructorParameter.kt")
|
||||
public void testAddEnumConstructorParameter() throws Exception {
|
||||
runTest("idea/testData/quickfix/changeSignature/addEnumConstructorParameter.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("addEnumConstructorParameter2.kt")
|
||||
public void testAddEnumConstructorParameter2() throws Exception {
|
||||
runTest("idea/testData/quickfix/changeSignature/addEnumConstructorParameter2.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("addEnumConstructorParameter3.kt")
|
||||
public void testAddEnumConstructorParameter3() throws Exception {
|
||||
runTest("idea/testData/quickfix/changeSignature/addEnumConstructorParameter3.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("addEnumConstructorParameter4.kt")
|
||||
public void testAddEnumConstructorParameter4() throws Exception {
|
||||
runTest("idea/testData/quickfix/changeSignature/addEnumConstructorParameter4.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("addEnumConstructorParameter5.kt")
|
||||
public void testAddEnumConstructorParameter5() throws Exception {
|
||||
runTest("idea/testData/quickfix/changeSignature/addEnumConstructorParameter5.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("addFunctionParameter.kt")
|
||||
public void testAddFunctionParameter() throws Exception {
|
||||
runTest("idea/testData/quickfix/changeSignature/addFunctionParameter.kt");
|
||||
|
||||
Reference in New Issue
Block a user