FIR: unwrap intersection overrides when looking for owner class

But not substitution overrides! This is important if the method called
is an intersection override where one of the intersected types is a
subtype of a generic type.
This commit is contained in:
pyos
2022-10-07 11:40:23 +02:00
committed by Space Team
parent 9f65c6022c
commit e2a83a0ed0
5 changed files with 58 additions and 7 deletions
@@ -148,9 +148,12 @@ abstract class FirVisibilityChecker : FirSessionComponent {
): FirClassLikeDeclaration? {
return when (this) {
is FirCallableDeclaration -> {
if (dispatchReceiverValue != null && dispatchReceiverType != null) {
dispatchReceiverValue.type.findClassRepresentation(dispatchReceiverType!!, session)?.toSymbol(session)?.fir?.let {
return it
if (dispatchReceiverValue != null) {
val baseReceiverType = dispatchReceiverClassTypeOrNull()
if (baseReceiverType != null) {
dispatchReceiverValue.type.findClassRepresentation(baseReceiverType, session)?.toSymbol(session)?.fir?.let {
return it
}
}
}