Light Classes: Fix origin search for KtLightSuperTypeReference

Use analyzeFully() when resolving super type references
This commit is contained in:
Alexey Sedunov
2017-03-27 15:36:03 +03:00
parent b6a26aa732
commit 72436c1738
4 changed files with 8 additions and 1 deletions
@@ -153,6 +153,8 @@ class CliLightClassGenerationSupport(project: Project) : LightClassGenerationSup
override fun analyze(element: KtElement) = bindingContext
override fun analyzeFully(element: KtElement) = bindingContext
override fun getFacadeClasses(facadeFqName: FqName, scope: GlobalSearchScope): Collection<PsiClass> {
val filesForFacade = findFilesForFacade(facadeFqName, scope)
if (filesForFacade.isEmpty()) return emptyList()
@@ -65,6 +65,8 @@ abstract class LightClassGenerationSupport {
abstract fun analyze(element: KtElement): BindingContext
abstract fun analyzeFully(element: KtElement): BindingContext
abstract fun getFacadeClasses(facadeFqName: FqName, scope: GlobalSearchScope): Collection<PsiClass>
abstract fun getMultifilePartClasses(partFqName: FqName, scope: GlobalSearchScope): Collection<PsiClass>
@@ -44,7 +44,7 @@ class KtLightPsiReferenceList (
override val kotlinOrigin by lazyPub {
val superTypeList = this@KtLightPsiReferenceList.kotlinOrigin ?: return@lazyPub null
val fqNameToFind = clsDelegate.qualifiedName ?: return@lazyPub null
val context = LightClassGenerationSupport.getInstance(project).analyze(superTypeList)
val context = LightClassGenerationSupport.getInstance(project).analyzeFully(superTypeList)
superTypeList.entries.firstOrNull {
val referencedType = context[BindingContext.TYPE, it.typeReference]
referencedType?.constructor?.declarationDescriptor?.fqNameUnsafe?.asString() == fqNameToFind