diff --git a/idea/idea-completion/testData/smart/EA70945.kt b/idea/idea-completion/testData/smart/EA70945.kt new file mode 100644 index 00000000000..1673544f07d --- /dev/null +++ b/idea/idea-completion/testData/smart/EA70945.kt @@ -0,0 +1,9 @@ +class A { + val foo: Int = 0 +} + +fun f() { + A().foo() +} + +// NUMBER: 0 diff --git a/idea/idea-completion/tests/org/jetbrains/kotlin/idea/completion/test/JvmSmartCompletionTestGenerated.java b/idea/idea-completion/tests/org/jetbrains/kotlin/idea/completion/test/JvmSmartCompletionTestGenerated.java index 0ebb61cdc50..c73e6aba160 100644 --- a/idea/idea-completion/tests/org/jetbrains/kotlin/idea/completion/test/JvmSmartCompletionTestGenerated.java +++ b/idea/idea-completion/tests/org/jetbrains/kotlin/idea/completion/test/JvmSmartCompletionTestGenerated.java @@ -113,6 +113,12 @@ public class JvmSmartCompletionTestGenerated extends AbstractJvmSmartCompletionT doTest(fileName); } + @TestMetadata("EA70945.kt") + public void testEA70945() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("idea/idea-completion/testData/smart/EA70945.kt"); + doTest(fileName); + } + @TestMetadata("EmptyPrefix.kt") public void testEmptyPrefix() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("idea/idea-completion/testData/smart/EmptyPrefix.kt"); diff --git a/idea/idea-core/src/org/jetbrains/kotlin/idea/core/ExpectedInfos.kt b/idea/idea-core/src/org/jetbrains/kotlin/idea/core/ExpectedInfos.kt index bf4d0c2db34..53c79913905 100644 --- a/idea/idea-core/src/org/jetbrains/kotlin/idea/core/ExpectedInfos.kt +++ b/idea/idea-core/src/org/jetbrains/kotlin/idea/core/ExpectedInfos.kt @@ -188,6 +188,8 @@ class ExpectedInfos( private fun calculateForArgument(callElement: KtCallElement, argument: ValueArgument): Collection? { val call = callElement.getCall(bindingContext) ?: return null + // sometimes we get wrong call (see testEA70945) TODO: refactor resolve so that it does not happen + if (call.callElement != callElement) return null return calculateForArgument(call, argument) }