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()
|
||||
?: error("Must have one diagnostic")
|
||||
|
||||
val intentionAction = (if (customIntentionFactory != null)
|
||||
customIntentionFactory.invoke(diagnostic)
|
||||
val intentionAction = if (customIntentionFactory != null)
|
||||
customIntentionFactory.invoke(diagnostic) ?: return
|
||||
else
|
||||
actionsFactory.createActions(diagnostic).singleOrNull())
|
||||
?: error("Must have one fix")
|
||||
actionsFactory.createActions(diagnostic).ifEmpty { return }.singleOrNull() ?: error("Must have one fix")
|
||||
|
||||
val text = descriptionMessage() ?: DefaultErrorMessages.render(diagnostic)
|
||||
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);
|
||||
}
|
||||
|
||||
@TestMetadata("notApplicable.kt")
|
||||
public void testNotApplicable() throws Exception {
|
||||
runTest("idea/testData/inspectionsLocal/warningOnMainUnusedParameterMigration/notApplicable.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("simple.kt")
|
||||
public void testSimple() throws Exception {
|
||||
runTest("idea/testData/inspectionsLocal/warningOnMainUnusedParameterMigration/simple.kt");
|
||||
|
||||
Reference in New Issue
Block a user