@@ -562,35 +562,15 @@ public class ClassName
562562 await VerifyCSharpDiagnosticAsync ( testCode , DiagnosticResult . EmptyDiagnosticResults , CancellationToken . None ) . ConfigureAwait ( false ) ;
563563 }
564564
565- private static DiagnosticResult [ ] GetExpectedDiagnostics ( DiagnosticResult normallyExpected , string declaration )
566- {
567- return GetExpectedDiagnostics ( new [ ] { normallyExpected } , declaration ) ;
568- }
569-
570565 // Syntax node actions for type declarations with a primary constructor were called twice
571566 // before support for c# 11 was added.
572- private static DiagnosticResult [ ] GetExpectedDiagnostics ( DiagnosticResult [ ] normallyExpected , string declaration )
573- {
574- var isPrimaryConstructor = declaration . Contains ( "record" ) || declaration . Contains ( "class" ) || declaration . Contains ( "struct" ) ;
575-
576- if ( isPrimaryConstructor && ! LightupHelpers . SupportsCSharp11 )
577- {
578- // Diagnostic issued twice because of https://github.com/dotnet/roslyn/issues/53136 and https://github.com/dotnet/roslyn/issues/70488
579- return normallyExpected . Concat ( normallyExpected ) . ToArray ( ) ;
580- }
581- else
582- {
583- return normallyExpected ;
584- }
585- }
586-
587- private static Task VerifyCSharpDiagnosticAsync ( string source , DiagnosticResult [ ] expected , CancellationToken cancellationToken )
567+ protected static Task VerifyCSharpDiagnosticAsync ( string source , DiagnosticResult [ ] expected , CancellationToken cancellationToken )
588568 => VerifyCSharpDiagnosticAsync ( source , testSettings : null , expected , ignoreCompilerDiagnostics : false , cancellationToken ) ;
589569
590- private static Task VerifyCSharpDiagnosticAsync ( string source , string testSettings , DiagnosticResult [ ] expected , CancellationToken cancellationToken )
570+ protected static Task VerifyCSharpDiagnosticAsync ( string source , string testSettings , DiagnosticResult [ ] expected , CancellationToken cancellationToken )
591571 => VerifyCSharpDiagnosticAsync ( source , testSettings , expected , ignoreCompilerDiagnostics : false , cancellationToken ) ;
592572
593- private static Task VerifyCSharpDiagnosticAsync ( string source , string testSettings , DiagnosticResult [ ] expected , bool ignoreCompilerDiagnostics , CancellationToken cancellationToken )
573+ protected static Task VerifyCSharpDiagnosticAsync ( string source , string testSettings , DiagnosticResult [ ] expected , bool ignoreCompilerDiagnostics , CancellationToken cancellationToken )
594574 {
595575 string contentWithoutParamDocumentation = @"<?xml version=""1.0"" encoding=""utf-8"" ?>
596576<ClassName>
@@ -696,5 +676,23 @@ private static Task VerifyCSharpDiagnosticAsync(string source, string testSettin
696676 test . ExpectedDiagnostics . AddRange ( expected ) ;
697677 return test . RunAsync ( cancellationToken ) ;
698678 }
679+
680+ private static DiagnosticResult [ ] GetExpectedDiagnostics ( DiagnosticResult normallyExpected , string declaration )
681+ {
682+ return GetExpectedDiagnostics ( new [ ] { normallyExpected } , declaration ) ;
683+ }
684+
685+ private static DiagnosticResult [ ] GetExpectedDiagnostics ( DiagnosticResult [ ] normallyExpected , string declaration )
686+ {
687+ var isPrimaryConstructor = declaration . Contains ( "record" ) || declaration . Contains ( "class" ) || declaration . Contains ( "struct" ) ;
688+
689+ if ( isPrimaryConstructor && ! LightupHelpers . SupportsCSharp11 )
690+ {
691+ // Diagnostic issued twice because of https://github.com/dotnet/roslyn/issues/53136 and https://github.com/dotnet/roslyn/issues/70488
692+ return normallyExpected . Concat ( normallyExpected ) . ToArray ( ) ;
693+ }
694+
695+ return normallyExpected ;
696+ }
699697 }
700698}
0 commit comments