From 966da0b03f096c84836c342c2fea590e0c1a34d5 Mon Sep 17 00:00:00 2001 From: "Pavel V. Talanov" Date: Wed, 16 Jul 2014 21:12:53 +0400 Subject: [PATCH] Fix ConvertAssertToIfWithThrowIntention to not invoke ShortenReferences on file created by JetPsiFactory #KT-5476 Fixed --- .../ConvertAssertToIfWithThrowIntention.kt | 42 ++++++++++++------- .../assertErrorOverloaded.kt | 7 +++- .../assertErrorOverloaded.kt.after | 9 +++- 3 files changed, 40 insertions(+), 18 deletions(-) diff --git a/idea/src/org/jetbrains/jet/plugin/intentions/ConvertAssertToIfWithThrowIntention.kt b/idea/src/org/jetbrains/jet/plugin/intentions/ConvertAssertToIfWithThrowIntention.kt index 6bcf056bd69..6fea99b3253 100644 --- a/idea/src/org/jetbrains/jet/plugin/intentions/ConvertAssertToIfWithThrowIntention.kt +++ b/idea/src/org/jetbrains/jet/plugin/intentions/ConvertAssertToIfWithThrowIntention.kt @@ -29,6 +29,8 @@ import org.jetbrains.jet.lang.types.lang.KotlinBuiltIns import org.jetbrains.jet.lang.psi.JetIfExpression import org.jetbrains.jet.lang.psi.JetDotQualifiedExpression import org.jetbrains.jet.lang.resolve.bindingContextUtil.getResolvedCall +import org.jetbrains.jet.lang.psi.JetBlockExpression +import org.jetbrains.jet.lang.psi.JetThrowExpression public class ConvertAssertToIfWithThrowIntention : JetSelfTargetingIntention( "convert.assert.to.if.with.throw", javaClass()) { @@ -57,6 +59,13 @@ public class ConvertAssertToIfWithThrowIntention : JetSelfTargetingIntentionassert(true, "text") } -class AssertionError \ No newline at end of file +class AssertionError + +// WITH_RUNTIME diff --git a/idea/testData/intentions/convertAssertToIf/assertErrorOverloaded.kt.after b/idea/testData/intentions/convertAssertToIf/assertErrorOverloaded.kt.after index 816f615395a..8de87c70cd4 100644 --- a/idea/testData/intentions/convertAssertToIf/assertErrorOverloaded.kt.after +++ b/idea/testData/intentions/convertAssertToIf/assertErrorOverloaded.kt.after @@ -1,8 +1,13 @@ -// WITH_RUNTIME +package a + +import java.lang + fun foo() { if (!true) { throw lang.AssertionError("text") } } -class AssertionError \ No newline at end of file +class AssertionError + +// WITH_RUNTIME