File tree Expand file tree Collapse file tree 2 files changed +24
-0
lines changed Expand file tree Collapse file tree 2 files changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -5224,6 +5224,10 @@ namespace {
5224
5224
return E;
5225
5225
}
5226
5226
5227
+ Expr *visitTypeJoinExpr (TypeJoinExpr *E) {
5228
+ llvm_unreachable (" already type-checked?" );
5229
+ }
5230
+
5227
5231
// / Interface for ExprWalker
5228
5232
void walkToExprPre (Expr *expr) {
5229
5233
// If we have an apply, make a note of its callee locator prior to
Original file line number Diff line number Diff line change @@ -3524,6 +3524,26 @@ namespace {
3524
3524
return tv;
3525
3525
}
3526
3526
3527
+ Type visitTypeJoinExpr (TypeJoinExpr *expr) {
3528
+ auto *locator = CS.getConstraintLocator (expr);
3529
+ SmallVector<std::pair<Type, ConstraintLocator *>, 4 > elements;
3530
+ elements.reserve (expr->getNumElements ());
3531
+
3532
+ for (auto *element : expr->getElements ()) {
3533
+ elements.emplace_back (CS.getType (element),
3534
+ CS.getConstraintLocator (element));
3535
+ }
3536
+
3537
+ auto resultTy = CS.getType (expr->getVar ());
3538
+ // The type of a join expression is obtained by performing
3539
+ // a "join-meet" operation on deduced types of its elements
3540
+ // and the underlying variable.
3541
+ auto joinedTy = CS.addJoinConstraint (locator, elements);
3542
+
3543
+ CS.addConstraint (ConstraintKind::Equal, resultTy, joinedTy, locator);
3544
+ return resultTy;
3545
+ }
3546
+
3527
3547
static bool isTriggerFallbackDiagnosticBuiltin (UnresolvedDotExpr *UDE,
3528
3548
ASTContext &Context) {
3529
3549
auto *DRE = dyn_cast<DeclRefExpr>(UDE->getBase ());
You can’t perform that action at this time.
0 commit comments