Skip to content

Commit c767f7a

Browse files
committed
[ConstraintSystem] Fix getEffectiveOverloadType handling of mutating methods
1 parent 95b47ae commit c767f7a

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

lib/Sema/TypeOfReference.cpp

+9-5
Original file line numberDiff line numberDiff line change
@@ -1833,11 +1833,15 @@ Type ConstraintSystem::getEffectiveOverloadType(ConstraintLocator *locator,
18331833
type, var, useDC, GetClosureType{*this},
18341834
ClosureIsolatedByPreconcurrency{*this});
18351835
} else if (isa<AbstractFunctionDecl>(decl) || isa<EnumElementDecl>(decl)) {
1836-
if (decl->isInstanceMember() &&
1837-
(!overload.getBaseType() ||
1838-
(!overload.getBaseType()->getAnyNominal() &&
1839-
!overload.getBaseType()->is<ExistentialType>())))
1840-
return Type();
1836+
if (decl->isInstanceMember()) {
1837+
auto baseTy = overload.getBaseType();
1838+
if (!baseTy)
1839+
return Type();
1840+
1841+
baseTy = baseTy->getRValueType();
1842+
if (!baseTy->getAnyNominal() && !baseTy->is<ExistentialType>())
1843+
return Type();
1844+
}
18411845

18421846
// Cope with 'Self' returns.
18431847
if (!decl->getDeclContext()->getSelfProtocolDecl()) {

0 commit comments

Comments
 (0)