File tree Expand file tree Collapse file tree 3 files changed +12
-0
lines changed
Expand file tree Collapse file tree 3 files changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -3440,6 +3440,8 @@ namespace {
34403440
34413441 // Generate constraints for each of the entries in the capture list.
34423442 if (auto captureList = dyn_cast<CaptureListExpr>(expr)) {
3443+ TypeChecker::diagnoseDuplicateCaptureVars (captureList);
3444+
34433445 auto &CS = CG.getConstraintSystem ();
34443446 for (const auto &capture : captureList->getCaptureList ()) {
34453447 SolutionApplicationTarget target (capture.Init );
Original file line number Diff line number Diff line change @@ -1334,6 +1334,14 @@ void TypeChecker::diagnoseDuplicateBoundVars(Pattern *pattern) {
13341334 diagnoseDuplicateDecls (boundVars);
13351335}
13361336
1337+ void TypeChecker::diagnoseDuplicateCaptureVars (CaptureListExpr *expr) {
1338+ SmallVector<VarDecl *, 2 > captureListVars;
1339+ for (auto &capture : expr->getCaptureList ())
1340+ captureListVars.push_back (capture.Var );
1341+
1342+ diagnoseDuplicateDecls (captureListVars);
1343+ }
1344+
13371345namespace {
13381346class DeclChecker : public DeclVisitor <DeclChecker> {
13391347public:
Original file line number Diff line number Diff line change @@ -502,6 +502,8 @@ void checkParameterList(ParameterList *params);
502502
503503void diagnoseDuplicateBoundVars (Pattern *pattern);
504504
505+ void diagnoseDuplicateCaptureVars (CaptureListExpr *expr);
506+
505507Type checkReferenceOwnershipAttr (VarDecl *D, Type interfaceType,
506508 ReferenceOwnershipAttr *attr);
507509
You can’t perform that action at this time.
0 commit comments