From cb5459b7d7ea664b2fad60a0f15f36acb945796c Mon Sep 17 00:00:00 2001 From: nd Date: Wed, 24 May 2017 15:06:51 +0200 Subject: [PATCH] Don't suggest adding replaceWith in DeprecationLevel.HIDDEN (#1094) #KT-17917 Fixed --- .../DeprecatedCallableAddReplaceWithIntention.kt | 16 +++++++++++++--- .../DeprecationLevelHidden.kt | 6 ++++++ .../idea/intentions/IntentionTestGenerated.java | 6 ++++++ 3 files changed, 25 insertions(+), 3 deletions(-) create mode 100644 idea/testData/intentions/deprecatedCallableAddReplaceWith/DeprecationLevelHidden.kt diff --git a/idea/src/org/jetbrains/kotlin/idea/intentions/DeprecatedCallableAddReplaceWithIntention.kt b/idea/src/org/jetbrains/kotlin/idea/intentions/DeprecatedCallableAddReplaceWithIntention.kt index b52446b3a12..2643b278fea 100644 --- a/idea/src/org/jetbrains/kotlin/idea/intentions/DeprecatedCallableAddReplaceWithIntention.kt +++ b/idea/src/org/jetbrains/kotlin/idea/intentions/DeprecatedCallableAddReplaceWithIntention.kt @@ -37,6 +37,7 @@ import org.jetbrains.kotlin.resolve.BindingContext import org.jetbrains.kotlin.resolve.DescriptorUtils import org.jetbrains.kotlin.resolve.ImportPath import org.jetbrains.kotlin.resolve.calls.callUtil.getResolvedCall +import org.jetbrains.kotlin.resolve.calls.model.ResolvedValueArgument import org.jetbrains.kotlin.resolve.calls.model.isReallySuccess import org.jetbrains.kotlin.resolve.descriptorUtil.isExtension import org.jetbrains.kotlin.types.typeUtil.isUnit @@ -118,9 +119,18 @@ class DeprecatedCallableAddReplaceWithIntention : SelfTargetingRangeIntention@Deprecated("Use the other version", level=DeprecationLevel.HIDDEN) +fun foo(a: Int) { foo(a) } + +fun foo(a: Int, b: Int = 0) { ... } \ No newline at end of file diff --git a/idea/tests/org/jetbrains/kotlin/idea/intentions/IntentionTestGenerated.java b/idea/tests/org/jetbrains/kotlin/idea/intentions/IntentionTestGenerated.java index 4fb3801fb6a..576bd50735b 100644 --- a/idea/tests/org/jetbrains/kotlin/idea/intentions/IntentionTestGenerated.java +++ b/idea/tests/org/jetbrains/kotlin/idea/intentions/IntentionTestGenerated.java @@ -7802,6 +7802,12 @@ public class IntentionTestGenerated extends AbstractIntentionTest { doTest(fileName); } + @TestMetadata("DeprecationLevelHidden.kt") + public void testDeprecationLevelHidden() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/deprecatedCallableAddReplaceWith/DeprecationLevelHidden.kt"); + doTest(fileName); + } + @TestMetadata("ExceptionInPropertyDestructuringEntry.kt") public void testExceptionInPropertyDestructuringEntry() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/deprecatedCallableAddReplaceWith/ExceptionInPropertyDestructuringEntry.kt");