Merge pull request #42146 from xedin/rdar-91145060

[ConstraintSystem] Cache types of `~=` components
This commit is contained in:
Pavel Yaskevich
2022-04-04 10:35:52 -07:00
committed by GitHub
3 changed files with 6 additions and 3 deletions

View File

@@ -8944,6 +8944,9 @@ static bool inferEnumMemberThroughTildeEqualsOperator(
std::tie(matchVar, matchCall) = *tildeEqualsApplication;
cs.setType(matchVar, enumTy);
cs.setType(EP, enumTy);
// result of ~= operator is always a `Bool`.
auto target = SolutionApplicationTarget::forExprPattern(
matchCall, DC, EP, ctx.getBoolDecl()->getDeclaredInterfaceType());
@@ -8972,7 +8975,6 @@ static bool inferEnumMemberThroughTildeEqualsOperator(
// Store the $match variable and binary expression for solution application.
EP->setMatchVar(matchVar);
EP->setMatchExpr(matchCall);
EP->setType(enumTy);
cs.setSolutionApplicationTarget(pattern, target);