@@ -4049,16 +4049,14 @@ static void diagnoseProtocolStubFixit(
40494049
40504050 // Issue diagnostics for witness types.
40514051 if (auto MissingTypeWitness = dyn_cast<AssociatedTypeDecl>(VD)) {
4052- std::optional<InFlightDiagnostic> diag;
40534052 if (isa<BuiltinTupleDecl>(DC->getSelfNominalTypeDecl ())) {
40544053 auto expectedTy = getTupleConformanceTypeWitness (DC, MissingTypeWitness);
4055- diag. emplace ( Diags.diagnose (MissingTypeWitness, diag::no_witnesses_type_tuple,
4056- MissingTypeWitness, expectedTy) );
4054+ Diags.diagnose (MissingTypeWitness, diag::no_witnesses_type_tuple,
4055+ MissingTypeWitness, expectedTy);
40574056 } else {
4058- diag. emplace ( Diags.diagnose (MissingTypeWitness, diag::no_witnesses_type,
4059- MissingTypeWitness) );
4057+ Diags.diagnose (MissingTypeWitness, diag::no_witnesses_type,
4058+ MissingTypeWitness);
40604059 }
4061- diag.value ().flush ();
40624060 continue ;
40634061 }
40644062
@@ -4208,7 +4206,6 @@ void ConformanceChecker::checkNonFinalClassWitness(ValueDecl *requirement,
42084206 // If the main diagnostic is emitted on the conformance, we want to
42094207 // attach the fix-it to the note that shows where the initializer is
42104208 // defined.
4211- fixItDiag.value ().flush ();
42124209 fixItDiag.emplace (diags.diagnose (ctor, diag::decl_declared_here,
42134210 ctor));
42144211 }
@@ -4387,7 +4384,6 @@ ConformanceChecker::resolveWitnessViaLookup(ValueDecl *requirement) {
43874384 if (diagLoc == witness->getLoc ()) {
43884385 fixDeclarationName (diag, witness, requirement->getName ());
43894386 } else {
4390- diag.flush ();
43914387 diags.diagnose (witness, diag::decl_declared_here, witness);
43924388 }
43934389 }
@@ -4568,7 +4564,6 @@ ConformanceChecker::resolveWitnessViaLookup(ValueDecl *requirement) {
45684564 if (diagLoc == witness->getLoc ()) {
45694565 addOptionalityFixIts (adjustments, ctx, witness, diag);
45704566 } else {
4571- diag.flush ();
45724567 diags.diagnose (witness, diag::decl_declared_here, witness);
45734568 }
45744569 }
@@ -5661,7 +5656,6 @@ void ConformanceChecker::resolveValueWitnesses() {
56615656 // If the main diagnostic is emitted on the conformance, we want
56625657 // to attach the fix-it to the note that shows where the
56635658 // witness is defined.
5664- fixItDiag.value ().flush ();
56655659 fixItDiag.emplace (
56665660 witness->diagnose (diag::make_decl_objc, witness));
56675661 }
@@ -5681,7 +5675,6 @@ void ConformanceChecker::resolveValueWitnesses() {
56815675 // If the main diagnostic is emitted on the conformance, we want
56825676 // to attach the fix-it to the note that shows where the
56835677 // witness is defined.
5684- fixItDiag.value ().flush ();
56855678 fixItDiag.emplace (
56865679 witness->diagnose (diag::make_decl_objc, witness));
56875680 }
@@ -5701,7 +5694,6 @@ void ConformanceChecker::resolveValueWitnesses() {
57015694 // If the main diagnostic is emitted on the conformance, we want
57025695 // to attach the fix-it to the note that shows where the
57035696 // witness is defined.
5704- fixItDiag.value ().flush ();
57055697 fixItDiag.emplace (
57065698 witness->diagnose (diag::make_decl_objc, witness));
57075699 }
0 commit comments