KT-12793 Code completion doesn't suggest abstract protected extension methods
#KT-12793 Fixed
This commit is contained in:
@@ -0,0 +1,9 @@
|
|||||||
|
abstract class ProtectedTest {
|
||||||
|
fun foo() {
|
||||||
|
"".<caret>
|
||||||
|
}
|
||||||
|
|
||||||
|
abstract protected fun String.bar()
|
||||||
|
}
|
||||||
|
|
||||||
|
// EXIST: bar
|
||||||
+6
@@ -649,6 +649,12 @@ public class JSBasicCompletionTestGenerated extends AbstractJSBasicCompletionTes
|
|||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("ProtectedExtensionMethod.kt")
|
||||||
|
public void testProtectedExtensionMethod() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("idea/idea-completion/testData/basic/common/ProtectedExtensionMethod.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("QualifiedSuperMembers.kt")
|
@TestMetadata("QualifiedSuperMembers.kt")
|
||||||
public void testQualifiedSuperMembers() throws Exception {
|
public void testQualifiedSuperMembers() throws Exception {
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("idea/idea-completion/testData/basic/common/QualifiedSuperMembers.kt");
|
String fileName = KotlinTestUtils.navigationMetadata("idea/idea-completion/testData/basic/common/QualifiedSuperMembers.kt");
|
||||||
|
|||||||
+6
@@ -649,6 +649,12 @@ public class JvmBasicCompletionTestGenerated extends AbstractJvmBasicCompletionT
|
|||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("ProtectedExtensionMethod.kt")
|
||||||
|
public void testProtectedExtensionMethod() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("idea/idea-completion/testData/basic/common/ProtectedExtensionMethod.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("QualifiedSuperMembers.kt")
|
@TestMetadata("QualifiedSuperMembers.kt")
|
||||||
public void testQualifiedSuperMembers() throws Exception {
|
public void testQualifiedSuperMembers() throws Exception {
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("idea/idea-completion/testData/basic/common/QualifiedSuperMembers.kt");
|
String fileName = KotlinTestUtils.navigationMetadata("idea/idea-completion/testData/basic/common/QualifiedSuperMembers.kt");
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ import org.jetbrains.kotlin.lexer.KtModifierKeywordToken
|
|||||||
import org.jetbrains.kotlin.lexer.KtTokens
|
import org.jetbrains.kotlin.lexer.KtTokens
|
||||||
import org.jetbrains.kotlin.psi.KtExpression
|
import org.jetbrains.kotlin.psi.KtExpression
|
||||||
import org.jetbrains.kotlin.resolve.BindingContext
|
import org.jetbrains.kotlin.resolve.BindingContext
|
||||||
|
import org.jetbrains.kotlin.resolve.descriptorUtil.isExtension
|
||||||
import org.jetbrains.kotlin.resolve.DescriptorUtils
|
import org.jetbrains.kotlin.resolve.DescriptorUtils
|
||||||
import org.jetbrains.kotlin.resolve.OverridingUtil
|
import org.jetbrains.kotlin.resolve.OverridingUtil
|
||||||
import org.jetbrains.kotlin.resolve.findOriginalTopMostOverriddenDescriptors
|
import org.jetbrains.kotlin.resolve.findOriginalTopMostOverriddenDescriptors
|
||||||
@@ -62,7 +63,8 @@ private fun DeclarationDescriptorWithVisibility.isVisible(
|
|||||||
|
|
||||||
if (bindingContext == null || resolutionScope == null) return false
|
if (bindingContext == null || resolutionScope == null) return false
|
||||||
|
|
||||||
if (receiverExpression != null) {
|
// for extension it makes no sense to check explicit receiver because we need dispatch receiver which is implicit in this case
|
||||||
|
if (receiverExpression != null && !isExtension) {
|
||||||
val receiverType = bindingContext.getType(receiverExpression) ?: return false
|
val receiverType = bindingContext.getType(receiverExpression) ?: return false
|
||||||
val explicitReceiver = ExpressionReceiver.create(receiverExpression, receiverType, bindingContext)
|
val explicitReceiver = ExpressionReceiver.create(receiverExpression, receiverType, bindingContext)
|
||||||
return Visibilities.isVisible(explicitReceiver, this, from)
|
return Visibilities.isVisible(explicitReceiver, this, from)
|
||||||
|
|||||||
Reference in New Issue
Block a user