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 {
3440
3440
3441
3441
// Generate constraints for each of the entries in the capture list.
3442
3442
if (auto captureList = dyn_cast<CaptureListExpr>(expr)) {
3443
+ TypeChecker::diagnoseDuplicateCaptureVars (captureList);
3444
+
3443
3445
auto &CS = CG.getConstraintSystem ();
3444
3446
for (const auto &capture : captureList->getCaptureList ()) {
3445
3447
SolutionApplicationTarget target (capture.Init );
Original file line number Diff line number Diff line change @@ -1334,6 +1334,14 @@ void TypeChecker::diagnoseDuplicateBoundVars(Pattern *pattern) {
1334
1334
diagnoseDuplicateDecls (boundVars);
1335
1335
}
1336
1336
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
+
1337
1345
namespace {
1338
1346
class DeclChecker : public DeclVisitor <DeclChecker> {
1339
1347
public:
Original file line number Diff line number Diff line change @@ -502,6 +502,8 @@ void checkParameterList(ParameterList *params);
502
502
503
503
void diagnoseDuplicateBoundVars (Pattern *pattern);
504
504
505
+ void diagnoseDuplicateCaptureVars (CaptureListExpr *expr);
506
+
505
507
Type checkReferenceOwnershipAttr (VarDecl *D, Type interfaceType,
506
508
ReferenceOwnershipAttr *attr);
507
509
You can’t perform that action at this time.
0 commit comments