From a89c07924daebb346a3fa43c2bd4790174bb938f Mon Sep 17 00:00:00 2001 From: Valentin Kipyatkov Date: Tue, 18 Nov 2014 14:44:35 +0300 Subject: [PATCH] Partial body resolve: fixed bug --- .../jet/lang/resolve/lazy/PartialBodyResolveFilter.kt | 2 +- .../resolve/partialBodyResolve/BangBangInIfCondition.dump | 3 +++ .../resolve/partialBodyResolve/BangBangInIfCondition.kt | 7 +++++++ .../jet/resolve/PartialBodyResolveTestGenerated.java | 6 ++++++ 4 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 idea/testData/resolve/partialBodyResolve/BangBangInIfCondition.dump create mode 100644 idea/testData/resolve/partialBodyResolve/BangBangInIfCondition.kt diff --git a/idea/ide-common/src/org/jetbrains/jet/lang/resolve/lazy/PartialBodyResolveFilter.kt b/idea/ide-common/src/org/jetbrains/jet/lang/resolve/lazy/PartialBodyResolveFilter.kt index e830bd390c7..561549959ae 100644 --- a/idea/ide-common/src/org/jetbrains/jet/lang/resolve/lazy/PartialBodyResolveFilter.kt +++ b/idea/ide-common/src/org/jetbrains/jet/lang/resolve/lazy/PartialBodyResolveFilter.kt @@ -141,7 +141,7 @@ class PartialBodyResolveFilter(elementToResolve: JetElement, private val body: J } } - condition.acceptChildren(this) + condition.accept(this) if (thenBranch != null && elseBranch != null) { val thenCasts = potentialSmartCastPlaces(thenBranch, filter) diff --git a/idea/testData/resolve/partialBodyResolve/BangBangInIfCondition.dump b/idea/testData/resolve/partialBodyResolve/BangBangInIfCondition.dump new file mode 100644 index 00000000000..514abfa40ed --- /dev/null +++ b/idea/testData/resolve/partialBodyResolve/BangBangInIfCondition.dump @@ -0,0 +1,3 @@ +Resolve target: value-parameter val p: kotlin.Boolean? smart-casted to kotlin.Boolean +Skipped statements: +print(p1!!.hashCode()) diff --git a/idea/testData/resolve/partialBodyResolve/BangBangInIfCondition.kt b/idea/testData/resolve/partialBodyResolve/BangBangInIfCondition.kt new file mode 100644 index 00000000000..2416d371c67 --- /dev/null +++ b/idea/testData/resolve/partialBodyResolve/BangBangInIfCondition.kt @@ -0,0 +1,7 @@ +fun foo(p: Boolean?, p1: Any?) { + if (p!!) { + print(p1!!.hashCode()) + } + + p.hashCode() +} \ No newline at end of file diff --git a/idea/tests/org/jetbrains/jet/resolve/PartialBodyResolveTestGenerated.java b/idea/tests/org/jetbrains/jet/resolve/PartialBodyResolveTestGenerated.java index 05c67cb8214..2ae898ce38a 100644 --- a/idea/tests/org/jetbrains/jet/resolve/PartialBodyResolveTestGenerated.java +++ b/idea/tests/org/jetbrains/jet/resolve/PartialBodyResolveTestGenerated.java @@ -48,6 +48,12 @@ public class PartialBodyResolveTestGenerated extends AbstractPartialBodyResolveT doTest(fileName); } + @TestMetadata("BangBangInIfCondition.kt") + public void testBangBangInIfCondition() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/resolve/partialBodyResolve/BangBangInIfCondition.kt"); + doTest(fileName); + } + @TestMetadata("DeclarationsBefore.kt") public void testDeclarationsBefore() throws Exception { String fileName = JetTestUtils.navigationMetadata("idea/testData/resolve/partialBodyResolve/DeclarationsBefore.kt");