FIR: fix of super.methodOfAny resolve in case of one supertype
This commit is contained in:
@@ -36,12 +36,13 @@ fun BodyResolveComponents.findTypesForSuperCandidates(
|
|||||||
containingCall: FirQualifiedAccess,
|
containingCall: FirQualifiedAccess,
|
||||||
): Collection<ConeKotlinType> {
|
): Collection<ConeKotlinType> {
|
||||||
val supertypes = superTypeRefs.map { (it as FirResolvedTypeRef).type }
|
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) {
|
return when (containingCall) {
|
||||||
is FirFunctionCall -> {
|
is FirFunctionCall -> {
|
||||||
val calleeName = containingCall.calleeReference.name
|
val calleeName = containingCall.calleeReference.name
|
||||||
if (isCallingMethodOfAny(containingCall)) {
|
if (isMethodOfAny) {
|
||||||
resolveSupertypesForMethodOfAny(supertypes, calleeName)
|
resolveSupertypesForMethodOfAny(supertypes, calleeName)
|
||||||
} else {
|
} else {
|
||||||
resolveSupertypesByCalleeName(supertypes, calleeName)
|
resolveSupertypesByCalleeName(supertypes, calleeName)
|
||||||
|
|||||||
-8
@@ -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
@@ -1,3 +1,4 @@
|
|||||||
|
// FIR_IDENTICAL
|
||||||
interface IWithToString {
|
interface IWithToString {
|
||||||
override fun toString(): String
|
override fun toString(): String
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user