Temporary fix for problem with ownerDescriptor in ImportingScope
This commit is contained in:
@@ -22,7 +22,10 @@ import org.jetbrains.kotlin.name.Name
|
|||||||
import org.jetbrains.kotlin.utils.Printer
|
import org.jetbrains.kotlin.utils.Printer
|
||||||
import org.jetbrains.kotlin.utils.addToStdlib.firstIsInstanceOrNull
|
import org.jetbrains.kotlin.utils.addToStdlib.firstIsInstanceOrNull
|
||||||
|
|
||||||
public class ExplicitImportsScope(private val descriptors: Collection<DeclarationDescriptor>) : ImportingScope by ImportingScope.Empty {
|
public class ExplicitImportsScope(
|
||||||
|
private val descriptors: Collection<DeclarationDescriptor>,
|
||||||
|
override val ownerDescriptor: DeclarationDescriptor //TODO: temporary?
|
||||||
|
) : ImportingScope by ImportingScope.Empty {
|
||||||
override fun getContributedClassifier(name: Name, location: LookupLocation)
|
override fun getContributedClassifier(name: Name, location: LookupLocation)
|
||||||
= descriptors.filter { it.getName() == name }.firstIsInstanceOrNull<ClassifierDescriptor>()
|
= descriptors.filter { it.getName() == name }.firstIsInstanceOrNull<ClassifierDescriptor>()
|
||||||
|
|
||||||
|
|||||||
@@ -191,7 +191,7 @@ public class ShadowedDeclarationsFilter private constructor(
|
|||||||
var scope = context.getResolutionScope(bindingContext, resolutionFacade)
|
var scope = context.getResolutionScope(bindingContext, resolutionFacade)
|
||||||
|
|
||||||
if (descriptorsToImport.isNotEmpty()) {
|
if (descriptorsToImport.isNotEmpty()) {
|
||||||
scope = scope.addImportScope(ExplicitImportsScope(descriptorsToImport))
|
scope = scope.addImportScope(ExplicitImportsScope(descriptorsToImport, scope.ownerDescriptor))
|
||||||
}
|
}
|
||||||
|
|
||||||
val dataFlowInfo = bindingContext.getDataFlowInfo(context)
|
val dataFlowInfo = bindingContext.getDataFlowInfo(context)
|
||||||
|
|||||||
+1
-1
@@ -207,7 +207,7 @@ object ReplaceWithAnnotationAnalyzer {
|
|||||||
private fun buildExplicitImportsScope(annotation: ReplaceWith, resolutionFacade: ResolutionFacade, module: ModuleDescriptor): ExplicitImportsScope {
|
private fun buildExplicitImportsScope(annotation: ReplaceWith, resolutionFacade: ResolutionFacade, module: ModuleDescriptor): ExplicitImportsScope {
|
||||||
val importedSymbols = importFqNames(annotation)
|
val importedSymbols = importFqNames(annotation)
|
||||||
.flatMap { resolutionFacade.resolveImportReference(module, it) }
|
.flatMap { resolutionFacade.resolveImportReference(module, it) }
|
||||||
return ExplicitImportsScope(importedSymbols)
|
return ExplicitImportsScope(importedSymbols, module)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun importFqNames(annotation: ReplaceWith): List<FqName> {
|
private fun importFqNames(annotation: ReplaceWith): List<FqName> {
|
||||||
|
|||||||
Reference in New Issue
Block a user