Skip to content

Commit bea99b1

Browse files
committed
[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.
1 parent 5888400 commit bea99b1

File tree

1 file changed

+5
-12
lines changed

1 file changed

+5
-12
lines changed

lib/Sema/ConstraintSystem.cpp

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2086,18 +2086,11 @@ void ConstraintSystem::bindOverloadType(
20862086
DeclName memberName =
20872087
isSubscriptRef ? DeclBaseName::createSubscript() : choice.getName();
20882088

2089-
auto *memberRef = Constraint::createMember(
2090-
*this, ConstraintKind::ValueMember, LValueType::get(rootTy), memberTy,
2091-
memberName, useDC,
2092-
isSubscriptRef ? FunctionRefKind::DoubleApply
2093-
: FunctionRefKind::Unapplied,
2094-
keyPathLoc);
2095-
2096-
// Delay simplication of this constraint until after the overload choice
2097-
// has been bound for this key path dynamic member. This helps to identify
2098-
// recursive calls with the same base.
2099-
addUnsolvedConstraint(memberRef);
2100-
activateConstraint(memberRef);
2089+
addValueMemberConstraint(LValueType::get(rootTy), memberName, memberTy,
2090+
useDC,
2091+
isSubscriptRef ? FunctionRefKind::DoubleApply
2092+
: FunctionRefKind::Unapplied,
2093+
/*outerAlternatives=*/{}, keyPathLoc);
21012094

21022095
// In case of subscript things are more compicated comparing to "dot"
21032096
// syntax, because we have to get "applicable function" constraint

0 commit comments

Comments
 (0)