Skip to content

Commit 7313080

Browse files
committed
Rename [RegexGenerator] to [GeneratedRegex]
1 parent e125acf commit 7313080

37 files changed

+521
-521
lines changed

docs/project/list-of-diagnostics.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ The PR that reveals the implementation of the `<IncludeInternalObsoleteAttribute
9090
| __`SYSLIB0033`__ | Rfc2898DeriveBytes.CryptDeriveKey is obsolete and is not supported. Use PasswordDeriveBytes.CryptDeriveKey instead. |
9191
| __`SYSLIB0034`__ | CmsSigner(CspParameters) is obsolete and is not supported. Use an alternative constructor instead. |
9292
| __`SYSLIB0035`__ | ComputeCounterSignature without specifying a CmsSigner is obsolete and is not supported. Use the overload that accepts a CmsSigner. |
93-
| __`SYSLIB0036`__ | Regex.CompileToAssembly is obsolete and not supported. Use RegexGeneratorAttribute with the regular expression source generator instead. |
93+
| __`SYSLIB0036`__ | Regex.CompileToAssembly is obsolete and not supported. Use GeneratedRegexAttribute with the regular expression source generator instead. |
9494
| __`SYSLIB0037`__ | AssemblyName members HashAlgorithm, ProcessorArchitecture, and VersionCompatibility are obsolete and not supported. |
9595
| __`SYSLIB0038`__ | SerializationFormat.Binary is obsolete and should not be used. See https://aka.ms/serializationformat-binary-obsolete for more information. |
9696
| __`SYSLIB0039`__ | TLS versions 1.0 and 1.1 have known vulnerabilities and are not recommended. Use a newer TLS version instead, or use SslProtocols.None to defer to OS defaults. |
@@ -148,11 +148,11 @@ The diagnostic id values reserved for .NET Libraries analyzer warnings are `SYSL
148148
| __`SYSLIB1037`__ | JsonSourceGenerator encountered a type with init-only properties for which deserialization is not supported |
149149
| __`SYSLIB1038`__ | JsonSourceGenerator encountered a property annotated with [JsonInclude] that has inaccessible accessors |
150150
| __`SYSLIB1039`__ | *_`SYSLIB1039` reserved for System.Text.Json.SourceGeneration._* |
151-
| __`SYSLIB1040`__ | Invalid RegexGenerator attribute |
152-
| __`SYSLIB1041`__ | Multiple RegexGenerator attribute |
153-
| __`SYSLIB1042`__ | Invalid RegexGenerator arguments |
154-
| __`SYSLIB1043`__ | RegexGenerator method must have a valid signature |
155-
| __`SYSLIB1044`__ | RegexGenerator only supports C# 10 and newer |
151+
| __`SYSLIB1040`__ | Invalid GeneratedRegex attribute |
152+
| __`SYSLIB1041`__ | Multiple GeneratedRegex attribute |
153+
| __`SYSLIB1042`__ | Invalid GeneratedRegex arguments |
154+
| __`SYSLIB1043`__ | GeneratedRegex method must have a valid signature |
155+
| __`SYSLIB1044`__ | GeneratedRegex only supports C# 11 and newer |
156156
| __`SYSLIB1045`__ | *_`SYSLIB1045`-`SYSLIB1049` reserved for System.Text.RegularExpressions.Generator._* |
157157
| __`SYSLIB1046`__ | *_`SYSLIB1045`-`SYSLIB1049` reserved for System.Text.RegularExpressions.Generator._* |
158158
| __`SYSLIB1047`__ | *_`SYSLIB1045`-`SYSLIB1049` reserved for System.Text.RegularExpressions.Generator._* |
@@ -183,4 +183,4 @@ The diagnostic id values reserved for .NET Libraries analyzer warnings are `SYSL
183183

184184
| Suppression ID | Suppressed Diagnostic ID | Description |
185185
| :----------------- | :----------------------- | :---------- |
186-
| __`SYSLIBSUPPRESS0001`__ | CA1822 | Do not offer to make methods static when the methods need to be instance methods for a custom marshaller shape. |
186+
| __`SYSLIBSUPPRESS0001`__ | CA1822 | Do not offer to make methods static when the methods need to be instance methods for a custom marshaller shape. |

src/libraries/Common/src/System/Obsoletions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ internal static class Obsoletions
118118
internal const string SignerInfoCounterSigMessage = "ComputeCounterSignature without specifying a CmsSigner is obsolete and is not supported. Use the overload that accepts a CmsSigner.";
119119
internal const string SignerInfoCounterSigDiagId = "SYSLIB0035";
120120

121-
internal const string RegexCompileToAssemblyMessage = "Regex.CompileToAssembly is obsolete and not supported. Use the RegexGeneratorAttribute with the regular expression source generator instead.";
121+
internal const string RegexCompileToAssemblyMessage = "Regex.CompileToAssembly is obsolete and not supported. Use the GeneratedRegexAttribute with the regular expression source generator instead.";
122122
internal const string RegexCompileToAssemblyDiagId = "SYSLIB0036";
123123

124124
internal const string AssemblyNameMembersMessage = "AssemblyName members HashAlgorithm, ProcessorArchitecture, and VersionCompatibility are obsolete and not supported.";

src/libraries/System.ComponentModel.TypeConverter/src/System/ComponentModel/Design/DesignerVerb.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public DesignerVerb(string text, EventHandler handler, CommandID startCommandID)
2525
Properties["Text"] = text == null ? null : GetParameterReplacementRegex().Replace(text, "");
2626
}
2727

28-
[RegexGenerator(@"\(\&.\)")]
28+
[GeneratedRegex(@"\(\&.\)")]
2929
private static partial Regex GetParameterReplacementRegex();
3030

3131
/// <summary>

src/libraries/System.Private.DataContractSerialization/src/System/Runtime/Serialization/Globals.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,7 @@ internal static bool TypeOfScriptObject_IsAssignableFrom(Type type) =>
339339
public static readonly string NewObjectId = string.Empty;
340340
public const string NullObjectId = null;
341341
public const string FullSRSInternalsVisiblePattern = @"^[\s]*System\.Runtime\.Serialization[\s]*,[\s]*PublicKey[\s]*=[\s]*(?i:00240000048000009400000006020000002400005253413100040000010001008d56c76f9e8649383049f383c44be0ec204181822a6c31cf5eb7ef486944d032188ea1d3920763712ccb12d75fb77e9811149e6148e5d32fbaab37611c1878ddc19e20ef135d0cb2cff2bfec3d115810c3d9069638fe4be215dbf795861920e5ab6f7db2e2ceef136ac23d5dd2bf031700aec232f6c6b1c785b4305c123b37ab)[\s]*$";
342-
[RegexGenerator(FullSRSInternalsVisiblePattern)]
342+
[GeneratedRegex(FullSRSInternalsVisiblePattern)]
343343
public static partial Regex FullSRSInternalsVisibleRegex();
344344
public const string Space = " ";
345345
public const string XsiPrefix = "i";

src/libraries/System.Private.Xml/src/System/Xml/Schema/FacetChecker.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1342,7 +1342,7 @@ private static bool MatchEnumeration(DateTime value, ArrayList enumeration, XmlS
13421342
internal sealed partial class StringFacetsChecker : FacetsChecker
13431343
{ //All types derived from string & anyURI
13441344

1345-
[RegexGenerator("^([a-zA-Z]{1,8})(-[a-zA-Z0-9]{1,8})*$", RegexOptions.ExplicitCapture)]
1345+
[GeneratedRegex("^([a-zA-Z]{1,8})(-[a-zA-Z0-9]{1,8})*$", RegexOptions.ExplicitCapture)]
13461346
private static partial Regex LanguageRegex();
13471347

13481348
internal override Exception? CheckValueFacets(object value, XmlSchemaDatatype datatype)

src/libraries/System.Private.Xml/src/System/Xml/Serialization/SourceInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@ internal sealed partial class SourceInfo
1515
{
1616
//a[ia]
1717
//((global::System.Xml.Serialization.XmlSerializerNamespaces)p[0])
18-
[RegexGenerator("([(][(](?<t>[^)]+)[)])?(?<a>[^[]+)[[](?<ia>.+)[]][)]?")]
18+
[GeneratedRegex("([(][(](?<t>[^)]+)[)])?(?<a>[^[]+)[[](?<ia>.+)[]][)]?")]
1919
private static partial Regex Regex1();
2020

2121
//((global::Microsoft.CFx.Test.Common.TypeLibrary.IXSType_9)o), @"IXSType_9", @"", true, true);
22-
[RegexGenerator("[(][(](?<cast>[^)]+)[)](?<arg>[^)]+)[)]")]
22+
[GeneratedRegex("[(][(](?<cast>[^)]+)[)](?<arg>[^)]+)[)]")]
2323
private static partial Regex Regex2();
2424

2525
private static readonly Lazy<MethodInfo> s_iListGetItemMethod = new Lazy<MethodInfo>(

src/libraries/System.Private.Xml/src/System/Xml/Serialization/XmlSerializationReaderILGen.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2704,10 +2704,10 @@ private void WriteSourceBeginTyped(string source, TypeDesc? typeDesc)
27042704
WriteSourceBegin(source);
27052705
}
27062706

2707-
[RegexGenerator("(?<locA1>[^ ]+) = .+EnsureArrayIndex[(](?<locA2>[^,]+), (?<locI1>[^,]+),[^;]+;(?<locA3>[^[]+)[[](?<locI2>[^+]+)[+][+][]]")]
2707+
[GeneratedRegex("(?<locA1>[^ ]+) = .+EnsureArrayIndex[(](?<locA2>[^,]+), (?<locI1>[^,]+),[^;]+;(?<locA3>[^[]+)[[](?<locI2>[^+]+)[+][+][]]")]
27082708
private static partial Regex EnsureArrayIndexRegex();
27092709

2710-
[RegexGenerator("(?<a>[^[]+)[[](?<ia>.+)[]]")]
2710+
[GeneratedRegex("(?<a>[^[]+)[[](?<ia>.+)[]]")]
27112711
private static partial Regex P0Regex();
27122712

27132713
private void WriteSourceBegin(string source)
@@ -3520,19 +3520,19 @@ private static void WriteLocalDecl(string variableName, SourceInfo initValue)
35203520
ReflectionAwareILGen.WriteLocalDecl(variableName, initValue);
35213521
}
35223522

3523-
[RegexGenerator("UnknownNode[(]null, @[\"](?<qnames>[^\"]*)[\"][)];")]
3523+
[GeneratedRegex("UnknownNode[(]null, @[\"](?<qnames>[^\"]*)[\"][)];")]
35243524
private static partial Regex UnknownNodeNullAnyTypeRegex();
35253525

3526-
[RegexGenerator("UnknownNode[(][(]object[)](?<o>[^,]+), @[\"](?<qnames>[^\"]*)[\"][)];")]
3526+
[GeneratedRegex("UnknownNode[(][(]object[)](?<o>[^,]+), @[\"](?<qnames>[^\"]*)[\"][)];")]
35273527
private static partial Regex UnknownNodeObjectEmptyRegex();
35283528

3529-
[RegexGenerator("UnknownNode[(][(]object[)](?<o>[^,]+), null[)];")]
3529+
[GeneratedRegex("UnknownNode[(][(]object[)](?<o>[^,]+), null[)];")]
35303530
private static partial Regex UnknownNodeObjectNullRegex();
35313531

3532-
[RegexGenerator("UnknownNode[(][(]object[)](?<o>[^)]+)[)];")]
3532+
[GeneratedRegex("UnknownNode[(][(]object[)](?<o>[^)]+)[)];")]
35333533
private static partial Regex UnknownNodeObjectRegex();
35343534

3535-
[RegexGenerator("paramsRead\\[(?<index>[0-9]+)\\]")]
3535+
[GeneratedRegex("paramsRead\\[(?<index>[0-9]+)\\]")]
35363536
private static partial Regex ParamsReadRegex();
35373537

35383538
private void ILGenElseString(string elseString)

src/libraries/System.Private.Xml/src/System/Xml/XmlConvert.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -280,10 +280,10 @@ public partial class XmlConvert
280280

281281
private const int EncodedCharLength = 7; // ("_xFFFF_".Length);
282282

283-
[RegexGenerator("_[Xx][0-9a-fA-F]{4}(?:_|[0-9a-fA-F]{4}_)")]
283+
[GeneratedRegex("_[Xx][0-9a-fA-F]{4}(?:_|[0-9a-fA-F]{4}_)")]
284284
private static partial Regex DecodeCharRegex();
285285

286-
[RegexGenerator("(?<=_)[Xx][0-9a-fA-F]{4}(?:_|[0-9a-fA-F]{4}_)")]
286+
[GeneratedRegex("(?<=_)[Xx][0-9a-fA-F]{4}(?:_|[0-9a-fA-F]{4}_)")]
287287
private static partial Regex EncodeCharRegex();
288288

289289
private static int FromHex(char digit)

src/libraries/System.Runtime/tests/System/TimeZoneInfoTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2327,7 +2327,7 @@ public static IEnumerable<object[]> SystemTimeZonesTestData()
23272327

23282328
private const string IanaAbbreviationPattern = @"^(?:[A-Z][A-Za-z]+|[+-]\d{2}|[+-]\d{4})$";
23292329

2330-
[RegexGenerator(IanaAbbreviationPattern)]
2330+
[GeneratedRegex(IanaAbbreviationPattern)]
23312331
private static partial Regex IanaAbbreviationRegex();
23322332

23332333
// UTC aliases per https://github.com/unicode-org/cldr/blob/master/common/bcp47/timezone.xml

src/libraries/System.Text.RegularExpressions/gen/DiagnosticDescriptors.cs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,29 +8,29 @@ namespace System.Text.RegularExpressions.Generator
88
{
99
internal static class DiagnosticDescriptors
1010
{
11-
private const string Category = "RegexGenerator";
11+
private const string Category = "GeneratedRegex";
1212

13-
public static DiagnosticDescriptor InvalidRegexGeneratorAttribute { get; } = new DiagnosticDescriptor(
13+
public static DiagnosticDescriptor InvalidGeneratedRegexAttribute { get; } = new DiagnosticDescriptor(
1414
id: "SYSLIB1040",
15-
title: new LocalizableResourceString(nameof(SR.InvalidRegexGeneratorAttributeTitle), SR.ResourceManager, typeof(FxResources.System.Text.RegularExpressions.Generator.SR)),
16-
messageFormat: new LocalizableResourceString(nameof(SR.InvalidRegexGeneratorAttributeMessage), SR.ResourceManager, typeof(FxResources.System.Text.RegularExpressions.Generator.SR)),
15+
title: new LocalizableResourceString(nameof(SR.InvalidGeneratedRegexAttributeTitle), SR.ResourceManager, typeof(FxResources.System.Text.RegularExpressions.Generator.SR)),
16+
messageFormat: new LocalizableResourceString(nameof(SR.InvalidGeneratedRegexAttributeMessage), SR.ResourceManager, typeof(FxResources.System.Text.RegularExpressions.Generator.SR)),
1717
category: Category,
1818
DiagnosticSeverity.Error,
1919
isEnabledByDefault: true,
2020
customTags: WellKnownDiagnosticTags.NotConfigurable);
2121

22-
public static DiagnosticDescriptor MultipleRegexGeneratorAttributes { get; } = new DiagnosticDescriptor(
22+
public static DiagnosticDescriptor MultipleGeneratedRegexAttributes { get; } = new DiagnosticDescriptor(
2323
id: "SYSLIB1041",
24-
title: new LocalizableResourceString(nameof(SR.InvalidRegexGeneratorAttributeTitle), SR.ResourceManager, typeof(FxResources.System.Text.RegularExpressions.Generator.SR)),
25-
messageFormat: new LocalizableResourceString(nameof(SR.MultipleRegexGeneratorAttributesMessage), SR.ResourceManager, typeof(FxResources.System.Text.RegularExpressions.Generator.SR)),
24+
title: new LocalizableResourceString(nameof(SR.InvalidGeneratedRegexAttributeTitle), SR.ResourceManager, typeof(FxResources.System.Text.RegularExpressions.Generator.SR)),
25+
messageFormat: new LocalizableResourceString(nameof(SR.MultipleGeneratedRegexAttributesMessage), SR.ResourceManager, typeof(FxResources.System.Text.RegularExpressions.Generator.SR)),
2626
category: Category,
2727
DiagnosticSeverity.Error,
2828
isEnabledByDefault: true,
2929
customTags: WellKnownDiagnosticTags.NotConfigurable);
3030

3131
public static DiagnosticDescriptor InvalidRegexArguments { get; } = new DiagnosticDescriptor(
3232
id: "SYSLIB1042",
33-
title: new LocalizableResourceString(nameof(SR.InvalidRegexGeneratorAttributeTitle), SR.ResourceManager, typeof(FxResources.System.Text.RegularExpressions.Generator.SR)),
33+
title: new LocalizableResourceString(nameof(SR.InvalidGeneratedRegexAttributeTitle), SR.ResourceManager, typeof(FxResources.System.Text.RegularExpressions.Generator.SR)),
3434
messageFormat: new LocalizableResourceString(nameof(SR.InvalidRegexArgumentsMessage), SR.ResourceManager, typeof(FxResources.System.Text.RegularExpressions.Generator.SR)),
3535
category: Category,
3636
DiagnosticSeverity.Error,
@@ -39,7 +39,7 @@ internal static class DiagnosticDescriptors
3939

4040
public static DiagnosticDescriptor RegexMethodMustHaveValidSignature { get; } = new DiagnosticDescriptor(
4141
id: "SYSLIB1043",
42-
title: new LocalizableResourceString(nameof(SR.InvalidRegexGeneratorAttributeTitle), SR.ResourceManager, typeof(FxResources.System.Text.RegularExpressions.Generator.SR)),
42+
title: new LocalizableResourceString(nameof(SR.InvalidGeneratedRegexAttributeTitle), SR.ResourceManager, typeof(FxResources.System.Text.RegularExpressions.Generator.SR)),
4343
messageFormat: new LocalizableResourceString(nameof(SR.RegexMethodMustHaveValidSignatureMessage), SR.ResourceManager, typeof(FxResources.System.Text.RegularExpressions.Generator.SR)),
4444
category: Category,
4545
DiagnosticSeverity.Error,

0 commit comments

Comments
 (0)