FIR: set substituteTypes value explicitly in some lookupSupertypes calls

This commit is contained in:
Mikhail Glukhikh
2021-10-19 12:50:35 +03:00
parent 7fc19520a5
commit 3483bc41fd
3 changed files with 6 additions and 3 deletions
@@ -218,7 +218,8 @@ object FirInlineClassDeclarationChecker : FirRegularClassChecker() {
private fun FirRegularClass.isSubtypeOfCloneable(session: FirSession): Boolean {
if (classId.isCloneableId()) return true
return lookupSuperTypes(this, lookupInterfaces = true, deep = true, session).any { superType ->
return lookupSuperTypes(this, lookupInterfaces = true, deep = true, session, substituteTypes = false).any { superType ->
// Note: We check just classId here, so type substitution isn't needed ^ (we aren't interested in type arguments)
(superType as? ConeClassLikeType)?.fullyExpandedType(session)?.lookupTag?.classId?.isCloneableId() == true
}
}
@@ -237,7 +237,8 @@ abstract class FirVisibilityChecker : FirSessionComponent {
private fun FirClass.isSubClass(ownerLookupTag: ConeClassLikeLookupTag, session: FirSession): Boolean {
if (classId.isSame(ownerLookupTag.classId)) return true
return lookupSuperTypes(this, lookupInterfaces = true, deep = true, session).any { superType ->
return lookupSuperTypes(this, lookupInterfaces = true, deep = true, session, substituteTypes = false).any { superType ->
// Note: We check just classId here, so type substitution isn't needed ^ (we aren't interested in type arguments)
(superType as? ConeClassLikeType)?.fullyExpandedType(session)?.lookupTag?.classId?.isSame(ownerLookupTag.classId) == true
}
}
@@ -251,7 +251,8 @@ private fun FirRegularClass.getSingleAbstractMethodOrNull(
private fun FirRegularClass.computeSamCandidateNames(session: FirSession): Set<Name> {
val classes =
lookupSuperTypes(this, lookupInterfaces = true, deep = true, useSiteSession = session)
// Note: we search only for names in this function, so substitution is not needed V
lookupSuperTypes(this, lookupInterfaces = true, deep = true, useSiteSession = session, substituteTypes = false)
.mapNotNullTo(mutableListOf(this)) {
(session.symbolProvider.getSymbolByLookupTag(it.lookupTag) as? FirRegularClassSymbol)?.fir
}