@@ -481,71 +481,50 @@ bool DependencyVerifier::verifyObligations(
481
481
auto &diags = SF->getASTContext ().Diags ;
482
482
for (auto &expectation : ExpectedDependencies) {
483
483
const bool wantsCascade = expectation.isCascading ();
484
- switch (expectation.Info .Kind ) {
485
- case Expectation::Kind::Negative:
484
+ if (expectation.Info .Kind == Expectation::Kind::Negative) {
486
485
// We'll verify negative expectations separately.
487
486
NegativeExpectations.insert ({expectation.MessageRange , expectation});
488
- break ;
489
- case Expectation::Kind::Member:
490
- matchExpectationOrFail (
491
- OM, expectation,
492
- [&](Obligation &p) {
493
- const auto haveCascade = p.getCascades ();
487
+ continue ;
488
+ }
489
+
490
+ matchExpectationOrFail (
491
+ OM, expectation,
492
+ [&](Obligation &O) {
493
+ const auto haveCascade = O.getCascades ();
494
+ switch (expectation.Info .Kind ) {
495
+ case Expectation::Kind::Negative:
496
+ llvm_unreachable (" Should have been handled above!" );
497
+ case Expectation::Kind::Member:
494
498
if (haveCascade != wantsCascade) {
495
499
diagnose (diags, expectation.MessageRange .begin (),
496
500
diag::dependency_cascading_mismatch, wantsCascade,
497
501
haveCascade);
498
- return p.fail ();
502
+ return O.fail ();
503
+ } else {
504
+ return O.fullfill ();
499
505
}
500
-
501
- return p.fullfill ();
502
- },
503
- [&](const Expectation &e) {
504
- diagnose (
505
- diags, e.MessageRange .begin (), diag::missing_member_dependency,
506
- static_cast <uint8_t >(expectation.Info .Kind ), e.MessageRange );
507
- });
508
- break ;
509
- case Expectation::Kind::PotentialMember:
510
- matchExpectationOrFail (
511
- OM, expectation,
512
- [&](Obligation &p) {
513
- assert (p.getName ().empty ());
514
- const auto haveCascade = p.getCascades ();
506
+ case Expectation::Kind::PotentialMember:
507
+ assert (O.getName ().empty ());
515
508
if (haveCascade != wantsCascade) {
516
509
diagnose (diags, expectation.MessageRange .begin (),
517
510
diag::potential_dependency_cascading_mismatch,
518
511
wantsCascade, haveCascade);
519
- return p.fail ();
512
+ return O.fail ();
513
+ } else {
514
+ return O.fullfill ();
520
515
}
521
-
522
- return p.fullfill ();
523
- },
524
- [&](const Expectation &e) {
525
- diagnose (
526
- diags, e.MessageRange .begin (), diag::missing_member_dependency,
527
- static_cast <uint8_t >(expectation.Info .Kind ), e.MessageRange );
528
- });
529
- break ;
530
- case Expectation::Kind::Provides:
531
- matchExpectationOrFail (
532
- OM, expectation, [](Obligation &O) { return O.fullfill (); },
533
- [&](const Expectation &e) {
534
- diagnose (
535
- diags, e.MessageRange .begin (), diag::missing_member_dependency,
536
- static_cast <uint8_t >(expectation.Info .Kind ), e.MessageRange );
537
- });
538
- break ;
539
- case Expectation::Kind::DynamicMember:
540
- matchExpectationOrFail (
541
- OM, expectation, [](Obligation &O) { return O.fullfill (); },
542
- [&](const Expectation &e) {
543
- diagnose (
544
- diags, e.MessageRange .begin (), diag::missing_member_dependency,
545
- static_cast <uint8_t >(expectation.Info .Kind ), e.MessageRange );
546
- });
547
- break ;
548
- }
516
+ case Expectation::Kind::Provides:
517
+ case Expectation::Kind::DynamicMember:
518
+ return O.fullfill ();
519
+ }
520
+
521
+ llvm_unreachable (" Unhandled expectation kind!" );
522
+ },
523
+ [&](const Expectation &e) {
524
+ diagnose (diags, e.MessageRange .begin (),
525
+ diag::missing_member_dependency,
526
+ static_cast <uint8_t >(expectation.Info .Kind ), e.MessageRange );
527
+ });
549
528
}
550
529
551
530
return false ;
0 commit comments