@@ -3825,16 +3825,10 @@ static void diagnoseProtocolStubFixit(
38253825 NoStubRequirements);
38263826 auto &Diags = Ctx.Diags ;
38273827
3828- // If we are in editor mode, squash all notes into a single fixit.
3829- if (Ctx.LangOpts .DiagnosticsEditorMode ) {
3830- if (!FixIt.empty ()) {
3831- Diags.diagnose (ComplainLoc, diag::missing_witnesses_general).
3832- fixItInsertAfter (FixitLocation, FixIt);
3833- }
3834- return ;
3828+ if (!FixIt.empty ()) {
3829+ Diags.diagnose (ComplainLoc, diag::missing_witnesses_general).
3830+ fixItInsertAfter (FixitLocation, FixIt);
38353831 }
3836- auto &SM = Ctx.SourceMgr ;
3837- auto FixitBufferId = SM.findBufferContainingLoc (FixitLocation);
38383832 for (const auto &Missing : MissingWitnesses) {
38393833 auto VD = Missing.requirement ;
38403834
@@ -3843,11 +3837,6 @@ static void diagnoseProtocolStubFixit(
38433837 if (isNSObjectProtocol (VD->getDeclContext ()->getSelfProtocolDecl ()))
38443838 continue ;
38453839
3846- // Whether this VD has a stub printed.
3847- bool AddFixit = !NoStubRequirements.count (VD);
3848- bool SameFile = VD->getLoc ().isValid () ?
3849- SM.findBufferContainingLoc (VD->getLoc ()) == FixitBufferId : false ;
3850-
38513840 // Issue diagnostics for witness types.
38523841 if (auto MissingTypeWitness = dyn_cast<AssociatedTypeDecl>(VD)) {
38533842 std::optional<InFlightDiagnostic> diag;
@@ -3859,50 +3848,15 @@ static void diagnoseProtocolStubFixit(
38593848 diag.emplace (Diags.diagnose (MissingTypeWitness, diag::no_witnesses_type,
38603849 MissingTypeWitness));
38613850 }
3862- if (SameFile) {
3863- // If the protocol member decl is in the same file of the stub,
3864- // we can directly associate the fixit with the note issued to the
3865- // requirement.
3866- diag->fixItInsertAfter (FixitLocation, FixIt);
3867- } else {
3868- diag.value ().flush ();
3869-
3870- // Otherwise, we have to issue another note to carry the fixit,
3871- // because editor may assume the fixit is in the same file with the note.
3872- if (Ctx.LangOpts .DiagnosticsEditorMode ) {
3873- Diags.diagnose (ComplainLoc, diag::missing_witnesses_general)
3874- .fixItInsertAfter (FixitLocation, FixIt);
3875- }
3876- }
3851+ diag.value ().flush ();
38773852 continue ;
38783853 }
38793854
38803855 // Issue diagnostics for witness values.
38813856 Type RequirementType =
38823857 getRequirementTypeForDisplay (Conf, VD);
3883- if (AddFixit) {
3884- if (SameFile) {
3885- // If the protocol member decl is in the same file of the stub,
3886- // we can directly associate the fixit with the note issued to the
3887- // requirement.
3888- Diags
3889- .diagnose (VD, diag::no_witnesses, getProtocolRequirementKind (VD),
3890- VD, RequirementType, true )
3891- .fixItInsertAfter (FixitLocation, FixIt);
3892- } else {
3893- // Otherwise, we have to issue another note to carry the fixit,
3894- // because editor may assume the fixit is in the same file with the note.
3895- Diags.diagnose (VD, diag::no_witnesses, getProtocolRequirementKind (VD),
3896- VD, RequirementType, false );
3897- if (Ctx.LangOpts .DiagnosticsEditorMode ) {
3898- Diags.diagnose (ComplainLoc, diag::missing_witnesses_general)
3899- .fixItInsertAfter (FixitLocation, FixIt);
3900- }
3901- }
3902- } else {
3903- Diags.diagnose (VD, diag::no_witnesses, getProtocolRequirementKind (VD),
3904- VD, RequirementType, true );
3905- }
3858+ Diags.diagnose (VD, diag::no_witnesses, getProtocolRequirementKind (VD), VD,
3859+ RequirementType);
39063860 }
39073861}
39083862
0 commit comments