diff --git a/idea/src/org/jetbrains/kotlin/idea/inspections/RemoveRedundantQualifierNameInspection.kt b/idea/src/org/jetbrains/kotlin/idea/inspections/RemoveRedundantQualifierNameInspection.kt index 931fe885310..73705b84a94 100644 --- a/idea/src/org/jetbrains/kotlin/idea/inspections/RemoveRedundantQualifierNameInspection.kt +++ b/idea/src/org/jetbrains/kotlin/idea/inspections/RemoveRedundantQualifierNameInspection.kt @@ -124,7 +124,7 @@ class RemoveRedundantQualifierNameQuickFix : LocalQuickFix { override fun applyFix(project: Project, descriptor: ProblemDescriptor) { val file = descriptor.psiElement.containingFile as KtFile val range = when (val element = descriptor.psiElement) { - is KtUserType -> IntRange(element.startOffset, element.referenceExpression?.endOffset ?: return) + is KtUserType -> IntRange(element.startOffset, element.endOffset) is KtDotQualifiedExpression -> IntRange( element.startOffset, element.getLastParentOfTypeInRowWithSelf()?.getQualifiedElementSelector()?.endOffset ?: return diff --git a/idea/testData/inspectionsLocal/removeRedundantQualifierName/userTypeWithTypeParameter.kt b/idea/testData/inspectionsLocal/removeRedundantQualifierName/userTypeWithTypeParameter.kt new file mode 100644 index 00000000000..1a9577b5b30 --- /dev/null +++ b/idea/testData/inspectionsLocal/removeRedundantQualifierName/userTypeWithTypeParameter.kt @@ -0,0 +1,5 @@ +// WITH_RUNTIME + +fun main() { + val a: kotlin.Pair +} diff --git a/idea/testData/inspectionsLocal/removeRedundantQualifierName/userTypeWithTypeParameter.kt.after b/idea/testData/inspectionsLocal/removeRedundantQualifierName/userTypeWithTypeParameter.kt.after new file mode 100644 index 00000000000..ac49ab150dc --- /dev/null +++ b/idea/testData/inspectionsLocal/removeRedundantQualifierName/userTypeWithTypeParameter.kt.after @@ -0,0 +1,5 @@ +// WITH_RUNTIME + +fun main() { + val a: Pair +} diff --git a/idea/testData/inspectionsLocal/removeRedundantQualifierName/withTypeParameter.kt b/idea/testData/inspectionsLocal/removeRedundantQualifierName/withTypeParameter.kt new file mode 100644 index 00000000000..0199de5e21b --- /dev/null +++ b/idea/testData/inspectionsLocal/removeRedundantQualifierName/withTypeParameter.kt @@ -0,0 +1,5 @@ +// WITH_RUNTIME + +fun main() { + kotlin.Pair(1, 1) +} diff --git a/idea/testData/inspectionsLocal/removeRedundantQualifierName/withTypeParameter.kt.after b/idea/testData/inspectionsLocal/removeRedundantQualifierName/withTypeParameter.kt.after new file mode 100644 index 00000000000..68e0c7d917f --- /dev/null +++ b/idea/testData/inspectionsLocal/removeRedundantQualifierName/withTypeParameter.kt.after @@ -0,0 +1,5 @@ +// WITH_RUNTIME + +fun main() { + Pair(1, 1) +} diff --git a/idea/tests/org/jetbrains/kotlin/idea/inspections/LocalInspectionTestGenerated.java b/idea/tests/org/jetbrains/kotlin/idea/inspections/LocalInspectionTestGenerated.java index baa55dfd5e4..6d286b4f8c7 100644 --- a/idea/tests/org/jetbrains/kotlin/idea/inspections/LocalInspectionTestGenerated.java +++ b/idea/tests/org/jetbrains/kotlin/idea/inspections/LocalInspectionTestGenerated.java @@ -6469,6 +6469,16 @@ public class LocalInspectionTestGenerated extends AbstractLocalInspectionTest { public void testTypeWithRuntime() throws Exception { runTest("idea/testData/inspectionsLocal/removeRedundantQualifierName/typeWithRuntime.kt"); } + + @TestMetadata("userTypeWithTypeParameter.kt") + public void testUserTypeWithTypeParameter() throws Exception { + runTest("idea/testData/inspectionsLocal/removeRedundantQualifierName/userTypeWithTypeParameter.kt"); + } + + @TestMetadata("withTypeParameter.kt") + public void testWithTypeParameter() throws Exception { + runTest("idea/testData/inspectionsLocal/removeRedundantQualifierName/withTypeParameter.kt"); + } } @TestMetadata("idea/testData/inspectionsLocal/removeRedundantSpreadOperator")