FIR: fix of super.methodOfAny resolve in case of one supertype

This commit is contained in:
Mikhail Glukhikh
2021-02-05 17:15:15 +03:00
parent 694d69fbfa
commit 1c210c2386
3 changed files with 4 additions and 10 deletions
@@ -36,12 +36,13 @@ fun BodyResolveComponents.findTypesForSuperCandidates(
containingCall: FirQualifiedAccess,
): Collection<ConeKotlinType> {
val supertypes = superTypeRefs.map { (it as FirResolvedTypeRef).type }
if (supertypes.size <= 1) return supertypes
val isMethodOfAny = containingCall is FirFunctionCall && isCallingMethodOfAny(containingCall)
if (supertypes.size <= 1 && !isMethodOfAny) return supertypes
return when (containingCall) {
is FirFunctionCall -> {
val calleeName = containingCall.calleeReference.name
if (isCallingMethodOfAny(containingCall)) {
if (isMethodOfAny) {
resolveSupertypesForMethodOfAny(supertypes, calleeName)
} else {
resolveSupertypesByCalleeName(supertypes, calleeName)
@@ -1,8 +0,0 @@
interface IWithToString {
override fun toString(): String
}
class A : IWithToString {
// Should be Any#toString(), even though IWithToString defines an abstract toString.
override fun toString(): String = super.<!ABSTRACT_SUPER_CALL!>toString<!>()
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
interface IWithToString {
override fun toString(): String
}