Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
4 changes: 4 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Fixed

- Fix analyzer [RCS1055](https://josefpihrt.github.io/docs/roslynator/analyzers/RCS1055) ([PR](https://github.com/dotnet/roslynator/pull/1361))

## [4.9.0] - 2024-01-10

### Added
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,12 +121,15 @@ private static void AnalyzeEnumDeclaration(SyntaxNodeAnalysisContext context)
{
var declaration = (EnumDeclarationSyntax)context.Node;

SyntaxToken semicolon = declaration.SemicolonToken;

if (semicolon.Parent is not null
&& !semicolon.IsMissing)
if (declaration.CloseBraceToken.IsKind(SyntaxKind.CloseBraceToken))
{
DiagnosticHelpers.ReportDiagnostic(context, DiagnosticRules.UnnecessarySemicolonAtEndOfDeclaration, semicolon);
SyntaxToken semicolon = declaration.SemicolonToken;

if (semicolon.Parent is not null
&& !semicolon.IsMissing)
{
DiagnosticHelpers.ReportDiagnostic(context, DiagnosticRules.UnnecessarySemicolonAtEndOfDeclaration, semicolon);
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,14 @@ public async Task TestNoDiagnostic_Interface()
{
await VerifyNoDiagnosticAsync(@"
interface C;
");
}

[Fact, Trait(Traits.Analyzer, DiagnosticIdentifiers.UnnecessarySemicolonAtEndOfDeclaration)]
public async Task TestNoDiagnostic_Enum()
{
await VerifyNoDiagnosticAsync(@"
enum E;
");
}
}