Make change signature fix non-applicable for constructors (EA-76554)
This commit is contained in:
@@ -102,7 +102,9 @@ public class ChangeFunctionReturnTypeFix extends KotlinQuickFixAction<KtFunction
|
||||
|
||||
@Override
|
||||
public boolean isAvailable(@NotNull Project project, @Nullable Editor editor, @NotNull PsiFile file) {
|
||||
return super.isAvailable(project, editor, file) && !ErrorUtils.containsErrorType(type);
|
||||
return super.isAvailable(project, editor, file) &&
|
||||
!ErrorUtils.containsErrorType(type) &&
|
||||
!(getElement() instanceof KtConstructor);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Vendored
+9
@@ -0,0 +1,9 @@
|
||||
// "Change 'A' function return type to 'B'" "false"
|
||||
// ACTION: Change 'b' type to 'A'
|
||||
// ACTION: Convert property initializer to getter
|
||||
// ERROR: Type mismatch: inferred type is A but B was expected
|
||||
|
||||
class A constructor() {}
|
||||
interface B
|
||||
|
||||
val b: B = <caret>A()
|
||||
@@ -7274,6 +7274,12 @@ public class QuickFixTestGenerated extends AbstractQuickFixTest {
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("notApplicableToConstructor.kt")
|
||||
public void testNotApplicableToConstructor() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/quickfix/typeMismatch/typeMismatchOnReturnedExpression/notApplicableToConstructor.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("propertyGetterInitializerTypeMismatch.kt")
|
||||
public void testPropertyGetterInitializerTypeMismatch() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/quickfix/typeMismatch/typeMismatchOnReturnedExpression/propertyGetterInitializerTypeMismatch.kt");
|
||||
|
||||
Reference in New Issue
Block a user