[CS] Attempt to simplify a member constraint immediately

Now that overload binding for dynamic member
lookup occurs after having recorded the
`subscript(dynamicMember:)` overload, we can
attempt simplification of this constraint right
away.
This commit is contained in:
Hamish Knight
2019-12-09 22:01:26 -08:00
parent 58884002d8
commit bea99b194b

View File

@@ -2086,18 +2086,11 @@ void ConstraintSystem::bindOverloadType(
DeclName memberName =
isSubscriptRef ? DeclBaseName::createSubscript() : choice.getName();
auto *memberRef = Constraint::createMember(
*this, ConstraintKind::ValueMember, LValueType::get(rootTy), memberTy,
memberName, useDC,
isSubscriptRef ? FunctionRefKind::DoubleApply
: FunctionRefKind::Unapplied,
keyPathLoc);
// Delay simplication of this constraint until after the overload choice
// has been bound for this key path dynamic member. This helps to identify
// recursive calls with the same base.
addUnsolvedConstraint(memberRef);
activateConstraint(memberRef);
addValueMemberConstraint(LValueType::get(rootTy), memberName, memberTy,
useDC,
isSubscriptRef ? FunctionRefKind::DoubleApply
: FunctionRefKind::Unapplied,
/*outerAlternatives=*/{}, keyPathLoc);
// In case of subscript things are more compicated comparing to "dot"
// syntax, because we have to get "applicable function" constraint