Skip to content

Commit

Permalink
Ignore suppressed diagnostics in code fix verifier (#88492)
Browse files Browse the repository at this point in the history
The failures started with
299a8c9,
which pulled in changes to the test SDK such that suppressed warnings
are now included in the set of warnings checked by the code fix
verifier.
  • Loading branch information
sbomer authored Jul 7, 2023
1 parent 94748a2 commit 8097783
Showing 1 changed file with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

using System.Collections.Generic;
using System.Collections.Immutable;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using ILLink.Shared;
Expand Down Expand Up @@ -36,6 +38,15 @@ public Test ()
return solution;
});
}

protected override ImmutableArray<(Project project, Diagnostic diagnostic)> SortDistinctDiagnostics (IEnumerable<(Project project, Diagnostic diagnostic)> diagnostics)
{
// Only include non-suppressed diagnostics in the result. Our tests suppress diagnostics
// with 'UnconditionalSuppressMessageAttribute', and expect them not to be reported.
return base.SortDistinctDiagnostics (diagnostics)
.Where (diagnostic => !diagnostic.diagnostic.IsSuppressed)
.ToImmutableArray ();
}
}

/// <inheritdoc cref="AnalyzerVerifier{TAnalyzer}.Diagnostic()"/>
Expand Down

0 comments on commit 8097783

Please sign in to comment.