From a47a69abfd85ecf097d4631a1edc8a675727c7ad Mon Sep 17 00:00:00 2001 From: Manish Vasani Date: Tue, 18 Jun 2019 07:14:58 -0700 Subject: [PATCH] Remove feature flag as per the offline discussion --- .../Test/CommandLine/CommandLineTests.cs | 35 ++++++------- .../Diagnostics/DiagnosticSuppressorTests.cs | 50 ++++++------------- .../CodeAnalysisResources.Designer.cs | 9 ---- .../Core/Portable/CodeAnalysisResources.resx | 3 -- .../DiagnosticAnalyzer/AnalyzerDriver.cs | 3 -- .../DiagnosticAnalysisContext.cs | 5 -- .../Portable/xlf/CodeAnalysisResources.cs.xlf | 5 -- .../Portable/xlf/CodeAnalysisResources.de.xlf | 5 -- .../Portable/xlf/CodeAnalysisResources.es.xlf | 5 -- .../Portable/xlf/CodeAnalysisResources.fr.xlf | 5 -- .../Portable/xlf/CodeAnalysisResources.it.xlf | 5 -- .../Portable/xlf/CodeAnalysisResources.ja.xlf | 5 -- .../Portable/xlf/CodeAnalysisResources.ko.xlf | 5 -- .../Portable/xlf/CodeAnalysisResources.pl.xlf | 5 -- .../xlf/CodeAnalysisResources.pt-BR.xlf | 5 -- .../Portable/xlf/CodeAnalysisResources.ru.xlf | 5 -- .../Portable/xlf/CodeAnalysisResources.tr.xlf | 5 -- .../xlf/CodeAnalysisResources.zh-Hans.xlf | 5 -- .../xlf/CodeAnalysisResources.zh-Hant.xlf | 5 -- .../Test/Utilities/CSharp/TestOptions.cs | 7 --- .../Test/Utilities/VisualBasic/TestOptions.vb | 6 --- .../Test/CommandLine/CommandLineTests.vb | 23 ++++----- 22 files changed, 37 insertions(+), 169 deletions(-) diff --git a/src/Compilers/CSharp/Test/CommandLine/CommandLineTests.cs b/src/Compilers/CSharp/Test/CommandLine/CommandLineTests.cs index 41713bd3d9c..961ac64e1f5 100644 --- a/src/Compilers/CSharp/Test/CommandLine/CommandLineTests.cs +++ b/src/Compilers/CSharp/Test/CommandLine/CommandLineTests.cs @@ -10770,7 +10770,7 @@ long M(int i) // and info diagnostic is logged with programmatic suppression information. var suppressor = new DiagnosticSuppressorForId("CS0078"); output = VerifyOutput(srcDirectory, srcFile, expectedInfoCount: 1, expectedWarningCount: 0, expectedErrorCount: 0, - additionalFlags: new[] { "/warnAsError", "/features:DiagnosticSuppressor" }, + additionalFlags: new[] { "/warnAsError" }, includeCurrentAssemblyAsAnalyzerReference: false, analyzers: suppressor); Assert.DoesNotContain($"error CS0078", output, StringComparison.Ordinal); @@ -10824,21 +10824,20 @@ void M(int i) suppressor.SuppressionDescriptor.Justification); output = VerifyOutput(srcDirectory, srcFile, expectedInfoCount: 1, expectedWarningCount: 0, includeCurrentAssemblyAsAnalyzerReference: false, - analyzers: suppressor, - additionalFlags: new[] { "/features:DiagnosticSuppressor" }); + analyzers: suppressor); Assert.DoesNotContain($"warning CS1522", output, StringComparison.Ordinal); Assert.Contains($"info SP0001", output, StringComparison.Ordinal); Assert.Contains(suppressionMessage, output, StringComparison.Ordinal); // Verify that compiler warning CS1522 is reported as error for /warnaserror. output = VerifyOutput(srcDirectory, srcFile, expectedErrorCount: 1, - additionalFlags: new[] { "/warnAsError", "/features:DiagnosticSuppressor" }, includeCurrentAssemblyAsAnalyzerReference: false); + additionalFlags: new[] { "/warnAsError" }, includeCurrentAssemblyAsAnalyzerReference: false); Assert.Contains("error CS1522", output, StringComparison.Ordinal); // Verify that compiler warning CS1522 is suppressed with diagnostic suppressor even with /warnaserror // and info diagnostic is logged with programmatic suppression information. output = VerifyOutput(srcDirectory, srcFile, expectedInfoCount: 1, expectedWarningCount: 0, expectedErrorCount: 0, - additionalFlags: new[] { "/warnAsError", "/features:DiagnosticSuppressor" }, + additionalFlags: new[] { "/warnAsError" }, includeCurrentAssemblyAsAnalyzerReference: false, analyzers: suppressor); Assert.DoesNotContain($"error CS1522", output, StringComparison.Ordinal); @@ -10879,21 +10878,20 @@ class C suppressor.SuppressionDescriptor.Justification); output = VerifyOutput(srcDirectory, srcFile, expectedInfoCount: 1, expectedWarningCount: 0, includeCurrentAssemblyAsAnalyzerReference: false, - analyzers: suppressor, - additionalFlags: new[] { "/features:DiagnosticSuppressor" }); + analyzers: suppressor); Assert.DoesNotContain($"warning CS0169", output, StringComparison.Ordinal); Assert.Contains("info SP0001", output, StringComparison.Ordinal); Assert.Contains(suppressionMessage, output, StringComparison.Ordinal); // Verify that compiler warning CS0169 is reported as error for /warnaserror. output = VerifyOutput(srcDirectory, srcFile, expectedErrorCount: 1, - additionalFlags: new[] { "/warnAsError", "/features:DiagnosticSuppressor" }, includeCurrentAssemblyAsAnalyzerReference: false); + additionalFlags: new[] { "/warnAsError" }, includeCurrentAssemblyAsAnalyzerReference: false); Assert.Contains("error CS0169", output, StringComparison.Ordinal); // Verify that compiler warning CS0169 is suppressed with diagnostic suppressor even with /warnaserror // and info diagnostic is logged with programmatic suppression information. output = VerifyOutput(srcDirectory, srcFile, expectedInfoCount: 1, expectedWarningCount: 0, expectedErrorCount: 0, - additionalFlags: new[] { "/warnAsError", "/features:DiagnosticSuppressor" }, + additionalFlags: new[] { "/warnAsError" }, includeCurrentAssemblyAsAnalyzerReference: false, analyzers: suppressor); Assert.DoesNotContain($"error CS0169", output, StringComparison.Ordinal); @@ -10921,8 +10919,7 @@ class { }"; // Verify that compiler syntax error CS1001 cannot be suppressed with diagnostic suppressor. output = VerifyOutput(srcDirectory, srcFile, expectedErrorCount: 1, includeCurrentAssemblyAsAnalyzerReference: false, - analyzers: new DiagnosticSuppressorForId("CS1001"), - additionalFlags: new[] { "/features:DiagnosticSuppressor" }); + analyzers: new DiagnosticSuppressorForId("CS1001")); Assert.Contains("error CS1001", output, StringComparison.Ordinal); CleanupAllGeneratedFiles(srcFile.Path); @@ -10948,8 +10945,7 @@ class C // Verify that compiler error CS0246 cannot be suppressed with diagnostic suppressor. output = VerifyOutput(srcDirectory, srcFile, expectedErrorCount: 1, includeCurrentAssemblyAsAnalyzerReference: false, - analyzers: new DiagnosticSuppressorForId("CS0246"), - additionalFlags: new[] { "/features:DiagnosticSuppressor" }); + analyzers: new DiagnosticSuppressorForId("CS0246")); Assert.Contains("error CS0246", output, StringComparison.Ordinal); CleanupAllGeneratedFiles(srcFile.Path); @@ -10986,15 +10982,14 @@ class C { }"; var analyzerAndSuppressor = new DiagnosticAnalyzer[] { analyzer, suppressor }; output = VerifyOutput(srcDirectory, srcFile, expectedInfoCount: 1, expectedWarningCount: 0, includeCurrentAssemblyAsAnalyzerReference: false, - analyzers: analyzerAndSuppressor, - additionalFlags: new[] { "/features:DiagnosticSuppressor" }); + analyzers: analyzerAndSuppressor); Assert.DoesNotContain($"warning {analyzer.Descriptor.Id}", output, StringComparison.Ordinal); Assert.Contains("info SP0001", output, StringComparison.Ordinal); Assert.Contains(suppressionMessage, output, StringComparison.Ordinal); // Verify that analyzer warning is reported as error for /warnaserror. output = VerifyOutput(srcDirectory, srcFile, expectedErrorCount: 1, - additionalFlags: new[] { "/warnAsError", "/features:DiagnosticSuppressor" }, + additionalFlags: new[] { "/warnAsError" }, includeCurrentAssemblyAsAnalyzerReference: false, analyzers: analyzer); Assert.Contains($"error {analyzer.Descriptor.Id}", output, StringComparison.Ordinal); @@ -11002,7 +10997,7 @@ class C { }"; // Verify that analyzer warning is suppressed with diagnostic suppressor even with /warnaserror // and info diagnostic is logged with programmatic suppression information. output = VerifyOutput(srcDirectory, srcFile, expectedInfoCount: 1, expectedWarningCount: 0, - additionalFlags: new[] { "/warnAsError", "/features:DiagnosticSuppressor" }, + additionalFlags: new[] { "/warnAsError" }, includeCurrentAssemblyAsAnalyzerReference: false, analyzers: analyzerAndSuppressor); Assert.DoesNotContain($"warning {analyzer.Descriptor.Id}", output, StringComparison.Ordinal); @@ -11015,8 +11010,7 @@ class C { }"; analyzerAndSuppressor = new DiagnosticAnalyzer[] { analyzer, suppressor }; output = VerifyOutput(srcDirectory, srcFile, expectedWarningCount: 1, includeCurrentAssemblyAsAnalyzerReference: false, - analyzers: analyzerAndSuppressor, - additionalFlags: new[] { "/features:DiagnosticSuppressor" }); + analyzers: analyzerAndSuppressor); Assert.Contains($"warning {analyzer.Descriptor.Id}", output, StringComparison.Ordinal); CleanupAllGeneratedFiles(srcFile.Path); @@ -11044,8 +11038,7 @@ class C { }"; var analyzerAndSuppressor = new DiagnosticAnalyzer[] { analyzer, suppressor }; output = VerifyOutput(srcDirectory, srcFile, expectedErrorCount: 1, includeCurrentAssemblyAsAnalyzerReference: false, - analyzers: analyzerAndSuppressor, - additionalFlags: new[] { "/features:DiagnosticSuppressor" }); + analyzers: analyzerAndSuppressor); Assert.Contains($"error {analyzer.Descriptor.Id}", output, StringComparison.Ordinal); CleanupAllGeneratedFiles(srcFile.Path); diff --git a/src/Compilers/CSharp/Test/Semantic/Diagnostics/DiagnosticSuppressorTests.cs b/src/Compilers/CSharp/Test/Semantic/Diagnostics/DiagnosticSuppressorTests.cs index 2fa0a50f2c5..89994af6b23 100644 --- a/src/Compilers/CSharp/Test/Semantic/Diagnostics/DiagnosticSuppressorTests.cs +++ b/src/Compilers/CSharp/Test/Semantic/Diagnostics/DiagnosticSuppressorTests.cs @@ -42,7 +42,7 @@ void M(int i) } }"; - var compilation = CreateCompilation(source, parseOptions: TestOptions.RegularWithDiagnosticSuppressorFeature); + var compilation = CreateCompilation(source); compilation.VerifyDiagnostics( // (7,9): warning CS1522: Empty switch block // { @@ -65,7 +65,7 @@ class C // warning CS0169: The field 'C.f' is never used private readonly int f; }"; - var compilation = CreateCompilation(source, parseOptions: TestOptions.RegularWithDiagnosticSuppressorFeature); + var compilation = CreateCompilation(source); compilation.VerifyDiagnostics( // (5,26): warning CS0169: The field 'C.f' is never used // private readonly int f; @@ -85,7 +85,7 @@ public void TestNoSuppression_CompilerSyntaxError() string source = @" class { }"; - var compilation = CreateCompilation(source, parseOptions: TestOptions.RegularWithDiagnosticSuppressorFeature); + var compilation = CreateCompilation(source); compilation.VerifyDiagnostics( // (2,7): error CS1001: Identifier expected @@ -106,7 +106,7 @@ class C void M(UndefinedType x) { } }"; - var compilation = CreateCompilation(source, parseOptions: TestOptions.RegularWithDiagnosticSuppressorFeature); + var compilation = CreateCompilation(source); compilation.VerifyDiagnostics( // (4,12): error CS0246: The type or namespace name 'UndefinedType' could not be found (are you missing a using directive or an assembly reference?) @@ -123,7 +123,7 @@ public void TestSuppression_MultipleDiagnostics() { string source1 = @"class C1 { }"; string source2 = @"class C2 { }"; - var compilation = CreateCompilation(new[] { source1, source2 }, parseOptions: TestOptions.RegularWithDiagnosticSuppressorFeature); + var compilation = CreateCompilation(new[] { source1, source2 }); compilation.VerifyDiagnostics(); var analyzer = new CompilationAnalyzerWithSeverity(DiagnosticSeverity.Warning, configurable: true); @@ -141,7 +141,7 @@ public void TestSuppression_MultipleDiagnostics() public void TestSuppression_MultipleSuppressors_SameDiagnostic() { string source = @"class C1 { }"; - var compilation = CreateCompilation(source, parseOptions: TestOptions.RegularWithDiagnosticSuppressorFeature); + var compilation = CreateCompilation(source); compilation.VerifyDiagnostics(); var analyzer = new CompilationAnalyzerWithSeverity(DiagnosticSeverity.Warning, configurable: true); @@ -161,7 +161,7 @@ public void TestSuppression_MultipleSuppressors_SameDiagnostic() public void TestSuppression_MultipleSuppressors_DifferentDiagnostic() { string source = @"class C1 { private readonly int f; }"; - var compilation = CreateCompilation(source, parseOptions: TestOptions.RegularWithDiagnosticSuppressorFeature); + var compilation = CreateCompilation(source); compilation.VerifyDiagnostics( // (1,33): warning CS0169: The field 'C1.f' is never used // class C1 { private readonly int f; } @@ -184,7 +184,7 @@ public void TestSuppression_MultipleSuppressors_DifferentDiagnostic() public void TestNoSuppression_SpecificOptionsTurnsOffSuppressor() { string source = @"class C1 { }"; - var compilation = CreateCompilation(source, parseOptions: TestOptions.RegularWithDiagnosticSuppressorFeature); + var compilation = CreateCompilation(source); compilation.VerifyDiagnostics(); var analyzer = new CompilationAnalyzerWithSeverity(DiagnosticSeverity.Warning, configurable: true); @@ -200,34 +200,12 @@ public void TestNoSuppression_SpecificOptionsTurnsOffSuppressor() VerifySuppressedDiagnostics(compilation, analyzersAndSuppressors); } - [Fact, WorkItem(20242, "https://github.com/dotnet/roslyn/issues/20242")] - public void TestDiagnosticOnMissingFeatureFlag() - { - string source = @"class C1 { }"; - var compilation = CreateCompilation(source); - compilation.VerifyDiagnostics(); - - var analyzer = new CompilationAnalyzerWithSeverity(DiagnosticSeverity.Warning, configurable: true); - var analyzerDiagnostic = Diagnostic(analyzer.Descriptor.Id, source); - VerifyAnalyzerDiagnostics(compilation, new DiagnosticAnalyzer[] { analyzer }, analyzerDiagnostic); - - var analyzersAndSuppressors = new DiagnosticAnalyzer[] { analyzer, new DiagnosticSuppressorForId(analyzer.Descriptor.Id, "SPR1001") }; - var expectedDiagnostics = new[] - { - analyzerDiagnostic, - Diagnostic("AD0001").WithArguments("Microsoft.CodeAnalysis.CommonDiagnosticAnalyzers+DiagnosticSuppressorForId", - "System.ArgumentException", - CodeAnalysisResources.DiagnosticSuppressorFeatureDisabled).WithLocation(1, 1) - }; - VerifyAnalyzerDiagnostics(compilation, analyzersAndSuppressors, expectedDiagnostics); - } - [Fact, WorkItem(20242, "https://github.com/dotnet/roslyn/issues/20242")] public void TestSuppression_AnalyzerDiagnostics_SeveritiesAndConfigurableMatrix() { string source = @" class C { }"; - var compilation = CreateCompilation(source, parseOptions: TestOptions.RegularWithDiagnosticSuppressorFeature); + var compilation = CreateCompilation(source); compilation.VerifyDiagnostics(); var configurations = new[] { false, true }; @@ -286,7 +264,7 @@ public void TestExceptionFromSuppressor() string source = @" class C { }"; - var compilation = CreateCompilation(source, parseOptions: TestOptions.RegularWithDiagnosticSuppressorFeature); + var compilation = CreateCompilation(source); compilation.VerifyDiagnostics(); var analyzer = new CompilationAnalyzerWithSeverity(DiagnosticSeverity.Warning, configurable: true); @@ -315,7 +293,7 @@ public void TestUnsupportedSuppressionReported() string source = @" class C { }"; - var compilation = CreateCompilation(source, parseOptions: TestOptions.RegularWithDiagnosticSuppressorFeature); + var compilation = CreateCompilation(source); compilation.VerifyDiagnostics(); const string supportedSuppressionId = "supportedId"; @@ -342,7 +320,7 @@ public void TestInvalidDiagnosticSuppressionReported() { string source = @" class C { }"; - var compilation = CreateCompilation(source, parseOptions: TestOptions.RegularWithDiagnosticSuppressorFeature); + var compilation = CreateCompilation(source); compilation.VerifyDiagnostics(); const string unsupportedSuppressedId = "UnsupportedId"; @@ -368,7 +346,7 @@ public void TestNonReportedDiagnosticCannotBeSuppressed() { string source = @" class C { }"; - var compilation = CreateCompilation(source, parseOptions: TestOptions.RegularWithDiagnosticSuppressorFeature); + var compilation = CreateCompilation(source); compilation.VerifyDiagnostics(); const string nonReportedDiagnosticId = "NonReportedId"; @@ -393,7 +371,7 @@ class C { }"; public void TestProgrammaticSuppressionInfo_DiagnosticSuppressor() { string source = @"class C1 { }"; - var compilation = CreateCompilation(source, parseOptions: TestOptions.RegularWithDiagnosticSuppressorFeature); + var compilation = CreateCompilation(source); compilation.VerifyDiagnostics(); var analyzer = new CompilationAnalyzerWithSeverity(DiagnosticSeverity.Warning, configurable: true); diff --git a/src/Compilers/Core/Portable/CodeAnalysisResources.Designer.cs b/src/Compilers/Core/Portable/CodeAnalysisResources.Designer.cs index 70ff75135da..7d5cb21fbc4 100644 --- a/src/Compilers/Core/Portable/CodeAnalysisResources.Designer.cs +++ b/src/Compilers/Core/Portable/CodeAnalysisResources.Designer.cs @@ -458,15 +458,6 @@ internal class CodeAnalysisResources { } } - /// - /// Looks up a localized string similar to Feature 'DiagnosticSuppressor' is disabled.. - /// - internal static string DiagnosticSuppressorFeatureDisabled { - get { - return ResourceManager.GetString("DiagnosticSuppressorFeatureDisabled", resourceCulture); - } - } - /// /// Looks up a localized string similar to Argument contains duplicate analyzer instances.. /// diff --git a/src/Compilers/Core/Portable/CodeAnalysisResources.resx b/src/Compilers/Core/Portable/CodeAnalysisResources.resx index b65c5a5763e..9328e25e048 100644 --- a/src/Compilers/Core/Portable/CodeAnalysisResources.resx +++ b/src/Compilers/Core/Portable/CodeAnalysisResources.resx @@ -660,9 +660,6 @@ Invalid severity in analyzer config file. - - Feature 'DiagnosticSuppressor' is disabled. - Programmatic suppression of an analyzer diagnostic diff --git a/src/Compilers/Core/Portable/DiagnosticAnalyzer/AnalyzerDriver.cs b/src/Compilers/Core/Portable/DiagnosticAnalyzer/AnalyzerDriver.cs index 199bf994eac..e50e34d1961 100644 --- a/src/Compilers/Core/Portable/DiagnosticAnalyzer/AnalyzerDriver.cs +++ b/src/Compilers/Core/Portable/DiagnosticAnalyzer/AnalyzerDriver.cs @@ -25,9 +25,6 @@ internal abstract partial class AnalyzerDriver : IDisposable // Protect against vicious analyzers that provide large values for SymbolKind. private const int MaxSymbolKind = 100; - // Feature flag for DiagnosticSuppressor feature - internal const string DiagnosticSuppressorFeatureName = "DiagnosticSuppressor"; - // Cache delegates for static methods private static readonly Func s_IsCompilerAnalyzerFunc = IsCompilerAnalyzer; diff --git a/src/Compilers/Core/Portable/DiagnosticAnalyzer/DiagnosticAnalysisContext.cs b/src/Compilers/Core/Portable/DiagnosticAnalyzer/DiagnosticAnalysisContext.cs index fbd6f12c4d6..c27d37a10ad 100644 --- a/src/Compilers/Core/Portable/DiagnosticAnalyzer/DiagnosticAnalysisContext.cs +++ b/src/Compilers/Core/Portable/DiagnosticAnalyzer/DiagnosticAnalysisContext.cs @@ -1528,11 +1528,6 @@ public void ReportSuppression(Suppression suppression) throw new ArgumentException(message); } - if (!Compilation.SyntaxTrees.Any(t => t.Options.Features.ContainsKey(AnalyzerDriver.DiagnosticSuppressorFeatureName))) - { - throw new ArgumentException(CodeAnalysisResources.DiagnosticSuppressorFeatureDisabled); - } - if (suppression.Descriptor.IsDisabled(Compilation.Options)) { // Suppression has been disabled by the end user through compilation options. diff --git a/src/Compilers/Core/Portable/xlf/CodeAnalysisResources.cs.xlf b/src/Compilers/Core/Portable/xlf/CodeAnalysisResources.cs.xlf index d22138e4de5..c937f6db414 100644 --- a/src/Compilers/Core/Portable/xlf/CodeAnalysisResources.cs.xlf +++ b/src/Compilers/Core/Portable/xlf/CodeAnalysisResources.cs.xlf @@ -19,11 +19,6 @@ {1}. - - Feature 'DiagnosticSuppressor' is disabled. - Feature 'DiagnosticSuppressor' is disabled. - - Suppressed diagnostic ID '{0}' does not match suppressable ID '{1}' for the given suppression descriptor. Suppressed diagnostic ID '{0}' does not match suppressable ID '{1}' for the given suppression descriptor. diff --git a/src/Compilers/Core/Portable/xlf/CodeAnalysisResources.de.xlf b/src/Compilers/Core/Portable/xlf/CodeAnalysisResources.de.xlf index 1ffb95b4504..e1ab6701159 100644 --- a/src/Compilers/Core/Portable/xlf/CodeAnalysisResources.de.xlf +++ b/src/Compilers/Core/Portable/xlf/CodeAnalysisResources.de.xlf @@ -19,11 +19,6 @@ "{1}". - - Feature 'DiagnosticSuppressor' is disabled. - Feature 'DiagnosticSuppressor' is disabled. - - Suppressed diagnostic ID '{0}' does not match suppressable ID '{1}' for the given suppression descriptor. Suppressed diagnostic ID '{0}' does not match suppressable ID '{1}' for the given suppression descriptor. diff --git a/src/Compilers/Core/Portable/xlf/CodeAnalysisResources.es.xlf b/src/Compilers/Core/Portable/xlf/CodeAnalysisResources.es.xlf index 5c3ee9d48c7..d7bb6a59216 100644 --- a/src/Compilers/Core/Portable/xlf/CodeAnalysisResources.es.xlf +++ b/src/Compilers/Core/Portable/xlf/CodeAnalysisResources.es.xlf @@ -19,11 +19,6 @@ '{1}'. - - Feature 'DiagnosticSuppressor' is disabled. - Feature 'DiagnosticSuppressor' is disabled. - - Suppressed diagnostic ID '{0}' does not match suppressable ID '{1}' for the given suppression descriptor. Suppressed diagnostic ID '{0}' does not match suppressable ID '{1}' for the given suppression descriptor. diff --git a/src/Compilers/Core/Portable/xlf/CodeAnalysisResources.fr.xlf b/src/Compilers/Core/Portable/xlf/CodeAnalysisResources.fr.xlf index 66f9c4870c0..4a7bf430f92 100644 --- a/src/Compilers/Core/Portable/xlf/CodeAnalysisResources.fr.xlf +++ b/src/Compilers/Core/Portable/xlf/CodeAnalysisResources.fr.xlf @@ -19,11 +19,6 @@ '{1}'. - - Feature 'DiagnosticSuppressor' is disabled. - Feature 'DiagnosticSuppressor' is disabled. - - Suppressed diagnostic ID '{0}' does not match suppressable ID '{1}' for the given suppression descriptor. Suppressed diagnostic ID '{0}' does not match suppressable ID '{1}' for the given suppression descriptor. diff --git a/src/Compilers/Core/Portable/xlf/CodeAnalysisResources.it.xlf b/src/Compilers/Core/Portable/xlf/CodeAnalysisResources.it.xlf index bbbb0179f64..861bf631ce8 100644 --- a/src/Compilers/Core/Portable/xlf/CodeAnalysisResources.it.xlf +++ b/src/Compilers/Core/Portable/xlf/CodeAnalysisResources.it.xlf @@ -19,11 +19,6 @@ '{1}'. - - Feature 'DiagnosticSuppressor' is disabled. - Feature 'DiagnosticSuppressor' is disabled. - - Suppressed diagnostic ID '{0}' does not match suppressable ID '{1}' for the given suppression descriptor. Suppressed diagnostic ID '{0}' does not match suppressable ID '{1}' for the given suppression descriptor. diff --git a/src/Compilers/Core/Portable/xlf/CodeAnalysisResources.ja.xlf b/src/Compilers/Core/Portable/xlf/CodeAnalysisResources.ja.xlf index 0f824e7f55f..935cc4f39d1 100644 --- a/src/Compilers/Core/Portable/xlf/CodeAnalysisResources.ja.xlf +++ b/src/Compilers/Core/Portable/xlf/CodeAnalysisResources.ja.xlf @@ -19,11 +19,6 @@ '{1}'。 - - Feature 'DiagnosticSuppressor' is disabled. - Feature 'DiagnosticSuppressor' is disabled. - - Suppressed diagnostic ID '{0}' does not match suppressable ID '{1}' for the given suppression descriptor. Suppressed diagnostic ID '{0}' does not match suppressable ID '{1}' for the given suppression descriptor. diff --git a/src/Compilers/Core/Portable/xlf/CodeAnalysisResources.ko.xlf b/src/Compilers/Core/Portable/xlf/CodeAnalysisResources.ko.xlf index b5b92b6d8fe..ae0c9b74cda 100644 --- a/src/Compilers/Core/Portable/xlf/CodeAnalysisResources.ko.xlf +++ b/src/Compilers/Core/Portable/xlf/CodeAnalysisResources.ko.xlf @@ -19,11 +19,6 @@ '{1}' - - Feature 'DiagnosticSuppressor' is disabled. - Feature 'DiagnosticSuppressor' is disabled. - - Suppressed diagnostic ID '{0}' does not match suppressable ID '{1}' for the given suppression descriptor. Suppressed diagnostic ID '{0}' does not match suppressable ID '{1}' for the given suppression descriptor. diff --git a/src/Compilers/Core/Portable/xlf/CodeAnalysisResources.pl.xlf b/src/Compilers/Core/Portable/xlf/CodeAnalysisResources.pl.xlf index 0a7e3156f1a..c815dcb8c5f 100644 --- a/src/Compilers/Core/Portable/xlf/CodeAnalysisResources.pl.xlf +++ b/src/Compilers/Core/Portable/xlf/CodeAnalysisResources.pl.xlf @@ -19,11 +19,6 @@ „{1}”. - - Feature 'DiagnosticSuppressor' is disabled. - Feature 'DiagnosticSuppressor' is disabled. - - Suppressed diagnostic ID '{0}' does not match suppressable ID '{1}' for the given suppression descriptor. Suppressed diagnostic ID '{0}' does not match suppressable ID '{1}' for the given suppression descriptor. diff --git a/src/Compilers/Core/Portable/xlf/CodeAnalysisResources.pt-BR.xlf b/src/Compilers/Core/Portable/xlf/CodeAnalysisResources.pt-BR.xlf index 5329f3b974e..9a9f74dbdb2 100644 --- a/src/Compilers/Core/Portable/xlf/CodeAnalysisResources.pt-BR.xlf +++ b/src/Compilers/Core/Portable/xlf/CodeAnalysisResources.pt-BR.xlf @@ -19,11 +19,6 @@ '{1}'. - - Feature 'DiagnosticSuppressor' is disabled. - Feature 'DiagnosticSuppressor' is disabled. - - Suppressed diagnostic ID '{0}' does not match suppressable ID '{1}' for the given suppression descriptor. Suppressed diagnostic ID '{0}' does not match suppressable ID '{1}' for the given suppression descriptor. diff --git a/src/Compilers/Core/Portable/xlf/CodeAnalysisResources.ru.xlf b/src/Compilers/Core/Portable/xlf/CodeAnalysisResources.ru.xlf index 0833b61fe2a..31e934ef574 100644 --- a/src/Compilers/Core/Portable/xlf/CodeAnalysisResources.ru.xlf +++ b/src/Compilers/Core/Portable/xlf/CodeAnalysisResources.ru.xlf @@ -19,11 +19,6 @@ "{1}". - - Feature 'DiagnosticSuppressor' is disabled. - Feature 'DiagnosticSuppressor' is disabled. - - Suppressed diagnostic ID '{0}' does not match suppressable ID '{1}' for the given suppression descriptor. Suppressed diagnostic ID '{0}' does not match suppressable ID '{1}' for the given suppression descriptor. diff --git a/src/Compilers/Core/Portable/xlf/CodeAnalysisResources.tr.xlf b/src/Compilers/Core/Portable/xlf/CodeAnalysisResources.tr.xlf index e4e79b77015..81a1779490d 100644 --- a/src/Compilers/Core/Portable/xlf/CodeAnalysisResources.tr.xlf +++ b/src/Compilers/Core/Portable/xlf/CodeAnalysisResources.tr.xlf @@ -19,11 +19,6 @@ '{1}'. - - Feature 'DiagnosticSuppressor' is disabled. - Feature 'DiagnosticSuppressor' is disabled. - - Suppressed diagnostic ID '{0}' does not match suppressable ID '{1}' for the given suppression descriptor. Suppressed diagnostic ID '{0}' does not match suppressable ID '{1}' for the given suppression descriptor. diff --git a/src/Compilers/Core/Portable/xlf/CodeAnalysisResources.zh-Hans.xlf b/src/Compilers/Core/Portable/xlf/CodeAnalysisResources.zh-Hans.xlf index 871a092330a..1b5d1e8cab6 100644 --- a/src/Compilers/Core/Portable/xlf/CodeAnalysisResources.zh-Hans.xlf +++ b/src/Compilers/Core/Portable/xlf/CodeAnalysisResources.zh-Hans.xlf @@ -19,11 +19,6 @@ “{1}”。 - - Feature 'DiagnosticSuppressor' is disabled. - Feature 'DiagnosticSuppressor' is disabled. - - Suppressed diagnostic ID '{0}' does not match suppressable ID '{1}' for the given suppression descriptor. Suppressed diagnostic ID '{0}' does not match suppressable ID '{1}' for the given suppression descriptor. diff --git a/src/Compilers/Core/Portable/xlf/CodeAnalysisResources.zh-Hant.xlf b/src/Compilers/Core/Portable/xlf/CodeAnalysisResources.zh-Hant.xlf index 1bb389e919d..04f98da3f5a 100644 --- a/src/Compilers/Core/Portable/xlf/CodeAnalysisResources.zh-Hant.xlf +++ b/src/Compilers/Core/Portable/xlf/CodeAnalysisResources.zh-Hant.xlf @@ -19,11 +19,6 @@ '{1}'。 - - Feature 'DiagnosticSuppressor' is disabled. - Feature 'DiagnosticSuppressor' is disabled. - - Suppressed diagnostic ID '{0}' does not match suppressable ID '{1}' for the given suppression descriptor. Suppressed diagnostic ID '{0}' does not match suppressable ID '{1}' for the given suppression descriptor. diff --git a/src/Compilers/Test/Utilities/CSharp/TestOptions.cs b/src/Compilers/Test/Utilities/CSharp/TestOptions.cs index 6355db7e1fe..1b881553e07 100644 --- a/src/Compilers/Test/Utilities/CSharp/TestOptions.cs +++ b/src/Compilers/Test/Utilities/CSharp/TestOptions.cs @@ -43,8 +43,6 @@ public static class TestOptions public static readonly CSharpParseOptions RegularWithoutRecursivePatterns = Regular7_3; public static readonly CSharpParseOptions RegularWithRecursivePatterns = Regular8; - public static readonly CSharpParseOptions RegularWithDiagnosticSuppressorFeature = Regular.WithDiagnosticSuppressorFeature(); - public static readonly CSharpCompilationOptions ReleaseDll = new CSharpCompilationOptions(OutputKind.DynamicallyLinkedLibrary, optimizationLevel: OptimizationLevel.Release); public static readonly CSharpCompilationOptions ReleaseExe = new CSharpCompilationOptions(OutputKind.ConsoleApplication, optimizationLevel: OptimizationLevel.Release); @@ -136,11 +134,6 @@ public static CSharpCompilationOptions WithSpecificDiagnosticOptions(this CSharp { return options.WithSpecificDiagnosticOptions(ImmutableDictionary.Empty.Add(key1, value).Add(key2, value)); } - - public static CSharpParseOptions WithDiagnosticSuppressorFeature(this CSharpParseOptions options) - { - return options.WithFeatures(options.Features.Concat(new[] { new KeyValuePair(AnalyzerDriver.DiagnosticSuppressorFeatureName, "true") })); - } } } diff --git a/src/Compilers/Test/Utilities/VisualBasic/TestOptions.vb b/src/Compilers/Test/Utilities/VisualBasic/TestOptions.vb index b8208481066..c0f53e7162e 100644 --- a/src/Compilers/Test/Utilities/VisualBasic/TestOptions.vb +++ b/src/Compilers/Test/Utilities/VisualBasic/TestOptions.vb @@ -11,7 +11,6 @@ Public Class TestOptions Public Shared ReadOnly Regular As New VisualBasicParseOptions(kind:=SourceCodeKind.Regular, languageVersion:=LanguageVersion.VisualBasic16) Public Shared ReadOnly Regular15_5 As VisualBasicParseOptions = Regular.WithLanguageVersion(LanguageVersion.VisualBasic15_5) Public Shared ReadOnly RegularWithLegacyStrongName As VisualBasicParseOptions = Regular.WithFeature("UseLegacyStrongNameProvider") - Public Shared ReadOnly RegularWithDiagnosticSuppressorFeature As VisualBasicParseOptions = Regular.WithDiagnosticSuppressorFeature() Public Shared ReadOnly ReleaseDll As VisualBasicCompilationOptions = New VisualBasicCompilationOptions(OutputKind.DynamicallyLinkedLibrary, optimizationLevel:=OptimizationLevel.Release).WithParseOptions(Regular) Public Shared ReadOnly ReleaseExe As VisualBasicCompilationOptions = New VisualBasicCompilationOptions(OutputKind.ConsoleApplication, optimizationLevel:=OptimizationLevel.Release).WithParseOptions(Regular) @@ -62,9 +61,4 @@ Friend Module TestOptionExtensions Next Return options.WithFeatures(options.Features.Concat(list)) End Function - - - Public Function WithDiagnosticSuppressorFeature(options As VisualBasicParseOptions) As VisualBasicParseOptions - Return options.WithFeatures(options.Features.Concat({New KeyValuePair(Of String, String)(AnalyzerDriver.DiagnosticSuppressorFeatureName, "true")})) - End Function End Module diff --git a/src/Compilers/VisualBasic/Test/CommandLine/CommandLineTests.vb b/src/Compilers/VisualBasic/Test/CommandLine/CommandLineTests.vb index 72d4e6fc636..a1f9064511d 100644 --- a/src/Compilers/VisualBasic/Test/CommandLine/CommandLineTests.vb +++ b/src/Compilers/VisualBasic/Test/CommandLine/CommandLineTests.vb @@ -9377,8 +9377,7 @@ End Class" Dim suppressors = ImmutableArray.Create(Of DiagnosticAnalyzer)(suppressor) output = VerifyOutput(dir, file, expectedInfoCount:=1, expectedWarningCount:=0, includeCurrentAssemblyAsAnalyzerReference:=False, - analyzers:=suppressors, - additionalFlags:={"/features:DiagnosticSuppressor"}) + analyzers:=suppressors) Assert.DoesNotContain("warning BC40008", output, StringComparison.Ordinal) Assert.Contains("info SP0001", output, StringComparison.Ordinal) Assert.Contains(suppressionMessage, output, StringComparison.Ordinal) @@ -9410,7 +9409,7 @@ End Class" Assert.Contains("warning BC40008", output, StringComparison.Ordinal) ' Verify that compiler warning BC40008 is reported as error for /warnaserror. - output = VerifyOutput(dir, file, expectedErrorCount:=1, additionalFlags:={"/warnaserror+", "/features:DiagnosticSuppressor"}, + output = VerifyOutput(dir, file, expectedErrorCount:=1, additionalFlags:={"/warnaserror+"}, includeCurrentAssemblyAsAnalyzerReference:=False) Assert.Contains("error BC40008", output, StringComparison.Ordinal) @@ -9420,7 +9419,7 @@ End Class" Dim suppressors = ImmutableArray.Create(Of DiagnosticAnalyzer)(suppressor) output = VerifyOutput(dir, file, expectedInfoCount:=1, expectedWarningCount:=0, expectedErrorCount:=0, - additionalFlags:={"/warnaserror+", "/features:DiagnosticSuppressor"}, + additionalFlags:={"/warnaserror+"}, includeCurrentAssemblyAsAnalyzerReference:=False, analyzers:=suppressors) Assert.DoesNotContain($"warning BC40008", output, StringComparison.Ordinal) @@ -9458,8 +9457,7 @@ End Class" Dim analyzers = ImmutableArray.Create(Of DiagnosticAnalyzer)(New DiagnosticSuppressorForId("BC30203")) output = VerifyOutput(dir, file, expectedErrorCount:=1, includeCurrentAssemblyAsAnalyzerReference:=False, - analyzers:=analyzers, - additionalFlags:={"/features:DiagnosticSuppressor"}) + analyzers:=analyzers) Assert.Contains("error BC30203", output, StringComparison.Ordinal) CleanupAllGeneratedFiles(file.Path) @@ -9497,15 +9495,14 @@ End Class" Dim analyzerAndSuppressor = ImmutableArray.Create(Of DiagnosticAnalyzer)(analyzer, suppressor) output = VerifyOutput(dir, file, expectedInfoCount:=1, expectedWarningCount:=0, includeCurrentAssemblyAsAnalyzerReference:=False, - analyzers:=analyzerAndSuppressor, - additionalFlags:={"/features:DiagnosticSuppressor"}) + analyzers:=analyzerAndSuppressor) Assert.DoesNotContain($"warning {analyzer.Descriptor.Id}", output, StringComparison.Ordinal) Assert.Contains("info SP0001", output, StringComparison.Ordinal) Assert.Contains(suppressionMessage, output, StringComparison.Ordinal) ' Verify that analyzer warning is reported as error for /warnaserror. output = VerifyOutput(dir, file, expectedErrorCount:=1, - additionalFlags:={"/warnaserror+", "/features:DiagnosticSuppressor"}, + additionalFlags:={"/warnaserror+"}, includeCurrentAssemblyAsAnalyzerReference:=False, analyzers:=analyzers) Assert.Contains($"error {analyzer.Descriptor.Id}", output, StringComparison.Ordinal) @@ -9513,7 +9510,7 @@ End Class" ' Verify that analyzer warning is suppressed with diagnostic suppressor even with /warnaserror ' and info diagnostic is logged with programmatic suppression information. output = VerifyOutput(dir, file, expectedInfoCount:=1, expectedWarningCount:=0, expectedErrorCount:=0, - additionalFlags:={"/warnaserror+", "/features:DiagnosticSuppressor"}, + additionalFlags:={"/warnaserror+"}, includeCurrentAssemblyAsAnalyzerReference:=False, analyzers:=analyzerAndSuppressor) Assert.DoesNotContain($"warning {analyzer.Descriptor.Id}", output, StringComparison.Ordinal) @@ -9526,8 +9523,7 @@ End Class" analyzerAndSuppressor = ImmutableArray.Create(Of DiagnosticAnalyzer)(analyzer, suppressor) output = VerifyOutput(dir, file, expectedWarningCount:=1, includeCurrentAssemblyAsAnalyzerReference:=False, - analyzers:=analyzerAndSuppressor, - additionalFlags:={"/features:DiagnosticSuppressor"}) + analyzers:=analyzerAndSuppressor) Assert.Contains($"warning {analyzer.Descriptor.Id}", output, StringComparison.Ordinal) CleanupAllGeneratedFiles(file.Path) @@ -9556,8 +9552,7 @@ End Class" Dim analyzerAndSuppressor = ImmutableArray.Create(Of DiagnosticAnalyzer)(analyzer, suppressor) output = VerifyOutput(dir, file, expectedErrorCount:=1, includeCurrentAssemblyAsAnalyzerReference:=False, - analyzers:=analyzerAndSuppressor, - additionalFlags:={"/features:DiagnosticSuppressor"}) + analyzers:=analyzerAndSuppressor) Assert.Contains($"error {analyzer.Descriptor.Id}", output, StringComparison.Ordinal) CleanupAllGeneratedFiles(file.Path) -- GitLab