Skip to content

Commit 2ba70df

Browse files
xedinahoppen
authored andcommitted
[CSClosure] Add TapExpr as a member of SyntacticElementContext
1 parent b03d8df commit 2ba70df

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

lib/Sema/CSSyntacticElement.cpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -410,13 +410,15 @@ ElementInfo makeJoinElement(ConstraintSystem &cs, TypeJoinExpr *join,
410410

411411
struct SyntacticElementContext
412412
: public llvm::PointerUnion<AbstractFunctionDecl *, AbstractClosureExpr *,
413-
SingleValueStmtExpr *, ExprPattern *> {
413+
SingleValueStmtExpr *, ExprPattern *, TapExpr *> {
414414
// Inherit the constructors from PointerUnion.
415415
using PointerUnion::PointerUnion;
416416

417417
/// A join that should be applied to the elements of a SingleValueStmtExpr.
418418
NullablePtr<TypeJoinExpr> ElementJoin;
419419

420+
static SyntacticElementContext forTapExpr(TapExpr *tap) { return {tap}; }
421+
420422
static SyntacticElementContext forFunctionRef(AnyFunctionRef ref) {
421423
if (auto *decl = ref.getAbstractFunctionDecl()) {
422424
return {decl};
@@ -454,6 +456,8 @@ struct SyntacticElementContext
454456
return SVE->getDeclContext();
455457
} else if (auto *EP = dyn_cast<ExprPattern *>()) {
456458
return EP->getDeclContext();
459+
} else if (auto *tap = this->dyn_cast<TapExpr *>()) {
460+
return tap->getVar()->getDeclContext();
457461
} else {
458462
llvm_unreachable("unsupported kind");
459463
}
@@ -489,6 +493,8 @@ struct SyntacticElementContext
489493
return closure->getBody();
490494
} else if (auto *SVE = dyn_cast<SingleValueStmtExpr *>()) {
491495
return SVE->getStmt();
496+
} else if (auto *tap = this->dyn_cast<TapExpr *>()) {
497+
return tap->getBody();
492498
} else {
493499
llvm_unreachable("unsupported kind");
494500
}
@@ -1542,6 +1548,8 @@ ConstraintSystem::simplifySyntacticElementConstraint(
15421548
context = SyntacticElementContext::forSingleValueStmtExpr(SVE);
15431549
} else if (auto *EP = getAsPattern<ExprPattern>(anchor)) {
15441550
context = SyntacticElementContext::forExprPattern(EP);
1551+
} else if (auto *tap = getAsExpr<TapExpr>(anchor)) {
1552+
context = SyntacticElementContext::forTapExpr(tap);
15451553
} else {
15461554
return SolutionKind::Error;
15471555
}

0 commit comments

Comments
 (0)