Kapt: asMemberOf() should also check the containing type itself, not only its supertypes (KT-13823)

(cherry picked from commit 9f9ffdf)
This commit is contained in:
Yan Zhulanow
2016-09-15 22:24:50 +03:00
committed by Yan Zhulanow
parent cb9dc21649
commit 415acfbd05
3 changed files with 15 additions and 3 deletions
@@ -250,9 +250,14 @@ class KotlinTypes(
val containingType = containing.psiType
val member = (element as JeElement).psi as? PsiMember ?: return element.asType()
val methodContainingClass = member.containingClass ?: return element.asType()
val memberContainingClass = member.containingClass ?: return element.asType()
val relevantSuperType = if (memberContainingClass == containingType.resolve()) {
containingType
} else {
containingType.superTypes.findSuperType(memberContainingClass) ?: return element.asType()
}
val relevantSuperType = containingType.superTypes.findSuperType(methodContainingClass) ?: return element.asType()
val resolveResult = relevantSuperType.resolveGenerics()
if (!resolveResult.isValidResult) return element.asType()
val substitutor = resolveResult.substitutor