@@ -80,7 +80,7 @@ x.Options is CSharpCompilationOptions options ?
8080 // We'll still output a limited implementation that just caches a new Regex(...).
8181 if ( ! SupportsCodeGeneration ( regexMethod , methodOrDiagnosticAndCompilationData . Right . LanguageVersion , out string ? reason ) )
8282 {
83- return ( regexMethod , reason , Diagnostic . Create ( DiagnosticDescriptors . LimitedSourceGeneration , regexMethod . MethodSyntax . GetLocation ( ) ) ) ;
83+ return ( regexMethod , reason , Diagnostic . Create ( DiagnosticDescriptors . LimitedSourceGeneration , regexMethod . MethodSyntax . GetLocation ( ) ) , methodOrDiagnosticAndCompilationData . Right ) ;
8484 }
8585
8686 // Generate the core logic for the regex.
@@ -150,7 +150,7 @@ x.Options is CSharpCompilationOptions options ?
150150 foreach ( object ? result in results )
151151 {
152152 RegexMethod ? regexMethod = null ;
153- if ( result is ValueTuple < RegexMethod , string , Diagnostic > limitedSupportResult )
153+ if ( result is ValueTuple < RegexMethod , string , Diagnostic , CompilationData > limitedSupportResult )
154154 {
155155 context . ReportDiagnostic ( limitedSupportResult . Item3 ) ;
156156 regexMethod = limitedSupportResult . Item1 ;
@@ -212,11 +212,11 @@ x.Options is CSharpCompilationOptions options ?
212212 writer . Indent ++ ;
213213 foreach ( object ? result in results )
214214 {
215- if ( result is ValueTuple < RegexMethod , string , Diagnostic > limitedSupportResult )
215+ if ( result is ValueTuple < RegexMethod , string , Diagnostic , CompilationData > limitedSupportResult )
216216 {
217217 if ( ! limitedSupportResult . Item1 . IsDuplicate )
218218 {
219- EmitRegexLimitedBoilerplate ( writer , limitedSupportResult . Item1 , limitedSupportResult . Item2 ) ;
219+ EmitRegexLimitedBoilerplate ( writer , limitedSupportResult . Item1 , limitedSupportResult . Item2 , limitedSupportResult . Item4 . LanguageVersion ) ;
220220 writer . WriteLine ( ) ;
221221 }
222222 }
@@ -273,7 +273,7 @@ x.Options is CSharpCompilationOptions options ?
273273 /// </remarks>
274274 private static bool SupportsCodeGeneration ( RegexMethod method , LanguageVersion languageVersion , [ NotNullWhen ( false ) ] out string ? reason )
275275 {
276- if ( languageVersion <= LanguageVersion . CSharp10 )
276+ if ( languageVersion < LanguageVersion . CSharp11 )
277277 {
278278 reason = "the language version must be C# 11 or higher." ;
279279 return false ;
0 commit comments