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 [RCS0034](https://josefpihrt.github.io/docs/roslynator/analyzers/RCS0034) for types with a primary constructor and multiple constraint clauses ([PR](https://github.com/dotnet/roslynator/pull/1791))

## [4.16.0] - 2026-08-08

### Added
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,12 @@ private static void AnalyzeTypeDeclaration(SyntaxNodeAnalysisContext context)
}
else if (typeDeclaration.TypeParameterList is not null)
{
Analyze(context, typeDeclaration.TypeParameterList.GreaterThanToken, constraintClauses);
#if ROSLYN_4_7
SyntaxToken previous = typeDeclaration.ParameterList?.CloseParenToken ?? typeDeclaration.TypeParameterList.GreaterThanToken;
#else
SyntaxToken previous = typeDeclaration.TypeParameterList.GreaterThanToken;
#endif
Analyze(context, previous, constraintClauses);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,19 @@ class C<T> where T : struct
");
}

[Fact, Trait(Traits.Analyzer, DiagnosticIdentifiers.PutTypeParameterConstraintOnItsOwnLine)]
public async Task TestNoDiagnostic_PrimaryConstructor()
{
await VerifyNoDiagnosticAsync(@"
internal sealed class Example<TEntry, TValue>(TEntry entry)
where TEntry : class
where TValue : class
{
public required TEntry Entry { get; set; } = entry;
}
");
}

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