Skip to content

Commit

Permalink
Fix RCS1213 (#1254)
Browse files Browse the repository at this point in the history
  • Loading branch information
josefpihrt authored Nov 18, 2023
1 parent d2c246a commit 71172ab
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 0 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
### Fixed

- Fix [RCS1228](https://josefpihrt.github.io/docs/roslynator/analyzers/RCS1228) ([PR](https://github.com/dotnet/roslynator/pull/1249))
- Fix [RCS1213](https://josefpihrt.github.io/docs/roslynator/analyzers/RCS1213) ([PR](https://github.com/dotnet/roslynator/pull/1254))

## [4.6.2] - 2023-11-10

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -229,18 +229,21 @@ public override void VisitNamespaceDeclaration(NamespaceDeclarationSyntax node)
public override void VisitClassDeclaration(ClassDeclarationSyntax node)
{
VisitAttributeLists(node.AttributeLists);
VisitParameterList(node.ParameterList);
VisitMembers(node.Members);
}

public override void VisitInterfaceDeclaration(InterfaceDeclarationSyntax node)
{
VisitAttributeLists(node.AttributeLists);
VisitParameterList(node.ParameterList);
VisitMembers(node.Members);
}

public override void VisitStructDeclaration(StructDeclarationSyntax node)
{
VisitAttributeLists(node.AttributeLists);
VisitParameterList(node.ParameterList);
VisitMembers(node.Members);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -388,4 +388,24 @@ class MonoBehaviour
}
", options: Options.AddConfigOption(ConfigOptionKeys.UnityCodeAnalysisEnabled, true));
}

[Fact, Trait(Traits.Analyzer, DiagnosticIdentifiers.RemoveUnusedMemberDeclaration)]
public async Task TestNoDiagnostic_PrimaryConstructor()
{
await VerifyNoDiagnosticAsync(@"
using System;
class Class([My(Class.Const)] int i)
{
private const string Const = ""const"";
}
class MyAttribute : Attribute
{
public MyAttribute(string s)
{
}
}
", options: Options.AddAllowedCompilerDiagnosticId("CS9113"));
}
}

0 comments on commit 71172ab

Please sign in to comment.