@@ -2583,8 +2583,9 @@ llvm::Optional<LifetimeDependenceInfo> validateLifetimeDependenceInfo(
25832583 auto *dc = decl->getDeclContext ();
25842584 auto &ctx = dc->getASTContext ();
25852585 auto &diags = ctx.Diags ;
2586- SmallBitVector copyLifetimeParamIndices (afd->getParameters ()->size () + 1 );
2586+ SmallBitVector inheritLifetimeParamIndices (afd->getParameters ()->size () + 1 );
25872587 SmallBitVector borrowLifetimeParamIndices (afd->getParameters ()->size () + 1 );
2588+ SmallBitVector mutateLifetimeParamIndices (afd->getParameters ()->size () + 1 );
25882589
25892590 auto updateLifetimeDependenceInfo = [&](LifetimeDependenceSpecifier specifier,
25902591 unsigned paramIndexToSet,
@@ -2619,18 +2620,19 @@ llvm::Optional<LifetimeDependenceInfo> validateLifetimeDependenceInfo(
26192620 getOwnershipSpelling (ownership));
26202621 return true ;
26212622 }
2622- if (copyLifetimeParamIndices .test (paramIndexToSet) ||
2623+ if (inheritLifetimeParamIndices .test (paramIndexToSet) ||
26232624 borrowLifetimeParamIndices.test (paramIndexToSet)) {
26242625 diags.diagnose (loc, diag::lifetime_dependence_duplicate_param_id);
26252626 return true ;
26262627 }
26272628 if (kind == LifetimeDependenceKind::Copy ||
26282629 kind == LifetimeDependenceKind::Consume) {
2629- copyLifetimeParamIndices.set (paramIndexToSet);
2630- } else {
2631- assert (kind == LifetimeDependenceKind::Borrow ||
2632- kind == LifetimeDependenceKind::Mutate);
2630+ inheritLifetimeParamIndices.set (paramIndexToSet);
2631+ } else if (kind == LifetimeDependenceKind::Borrow) {
26332632 borrowLifetimeParamIndices.set (paramIndexToSet);
2633+ } else {
2634+ assert (kind == LifetimeDependenceKind::Mutate);
2635+ mutateLifetimeParamIndices.set (paramIndexToSet);
26342636 }
26352637 return false ;
26362638 };
@@ -2691,8 +2693,9 @@ llvm::Optional<LifetimeDependenceInfo> validateLifetimeDependenceInfo(
26912693 }
26922694
26932695 return LifetimeDependenceInfo (
2694- IndexSubset::get (ctx, copyLifetimeParamIndices),
2695- IndexSubset::get (ctx, borrowLifetimeParamIndices));
2696+ IndexSubset::get (ctx, inheritLifetimeParamIndices),
2697+ IndexSubset::get (ctx, borrowLifetimeParamIndices),
2698+ IndexSubset::get (ctx, mutateLifetimeParamIndices));
26962699}
26972700
26982701static void maybeAddParameterIsolation (AnyFunctionType::ExtInfoBuilder &infoBuilder,
0 commit comments