From e5cfbdb01a0ebac7c9fab8ab4b99a7b92f739138 Mon Sep 17 00:00:00 2001 From: Josef Pihrt Date: Sun, 15 Sep 2024 11:00:04 +0200 Subject: [PATCH] Target .NET 8 (tests etc.) (#1523) --- src/Tests/Analyzers.Tests/Analyzers.Tests.csproj | 2 +- .../RCS1257UseEnumFieldExplicitlyTests.cs | 11 +++++++++-- src/Tests/CSharp.Tests/CSharp.Tests.csproj | 2 +- .../CSharp.Workspaces.Tests.csproj | 2 +- .../CodeAnalysis.Analyzers.Tests.csproj | 2 +- src/Tests/CodeFixes.Tests/CodeFixes.Tests.csproj | 2 +- src/Tests/Core.Tests/Core.Tests.csproj | 2 +- .../Formatting.Analyzers.Tests.csproj | 2 +- .../RR0059AddMissingCasesToSwitchStatementTests.cs | 2 ++ .../Refactorings.Tests/Refactorings.Tests.csproj | 2 +- src/Tests/TestConsole/TestConsole.csproj | 2 +- src/Tests/TestLibrary/TestLibrary.csproj | 2 +- .../CodeGeneration/CSharp/DiagnosticRulesGenerator.cs | 2 +- src/Tools/CodeGeneration/CodeGeneration.csproj | 2 +- .../CodeGeneration/Markdown/MarkdownGenerator.cs | 2 +- src/Tools/CodeGenerator/CodeGenerator.csproj | 2 +- .../ConfigurationFileGenerator.csproj | 2 +- src/Tools/Metadata/Metadata.csproj | 2 +- src/Tools/MetadataGenerator/MetadataGenerator.csproj | 2 +- 19 files changed, 28 insertions(+), 19 deletions(-) diff --git a/src/Tests/Analyzers.Tests/Analyzers.Tests.csproj b/src/Tests/Analyzers.Tests/Analyzers.Tests.csproj index 0dd7b78f0e..36db97317e 100644 --- a/src/Tests/Analyzers.Tests/Analyzers.Tests.csproj +++ b/src/Tests/Analyzers.Tests/Analyzers.Tests.csproj @@ -1,7 +1,7 @@  - net6.0 + net8.0 diff --git a/src/Tests/Analyzers.Tests/RCS1257UseEnumFieldExplicitlyTests.cs b/src/Tests/Analyzers.Tests/RCS1257UseEnumFieldExplicitlyTests.cs index 511104b21c..1402fc5138 100644 --- a/src/Tests/Analyzers.Tests/RCS1257UseEnumFieldExplicitlyTests.cs +++ b/src/Tests/Analyzers.Tests/RCS1257UseEnumFieldExplicitlyTests.cs @@ -123,16 +123,23 @@ enum Foo } [Fact, Trait(Traits.Analyzer, DiagnosticIdentifiers.UseEnumFieldExplicitly)] - public async Task TestNoDiagnostic_FileAttributes() + public async Task TestNoDiagnostic_ZeroNotDefined() { await VerifyNoDiagnosticAsync(@" class C { void M() { - var x = (System.IO.FileAttributes)0; + var x = (E)0; } } + +[System.Flags] +enum E +{ + A = 1, + B = 2, +} "); } } diff --git a/src/Tests/CSharp.Tests/CSharp.Tests.csproj b/src/Tests/CSharp.Tests/CSharp.Tests.csproj index 72694b4303..30b3796217 100644 --- a/src/Tests/CSharp.Tests/CSharp.Tests.csproj +++ b/src/Tests/CSharp.Tests/CSharp.Tests.csproj @@ -1,7 +1,7 @@  - net6.0 + net8.0 diff --git a/src/Tests/CSharp.Workspaces.Tests/CSharp.Workspaces.Tests.csproj b/src/Tests/CSharp.Workspaces.Tests/CSharp.Workspaces.Tests.csproj index 008404f86c..0e5323e67e 100644 --- a/src/Tests/CSharp.Workspaces.Tests/CSharp.Workspaces.Tests.csproj +++ b/src/Tests/CSharp.Workspaces.Tests/CSharp.Workspaces.Tests.csproj @@ -1,7 +1,7 @@  - net6.0 + net8.0 diff --git a/src/Tests/CodeAnalysis.Analyzers.Tests/CodeAnalysis.Analyzers.Tests.csproj b/src/Tests/CodeAnalysis.Analyzers.Tests/CodeAnalysis.Analyzers.Tests.csproj index 46b74c3e12..805e8bfd9f 100644 --- a/src/Tests/CodeAnalysis.Analyzers.Tests/CodeAnalysis.Analyzers.Tests.csproj +++ b/src/Tests/CodeAnalysis.Analyzers.Tests/CodeAnalysis.Analyzers.Tests.csproj @@ -1,7 +1,7 @@  - net6.0 + net8.0 diff --git a/src/Tests/CodeFixes.Tests/CodeFixes.Tests.csproj b/src/Tests/CodeFixes.Tests/CodeFixes.Tests.csproj index be973f1c7c..e1db4c94cc 100644 --- a/src/Tests/CodeFixes.Tests/CodeFixes.Tests.csproj +++ b/src/Tests/CodeFixes.Tests/CodeFixes.Tests.csproj @@ -1,7 +1,7 @@  - net6.0 + net8.0 diff --git a/src/Tests/Core.Tests/Core.Tests.csproj b/src/Tests/Core.Tests/Core.Tests.csproj index 02936ea3e6..0adbadcf7a 100644 --- a/src/Tests/Core.Tests/Core.Tests.csproj +++ b/src/Tests/Core.Tests/Core.Tests.csproj @@ -1,7 +1,7 @@  - net6.0 + net8.0 diff --git a/src/Tests/Formatting.Analyzers.Tests/Formatting.Analyzers.Tests.csproj b/src/Tests/Formatting.Analyzers.Tests/Formatting.Analyzers.Tests.csproj index 887df84c48..613c3c898c 100644 --- a/src/Tests/Formatting.Analyzers.Tests/Formatting.Analyzers.Tests.csproj +++ b/src/Tests/Formatting.Analyzers.Tests/Formatting.Analyzers.Tests.csproj @@ -1,7 +1,7 @@  - net6.0 + net8.0 diff --git a/src/Tests/Refactorings.Tests/RR0059AddMissingCasesToSwitchStatementTests.cs b/src/Tests/Refactorings.Tests/RR0059AddMissingCasesToSwitchStatementTests.cs index a3ce7fca10..9ef98ac00f 100644 --- a/src/Tests/Refactorings.Tests/RR0059AddMissingCasesToSwitchStatementTests.cs +++ b/src/Tests/Refactorings.Tests/RR0059AddMissingCasesToSwitchStatementTests.cs @@ -249,6 +249,8 @@ void M() break; case RegexOptions.CultureInvariant: break; + case RegexOptions.NonBacktracking: + break; default: break; } diff --git a/src/Tests/Refactorings.Tests/Refactorings.Tests.csproj b/src/Tests/Refactorings.Tests/Refactorings.Tests.csproj index 6cfbb57ed3..c9bd43b652 100644 --- a/src/Tests/Refactorings.Tests/Refactorings.Tests.csproj +++ b/src/Tests/Refactorings.Tests/Refactorings.Tests.csproj @@ -1,7 +1,7 @@  - net6.0 + net8.0 diff --git a/src/Tests/TestConsole/TestConsole.csproj b/src/Tests/TestConsole/TestConsole.csproj index 5ded285e1c..fd6173d30b 100644 --- a/src/Tests/TestConsole/TestConsole.csproj +++ b/src/Tests/TestConsole/TestConsole.csproj @@ -2,7 +2,7 @@ Exe - net6.0 + net8.0 diff --git a/src/Tests/TestLibrary/TestLibrary.csproj b/src/Tests/TestLibrary/TestLibrary.csproj index cb0d038cec..69ea0350a3 100644 --- a/src/Tests/TestLibrary/TestLibrary.csproj +++ b/src/Tests/TestLibrary/TestLibrary.csproj @@ -1,7 +1,7 @@  - net6.0 + net8.0 diff --git a/src/Tools/CodeGeneration/CSharp/DiagnosticRulesGenerator.cs b/src/Tools/CodeGeneration/CSharp/DiagnosticRulesGenerator.cs index 45a9352f45..7b1b131303 100644 --- a/src/Tools/CodeGeneration/CSharp/DiagnosticRulesGenerator.cs +++ b/src/Tools/CodeGeneration/CSharp/DiagnosticRulesGenerator.cs @@ -97,7 +97,7 @@ protected virtual ClassDeclarationSyntax CreateClassDeclaration( useParentProperties))); } - private MemberDeclarationSyntax CreateMember( + private FieldDeclarationSyntax CreateMember( AnalyzerMetadata analyzer, string identifiersClassName, string categoryName, diff --git a/src/Tools/CodeGeneration/CodeGeneration.csproj b/src/Tools/CodeGeneration/CodeGeneration.csproj index 9c5c4185a1..12656c13d3 100644 --- a/src/Tools/CodeGeneration/CodeGeneration.csproj +++ b/src/Tools/CodeGeneration/CodeGeneration.csproj @@ -1,7 +1,7 @@  - net6.0 + net8.0 diff --git a/src/Tools/CodeGeneration/Markdown/MarkdownGenerator.cs b/src/Tools/CodeGeneration/Markdown/MarkdownGenerator.cs index 3b4ab06f13..499ba4a85e 100644 --- a/src/Tools/CodeGeneration/Markdown/MarkdownGenerator.cs +++ b/src/Tools/CodeGeneration/Markdown/MarkdownGenerator.cs @@ -476,7 +476,7 @@ private static MElement CheckboxOrHyphen(bool value) } } - private static MObject CreateFrontMatter(string title = null, int? position = null, string label = null) + private static DocusaurusFrontMatter CreateFrontMatter(string title = null, int? position = null, string label = null) { return DocusaurusMarkdownFactory.FrontMatter(GetLabels()); diff --git a/src/Tools/CodeGenerator/CodeGenerator.csproj b/src/Tools/CodeGenerator/CodeGenerator.csproj index 0c429f3895..6a4a16fdbc 100644 --- a/src/Tools/CodeGenerator/CodeGenerator.csproj +++ b/src/Tools/CodeGenerator/CodeGenerator.csproj @@ -2,7 +2,7 @@ Exe - net7.0 + net8.0 diff --git a/src/Tools/ConfigurationFileGenerator/ConfigurationFileGenerator.csproj b/src/Tools/ConfigurationFileGenerator/ConfigurationFileGenerator.csproj index 5b8d7c1219..de103e9207 100644 --- a/src/Tools/ConfigurationFileGenerator/ConfigurationFileGenerator.csproj +++ b/src/Tools/ConfigurationFileGenerator/ConfigurationFileGenerator.csproj @@ -2,7 +2,7 @@ Exe - net7.0 + net8.0 diff --git a/src/Tools/Metadata/Metadata.csproj b/src/Tools/Metadata/Metadata.csproj index 50ed560689..8207189ad7 100644 --- a/src/Tools/Metadata/Metadata.csproj +++ b/src/Tools/Metadata/Metadata.csproj @@ -1,7 +1,7 @@  - net6.0 + net8.0 diff --git a/src/Tools/MetadataGenerator/MetadataGenerator.csproj b/src/Tools/MetadataGenerator/MetadataGenerator.csproj index 60a07cda7b..20474cd697 100644 --- a/src/Tools/MetadataGenerator/MetadataGenerator.csproj +++ b/src/Tools/MetadataGenerator/MetadataGenerator.csproj @@ -2,7 +2,7 @@ Exe - net7.0 + net8.0