From 975026fa77271c7d890bb497c5f944bde7dd74d7 Mon Sep 17 00:00:00 2001 From: Josef Pihrt Date: Wed, 19 Jul 2023 15:42:21 +0200 Subject: [PATCH] Bump Roslyn to 4.4.0 (#1116) --- ChangeLog.md | 1 + .../Analyzers.CodeFixes.csproj | 4 +- ...meterNameDiffersFromBaseCodeFixProvider.cs | 7 ++- .../UnusedParameterCodeFixProvider.cs | 4 +- src/Analyzers/Analyzers.csproj | 5 +- .../CSharp.Workspaces.csproj | 7 ++- src/CSharp/CSharp.csproj | 7 ++- .../SyntaxWalkers/CSharpSyntaxNodeWalker.cs | 46 +++++++++++++++++++ .../CodeAnalysis.Analyzers.CodeFixes.csproj | 4 +- .../CodeAnalysis.Analyzers.csproj | 5 +- src/CodeFixes/CodeFixes.csproj | 4 +- src/Common/Common.csproj | 4 +- src/Core/Core.csproj | 2 +- src/Directory.Build.props | 2 + .../Formatting.Analyzers.CodeFixes.csproj | 4 +- .../Formatting.Analyzers.csproj | 5 +- .../AddOrRenameParameterRefactoring.cs | 2 +- .../DeclarationExpressionRefactoring.cs | 2 +- .../DeclarationPatternRefactoring.cs | 2 +- .../ForEachStatementRefactoring.cs | 2 +- .../Refactorings/IdentifierNameRefactoring.cs | 2 +- .../MethodDeclarationRefactoring.cs | 2 +- .../PropertyDeclarationRefactoring.cs | 2 +- .../VariableDeclarationRefactoring.cs | 2 +- src/Refactorings/Refactorings.csproj | 4 +- .../Analyzers.Tests.Old.csproj | 2 +- .../CodeFixes.Tests.Old.csproj | 2 +- .../Refactorings.Tests.Old.csproj | 2 +- ...RemoveRedundantFieldInitializationTests.cs | 10 ++++ .../RCS1251RemoveUnnecessaryBracesTests.cs | 4 +- src/Tests/CSharp.Tests/SyntaxKindTests.cs | 22 +++++++++ src/Tests/TestConsole/TestConsole.csproj | 2 +- .../Testing.CSharp/Testing.CSharp.csproj | 2 +- .../Testing.Common/Testing.Common.csproj | 2 +- .../Testing/RefactoringTestData.cs | 2 +- .../Testing.VisualBasic.csproj | 2 +- .../CSharp/Symbols.Generated.cs | 21 +++++++++ .../CSharp/SymbolsGetKindsGenerator.cs | 18 ++++++++ .../CSharpSyntaxWalkerGenerator.Generated.cs | 46 +++++++++++++++++++ .../CSharpSyntaxWalkerGenerator.cs | 1 + .../CodeGeneration/CodeGeneration.csproj | 2 +- src/Tools/CodeGenerator/CodeGenerator.csproj | 2 +- .../MetadataGenerator.csproj | 4 +- .../TestCodeGenerator.csproj | 2 +- src/Tools/Utilities/Utilities.csproj | 2 +- .../VisualBasic.Workspaces.csproj | 7 ++- src/VisualBasic/VisualBasic.csproj | 2 +- .../Workspaces.Common.csproj | 4 +- src/Workspaces.Core/Rename/SymbolRenamer.cs | 2 +- src/Workspaces.Core/Spelling/SpellingFixer.cs | 4 +- src/Workspaces.Core/Workspaces.Core.csproj | 2 +- 51 files changed, 243 insertions(+), 59 deletions(-) diff --git a/ChangeLog.md b/ChangeLog.md index d72b386a08..4ab537bd71 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed - [CLI] Bump Roslyn to 4.6.0 ([#1106](https://github.com/josefpihrt/roslynator/pull/1106)). +- Bump Roslyn to 4.4.0 ([#1116](https://github.com/josefpihrt/roslynator/pull/1116)). ### Fixed diff --git a/src/Analyzers.CodeFixes/Analyzers.CodeFixes.csproj b/src/Analyzers.CodeFixes/Analyzers.CodeFixes.csproj index ea36b045b0..e9ec95fcb6 100644 --- a/src/Analyzers.CodeFixes/Analyzers.CodeFixes.csproj +++ b/src/Analyzers.CodeFixes/Analyzers.CodeFixes.csproj @@ -18,11 +18,11 @@ - + all runtime; build; native; contentfiles; analyzers - + diff --git a/src/Analyzers.CodeFixes/CSharp/CodeFixes/ParameterNameDiffersFromBaseCodeFixProvider.cs b/src/Analyzers.CodeFixes/CSharp/CodeFixes/ParameterNameDiffersFromBaseCodeFixProvider.cs index 65db51452c..b8a34f1061 100644 --- a/src/Analyzers.CodeFixes/CSharp/CodeFixes/ParameterNameDiffersFromBaseCodeFixProvider.cs +++ b/src/Analyzers.CodeFixes/CSharp/CodeFixes/ParameterNameDiffersFromBaseCodeFixProvider.cs @@ -84,7 +84,12 @@ public override async Task RegisterCodeFixesAsync(CodeFixContext context) CodeAction codeAction = CodeAction.Create( $"Rename '{oldName}' to '{newName}'", - ct => Renamer.RenameSymbolAsync(context.Document.Solution(), parameterSymbol, newName, default(OptionSet), ct), + ct => Renamer.RenameSymbolAsync( + context.Document.Solution(), + parameterSymbol, + default(SymbolRenameOptions), + newName, + ct), GetEquivalenceKey(diagnostic)); context.RegisterCodeFix(codeAction, diagnostic); diff --git a/src/Analyzers.CodeFixes/CSharp/CodeFixes/UnusedParameterCodeFixProvider.cs b/src/Analyzers.CodeFixes/CSharp/CodeFixes/UnusedParameterCodeFixProvider.cs index 2ed10d5d3c..2dab1f38be 100644 --- a/src/Analyzers.CodeFixes/CSharp/CodeFixes/UnusedParameterCodeFixProvider.cs +++ b/src/Analyzers.CodeFixes/CSharp/CodeFixes/UnusedParameterCodeFixProvider.cs @@ -68,8 +68,6 @@ private static async Task RefactorAsync( string newName = NameGenerators.UnderscoreSuffix.EnsureUniqueParameterName("_", anonymousFunctionSymbol, semanticModel, cancellationToken: cancellationToken); - DocumentOptionSet options = await document.GetOptionsAsync(cancellationToken).ConfigureAwait(false); - - return await Renamer.RenameSymbolAsync(document.Solution(), parameterSymbol, newName, options, cancellationToken).ConfigureAwait(false); + return await Renamer.RenameSymbolAsync(document.Solution(), parameterSymbol, default(SymbolRenameOptions), newName, cancellationToken).ConfigureAwait(false); } } diff --git a/src/Analyzers/Analyzers.csproj b/src/Analyzers/Analyzers.csproj index efed7ba1df..dda4e56d2d 100644 --- a/src/Analyzers/Analyzers.csproj +++ b/src/Analyzers/Analyzers.csproj @@ -9,14 +9,15 @@ Roslynator.CSharp.Analyzers Roslynator.CSharp false + true - + all runtime; build; native; contentfiles; analyzers - + diff --git a/src/CSharp.Workspaces/CSharp.Workspaces.csproj b/src/CSharp.Workspaces/CSharp.Workspaces.csproj index baaf1dc028..c9f1485be9 100644 --- a/src/CSharp.Workspaces/CSharp.Workspaces.csproj +++ b/src/CSharp.Workspaces/CSharp.Workspaces.csproj @@ -38,8 +38,11 @@ Roslynator.NameGenerator - - + + all + runtime; build; native; contentfiles; analyzers + + diff --git a/src/CSharp/CSharp.csproj b/src/CSharp/CSharp.csproj index 2cf9767793..8905dab12c 100644 --- a/src/CSharp/CSharp.csproj +++ b/src/CSharp/CSharp.csproj @@ -38,8 +38,11 @@ Roslynator.NameGenerator - - + + all + runtime; build; native; contentfiles; analyzers + + diff --git a/src/CSharp/CSharp/SyntaxWalkers/CSharpSyntaxNodeWalker.cs b/src/CSharp/CSharp/SyntaxWalkers/CSharpSyntaxNodeWalker.cs index 8f6238d734..1e9f7cfdb1 100644 --- a/src/CSharp/CSharp/SyntaxWalkers/CSharpSyntaxNodeWalker.cs +++ b/src/CSharp/CSharp/SyntaxWalkers/CSharpSyntaxNodeWalker.cs @@ -2562,6 +2562,19 @@ public override void VisitLineSpanDirectiveTrivia(LineSpanDirectiveTriviaSyntax } } + public override void VisitListPattern(ListPatternSyntax node) + { + foreach (PatternSyntax pattern in node.Patterns) + { + if (!ShouldVisit) + { + return; + } + + VisitPattern(pattern); + } + } + public override void VisitLiteralExpression(LiteralExpressionSyntax node) { } @@ -3790,6 +3803,20 @@ public override void VisitReturnStatement(ReturnStatementSyntax node) } } + public override void VisitScopedType(ScopedTypeSyntax node) + { + if (!ShouldVisit) + { + return; + } + + TypeSyntax type = node.Type; + if (type != null) + { + VisitType(type); + } + } + public override void VisitSelectClause(SelectClauseSyntax node) { if (!ShouldVisit) @@ -3890,6 +3917,10 @@ public override void VisitSkippedTokensTrivia(SkippedTokensTriviaSyntax node) { } + public override void VisitSlicePattern(SlicePatternSyntax node) + { + } + public override void VisitStackAllocArrayCreationExpression(StackAllocArrayCreationExpressionSyntax node) { if (!ShouldVisit) @@ -4890,6 +4921,7 @@ protected virtual void VisitExpression(ExpressionSyntax node) case SyntaxKind.LeftShiftAssignmentExpression: case SyntaxKind.RightShiftAssignmentExpression: case SyntaxKind.CoalesceAssignmentExpression: + case SyntaxKind.UnsignedRightShiftAssignmentExpression: VisitAssignmentExpression((AssignmentExpressionSyntax)node); break; case SyntaxKind.AwaitExpression: @@ -4919,6 +4951,7 @@ protected virtual void VisitExpression(ExpressionSyntax node) case SyntaxKind.IsExpression: case SyntaxKind.AsExpression: case SyntaxKind.CoalesceExpression: + case SyntaxKind.UnsignedRightShiftExpression: VisitBinaryExpression((BinaryExpressionSyntax)node); break; case SyntaxKind.CastExpression: @@ -4991,6 +5024,7 @@ protected virtual void VisitExpression(ExpressionSyntax node) case SyntaxKind.FalseLiteralExpression: case SyntaxKind.NullLiteralExpression: case SyntaxKind.DefaultLiteralExpression: + case SyntaxKind.Utf8StringLiteralExpression: VisitLiteralExpression((LiteralExpressionSyntax)node); break; case SyntaxKind.MakeRefExpression: @@ -5064,6 +5098,9 @@ protected virtual void VisitExpression(ExpressionSyntax node) case SyntaxKind.RefValueExpression: VisitRefValueExpression((RefValueExpressionSyntax)node); break; + case SyntaxKind.ScopedType: + VisitScopedType((ScopedTypeSyntax)node); + break; case SyntaxKind.SimpleLambdaExpression: VisitSimpleLambdaExpression((SimpleLambdaExpressionSyntax)node); break; @@ -5233,6 +5270,9 @@ protected virtual void VisitPattern(PatternSyntax node) case SyntaxKind.DiscardPattern: VisitDiscardPattern((DiscardPatternSyntax)node); break; + case SyntaxKind.ListPattern: + VisitListPattern((ListPatternSyntax)node); + break; case SyntaxKind.ParenthesizedPattern: VisitParenthesizedPattern((ParenthesizedPatternSyntax)node); break; @@ -5242,6 +5282,9 @@ protected virtual void VisitPattern(PatternSyntax node) case SyntaxKind.RelationalPattern: VisitRelationalPattern((RelationalPatternSyntax)node); break; + case SyntaxKind.SlicePattern: + VisitSlicePattern((SlicePatternSyntax)node); + break; case SyntaxKind.TypePattern: VisitTypePattern((TypePatternSyntax)node); break; @@ -5489,6 +5532,9 @@ protected virtual void VisitType(TypeSyntax node) case SyntaxKind.RefType: VisitRefType((RefTypeSyntax)node); break; + case SyntaxKind.ScopedType: + VisitScopedType((ScopedTypeSyntax)node); + break; case SyntaxKind.TupleType: VisitTupleType((TupleTypeSyntax)node); break; diff --git a/src/CodeAnalysis.Analyzers.CodeFixes/CodeAnalysis.Analyzers.CodeFixes.csproj b/src/CodeAnalysis.Analyzers.CodeFixes/CodeAnalysis.Analyzers.CodeFixes.csproj index e5497bfca6..cbe426102c 100644 --- a/src/CodeAnalysis.Analyzers.CodeFixes/CodeAnalysis.Analyzers.CodeFixes.csproj +++ b/src/CodeAnalysis.Analyzers.CodeFixes/CodeAnalysis.Analyzers.CodeFixes.csproj @@ -18,11 +18,11 @@ - + all runtime; build; native; contentfiles; analyzers - + diff --git a/src/CodeAnalysis.Analyzers/CodeAnalysis.Analyzers.csproj b/src/CodeAnalysis.Analyzers/CodeAnalysis.Analyzers.csproj index 43d16eb345..9d42b91133 100644 --- a/src/CodeAnalysis.Analyzers/CodeAnalysis.Analyzers.csproj +++ b/src/CodeAnalysis.Analyzers/CodeAnalysis.Analyzers.csproj @@ -9,14 +9,15 @@ Roslynator.CodeAnalysis.Analyzers Roslynator.CodeAnalysis false + true - + all runtime; build; native; contentfiles; analyzers - + diff --git a/src/CodeFixes/CodeFixes.csproj b/src/CodeFixes/CodeFixes.csproj index 0fd0bb486b..08ab78361b 100644 --- a/src/CodeFixes/CodeFixes.csproj +++ b/src/CodeFixes/CodeFixes.csproj @@ -19,11 +19,11 @@ - + all runtime; build; native; contentfiles; analyzers - + diff --git a/src/Common/Common.csproj b/src/Common/Common.csproj index de6f44aacb..4c7c47a3a6 100644 --- a/src/Common/Common.csproj +++ b/src/Common/Common.csproj @@ -17,11 +17,11 @@ - + all runtime; build; native; contentfiles; analyzers - + diff --git a/src/Core/Core.csproj b/src/Core/Core.csproj index da3b6381c2..3021efd9a2 100644 --- a/src/Core/Core.csproj +++ b/src/Core/Core.csproj @@ -32,7 +32,7 @@ - + diff --git a/src/Directory.Build.props b/src/Directory.Build.props index 207476adb6..60720619f9 100644 --- a/src/Directory.Build.props +++ b/src/Directory.Build.props @@ -8,6 +8,8 @@ Copyright (c) 2016-2023 Josef Pihrt false 0024000004800000940000000602000000240000525341310004000001000100d348e1a51bc190259aed17cfe132736241fef462de45a5de6c881c7f9d705073c7a2a08ba5ae493c7e878fe5f3cf7909e89045cca696422f03b284b147daf6b93c47bc53dd61ceeae60f73149d183032f029761d0d59aab49a26be4f6af71cd8194ace937642bdcb515f07530096122e97cfe6c8549a843530f71c24c7e3dab8 + 4.4.0 + 3.3.4 4.6.0 diff --git a/src/Formatting.Analyzers.CodeFixes/Formatting.Analyzers.CodeFixes.csproj b/src/Formatting.Analyzers.CodeFixes/Formatting.Analyzers.CodeFixes.csproj index 7064ccb45b..fc1ab34fdc 100644 --- a/src/Formatting.Analyzers.CodeFixes/Formatting.Analyzers.CodeFixes.csproj +++ b/src/Formatting.Analyzers.CodeFixes/Formatting.Analyzers.CodeFixes.csproj @@ -18,11 +18,11 @@ - + all runtime; build; native; contentfiles; analyzers - + diff --git a/src/Formatting.Analyzers/Formatting.Analyzers.csproj b/src/Formatting.Analyzers/Formatting.Analyzers.csproj index bb4a933bf6..373b5629e7 100644 --- a/src/Formatting.Analyzers/Formatting.Analyzers.csproj +++ b/src/Formatting.Analyzers/Formatting.Analyzers.csproj @@ -9,14 +9,15 @@ Roslynator.Formatting.Analyzers Roslynator.Formatting false + true - + all runtime; build; native; contentfiles; analyzers - + diff --git a/src/Refactorings/CSharp/Refactorings/AddOrRenameParameterRefactoring.cs b/src/Refactorings/CSharp/Refactorings/AddOrRenameParameterRefactoring.cs index c418d22a7a..cbb75d73b0 100644 --- a/src/Refactorings/CSharp/Refactorings/AddOrRenameParameterRefactoring.cs +++ b/src/Refactorings/CSharp/Refactorings/AddOrRenameParameterRefactoring.cs @@ -41,7 +41,7 @@ public static async Task ComputeRefactoringsAsync(RefactoringContext context, Pa { context.RegisterRefactoring( $"Rename '{oldName}' to '{newName}'", - ct => Renamer.RenameSymbolAsync(context.Solution, parameterSymbol, newName, default(OptionSet), ct), + ct => Renamer.RenameSymbolAsync(context.Solution, parameterSymbol, default(SymbolRenameOptions), newName, ct), RefactoringDescriptors.RenameParameterAccordingToTypeName); } } diff --git a/src/Refactorings/CSharp/Refactorings/DeclarationExpressionRefactoring.cs b/src/Refactorings/CSharp/Refactorings/DeclarationExpressionRefactoring.cs index b5f3bcb6da..36dcb5e7a6 100644 --- a/src/Refactorings/CSharp/Refactorings/DeclarationExpressionRefactoring.cs +++ b/src/Refactorings/CSharp/Refactorings/DeclarationExpressionRefactoring.cs @@ -61,7 +61,7 @@ private static async Task RenameVariableAccordingToTypeNameAsync( context.RegisterRefactoring( $"Rename '{oldName}' to '{newName}'", - ct => Renamer.RenameSymbolAsync(context.Solution, localSymbol, newName, default(OptionSet), ct), + ct => Renamer.RenameSymbolAsync(context.Solution, localSymbol, default(SymbolRenameOptions), newName, ct), RefactoringDescriptors.RenameIdentifierAccordingToTypeName); } } diff --git a/src/Refactorings/CSharp/Refactorings/DeclarationPatternRefactoring.cs b/src/Refactorings/CSharp/Refactorings/DeclarationPatternRefactoring.cs index 7b829f44d7..d6a7b9c59e 100644 --- a/src/Refactorings/CSharp/Refactorings/DeclarationPatternRefactoring.cs +++ b/src/Refactorings/CSharp/Refactorings/DeclarationPatternRefactoring.cs @@ -46,7 +46,7 @@ internal static async Task ComputeRefactoringAsync(RefactoringContext context, D { context.RegisterRefactoring( $"Rename '{oldName}' to '{newName}'", - ct => Renamer.RenameSymbolAsync(context.Solution, symbol, newName, default(OptionSet), ct), + ct => Renamer.RenameSymbolAsync(context.Solution, symbol, default(SymbolRenameOptions), newName, ct), RefactoringDescriptors.RenameIdentifierAccordingToTypeName); } } diff --git a/src/Refactorings/CSharp/Refactorings/ForEachStatementRefactoring.cs b/src/Refactorings/CSharp/Refactorings/ForEachStatementRefactoring.cs index bb586584b1..8a41ce81e1 100644 --- a/src/Refactorings/CSharp/Refactorings/ForEachStatementRefactoring.cs +++ b/src/Refactorings/CSharp/Refactorings/ForEachStatementRefactoring.cs @@ -163,7 +163,7 @@ internal static async Task RenameIdentifierAccordingToTypeNameAsync( context.RegisterRefactoring( $"Rename '{oldName}' to '{newName}'", - ct => Renamer.RenameSymbolAsync(context.Solution, symbol, newName, default(OptionSet), ct), + ct => Renamer.RenameSymbolAsync(context.Solution, symbol, default(SymbolRenameOptions), newName, ct), RefactoringDescriptors.RenameIdentifierAccordingToTypeName); } } diff --git a/src/Refactorings/CSharp/Refactorings/IdentifierNameRefactoring.cs b/src/Refactorings/CSharp/Refactorings/IdentifierNameRefactoring.cs index 2e838c7c2d..69cbe5bd9c 100644 --- a/src/Refactorings/CSharp/Refactorings/IdentifierNameRefactoring.cs +++ b/src/Refactorings/CSharp/Refactorings/IdentifierNameRefactoring.cs @@ -81,7 +81,7 @@ private static async Task SyncPropertyNameAndBackingFieldNameAsync( context.RegisterRefactoring( $"Rename '{fieldSymbol.Name}' to '{newName}'", - ct => Renamer.RenameSymbolAsync(context.Solution, fieldSymbol, newName, default(OptionSet), ct), + ct => Renamer.RenameSymbolAsync(context.Solution, fieldSymbol, default(SymbolRenameOptions), newName, ct), RefactoringDescriptors.SyncPropertyNameAndBackingFieldName); } diff --git a/src/Refactorings/CSharp/Refactorings/MethodDeclarationRefactoring.cs b/src/Refactorings/CSharp/Refactorings/MethodDeclarationRefactoring.cs index 7ad549adc8..6536e23c7c 100644 --- a/src/Refactorings/CSharp/Refactorings/MethodDeclarationRefactoring.cs +++ b/src/Refactorings/CSharp/Refactorings/MethodDeclarationRefactoring.cs @@ -143,7 +143,7 @@ private static async Task RenameMethodAccordingToTypeNameAsync( context.RegisterRefactoring( $"Rename '{oldName}' to '{newName}'", - ct => Renamer.RenameSymbolAsync(context.Solution, methodSymbol, newName, default(OptionSet), ct), + ct => Renamer.RenameSymbolAsync(context.Solution, methodSymbol, new SymbolRenameOptions(RenameOverloads: true), newName, ct), RefactoringDescriptors.RenameMethodAccordingToTypeName); } diff --git a/src/Refactorings/CSharp/Refactorings/PropertyDeclarationRefactoring.cs b/src/Refactorings/CSharp/Refactorings/PropertyDeclarationRefactoring.cs index d70453fdc7..6ce4b9fcfa 100644 --- a/src/Refactorings/CSharp/Refactorings/PropertyDeclarationRefactoring.cs +++ b/src/Refactorings/CSharp/Refactorings/PropertyDeclarationRefactoring.cs @@ -145,7 +145,7 @@ private static async Task RenamePropertyAccordingToTypeName(RefactoringContext c context.RegisterRefactoring( $"Rename '{oldName}' to '{newName}'", - ct => Renamer.RenameSymbolAsync(context.Solution, symbol, newName, default(OptionSet), ct), + ct => Renamer.RenameSymbolAsync(context.Solution, symbol, new SymbolRenameOptions(RenameOverloads: true), newName, ct), RefactoringDescriptors.RenamePropertyAccordingToTypeName); } } diff --git a/src/Refactorings/CSharp/Refactorings/VariableDeclarationRefactoring.cs b/src/Refactorings/CSharp/Refactorings/VariableDeclarationRefactoring.cs index 9eb2c10a16..e0571fe827 100644 --- a/src/Refactorings/CSharp/Refactorings/VariableDeclarationRefactoring.cs +++ b/src/Refactorings/CSharp/Refactorings/VariableDeclarationRefactoring.cs @@ -73,7 +73,7 @@ private static async Task RenameVariableAccordingToTypeNameAsync( context.RegisterRefactoring( $"Rename '{oldName}' to '{newName}'", - ct => Renamer.RenameSymbolAsync(context.Solution, localSymbol, newName, default(OptionSet), ct), + ct => Renamer.RenameSymbolAsync(context.Solution, localSymbol, default(SymbolRenameOptions), newName, ct), RefactoringDescriptors.RenameIdentifierAccordingToTypeName); } } diff --git a/src/Refactorings/Refactorings.csproj b/src/Refactorings/Refactorings.csproj index 0128ee47a9..82e4aed527 100644 --- a/src/Refactorings/Refactorings.csproj +++ b/src/Refactorings/Refactorings.csproj @@ -17,11 +17,11 @@ - + all runtime; build; native; contentfiles; analyzers - + diff --git a/src/Tests.Old/Analyzers.Tests.Old/Analyzers.Tests.Old.csproj b/src/Tests.Old/Analyzers.Tests.Old/Analyzers.Tests.Old.csproj index 8f00083d78..c3e1f475a0 100644 --- a/src/Tests.Old/Analyzers.Tests.Old/Analyzers.Tests.Old.csproj +++ b/src/Tests.Old/Analyzers.Tests.Old/Analyzers.Tests.Old.csproj @@ -12,7 +12,7 @@ - + diff --git a/src/Tests.Old/CodeFixes.Tests.Old/CodeFixes.Tests.Old.csproj b/src/Tests.Old/CodeFixes.Tests.Old/CodeFixes.Tests.Old.csproj index 488d89c05a..4c6605bd6e 100644 --- a/src/Tests.Old/CodeFixes.Tests.Old/CodeFixes.Tests.Old.csproj +++ b/src/Tests.Old/CodeFixes.Tests.Old/CodeFixes.Tests.Old.csproj @@ -12,7 +12,7 @@ - + diff --git a/src/Tests.Old/Refactorings.Tests.Old/Refactorings.Tests.Old.csproj b/src/Tests.Old/Refactorings.Tests.Old/Refactorings.Tests.Old.csproj index 73a80359f7..4978249a18 100644 --- a/src/Tests.Old/Refactorings.Tests.Old/Refactorings.Tests.Old.csproj +++ b/src/Tests.Old/Refactorings.Tests.Old/Refactorings.Tests.Old.csproj @@ -12,7 +12,7 @@ - + diff --git a/src/Tests/Analyzers.Tests/RCS1129RemoveRedundantFieldInitializationTests.cs b/src/Tests/Analyzers.Tests/RCS1129RemoveRedundantFieldInitializationTests.cs index 8908db4456..9b05a13bf0 100644 --- a/src/Tests/Analyzers.Tests/RCS1129RemoveRedundantFieldInitializationTests.cs +++ b/src/Tests/Analyzers.Tests/RCS1129RemoveRedundantFieldInitializationTests.cs @@ -203,11 +203,21 @@ public async Task Test_StructWithoutConstructor() await VerifyDiagnosticAndFixAsync(@" struct C { + public C() + { + _f = 0; + } + private int _f [|= 0|]; } ", @" struct C { + public C() + { + _f = 0; + } + private int _f; } "); diff --git a/src/Tests/Analyzers.Tests/RCS1251RemoveUnnecessaryBracesTests.cs b/src/Tests/Analyzers.Tests/RCS1251RemoveUnnecessaryBracesTests.cs index 68a17c9256..6bda36a52e 100644 --- a/src/Tests/Analyzers.Tests/RCS1251RemoveUnnecessaryBracesTests.cs +++ b/src/Tests/Analyzers.Tests/RCS1251RemoveUnnecessaryBracesTests.cs @@ -20,7 +20,7 @@ await VerifyDiagnosticAndFixAsync(@" namespace N { record R(string Value) - [|[|{|]|] + [|{|] } } @@ -42,7 +42,7 @@ await VerifyDiagnosticAndFixAsync(@" namespace N { record struct R(string Value) - [|[|{|]|] + [|{|] } } diff --git a/src/Tests/CSharp.Tests/SyntaxKindTests.cs b/src/Tests/CSharp.Tests/SyntaxKindTests.cs index 5347539b11..63609c9b36 100644 --- a/src/Tests/CSharp.Tests/SyntaxKindTests.cs +++ b/src/Tests/CSharp.Tests/SyntaxKindTests.cs @@ -562,6 +562,28 @@ public static void DetectNewSyntaxKinds() case SyntaxKind.LineDirectivePosition: case SyntaxKind.LineSpanDirectiveTrivia: case SyntaxKind.RecordStructDeclaration: + // new in 4.2.0 + case SyntaxKind.SingleLineRawStringLiteralToken: + case SyntaxKind.MultiLineRawStringLiteralToken: + case SyntaxKind.ListPattern: + case SyntaxKind.SlicePattern: + case SyntaxKind.InterpolatedSingleLineRawStringStartToken: + case SyntaxKind.InterpolatedMultiLineRawStringStartToken: + case SyntaxKind.InterpolatedRawStringEndToken: + // new in 4.3.0 + case SyntaxKind.GreaterThanGreaterThanGreaterThanToken: + case SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken: + case SyntaxKind.RequiredKeyword: + case SyntaxKind.ScopedKeyword: + case SyntaxKind.Utf8StringLiteralToken: + case SyntaxKind.Utf8SingleLineRawStringLiteralToken: + case SyntaxKind.Utf8MultiLineRawStringLiteralToken: + case SyntaxKind.UnsignedRightShiftExpression: + case SyntaxKind.UnsignedRightShiftAssignmentExpression: + case SyntaxKind.Utf8StringLiteralExpression: + // new in 4.4.0 + case SyntaxKind.FileKeyword: + case SyntaxKind.ScopedType: { break; } diff --git a/src/Tests/TestConsole/TestConsole.csproj b/src/Tests/TestConsole/TestConsole.csproj index 11a227d4e5..19ab77765f 100644 --- a/src/Tests/TestConsole/TestConsole.csproj +++ b/src/Tests/TestConsole/TestConsole.csproj @@ -11,7 +11,7 @@ - + diff --git a/src/Tests/Testing.CSharp/Testing.CSharp.csproj b/src/Tests/Testing.CSharp/Testing.CSharp.csproj index 63ec59097b..5900bac72a 100644 --- a/src/Tests/Testing.CSharp/Testing.CSharp.csproj +++ b/src/Tests/Testing.CSharp/Testing.CSharp.csproj @@ -32,7 +32,7 @@ - + diff --git a/src/Tests/Testing.Common/Testing.Common.csproj b/src/Tests/Testing.Common/Testing.Common.csproj index dc73e66dd7..5bc1a197a3 100644 --- a/src/Tests/Testing.Common/Testing.Common.csproj +++ b/src/Tests/Testing.Common/Testing.Common.csproj @@ -32,7 +32,7 @@ - + diff --git a/src/Tests/Testing.Common/Testing/RefactoringTestData.cs b/src/Tests/Testing.Common/Testing/RefactoringTestData.cs index 8098c186ac..0d0ceb4fa0 100644 --- a/src/Tests/Testing.Common/Testing/RefactoringTestData.cs +++ b/src/Tests/Testing.Common/Testing/RefactoringTestData.cs @@ -41,7 +41,7 @@ public RefactoringTestData( /// /// Gets text spans on which a code refactoring will be applied. /// - public ImmutableArray Spans { get; private set; } + public ImmutableArray Spans { get; } /// /// Gets additional source files. diff --git a/src/Tests/Testing.VisualBasic/Testing.VisualBasic.csproj b/src/Tests/Testing.VisualBasic/Testing.VisualBasic.csproj index 14d9b2fffc..91e7e01547 100644 --- a/src/Tests/Testing.VisualBasic/Testing.VisualBasic.csproj +++ b/src/Tests/Testing.VisualBasic/Testing.VisualBasic.csproj @@ -33,7 +33,7 @@ - + diff --git a/src/Tools/CodeGeneration/CSharp/Symbols.Generated.cs b/src/Tools/CodeGeneration/CSharp/Symbols.Generated.cs index 0755480d73..8784e8e618 100644 --- a/src/Tools/CodeGeneration/CSharp/Symbols.Generated.cs +++ b/src/Tools/CodeGeneration/CSharp/Symbols.Generated.cs @@ -105,6 +105,7 @@ public static IEnumerable GetKinds(INamedTypeSymbol syntaxSymbol) yield return SyntaxKind.LeftShiftAssignmentExpression; yield return SyntaxKind.RightShiftAssignmentExpression; yield return SyntaxKind.CoalesceAssignmentExpression; + yield return SyntaxKind.UnsignedRightShiftAssignmentExpression; break; } @@ -185,6 +186,7 @@ public static IEnumerable GetKinds(INamedTypeSymbol syntaxSymbol) yield return SyntaxKind.IsExpression; yield return SyntaxKind.AsExpression; yield return SyntaxKind.CoalesceExpression; + yield return SyntaxKind.UnsignedRightShiftExpression; break; } @@ -812,6 +814,12 @@ public static IEnumerable GetKinds(INamedTypeSymbol syntaxSymbol) break; } + case "ListPatternSyntax": + { + yield return SyntaxKind.ListPattern; + break; + } + case "LiteralExpressionSyntax": { yield return SyntaxKind.ArgListExpression; @@ -822,6 +830,7 @@ public static IEnumerable GetKinds(INamedTypeSymbol syntaxSymbol) yield return SyntaxKind.FalseLiteralExpression; yield return SyntaxKind.NullLiteralExpression; yield return SyntaxKind.DefaultLiteralExpression; + yield return SyntaxKind.Utf8StringLiteralExpression; break; } @@ -1156,6 +1165,12 @@ public static IEnumerable GetKinds(INamedTypeSymbol syntaxSymbol) break; } + case "ScopedTypeSyntax": + { + yield return SyntaxKind.ScopedType; + break; + } + case "SelectClauseSyntax": { yield return SyntaxKind.SelectClause; @@ -1198,6 +1213,12 @@ public static IEnumerable GetKinds(INamedTypeSymbol syntaxSymbol) break; } + case "SlicePatternSyntax": + { + yield return SyntaxKind.SlicePattern; + break; + } + case "StackAllocArrayCreationExpressionSyntax": { yield return SyntaxKind.StackAllocArrayCreationExpression; diff --git a/src/Tools/CodeGeneration/CSharp/SymbolsGetKindsGenerator.cs b/src/Tools/CodeGeneration/CSharp/SymbolsGetKindsGenerator.cs index 3027c6766f..8f732ccde8 100644 --- a/src/Tools/CodeGeneration/CSharp/SymbolsGetKindsGenerator.cs +++ b/src/Tools/CodeGeneration/CSharp/SymbolsGetKindsGenerator.cs @@ -193,6 +193,7 @@ static IEnumerable GetSyntaxKinds(INamedTypeSymbol syntaxSymbol) yield return SyntaxKind.LeftShiftAssignmentExpression; yield return SyntaxKind.RightShiftAssignmentExpression; yield return SyntaxKind.CoalesceAssignmentExpression; + yield return SyntaxKind.UnsignedRightShiftAssignmentExpression; break; } case "AttributeArgumentListSyntax": @@ -263,6 +264,7 @@ static IEnumerable GetSyntaxKinds(INamedTypeSymbol syntaxSymbol) yield return SyntaxKind.IsExpression; yield return SyntaxKind.AsExpression; yield return SyntaxKind.CoalesceExpression; + yield return SyntaxKind.UnsignedRightShiftExpression; break; } case "BlockSyntax": @@ -731,6 +733,7 @@ static IEnumerable GetSyntaxKinds(INamedTypeSymbol syntaxSymbol) yield return SyntaxKind.FalseLiteralExpression; yield return SyntaxKind.NullLiteralExpression; yield return SyntaxKind.DefaultLiteralExpression; + yield return SyntaxKind.Utf8StringLiteralExpression; break; } case "LoadDirectiveTriviaSyntax": @@ -1334,6 +1337,21 @@ static IEnumerable GetSyntaxKinds(INamedTypeSymbol syntaxSymbol) yield return SyntaxKind.LineSpanDirectiveTrivia; break; } + case "ListPatternSyntax": + { + yield return SyntaxKind.ListPattern; + break; + } + case "SlicePatternSyntax": + { + yield return SyntaxKind.SlicePattern; + break; + } + case "ScopedTypeSyntax": + { + yield return SyntaxKind.ScopedType; + break; + } default: { throw new InvalidOperationException(syntaxSymbol.Name); diff --git a/src/Tools/CodeGeneration/CSharp/SyntaxWalker/CSharpSyntaxWalkerGenerator.Generated.cs b/src/Tools/CodeGeneration/CSharp/SyntaxWalker/CSharpSyntaxWalkerGenerator.Generated.cs index 47f31557f0..7b65c2bd69 100644 --- a/src/Tools/CodeGeneration/CSharp/SyntaxWalker/CSharpSyntaxWalkerGenerator.Generated.cs +++ b/src/Tools/CodeGeneration/CSharp/SyntaxWalker/CSharpSyntaxWalkerGenerator.Generated.cs @@ -4,6 +4,7 @@ using System; using Microsoft.CodeAnalysis; +using Microsoft.CodeAnalysis.CSharp.Syntax; namespace Roslynator.CodeGeneration.CSharp { @@ -608,6 +609,7 @@ protected virtual bool ShouldVisit(IPropertySymbol propertySymbol) case "Modifiers": case "ImplicitOrExplicitKeyword": case "OperatorKeyword": + case "CheckedKeyword": case "Type": case "ExplicitInterfaceSpecifier": case "ParameterList": @@ -626,6 +628,7 @@ protected virtual bool ShouldVisit(IPropertySymbol propertySymbol) { case "ImplicitOrExplicitKeyword": case "OperatorKeyword": + case "CheckedKeyword": case "Type": case "Parameters": return true; @@ -1839,6 +1842,7 @@ protected virtual bool ShouldVisit(IPropertySymbol propertySymbol) case "Modifiers": case "ReturnType": case "OperatorKeyword": + case "CheckedKeyword": case "ExplicitInterfaceSpecifier": case "OperatorToken": case "ParameterList": @@ -1856,6 +1860,7 @@ protected virtual bool ShouldVisit(IPropertySymbol propertySymbol) switch (propertySymbol.Name) { case "OperatorKeyword": + case "CheckedKeyword": case "OperatorToken": case "Parameters": return true; @@ -2177,6 +2182,7 @@ protected virtual bool ShouldVisit(IPropertySymbol propertySymbol) { case "RefKeyword": case "ReadOnlyKeyword": + case "ScopedKeyword": case "Type": return true; default: @@ -3326,6 +3332,46 @@ protected virtual bool ShouldVisit(IPropertySymbol propertySymbol) } } + case "ListPatternSyntax": + { + switch (propertySymbol.Name) + { + case "OpenBracketToken": + case "Patterns": + case "CloseBracketToken": + return true; + case "Designation": + return false; + default: + throw new InvalidOperationException($"Unrecognized property '{propertySymbol.ToDisplayString(SymbolDisplayFormats.Test)}'"); + } + } + + case "SlicePatternSyntax": + { + switch (propertySymbol.Name) + { + case "DotDotToken": + return true; + case "Pattern": + return false; + default: + throw new InvalidOperationException($"Unrecognized property '{propertySymbol.ToDisplayString(SymbolDisplayFormats.Test)}'"); + } + } + + case "ScopedTypeSyntax": + { + switch (propertySymbol.Name) + { + case "ScopedKeyword": + case "Type": + return true; + default: + throw new InvalidOperationException($"Unrecognized property '{propertySymbol.ToDisplayString(SymbolDisplayFormats.Test)}'"); + } + } + default: { throw new InvalidOperationException($"Unrecognized type '{propertySymbol.ContainingType.Name}'"); diff --git a/src/Tools/CodeGeneration/CSharp/SyntaxWalker/CSharpSyntaxWalkerGenerator.cs b/src/Tools/CodeGeneration/CSharp/SyntaxWalker/CSharpSyntaxWalkerGenerator.cs index 1f608b797f..e2c0e696e2 100644 --- a/src/Tools/CodeGeneration/CSharp/SyntaxWalker/CSharpSyntaxWalkerGenerator.cs +++ b/src/Tools/CodeGeneration/CSharp/SyntaxWalker/CSharpSyntaxWalkerGenerator.cs @@ -233,6 +233,7 @@ protected virtual void CreateVisitStatements(MethodGenerationContext context) case "FunctionPointerUnmanagedCallingConventionListSyntax": case "LineDirectivePositionSyntax": case "BaseExpressionColonSyntax": + case "ListPatternSyntax": { if (UseCustomVisitMethod) { diff --git a/src/Tools/CodeGeneration/CodeGeneration.csproj b/src/Tools/CodeGeneration/CodeGeneration.csproj index 0747ad4ac5..7d16c78168 100644 --- a/src/Tools/CodeGeneration/CodeGeneration.csproj +++ b/src/Tools/CodeGeneration/CodeGeneration.csproj @@ -17,7 +17,7 @@ - + diff --git a/src/Tools/CodeGenerator/CodeGenerator.csproj b/src/Tools/CodeGenerator/CodeGenerator.csproj index 50d552b798..95832a6143 100644 --- a/src/Tools/CodeGenerator/CodeGenerator.csproj +++ b/src/Tools/CodeGenerator/CodeGenerator.csproj @@ -11,7 +11,7 @@ - + diff --git a/src/Tools/MetadataGenerator/MetadataGenerator.csproj b/src/Tools/MetadataGenerator/MetadataGenerator.csproj index f80df41e84..74e97ab62b 100644 --- a/src/Tools/MetadataGenerator/MetadataGenerator.csproj +++ b/src/Tools/MetadataGenerator/MetadataGenerator.csproj @@ -11,8 +11,8 @@ - - + + diff --git a/src/Tools/TestCodeGenerator/TestCodeGenerator.csproj b/src/Tools/TestCodeGenerator/TestCodeGenerator.csproj index 58b6a3b99c..c360c5d04b 100644 --- a/src/Tools/TestCodeGenerator/TestCodeGenerator.csproj +++ b/src/Tools/TestCodeGenerator/TestCodeGenerator.csproj @@ -9,7 +9,7 @@ - + diff --git a/src/Tools/Utilities/Utilities.csproj b/src/Tools/Utilities/Utilities.csproj index 25afeeaaff..dfc9d24747 100644 --- a/src/Tools/Utilities/Utilities.csproj +++ b/src/Tools/Utilities/Utilities.csproj @@ -17,7 +17,7 @@ - + diff --git a/src/VisualBasic.Workspaces/VisualBasic.Workspaces.csproj b/src/VisualBasic.Workspaces/VisualBasic.Workspaces.csproj index 53a35a5f6b..8148e127ce 100644 --- a/src/VisualBasic.Workspaces/VisualBasic.Workspaces.csproj +++ b/src/VisualBasic.Workspaces/VisualBasic.Workspaces.csproj @@ -18,8 +18,11 @@ - - + + all + runtime; build; native; contentfiles; analyzers + + diff --git a/src/VisualBasic/VisualBasic.csproj b/src/VisualBasic/VisualBasic.csproj index 444c52c2c0..408e18c941 100644 --- a/src/VisualBasic/VisualBasic.csproj +++ b/src/VisualBasic/VisualBasic.csproj @@ -18,7 +18,7 @@ - + diff --git a/src/Workspaces.Common/Workspaces.Common.csproj b/src/Workspaces.Common/Workspaces.Common.csproj index ec633b25d0..c023cd7905 100644 --- a/src/Workspaces.Common/Workspaces.Common.csproj +++ b/src/Workspaces.Common/Workspaces.Common.csproj @@ -17,11 +17,11 @@ - + all runtime; build; native; contentfiles; analyzers - + diff --git a/src/Workspaces.Core/Rename/SymbolRenamer.cs b/src/Workspaces.Core/Rename/SymbolRenamer.cs index 9ef8f0aec4..93cfa6970b 100644 --- a/src/Workspaces.Core/Rename/SymbolRenamer.cs +++ b/src/Workspaces.Core/Rename/SymbolRenamer.cs @@ -648,8 +648,8 @@ private async Task RenameSymbolAsync( newSolution = await Microsoft.CodeAnalysis.Rename.Renamer.RenameSymbolAsync( CurrentSolution, symbol, + new Microsoft.CodeAnalysis.Rename.SymbolRenameOptions(RenameOverloads: true), newName, - default(Microsoft.CodeAnalysis.Options.OptionSet), cancellationToken) .ConfigureAwait(false); } diff --git a/src/Workspaces.Core/Spelling/SpellingFixer.cs b/src/Workspaces.Core/Spelling/SpellingFixer.cs index 3f0a430ddc..4139c8f871 100644 --- a/src/Workspaces.Core/Spelling/SpellingFixer.cs +++ b/src/Workspaces.Core/Spelling/SpellingFixer.cs @@ -10,6 +10,7 @@ using System.Threading.Tasks; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.Diagnostics; +using Microsoft.CodeAnalysis.Rename; using Microsoft.CodeAnalysis.Text; using Roslynator.Host.Mef; using static Roslynator.Logger; @@ -469,8 +470,9 @@ private async Task> FixCommentsAsync( newSolution = await Microsoft.CodeAnalysis.Rename.Renamer.RenameSymbolAsync( CurrentSolution, symbol, + //TODO: rename file when renaming symbol? + new SymbolRenameOptions(RenameOverloads: true), newName, - default(Microsoft.CodeAnalysis.Options.OptionSet), cancellationToken) .ConfigureAwait(false); } diff --git a/src/Workspaces.Core/Workspaces.Core.csproj b/src/Workspaces.Core/Workspaces.Core.csproj index dd431f8df0..cfa00355ea 100644 --- a/src/Workspaces.Core/Workspaces.Core.csproj +++ b/src/Workspaces.Core/Workspaces.Core.csproj @@ -32,7 +32,7 @@ - +