Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Fixed

- Fix analyzer [RCS1231](https://josefpihrt.github.io/docs/roslynator/analyzers/RCS1231) ([PR](https://github.com/dotnet/roslynator/pull/1744) by @cbersch)
Comment thread
cbersch marked this conversation as resolved.
Outdated
- Fix enum contained flags check for partial matches in [RCS1258](https://josefpihrt.github.io/docs/roslynator/analyzers/RCS1258) ([PR](https://github.com/dotnet/roslynator/pull/1740) by @ovska)
- Fix analyzer [RCS1146](https://josefpihrt.github.io/docs/roslynator/analyzers/RCS1146) ([PR](https://github.com/dotnet/roslynator/pull/1747))
- Fix analyzer [RCS1194](https://josefpihrt.github.io/docs/roslynator/analyzers/RCS1194) ([PR](https://github.com/dotnet/roslynator/pull/1733))
Expand Down
3 changes: 3 additions & 0 deletions src/Analyzers/CSharp/Analysis/RefReadOnlyParameterAnalyzer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,9 @@ private static void Analyze(
if (parameter.RefKind != RefKind.None)
continue;

if (parameter.IsParams)
continue;

if (walker is null)
{
if (methodSymbol.ImplementsInterfaceMember(allInterfaces: true))
Expand Down
30 changes: 30 additions & 0 deletions src/Tests/Analyzers.Tests/RCS1231MakeParameterRefReadOnlyTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,36 @@ void M(C c, C c)
", options: Options.AddAllowedCompilerDiagnosticId("CS0100"));
}

[Fact, Trait(Traits.Analyzer, DiagnosticIdentifiers.MakeParameterRefReadOnly)]
public async Task TestNoDiagnostic_ParamsArray()
{
await VerifyNoDiagnosticAsync(@"
using System;

readonly struct C
{
void M(params C[] c)
Comment thread
cbersch marked this conversation as resolved.
Outdated
{
}
}
");
}

[Fact, Trait(Traits.Analyzer, DiagnosticIdentifiers.MakeParameterRefReadOnly)]
public async Task TestNoDiagnostic_ParamsCollection()
{
await VerifyNoDiagnosticAsync(@"
using System;

readonly struct C
{
void M(params ReadOnlySpan<C> c)
{
}
}
");
}

[Fact, Trait(Traits.Analyzer, DiagnosticIdentifiers.MakeParameterRefReadOnly)]
public async Task TestNoDiagnostic_MethodReferencedAsMethodGroup()
{
Expand Down
Loading