AbstractDiagnosticBasedMigrationInspection: fix case with nullable custom factory
#KT-36479 Fixed
This commit is contained in:
+3
-4
@@ -48,11 +48,10 @@ abstract class AbstractDiagnosticBasedMigrationInspection<T : KtElement>(
|
|||||||
.singleOrNull()
|
.singleOrNull()
|
||||||
?: error("Must have one diagnostic")
|
?: error("Must have one diagnostic")
|
||||||
|
|
||||||
val intentionAction = (if (customIntentionFactory != null)
|
val intentionAction = if (customIntentionFactory != null)
|
||||||
customIntentionFactory.invoke(diagnostic)
|
customIntentionFactory.invoke(diagnostic) ?: return
|
||||||
else
|
else
|
||||||
actionsFactory.createActions(diagnostic).singleOrNull())
|
actionsFactory.createActions(diagnostic).ifEmpty { return }.singleOrNull() ?: error("Must have one fix")
|
||||||
?: error("Must have one fix")
|
|
||||||
|
|
||||||
val text = descriptionMessage() ?: DefaultErrorMessages.render(diagnostic)
|
val text = descriptionMessage() ?: DefaultErrorMessages.render(diagnostic)
|
||||||
problemDescriptors.add(
|
problemDescriptors.add(
|
||||||
|
|||||||
+6
@@ -0,0 +1,6 @@
|
|||||||
|
// LANGUAGE_VERSION: 1.4
|
||||||
|
// PROBLEM: none
|
||||||
|
|
||||||
|
var vgs: Int
|
||||||
|
get() = 0
|
||||||
|
set(value<caret>) {}
|
||||||
+5
@@ -13337,6 +13337,11 @@ public class LocalInspectionTestGenerated extends AbstractLocalInspectionTest {
|
|||||||
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("idea/testData/inspectionsLocal/warningOnMainUnusedParameterMigration"), Pattern.compile("^([\\w\\-_]+)\\.(kt|kts)$"), null, true);
|
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("idea/testData/inspectionsLocal/warningOnMainUnusedParameterMigration"), Pattern.compile("^([\\w\\-_]+)\\.(kt|kts)$"), null, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("notApplicable.kt")
|
||||||
|
public void testNotApplicable() throws Exception {
|
||||||
|
runTest("idea/testData/inspectionsLocal/warningOnMainUnusedParameterMigration/notApplicable.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("simple.kt")
|
@TestMetadata("simple.kt")
|
||||||
public void testSimple() throws Exception {
|
public void testSimple() throws Exception {
|
||||||
runTest("idea/testData/inspectionsLocal/warningOnMainUnusedParameterMigration/simple.kt");
|
runTest("idea/testData/inspectionsLocal/warningOnMainUnusedParameterMigration/simple.kt");
|
||||||
|
|||||||
Reference in New Issue
Block a user