@@ -4049,16 +4049,14 @@ static void diagnoseProtocolStubFixit(
4049
4049
4050
4050
// Issue diagnostics for witness types.
4051
4051
if (auto MissingTypeWitness = dyn_cast<AssociatedTypeDecl>(VD)) {
4052
- std::optional<InFlightDiagnostic> diag;
4053
4052
if (isa<BuiltinTupleDecl>(DC->getSelfNominalTypeDecl ())) {
4054
4053
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);
4057
4056
} else {
4058
- diag. emplace ( Diags.diagnose (MissingTypeWitness, diag::no_witnesses_type,
4059
- MissingTypeWitness) );
4057
+ Diags.diagnose (MissingTypeWitness, diag::no_witnesses_type,
4058
+ MissingTypeWitness);
4060
4059
}
4061
- diag.value ().flush ();
4062
4060
continue ;
4063
4061
}
4064
4062
@@ -4208,7 +4206,6 @@ void ConformanceChecker::checkNonFinalClassWitness(ValueDecl *requirement,
4208
4206
// If the main diagnostic is emitted on the conformance, we want to
4209
4207
// attach the fix-it to the note that shows where the initializer is
4210
4208
// defined.
4211
- fixItDiag.value ().flush ();
4212
4209
fixItDiag.emplace (diags.diagnose (ctor, diag::decl_declared_here,
4213
4210
ctor));
4214
4211
}
@@ -4387,7 +4384,6 @@ ConformanceChecker::resolveWitnessViaLookup(ValueDecl *requirement) {
4387
4384
if (diagLoc == witness->getLoc ()) {
4388
4385
fixDeclarationName (diag, witness, requirement->getName ());
4389
4386
} else {
4390
- diag.flush ();
4391
4387
diags.diagnose (witness, diag::decl_declared_here, witness);
4392
4388
}
4393
4389
}
@@ -4568,7 +4564,6 @@ ConformanceChecker::resolveWitnessViaLookup(ValueDecl *requirement) {
4568
4564
if (diagLoc == witness->getLoc ()) {
4569
4565
addOptionalityFixIts (adjustments, ctx, witness, diag);
4570
4566
} else {
4571
- diag.flush ();
4572
4567
diags.diagnose (witness, diag::decl_declared_here, witness);
4573
4568
}
4574
4569
}
@@ -5661,7 +5656,6 @@ void ConformanceChecker::resolveValueWitnesses() {
5661
5656
// If the main diagnostic is emitted on the conformance, we want
5662
5657
// to attach the fix-it to the note that shows where the
5663
5658
// witness is defined.
5664
- fixItDiag.value ().flush ();
5665
5659
fixItDiag.emplace (
5666
5660
witness->diagnose (diag::make_decl_objc, witness));
5667
5661
}
@@ -5681,7 +5675,6 @@ void ConformanceChecker::resolveValueWitnesses() {
5681
5675
// If the main diagnostic is emitted on the conformance, we want
5682
5676
// to attach the fix-it to the note that shows where the
5683
5677
// witness is defined.
5684
- fixItDiag.value ().flush ();
5685
5678
fixItDiag.emplace (
5686
5679
witness->diagnose (diag::make_decl_objc, witness));
5687
5680
}
@@ -5701,7 +5694,6 @@ void ConformanceChecker::resolveValueWitnesses() {
5701
5694
// If the main diagnostic is emitted on the conformance, we want
5702
5695
// to attach the fix-it to the note that shows where the
5703
5696
// witness is defined.
5704
- fixItDiag.value ().flush ();
5705
5697
fixItDiag.emplace (
5706
5698
witness->diagnose (diag::make_decl_objc, witness));
5707
5699
}
0 commit comments