DeprecatedSymbolUsageFix: fixed bug with symbols from root package not imported

This commit is contained in:
Valentin Kipyatkov
2015-05-22 11:46:41 +03:00
parent 97d3620262
commit be9a3d10f6
8 changed files with 41 additions and 5 deletions
@@ -72,11 +72,12 @@ public class KotlinCacheService(val project: Project) {
return cache.getLazyResolveSession(file).getScopeProvider().getFileScope(file)
}
override fun resolveImportReference(file: JetFile, fqName: FqName): Collection<DeclarationDescriptor> {
override fun resolveImportReference(file: JetFile, fqName: FqName, isDefaultImport: Boolean): Collection<DeclarationDescriptor> {
val importDirective = JetPsiFactory(project).createImportDirective(ImportPath(fqName, false))
val moduleDescriptor = findModuleDescriptor(file)
val scope = JetModuleUtil.getSubpackagesOfRootScope(moduleDescriptor)
val resolver = cache.getLazyResolveSession(file).getQualifiedExpressionResolver()
val resolveSession = cache.getLazyResolveSession(file)
val scope = JetModuleUtil.getImportsResolutionScope(moduleDescriptor, !isDefaultImport)
val resolver = resolveSession.getQualifiedExpressionResolver()
return resolver.processImportReference(
importDirective, scope, scope, BindingTraceContext(), QualifiedExpressionResolver.LookupMode.EVERYTHING).getAllDescriptors()
}
@@ -38,7 +38,7 @@ public trait ResolutionFacade {
public fun getFileTopLevelScope(file: JetFile): JetScope
//TODO: better pass ModuleDescriptor here
public fun resolveImportReference(file: JetFile, fqName: FqName): Collection<DeclarationDescriptor>
public fun resolveImportReference(file: JetFile, fqName: FqName, isDefaultImport: Boolean = false): Collection<DeclarationDescriptor>
public fun findModuleDescriptor(element: JetElement): ModuleDescriptor