From 345b35c9d755711498567ae6864faa3c0395f950 Mon Sep 17 00:00:00 2001 From: Josef Pihrt Date: Sat, 18 Nov 2023 03:53:14 +0100 Subject: [PATCH 1/3] Fix RCS1228 --- ...nusedElementInDocumentationCommentTests.cs | 30 +++++++++++++++++++ .../CSharp/DefaultCSharpTestOptions.cs | 2 +- 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/src/Tests/Analyzers.Tests/RCS1228UnusedElementInDocumentationCommentTests.cs b/src/Tests/Analyzers.Tests/RCS1228UnusedElementInDocumentationCommentTests.cs index b8af93598e..c02233bea4 100644 --- a/src/Tests/Analyzers.Tests/RCS1228UnusedElementInDocumentationCommentTests.cs +++ b/src/Tests/Analyzers.Tests/RCS1228UnusedElementInDocumentationCommentTests.cs @@ -333,4 +333,34 @@ await VerifyNoDiagnosticAsync(@" public record struct Foo(string Bar); ", options: Options.AddAllowedCompilerDiagnosticId("CS0518")); } + + [Fact, Trait(Traits.Analyzer, DiagnosticIdentifiers.UnusedElementInDocumentationComment)] + public async Task TestNoDiagnostic_ClassPrimaryConstructor() + { + await VerifyNoDiagnosticAsync(@" +/// +/// x +/// +/// x +public class C(string value) +{ + public string Value { get; } = value; +} +"); + } + + [Fact, Trait(Traits.Analyzer, DiagnosticIdentifiers.UnusedElementInDocumentationComment)] + public async Task TestNoDiagnostic_StructPrimaryConstructor() + { + await VerifyNoDiagnosticAsync(@" +/// +/// x +/// +/// x +public struct FooC(string value) +{ + public string Value { get; } = value; +} +"); + } } diff --git a/src/Tests/Tests.Common/Testing/CSharp/DefaultCSharpTestOptions.cs b/src/Tests/Tests.Common/Testing/CSharp/DefaultCSharpTestOptions.cs index 5bf5d40380..41a4bd03a9 100644 --- a/src/Tests/Tests.Common/Testing/CSharp/DefaultCSharpTestOptions.cs +++ b/src/Tests/Tests.Common/Testing/CSharp/DefaultCSharpTestOptions.cs @@ -26,7 +26,7 @@ private static CSharpTestOptions Create() ); return CSharpTestOptions.Default - .WithParseOptions(CSharpTestOptions.Default.ParseOptions.WithLanguageVersion(LanguageVersion.CSharp10)) + .WithParseOptions(CSharpTestOptions.Default.ParseOptions.WithLanguageVersion(LanguageVersion.Preview)) .WithAllowedCompilerDiagnosticIds(allowedCompilerDiagnosticIds) .AddConfigOptions( ("indent_size", "4"), From 39bfd25c61cd8c043fffbef92c043fde080909c2 Mon Sep 17 00:00:00 2001 From: Josef Pihrt Date: Sat, 18 Nov 2023 04:15:53 +0100 Subject: [PATCH 2/3] update --- .../RCS1228UnusedElementInDocumentationCommentTests.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Tests/Analyzers.Tests/RCS1228UnusedElementInDocumentationCommentTests.cs b/src/Tests/Analyzers.Tests/RCS1228UnusedElementInDocumentationCommentTests.cs index c02233bea4..fe42276f23 100644 --- a/src/Tests/Analyzers.Tests/RCS1228UnusedElementInDocumentationCommentTests.cs +++ b/src/Tests/Analyzers.Tests/RCS1228UnusedElementInDocumentationCommentTests.cs @@ -342,7 +342,7 @@ await VerifyNoDiagnosticAsync(@" /// x /// /// x -public class C(string value) +public class Foo(string value) { public string Value { get; } = value; } @@ -357,7 +357,7 @@ await VerifyNoDiagnosticAsync(@" /// x /// /// x -public struct FooC(string value) +public struct Foo(string value) { public string Value { get; } = value; } From 89e216aad0355a3ecaa11268975d6c40966958b4 Mon Sep 17 00:00:00 2001 From: Josef Pihrt Date: Sat, 18 Nov 2023 04:23:47 +0100 Subject: [PATCH 3/3] update --- ChangeLog.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ChangeLog.md b/ChangeLog.md index 67c153e02c..5d215a24f2 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -11,6 +11,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Bump Roslyn to 4.6.0 ([PR](https://github.com/dotnet/roslynator/pull/1248)). +### Fixed + +- Fix [RCS1228](https://josefpihrt.github.io/docs/roslynator/analyzers/RCS1228) ([PR](https://github.com/dotnet/roslynator/pull/1249)) + ## [4.6.2] - 2023-11-10 ### Added