@@ -410,13 +410,15 @@ ElementInfo makeJoinElement(ConstraintSystem &cs, TypeJoinExpr *join,
410
410
411
411
struct SyntacticElementContext
412
412
: public llvm::PointerUnion<AbstractFunctionDecl *, AbstractClosureExpr *,
413
- SingleValueStmtExpr *, ExprPattern *> {
413
+ SingleValueStmtExpr *, ExprPattern *, TapExpr * > {
414
414
// Inherit the constructors from PointerUnion.
415
415
using PointerUnion::PointerUnion;
416
416
417
417
// / A join that should be applied to the elements of a SingleValueStmtExpr.
418
418
NullablePtr<TypeJoinExpr> ElementJoin;
419
419
420
+ static SyntacticElementContext forTapExpr (TapExpr *tap) { return {tap}; }
421
+
420
422
static SyntacticElementContext forFunctionRef (AnyFunctionRef ref) {
421
423
if (auto *decl = ref.getAbstractFunctionDecl ()) {
422
424
return {decl};
@@ -454,6 +456,8 @@ struct SyntacticElementContext
454
456
return SVE->getDeclContext ();
455
457
} else if (auto *EP = dyn_cast<ExprPattern *>()) {
456
458
return EP->getDeclContext ();
459
+ } else if (auto *tap = this ->dyn_cast <TapExpr *>()) {
460
+ return tap->getVar ()->getDeclContext ();
457
461
} else {
458
462
llvm_unreachable (" unsupported kind" );
459
463
}
@@ -489,6 +493,8 @@ struct SyntacticElementContext
489
493
return closure->getBody ();
490
494
} else if (auto *SVE = dyn_cast<SingleValueStmtExpr *>()) {
491
495
return SVE->getStmt ();
496
+ } else if (auto *tap = this ->dyn_cast <TapExpr *>()) {
497
+ return tap->getBody ();
492
498
} else {
493
499
llvm_unreachable (" unsupported kind" );
494
500
}
@@ -1542,6 +1548,8 @@ ConstraintSystem::simplifySyntacticElementConstraint(
1542
1548
context = SyntacticElementContext::forSingleValueStmtExpr (SVE);
1543
1549
} else if (auto *EP = getAsPattern<ExprPattern>(anchor)) {
1544
1550
context = SyntacticElementContext::forExprPattern (EP);
1551
+ } else if (auto *tap = getAsExpr<TapExpr>(anchor)) {
1552
+ context = SyntacticElementContext::forTapExpr (tap);
1545
1553
} else {
1546
1554
return SolutionKind::Error;
1547
1555
}
0 commit comments