Skip to content

Commit

Permalink
Handle comments from PR #3800 and #3801
Browse files Browse the repository at this point in the history
  • Loading branch information
bjornhellander committed Mar 19, 2024
1 parent f66d17d commit f05e541
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -536,13 +536,13 @@ public class ClassName
}

private static Task VerifyCSharpDiagnosticAsync(string source, DiagnosticResult expected, CancellationToken cancellationToken)
=> VerifyCSharpDiagnosticAsync(source, testSettings: null, new[] { expected }, false, cancellationToken);
=> VerifyCSharpDiagnosticAsync(source, testSettings: null, new[] { expected }, ignoreCompilerDiagnostics: false, cancellationToken);

private static Task VerifyCSharpDiagnosticAsync(string source, DiagnosticResult[] expected, CancellationToken cancellationToken)
=> VerifyCSharpDiagnosticAsync(source, testSettings: null, expected, false, cancellationToken);
=> VerifyCSharpDiagnosticAsync(source, testSettings: null, expected, ignoreCompilerDiagnostics: false, cancellationToken);

private static Task VerifyCSharpDiagnosticAsync(string source, string testSettings, DiagnosticResult[] expected, CancellationToken cancellationToken)
=> VerifyCSharpDiagnosticAsync(source, testSettings, expected, false, cancellationToken);
=> VerifyCSharpDiagnosticAsync(source, testSettings, expected, ignoreCompilerDiagnostics: false, cancellationToken);

private static Task VerifyCSharpDiagnosticAsync(string source, string testSettings, DiagnosticResult[] expected, bool ignoreCompilerDiagnostics, CancellationToken cancellationToken)
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
// Copyright (c) Tunnel Vision Laboratories, LLC. All Rights Reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.

#nullable disable

namespace StyleCop.Analyzers.Test.Helpers
{
using System.Collections.Generic;
Expand Down Expand Up @@ -115,7 +113,7 @@ public static IEnumerable<object[]> GenericTypeDeclarationKeywords
}
}

public static IEnumerable<object[]> TypeKeywordsWhichSupportPrimaryConstructors
public static IEnumerable<object[]> ReferenceTypeKeywordsWhichSupportPrimaryConstructors
{
get
{
Expand All @@ -127,22 +125,33 @@ public static IEnumerable<object[]> TypeKeywordsWhichSupportPrimaryConstructors
if (LightupHelpers.SupportsCSharp10)
{
yield return new[] { "record class" };
yield return new[] { "record struct" };
}

if (LightupHelpers.SupportsCSharp12)
{
yield return new[] { "class" };
yield return new[] { "struct" };
}
}
}

public static IEnumerable<object[]> ReferenceTypeKeywordsWhichSupportPrimaryConstructors
public static IEnumerable<object[]> TypeKeywordsWhichSupportPrimaryConstructors
{
get
{
return TypeKeywordsWhichSupportPrimaryConstructors.Where(x => !((string)x[0]).Contains("struct"));
foreach (var keyword in ReferenceTypeKeywordsWhichSupportPrimaryConstructors)
{
yield return keyword;
}

if (LightupHelpers.SupportsCSharp10)
{
yield return new[] { "record struct" };
}

if (LightupHelpers.SupportsCSharp12)
{
yield return new[] { "struct" };
}
}
}
}
Expand Down

0 comments on commit f05e541

Please sign in to comment.