Skip to content

Commit

Permalink
Merge branch 'main' into feature/remove-empty-line
Browse files Browse the repository at this point in the history
  • Loading branch information
josefpihrt authored Jan 1, 2025
2 parents 4129eb2 + 8c591b3 commit 88c4a38
Show file tree
Hide file tree
Showing 11 changed files with 49 additions and 7 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,9 @@ jobs:
working-directory: src/CommandLine
steps:
- uses: actions/checkout@v4
- uses: actions/setup-dotnet@v4
with:
dotnet-version: 9.0.101
- run: dotnet restore
- run: dotnet build --no-restore
- run: dotnet pack --no-build
Expand Down
5 changes: 5 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Added

- [CLI] Add support for .NET 9 ([PR](https://github.com/dotnet/roslynator/pull/1605))

### Fixed

- Fix refactoring 'Change accessibility' ([RR0186](https://josefpihrt.github.io/docs/roslynator/refactorings/RR0186)) ([PR](https://github.com/dotnet/roslynator/pull/1599))
- Fix analyzer [RCS1264](https://josefpihrt.github.io/docs/roslynator/analyzers/RCS1264) ([PR](https://github.com/dotnet/roslynator/pull/1604))

### Changed

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ private static void AnalyzeVariableDeclaration(SyntaxNodeAnalysisContext context
}
else if (style == TypeStyle.Explicit)
{
if (CSharpTypeAnalysis.IsImplicitThatCanBeExplicit(variableDeclaration, context.SemanticModel, TypeAppearance.Obvious, context.CancellationToken))
if (CSharpTypeAnalysis.IsImplicitThatCanBeExplicit(variableDeclaration, context.SemanticModel, context.CancellationToken))
ReportImplicitToExplicit(context, variableDeclaration.Type);
}
else if (style == TypeStyle.ImplicitWhenTypeIsObvious)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
</PropertyGroup>

<PropertyGroup Condition="'$(RoslynatorDotNetCli)' == true">
<TargetFrameworks>net6.0;net7.0;net8.0</TargetFrameworks>
<TargetFrameworks>net7.0;net8.0;net9.0</TargetFrameworks>
</PropertyGroup>

<PropertyGroup Condition="'$(RoslynatorCommandLine)' == true">
Expand Down
2 changes: 1 addition & 1 deletion src/CommandLine/CommandLine.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
</PropertyGroup>

<PropertyGroup Condition="'$(RoslynatorDotNetCli)' == true">
<TargetFrameworks>net7.0;net8.0</TargetFrameworks>
<TargetFrameworks>net7.0;net8.0;net9.0</TargetFrameworks>
</PropertyGroup>

<PropertyGroup Condition="'$(RoslynatorCommandLine)' == true">
Expand Down
4 changes: 4 additions & 0 deletions src/CommandLine/DelegateFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,11 @@ private static TDelegate CreateDelegate<TDelegate>(

if (method.IsStatic)
{
#if NETFRAMEWORK
return (TDelegate)method.CreateDelegate(typeof(TDelegate));
#else
return method.CreateDelegate<TDelegate>();
#endif
}
else
{
Expand Down
2 changes: 1 addition & 1 deletion src/CommandLine/docs/NetCore/NuGetReadme.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

## Requirements

.NET Core SDK 6.0, 7.0 or 8.0.
.NET Core SDK 7, 8 or 9.

## Installation

Expand Down
2 changes: 1 addition & 1 deletion src/Documentation/SymbolDefinitionDisplay.cs
Original file line number Diff line number Diff line change
Expand Up @@ -955,7 +955,7 @@ private static void FormatParameters(

private static int FindParameterListStart(
ISymbol symbol,
IList<SymbolDisplayPart> parts)
ImmutableArray<SymbolDisplayPart>.Builder parts)
{
int parenthesesDepth = 0;
int bracesDepth = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ private static Task<Document> RefactorAsync(
return document.ReplaceMembersAsync(info, newMembers, cancellationToken);
}

private static SyntaxKind GetSingleKindOrDefault(IReadOnlyList<MemberDeclarationSyntax> members)
private static SyntaxKind GetSingleKindOrDefault(MemberDeclarationListSelection members)
{
SyntaxKind kind = members[0].Kind();

Expand Down
30 changes: 30 additions & 0 deletions src/Tests/Analyzers.Tests/RCS1264UseVarOrExplicitTypeTests2.cs
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,36 @@ void M()
", options: Options.AddConfigOption(ConfigOptionKeys.UseVar, ConfigOptionValues.UseVar_Never));
}

[Fact, Trait(Traits.Analyzer, DiagnosticIdentifiers.UseVarOrExplicitType)]
public async Task Test_NotObviousExpression()
{
await VerifyDiagnosticAndFixAsync(@"
using System.Threading.Tasks;
using System.Collections.Generic;
class C
{
void M()
{
[|var|] x1 = string.Empty;
[|var|] x2 = Task.FromResult(string.Empty);
}
}
", @"
using System.Threading.Tasks;
using System.Collections.Generic;
class C
{
void M()
{
string x1 = string.Empty;
Task<string> x2 = Task.FromResult(string.Empty);
}
}
", options: Options.AddConfigOption(ConfigOptionKeys.UseVar, ConfigOptionValues.UseVar_Never));
}

[Fact, Trait(Traits.Analyzer, DiagnosticIdentifiers.UseVarOrExplicitType)]
public async Task TestNoDiagnostic_ForEach_DeclarationExpression()
{
Expand Down
2 changes: 1 addition & 1 deletion src/Tools/CodeGeneration/Markdown/MarkdownGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ public static string CreateAnalyzerMarkdown(AnalyzerMetadata analyzer, Immutable

static IEnumerable<MElement> CreateSamples(AnalyzerMetadata analyzer)
{
IReadOnlyList<SampleMetadata> samples = analyzer.Samples;
List<SampleMetadata> samples = analyzer.Samples;
LegacyAnalyzerOptionKind kind = analyzer.Kind;

if (samples.Count > 0)
Expand Down

0 comments on commit 88c4a38

Please sign in to comment.