Fixed KT-6056 Smart completion does not filter out inaccessible declarations
#KT-6056
This commit is contained in:
@@ -209,7 +209,7 @@ class SmartCompletionSession(configuration: CompletionSessionConfiguration, para
|
||||
val filter = result.declarationFilter
|
||||
if (filter != null) {
|
||||
TipsManager.getReferenceVariants(jetReference.expression, bindingContext!!)
|
||||
.forEach { collector.addElements(filter(it)) }
|
||||
.forEach { if (isVisibleDescriptor(it)) collector.addElements(filter(it)) }
|
||||
|
||||
flushToResultSet()
|
||||
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
class A {
|
||||
public val publicVal: Int = 1
|
||||
protected val protectedVal: Int = 2
|
||||
private val privateVal: Int = 3
|
||||
|
||||
public fun publicFun(): Int = 4
|
||||
private fun privateFun() = 5
|
||||
}
|
||||
|
||||
val p: Int = A().p<caret>
|
||||
|
||||
// EXIST: publicVal
|
||||
// ABSENT: protectedVal
|
||||
// ABSENT: privateVal
|
||||
// EXIST: publicFun
|
||||
// ABSENT: privateFun
|
||||
@@ -342,6 +342,12 @@ public class JvmSmartCompletionTestGenerated extends AbstractJvmSmartCompletionT
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("InaccessibleDeclarations.kt")
|
||||
public void testInaccessibleDeclarations() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("idea/testData/completion/smart/InaccessibleDeclarations.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("InfixCall.kt")
|
||||
public void testInfixCall() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("idea/testData/completion/smart/InfixCall.kt");
|
||||
|
||||
Reference in New Issue
Block a user