Prioritize resolution anchors during resolution

When required dependency is present both in source dependencies and in
library dependencies, the former one should be selected.

#KT-24309
This commit is contained in:
Pavel Kirpichenkov
2020-07-24 12:21:30 +03:00
parent f8ee976720
commit 24d8aee2bb
2 changed files with 11 additions and 12 deletions
@@ -237,9 +237,9 @@ class QualifiedExpressionResolver(val languageVersionSettings: LanguageVersionSe
if (!languageVersionSettings.isLibraryToSourceAnalysisEnabled) return primaryImportingScope
val resolutionAnchor = moduleDescriptor.getResolutionAnchorIfAny() ?: return primaryImportingScope
val secondaryImportingScope = processReferenceInContextOf(resolutionAnchor) ?: return primaryImportingScope
if (primaryImportingScope == null) return secondaryImportingScope
return CompositePrioritizedImportingScope(primaryImportingScope, secondaryImportingScope)
val anchorImportingScope = processReferenceInContextOf(resolutionAnchor) ?: return primaryImportingScope
if (primaryImportingScope == null) return anchorImportingScope
return CompositePrioritizedImportingScope(anchorImportingScope, primaryImportingScope)
}
private fun doProcessImportReference(