Internal Kotlin packages now should be completable in parent packages

Internal packages which are hard-excluded from completion and
 imports now should be visible there if file package are parent of
 excluded one
 e.g kotlin.jvm.internal.* now visible from kotlin and kotlin.jvm
 #KT-16214 fixed
This commit is contained in:
Simon Ogorodnik
2017-03-03 16:11:21 +03:00
parent 27bf51c73f
commit 3bf7223448
9 changed files with 62 additions and 8 deletions
@@ -153,7 +153,8 @@ abstract class CompletionSession(
searchScope,
filter,
filterOutPrivate = !mayIncludeInaccessible,
declarationTranslator = { toFromOriginalFileMapper.toSyntheticFile(it) })
declarationTranslator = { toFromOriginalFileMapper.toSyntheticFile(it) },
file = file)
}
private fun isVisibleDescriptor(descriptor: DeclarationDescriptor, completeNonAccessible: Boolean): Boolean {
@@ -169,7 +170,7 @@ abstract class CompletionSession(
return completeNonAccessible && (!descriptor.isFromLibrary() || isDebuggerContext)
}
if (descriptor.isExcludedFromAutoImport(project)) return false
if (descriptor.isExcludedFromAutoImport(project, file)) return false
return true
}
@@ -0,0 +1,7 @@
package kotlin
fun some() {
kotlin.jvm.<caret>
}
// EXIST: internal
@@ -2789,6 +2789,12 @@ public class JvmBasicCompletionTestGenerated extends AbstractJvmBasicCompletionT
doTest(fileName);
}
@TestMetadata("CompletionForExcludedWhenInternalUse.kt")
public void testCompletionForExcludedWhenInternalUse() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/idea-completion/testData/basic/java/CompletionForExcludedWhenInternalUse.kt");
doTest(fileName);
}
@TestMetadata("ExtensionFromStandardLibrary.kt")
public void testExtensionFromStandardLibrary() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/idea-completion/testData/basic/java/ExtensionFromStandardLibrary.kt");