Skip to content

Commit

Permalink
Bump Roslyn to 4.4.0 (#1116)
Browse files Browse the repository at this point in the history
  • Loading branch information
josefpihrt authored Jul 19, 2023
1 parent d102391 commit 975026f
Show file tree
Hide file tree
Showing 51 changed files with 243 additions and 59 deletions.
1 change: 1 addition & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions src/Analyzers.CodeFixes/Analyzers.CodeFixes.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.Analyzers" Version="3.3.3">
<PackageReference Include="Microsoft.CodeAnalysis.Analyzers" Version="$(RoslynAnalyzersVersion)">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="4.0.1" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="$(RoslynVersion)" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,6 @@ private static async Task<Solution> 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);
}
}
5 changes: 3 additions & 2 deletions src/Analyzers/Analyzers.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,15 @@
<AssemblyName>Roslynator.CSharp.Analyzers</AssemblyName>
<RootNamespace>Roslynator.CSharp</RootNamespace>
<IsPackable>false</IsPackable>
<EnforceExtendedAnalyzerRules>true</EnforceExtendedAnalyzerRules>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.Analyzers" Version="3.3.3">
<PackageReference Include="Microsoft.CodeAnalysis.Analyzers" Version="$(RoslynAnalyzersVersion)">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.0.1" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="$(RoslynVersion)" />
</ItemGroup>

<ItemGroup>
Expand Down
7 changes: 5 additions & 2 deletions src/CSharp.Workspaces/CSharp.Workspaces.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,11 @@ Roslynator.NameGenerator</Description>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.Analyzers" Version="3.3.3" PrivateAssets="All" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="4.0.1" />
<PackageReference Include="Microsoft.CodeAnalysis.Analyzers" Version="$(RoslynAnalyzersVersion)">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="$(RoslynVersion)" />
</ItemGroup>

<ItemGroup>
Expand Down
7 changes: 5 additions & 2 deletions src/CSharp/CSharp.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,11 @@ Roslynator.NameGenerator</Description>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.Analyzers" Version="3.3.3" PrivateAssets="All" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.0.1" />
<PackageReference Include="Microsoft.CodeAnalysis.Analyzers" Version="$(RoslynAnalyzersVersion)">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="$(RoslynVersion)" />
</ItemGroup>

<ItemGroup>
Expand Down
46 changes: 46 additions & 0 deletions src/CSharp/CSharp/SyntaxWalkers/CSharpSyntaxNodeWalker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
}
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -3890,6 +3917,10 @@ public override void VisitSkippedTokensTrivia(SkippedTokensTriviaSyntax node)
{
}

public override void VisitSlicePattern(SlicePatternSyntax node)
{
}

public override void VisitStackAllocArrayCreationExpression(StackAllocArrayCreationExpressionSyntax node)
{
if (!ShouldVisit)
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.Analyzers" Version="3.3.3">
<PackageReference Include="Microsoft.CodeAnalysis.Analyzers" Version="$(RoslynAnalyzersVersion)">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="4.0.1" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="$(RoslynVersion)" />
</ItemGroup>

<ItemGroup>
Expand Down
5 changes: 3 additions & 2 deletions src/CodeAnalysis.Analyzers/CodeAnalysis.Analyzers.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,15 @@
<AssemblyName>Roslynator.CodeAnalysis.Analyzers</AssemblyName>
<RootNamespace>Roslynator.CodeAnalysis</RootNamespace>
<IsPackable>false</IsPackable>
<EnforceExtendedAnalyzerRules>true</EnforceExtendedAnalyzerRules>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.Analyzers" Version="3.3.3">
<PackageReference Include="Microsoft.CodeAnalysis.Analyzers" Version="$(RoslynAnalyzersVersion)">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.0.1" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="$(RoslynVersion)" />
</ItemGroup>

<ItemGroup>
Expand Down
4 changes: 2 additions & 2 deletions src/CodeFixes/CodeFixes.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.Analyzers" Version="3.3.3">
<PackageReference Include="Microsoft.CodeAnalysis.Analyzers" Version="$(RoslynAnalyzersVersion)">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.0.1" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="$(RoslynVersion)" />
</ItemGroup>

<ItemGroup>
Expand Down
4 changes: 2 additions & 2 deletions src/Common/Common.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.Analyzers" Version="3.3.3">
<PackageReference Include="Microsoft.CodeAnalysis.Analyzers" Version="$(RoslynAnalyzersVersion)">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.0.1" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="$(RoslynVersion)" />
</ItemGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/Core/Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.Common" Version="4.0.1" />
<PackageReference Include="Microsoft.CodeAnalysis.Common" Version="$(RoslynVersion)" />
</ItemGroup>

<ItemGroup>
Expand Down
2 changes: 2 additions & 0 deletions src/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
<Copyright>Copyright (c) 2016-2023 Josef Pihrt</Copyright>
<EnableNETAnalyzers>false</EnableNETAnalyzers>
<RoslynatorPublicKey>0024000004800000940000000602000000240000525341310004000001000100d348e1a51bc190259aed17cfe132736241fef462de45a5de6c881c7f9d705073c7a2a08ba5ae493c7e878fe5f3cf7909e89045cca696422f03b284b147daf6b93c47bc53dd61ceeae60f73149d183032f029761d0d59aab49a26be4f6af71cd8194ace937642bdcb515f07530096122e97cfe6c8549a843530f71c24c7e3dab8</RoslynatorPublicKey>
<RoslynVersion>4.4.0</RoslynVersion>
<RoslynAnalyzersVersion>3.3.4</RoslynAnalyzersVersion>
<RoslynCliVersion>4.6.0</RoslynCliVersion>
</PropertyGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.Analyzers" Version="3.3.3">
<PackageReference Include="Microsoft.CodeAnalysis.Analyzers" Version="$(RoslynAnalyzersVersion)">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="4.0.1" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="$(RoslynVersion)" />
</ItemGroup>

<ItemGroup>
Expand Down
5 changes: 3 additions & 2 deletions src/Formatting.Analyzers/Formatting.Analyzers.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,15 @@
<AssemblyName>Roslynator.Formatting.Analyzers</AssemblyName>
<RootNamespace>Roslynator.Formatting</RootNamespace>
<IsPackable>false</IsPackable>
<EnforceExtendedAnalyzerRules>true</EnforceExtendedAnalyzerRules>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.Analyzers" Version="3.3.3">
<PackageReference Include="Microsoft.CodeAnalysis.Analyzers" Version="$(RoslynAnalyzersVersion)">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.0.1" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="$(RoslynVersion)" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
Loading

0 comments on commit 975026f

Please sign in to comment.