Fix bug with member extensions with explicit receiver
Co-authored-by: Ilya Kirillov <ilya.kirillov@jetbrains.com>
This commit is contained in:
committed by
Ilya Kirillov
parent
df03e31b86
commit
a2cf01162e
+11
@@ -0,0 +1,11 @@
|
||||
class A {
|
||||
fun Int.intExtFun() {}
|
||||
val Int.intExtVal: Int get() = 0
|
||||
}
|
||||
|
||||
fun usage() {
|
||||
A().<caret>
|
||||
}
|
||||
|
||||
// ABSENT: intExtFun
|
||||
// ABSENT: intExtVal
|
||||
+6
@@ -2,6 +2,9 @@ class A {
|
||||
fun aa() {}
|
||||
val aaa = 10
|
||||
|
||||
fun Int.extFun() {}
|
||||
fun Int.extVal() {}
|
||||
|
||||
fun test() {
|
||||
<caret>
|
||||
}
|
||||
@@ -9,3 +12,6 @@ class A {
|
||||
|
||||
// EXIST: aa
|
||||
// EXIST: aaa
|
||||
// ESIST: test
|
||||
// ABSENT: extFun
|
||||
// ABSENT: extVal
|
||||
Vendored
+2
-5
@@ -5,13 +5,10 @@ class A {
|
||||
|
||||
fun A.run(action: A.() -> Unit) {}
|
||||
|
||||
fun test(a: A) {
|
||||
fun test() {
|
||||
val a = A()
|
||||
a.run {
|
||||
|
||||
<caret>
|
||||
|
||||
// remove this
|
||||
Unit
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+5
@@ -2227,6 +2227,11 @@ public class JSBasicCompletionTestGenerated extends AbstractJSBasicCompletionTes
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("idea/idea-completion/testData/basic/common/primitiveCompletion"), Pattern.compile("^(.+)\\.kt$"), null, true);
|
||||
}
|
||||
|
||||
@TestMetadata("classExtensionFunctionExplicitReceiver.kt")
|
||||
public void testClassExtensionFunctionExplicitReceiver() throws Exception {
|
||||
runTest("idea/idea-completion/testData/basic/common/primitiveCompletion/classExtensionFunctionExplicitReceiver.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("classFieldsAndFunctions.kt")
|
||||
public void testClassFieldsAndFunctions() throws Exception {
|
||||
runTest("idea/idea-completion/testData/basic/common/primitiveCompletion/classFieldsAndFunctions.kt");
|
||||
|
||||
+5
@@ -2227,6 +2227,11 @@ public class JvmBasicCompletionTestGenerated extends AbstractJvmBasicCompletionT
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("idea/idea-completion/testData/basic/common/primitiveCompletion"), Pattern.compile("^(.+)\\.kt$"), null, true);
|
||||
}
|
||||
|
||||
@TestMetadata("classExtensionFunctionExplicitReceiver.kt")
|
||||
public void testClassExtensionFunctionExplicitReceiver() throws Exception {
|
||||
runTest("idea/idea-completion/testData/basic/common/primitiveCompletion/classExtensionFunctionExplicitReceiver.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("classFieldsAndFunctions.kt")
|
||||
public void testClassFieldsAndFunctions() throws Exception {
|
||||
runTest("idea/idea-completion/testData/basic/common/primitiveCompletion/classFieldsAndFunctions.kt");
|
||||
|
||||
+2
-1
@@ -79,7 +79,8 @@ private object KotlinFirCompletionProvider : CompletionProvider<CompletionParame
|
||||
val typeContext = completionContext.session.typeContext
|
||||
|
||||
if (explicitReceiverScope != null) {
|
||||
yieldAll(explicitReceiverScope.collectCallableSymbols(packageIndexHelper))
|
||||
val nonExtensionMembers = explicitReceiverScope.collectCallableSymbols(packageIndexHelper).filter { !it.isExtension }
|
||||
yieldAll(nonExtensionMembers)
|
||||
|
||||
val allApplicableExtensions = allNonExplicitScopes
|
||||
.flatMap { it.collectCallableSymbols(packageIndexHelper) }
|
||||
|
||||
Reference in New Issue
Block a user