diff --git a/ConsoleApp1/ConsoleApp1.csproj b/ConsoleApp1/ConsoleApp1.csproj index 1f3478e..4b2c583 100644 --- a/ConsoleApp1/ConsoleApp1.csproj +++ b/ConsoleApp1/ConsoleApp1.csproj @@ -24,7 +24,7 @@ - + diff --git a/ConsoleApp1/Generated/PrimaryParameter.SG/PrimaryParameter.SG.Generator/DontUseAttribute.g.cs b/ConsoleApp1/Generated/PrimaryParameter.SG/PrimaryParameter.SG.Generator/DoNotUseAttribute.g.cs similarity index 83% rename from ConsoleApp1/Generated/PrimaryParameter.SG/PrimaryParameter.SG.Generator/DontUseAttribute.g.cs rename to ConsoleApp1/Generated/PrimaryParameter.SG/PrimaryParameter.SG.Generator/DoNotUseAttribute.g.cs index d2a1a03..868120c 100644 --- a/ConsoleApp1/Generated/PrimaryParameter.SG/PrimaryParameter.SG.Generator/DontUseAttribute.g.cs +++ b/ConsoleApp1/Generated/PrimaryParameter.SG/PrimaryParameter.SG.Generator/DoNotUseAttribute.g.cs @@ -3,7 +3,7 @@ namespace PrimaryParameter.SG { [AttributeUsage(AttributeTargets.Parameter, Inherited = false, AllowMultiple = false)] - sealed class DontUseAttribute : Attribute + sealed class DoNotUseAttribute : Attribute { public bool AllowInMemberInit { get; init; } } diff --git a/PrimaryParameter.SG/Diagnostics.cs b/PrimaryParameter.SG/Diagnostics.cs index 273f315..a9edd34 100644 --- a/PrimaryParameter.SG/Diagnostics.cs +++ b/PrimaryParameter.SG/Diagnostics.cs @@ -11,7 +11,7 @@ static class Diagnostics public static readonly DiagnosticDescriptor ErrorWhenAccessingPrimaryParameter = new( id: "PC01", title: "Accessing a Primary Parameter", - messageFormat: "Can't access a primary parameter ('{0}') with a [Field] [RefField], [Property] or [DontUse] attribute, use {1}", + messageFormat: "Can't access a primary parameter ('{0}') with a [Field] [RefField], [Property] or [DoNotUse] attribute, use {1}", category: "tests", defaultSeverity: DiagnosticSeverity.Error, isEnabledByDefault: true); diff --git a/PrimaryParameter.SG/Generator.cs b/PrimaryParameter.SG/Generator.cs index 67dcd32..47bd556 100644 --- a/PrimaryParameter.SG/Generator.cs +++ b/PrimaryParameter.SG/Generator.cs @@ -74,13 +74,13 @@ sealed class PropertyAttribute : Attribute } """); - ctx.AddSource("DontUseAttribute.g.cs", """ + ctx.AddSource("DoNotUseAttribute.g.cs", """ // using global::System; namespace PrimaryParameter.SG { [AttributeUsage(AttributeTargets.Parameter, Inherited = false, AllowMultiple = false)] - sealed class DontUseAttribute : Attribute + sealed class DoNotUseAttribute : Attribute { public bool AllowInMemberInit { get; init; } } @@ -92,7 +92,7 @@ sealed class DontUseAttribute : Attribute var paramDeclarations = context.SyntaxProvider .CreateSyntaxProvider( predicate: IsSyntaxTargetForGeneration, // select params with attributes - transform: GetSemanticTargetForGeneration) // select the param with the [Field], [RefField], [Property] or [DontUse] attribute + transform: GetSemanticTargetForGeneration) // select the param with the [Field], [RefField], [Property] or [DoNotUse] attribute .Where(static m => m is not null)!; // filter out attributed parameters that we don't care about // Combine the selected parameters with the `Compilation` @@ -170,8 +170,8 @@ static bool IsSyntaxTargetForGeneration(SyntaxNode s, CancellationToken token) var fullName = attributeContainingTypeSymbol.ToDisplayString(); - // Is the attribute the [Field], [RefField], [Property] or [DontUse] attribute? - if (fullName is "PrimaryParameter.SG.FieldAttribute" or "PrimaryParameter.SG.RefFieldAttribute" or "PrimaryParameter.SG.PropertyAttribute" or "PrimaryParameter.SG.DontUseAttribute") + // Is the attribute the [Field], [RefField], [Property] or [DoNotUse] attribute? + if (fullName is "PrimaryParameter.SG.FieldAttribute" or "PrimaryParameter.SG.RefFieldAttribute" or "PrimaryParameter.SG.PropertyAttribute" or "PrimaryParameter.SG.DoNotUseAttribute") { if (parameterSyntax is not { Parent.Parent: ClassDeclarationSyntax or StructDeclarationSyntax }) { @@ -232,10 +232,10 @@ static IEnumerable GetTypesToGenerate(Compilation compilation, IEnume if ((compilation.GetTypeByMetadataName("PrimaryParameter.SG.FieldAttribute"), compilation.GetTypeByMetadataName("PrimaryParameter.SG.RefFieldAttribute"), compilation.GetTypeByMetadataName("PrimaryParameter.SG.PropertyAttribute"), - compilation.GetTypeByMetadataName("PrimaryParameter.SG.DontUseAttribute")) is not (INamedTypeSymbol fieldAttributeSymbol, + compilation.GetTypeByMetadataName("PrimaryParameter.SG.DoNotUseAttribute")) is not (INamedTypeSymbol fieldAttributeSymbol, INamedTypeSymbol refFieldAttributeSymbol, INamedTypeSymbol propertyAttributeSymbol, - INamedTypeSymbol dontUseAttributeSymbol)) + INamedTypeSymbol doNotUseAttributeSymbol)) { // If this is null, the compilation couldn't find the marker attribute type // which suggests there's something very wrong! Bail out.. @@ -311,7 +311,7 @@ static IEnumerable GetTypesToGenerate(Compilation compilation, IEnume else if (!memberNames.Add(new GenerateProperty(name, setter, scope, format, type))) context.ReportDiagnostic(Diagnostic.Create(Diagnostics.WarningOnUsedMember, nameLocation, name)); } - else if (dontUseAttributeSymbol.Equals(objectCreationOperation.Type, SymbolEqualityComparer.Default)) + else if (doNotUseAttributeSymbol.Equals(objectCreationOperation.Type, SymbolEqualityComparer.Default)) allowInMemberInit &= GetAttributeProperty(operation, "AllowInMemberInit", out _, defaultValue: true); } var parameter = new Parameter(GetNamespace(containingType), ParentClass.GetParentClasses(containingType)!, paramSyntax.Identifier.Text, semanticModel.GetTypeInfo(paramSyntax.Type!).Type!.ToDisplayString(), [.. memberNames]); diff --git a/PrimaryParameter.SG/PrimaryParameter.SG.csproj b/PrimaryParameter.SG/PrimaryParameter.SG.csproj index c4bc7fb..99cf1fe 100644 --- a/PrimaryParameter.SG/PrimaryParameter.SG.csproj +++ b/PrimaryParameter.SG/PrimaryParameter.SG.csproj @@ -30,7 +30,7 @@ FaustVX.PrimaryParameter.SG - 1.3.2 + 1.3.3 FaustVX https://github.com/FaustVX/PrimaryParameter git diff --git a/PrimaryParameter.Tests/PrimaryParameterSnapshotTests.cs b/PrimaryParameter.Tests/PrimaryParameterSnapshotTests.cs index 244c492..0a58b3e 100644 --- a/PrimaryParameter.Tests/PrimaryParameterSnapshotTests.cs +++ b/PrimaryParameter.Tests/PrimaryParameterSnapshotTests.cs @@ -142,12 +142,12 @@ public partial class C([Property] int i) } [Fact] - public Task GeneratesPC01WithDontUse() + public Task GeneratesPC01WithDoNotUse() { // The source code to test var source = """ using PrimaryParameter.SG; - public class C([DontUse] int i) + public class C([DoNotUse] int i) { int M() => i; } @@ -158,12 +158,12 @@ public class C([DontUse] int i) } [Fact] - public Task DontGeneratesPC01WithDontUseOnMember_Simple() + public Task DontGeneratesPC01WithDoNotUseOnMember_Simple() { // The source code to test var source = """ using PrimaryParameter.SG; - public class C([DontUse(AllowInMemberInit = true)] int i) + public class C([DoNotUse(AllowInMemberInit = true)] int i) { int M = i; } @@ -174,12 +174,12 @@ public class C([DontUse(AllowInMemberInit = true)] int i) } [Fact] - public Task DontGeneratesPC01WithDontUseOnMember_Complex() + public Task DontGeneratesPC01WithDoNotUseOnMember_Complex() { // The source code to test var source = """ using PrimaryParameter.SG; - public class C([DontUse(AllowInMemberInit = true)] int i) + public class C([DoNotUse(AllowInMemberInit = true)] int i) { string L = i.ToString(); } @@ -190,12 +190,12 @@ public class C([DontUse(AllowInMemberInit = true)] int i) } [Fact] - public Task DontGeneratesPC01WithDontUseOnPropertyInitializer() + public Task DontGeneratesPC01WithDoNotUseOnPropertyInitializer() { // The source code to test var source = """ using PrimaryParameter.SG; - public class C([DontUse(AllowInMemberInit = true)] int i) + public class C([DoNotUse(AllowInMemberInit = true)] int i) { string L { get; } = i.ToString(); } @@ -206,12 +206,12 @@ public class C([DontUse(AllowInMemberInit = true)] int i) } [Fact] - public Task DoGeneratesPC01WithDontUseOnPropertyBody() + public Task DoGeneratesPC01WithDoNotUseOnPropertyBody() { // The source code to test var source = """ using PrimaryParameter.SG; - public class C([DontUse] int i) + public class C([DoNotUse] int i) { int M => i; } @@ -222,12 +222,12 @@ public class C([DontUse] int i) } [Fact] - public Task DoGeneratesPC01WithDontUseOnPropertyGet() + public Task DoGeneratesPC01WithDoNotUseOnPropertyGet() { // The source code to test var source = """ using PrimaryParameter.SG; - public class C([DontUse] int i) + public class C([DoNotUse] int i) { int M { @@ -241,12 +241,12 @@ int M } [Fact] - public Task DoGeneratesPC01WithDontUseOnMember() + public Task DoGeneratesPC01WithDoNotUseOnMember() { // The source code to test var source = """ using PrimaryParameter.SG; - public class C([DontUse(AllowInMemberInit = false)] int i) + public class C([DoNotUse(AllowInMemberInit = false)] int i) { int M = i; } @@ -262,7 +262,7 @@ public Task DontNeedPartialModifierOnType() // The source code to test var source = """ using PrimaryParameter.SG; - public class C([DontUse] int i) + public class C([DoNotUse] int i) { } """; diff --git a/PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.DoGeneratesPC01WithDontUseOnMember/DontUseAttribute.g.verified.cs b/PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.DefaultPropertySetter_Init/DoNotUseAttribute.g.verified.cs similarity index 73% rename from PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.DoGeneratesPC01WithDontUseOnMember/DontUseAttribute.g.verified.cs rename to PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.DefaultPropertySetter_Init/DoNotUseAttribute.g.verified.cs index 56e9a73..75ad135 100644 --- a/PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.DoGeneratesPC01WithDontUseOnMember/DontUseAttribute.g.verified.cs +++ b/PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.DefaultPropertySetter_Init/DoNotUseAttribute.g.verified.cs @@ -1,10 +1,10 @@ -//HintName: DontUseAttribute.g.cs +//HintName: DoNotUseAttribute.g.cs // using global::System; namespace PrimaryParameter.SG { [AttributeUsage(AttributeTargets.Parameter, Inherited = false, AllowMultiple = false)] - sealed class DontUseAttribute : Attribute + sealed class DoNotUseAttribute : Attribute { public bool AllowInMemberInit { get; init; } } diff --git a/PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.DefaultPropertySetter_Init/DontUseAttribute.g.verified.cs b/PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.DefaultPropertySetter_None/DoNotUseAttribute.g.verified.cs similarity index 73% rename from PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.DefaultPropertySetter_Init/DontUseAttribute.g.verified.cs rename to PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.DefaultPropertySetter_None/DoNotUseAttribute.g.verified.cs index 56e9a73..75ad135 100644 --- a/PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.DefaultPropertySetter_Init/DontUseAttribute.g.verified.cs +++ b/PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.DefaultPropertySetter_None/DoNotUseAttribute.g.verified.cs @@ -1,10 +1,10 @@ -//HintName: DontUseAttribute.g.cs +//HintName: DoNotUseAttribute.g.cs // using global::System; namespace PrimaryParameter.SG { [AttributeUsage(AttributeTargets.Parameter, Inherited = false, AllowMultiple = false)] - sealed class DontUseAttribute : Attribute + sealed class DoNotUseAttribute : Attribute { public bool AllowInMemberInit { get; init; } } diff --git a/PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.DefaultPropertySetter_None/DontUseAttribute.g.verified.cs b/PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.DefaultPropertySetter_Set/DoNotUseAttribute.g.verified.cs similarity index 73% rename from PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.DefaultPropertySetter_None/DontUseAttribute.g.verified.cs rename to PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.DefaultPropertySetter_Set/DoNotUseAttribute.g.verified.cs index 56e9a73..75ad135 100644 --- a/PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.DefaultPropertySetter_None/DontUseAttribute.g.verified.cs +++ b/PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.DefaultPropertySetter_Set/DoNotUseAttribute.g.verified.cs @@ -1,10 +1,10 @@ -//HintName: DontUseAttribute.g.cs +//HintName: DoNotUseAttribute.g.cs // using global::System; namespace PrimaryParameter.SG { [AttributeUsage(AttributeTargets.Parameter, Inherited = false, AllowMultiple = false)] - sealed class DontUseAttribute : Attribute + sealed class DoNotUseAttribute : Attribute { public bool AllowInMemberInit { get; init; } } diff --git a/PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.DefaultPropertySetter_Set/DontUseAttribute.g.verified.cs b/PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.DoGeneratesPC01WithDoNotUseOnMember/DoNotUseAttribute.g.verified.cs similarity index 73% rename from PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.DefaultPropertySetter_Set/DontUseAttribute.g.verified.cs rename to PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.DoGeneratesPC01WithDoNotUseOnMember/DoNotUseAttribute.g.verified.cs index 56e9a73..75ad135 100644 --- a/PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.DefaultPropertySetter_Set/DontUseAttribute.g.verified.cs +++ b/PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.DoGeneratesPC01WithDoNotUseOnMember/DoNotUseAttribute.g.verified.cs @@ -1,10 +1,10 @@ -//HintName: DontUseAttribute.g.cs +//HintName: DoNotUseAttribute.g.cs // using global::System; namespace PrimaryParameter.SG { [AttributeUsage(AttributeTargets.Parameter, Inherited = false, AllowMultiple = false)] - sealed class DontUseAttribute : Attribute + sealed class DoNotUseAttribute : Attribute { public bool AllowInMemberInit { get; init; } } diff --git a/PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.DoGeneratesPC01WithDontUseOnMember/FaustVX.PrimaryParameter.SG.g.verified.cs b/PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.DoGeneratesPC01WithDoNotUseOnMember/FaustVX.PrimaryParameter.SG.g.verified.cs similarity index 100% rename from PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.DoGeneratesPC01WithDontUseOnMember/FaustVX.PrimaryParameter.SG.g.verified.cs rename to PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.DoGeneratesPC01WithDoNotUseOnMember/FaustVX.PrimaryParameter.SG.g.verified.cs diff --git a/PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.DoGeneratesPC01WithDontUseOnMember/FieldAttribute.g.verified.cs b/PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.DoGeneratesPC01WithDoNotUseOnMember/FieldAttribute.g.verified.cs similarity index 100% rename from PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.DoGeneratesPC01WithDontUseOnMember/FieldAttribute.g.verified.cs rename to PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.DoGeneratesPC01WithDoNotUseOnMember/FieldAttribute.g.verified.cs diff --git a/PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.DoGeneratesPC01WithDontUseOnMember/PropertyAttribute.g.verified.cs b/PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.DoGeneratesPC01WithDoNotUseOnMember/PropertyAttribute.g.verified.cs similarity index 100% rename from PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.DoGeneratesPC01WithDontUseOnMember/PropertyAttribute.g.verified.cs rename to PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.DoGeneratesPC01WithDoNotUseOnMember/PropertyAttribute.g.verified.cs diff --git a/PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.DoGeneratesPC01WithDontUseOnMember/RefFieldAttribute.g.verified.cs b/PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.DoGeneratesPC01WithDoNotUseOnMember/RefFieldAttribute.g.verified.cs similarity index 100% rename from PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.DoGeneratesPC01WithDontUseOnMember/RefFieldAttribute.g.verified.cs rename to PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.DoGeneratesPC01WithDoNotUseOnMember/RefFieldAttribute.g.verified.cs diff --git a/PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.DoGeneratesPC01WithDontUseOnMember/target.verified.txt b/PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.DoGeneratesPC01WithDoNotUseOnMember/target.verified.txt similarity index 71% rename from PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.DoGeneratesPC01WithDontUseOnMember/target.verified.txt rename to PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.DoGeneratesPC01WithDoNotUseOnMember/target.verified.txt index 36d0f9d..7de913f 100644 --- a/PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.DoGeneratesPC01WithDontUseOnMember/target.verified.txt +++ b/PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.DoGeneratesPC01WithDoNotUseOnMember/target.verified.txt @@ -6,8 +6,8 @@ Severity: Error, WarningLevel: 0, Location: : (3,12)-(3,13), - MessageFormat: Can't access a primary parameter ('{0}') with a [Field] [RefField], [Property] or [DontUse] attribute, use {1}, - Message: Can't access a primary parameter ('i') with a [Field] [RefField], [Property] or [DontUse] attribute, use , + MessageFormat: Can't access a primary parameter ('{0}') with a [Field] [RefField], [Property] or [DoNotUse] attribute, use {1}, + Message: Can't access a primary parameter ('i') with a [Field] [RefField], [Property] or [DoNotUse] attribute, use , Category: tests } ] diff --git a/PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.DoGeneratesPC01WithDoNotUseOnPropertyBody/DoNotUseAttribute.g.verified.cs b/PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.DoGeneratesPC01WithDoNotUseOnPropertyBody/DoNotUseAttribute.g.verified.cs new file mode 100644 index 0000000..75ad135 --- /dev/null +++ b/PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.DoGeneratesPC01WithDoNotUseOnPropertyBody/DoNotUseAttribute.g.verified.cs @@ -0,0 +1,11 @@ +//HintName: DoNotUseAttribute.g.cs +// +using global::System; +namespace PrimaryParameter.SG +{ + [AttributeUsage(AttributeTargets.Parameter, Inherited = false, AllowMultiple = false)] + sealed class DoNotUseAttribute : Attribute + { + public bool AllowInMemberInit { get; init; } + } +} diff --git a/PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.DoGeneratesPC01WithDontUseOnPropertyBody/FaustVX.PrimaryParameter.SG.g.verified.cs b/PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.DoGeneratesPC01WithDoNotUseOnPropertyBody/FaustVX.PrimaryParameter.SG.g.verified.cs similarity index 100% rename from PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.DoGeneratesPC01WithDontUseOnPropertyBody/FaustVX.PrimaryParameter.SG.g.verified.cs rename to PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.DoGeneratesPC01WithDoNotUseOnPropertyBody/FaustVX.PrimaryParameter.SG.g.verified.cs diff --git a/PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.DoGeneratesPC01WithDontUseOnPropertyBody/FieldAttribute.g.verified.cs b/PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.DoGeneratesPC01WithDoNotUseOnPropertyBody/FieldAttribute.g.verified.cs similarity index 100% rename from PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.DoGeneratesPC01WithDontUseOnPropertyBody/FieldAttribute.g.verified.cs rename to PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.DoGeneratesPC01WithDoNotUseOnPropertyBody/FieldAttribute.g.verified.cs diff --git a/PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.DoGeneratesPC01WithDontUseOnPropertyBody/PropertyAttribute.g.verified.cs b/PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.DoGeneratesPC01WithDoNotUseOnPropertyBody/PropertyAttribute.g.verified.cs similarity index 100% rename from PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.DoGeneratesPC01WithDontUseOnPropertyBody/PropertyAttribute.g.verified.cs rename to PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.DoGeneratesPC01WithDoNotUseOnPropertyBody/PropertyAttribute.g.verified.cs diff --git a/PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.DoGeneratesPC01WithDontUseOnPropertyBody/RefFieldAttribute.g.verified.cs b/PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.DoGeneratesPC01WithDoNotUseOnPropertyBody/RefFieldAttribute.g.verified.cs similarity index 100% rename from PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.DoGeneratesPC01WithDontUseOnPropertyBody/RefFieldAttribute.g.verified.cs rename to PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.DoGeneratesPC01WithDoNotUseOnPropertyBody/RefFieldAttribute.g.verified.cs diff --git a/PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.DoGeneratesPC01WithDontUseOnPropertyBody/target.verified.txt b/PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.DoGeneratesPC01WithDoNotUseOnPropertyBody/target.verified.txt similarity index 71% rename from PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.DoGeneratesPC01WithDontUseOnPropertyBody/target.verified.txt rename to PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.DoGeneratesPC01WithDoNotUseOnPropertyBody/target.verified.txt index febd62f..646127b 100644 --- a/PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.DoGeneratesPC01WithDontUseOnPropertyBody/target.verified.txt +++ b/PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.DoGeneratesPC01WithDoNotUseOnPropertyBody/target.verified.txt @@ -6,8 +6,8 @@ Severity: Error, WarningLevel: 0, Location: : (3,13)-(3,14), - MessageFormat: Can't access a primary parameter ('{0}') with a [Field] [RefField], [Property] or [DontUse] attribute, use {1}, - Message: Can't access a primary parameter ('i') with a [Field] [RefField], [Property] or [DontUse] attribute, use , + MessageFormat: Can't access a primary parameter ('{0}') with a [Field] [RefField], [Property] or [DoNotUse] attribute, use {1}, + Message: Can't access a primary parameter ('i') with a [Field] [RefField], [Property] or [DoNotUse] attribute, use , Category: tests } ] diff --git a/PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.DoGeneratesPC01WithDoNotUseOnPropertyGet/DoNotUseAttribute.g.verified.cs b/PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.DoGeneratesPC01WithDoNotUseOnPropertyGet/DoNotUseAttribute.g.verified.cs new file mode 100644 index 0000000..75ad135 --- /dev/null +++ b/PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.DoGeneratesPC01WithDoNotUseOnPropertyGet/DoNotUseAttribute.g.verified.cs @@ -0,0 +1,11 @@ +//HintName: DoNotUseAttribute.g.cs +// +using global::System; +namespace PrimaryParameter.SG +{ + [AttributeUsage(AttributeTargets.Parameter, Inherited = false, AllowMultiple = false)] + sealed class DoNotUseAttribute : Attribute + { + public bool AllowInMemberInit { get; init; } + } +} diff --git a/PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.DoGeneratesPC01WithDontUseOnPropertyGet/FaustVX.PrimaryParameter.SG.g.verified.cs b/PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.DoGeneratesPC01WithDoNotUseOnPropertyGet/FaustVX.PrimaryParameter.SG.g.verified.cs similarity index 100% rename from PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.DoGeneratesPC01WithDontUseOnPropertyGet/FaustVX.PrimaryParameter.SG.g.verified.cs rename to PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.DoGeneratesPC01WithDoNotUseOnPropertyGet/FaustVX.PrimaryParameter.SG.g.verified.cs diff --git a/PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.DoGeneratesPC01WithDontUseOnPropertyGet/FieldAttribute.g.verified.cs b/PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.DoGeneratesPC01WithDoNotUseOnPropertyGet/FieldAttribute.g.verified.cs similarity index 100% rename from PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.DoGeneratesPC01WithDontUseOnPropertyGet/FieldAttribute.g.verified.cs rename to PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.DoGeneratesPC01WithDoNotUseOnPropertyGet/FieldAttribute.g.verified.cs diff --git a/PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.DoGeneratesPC01WithDontUseOnPropertyGet/PropertyAttribute.g.verified.cs b/PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.DoGeneratesPC01WithDoNotUseOnPropertyGet/PropertyAttribute.g.verified.cs similarity index 100% rename from PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.DoGeneratesPC01WithDontUseOnPropertyGet/PropertyAttribute.g.verified.cs rename to PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.DoGeneratesPC01WithDoNotUseOnPropertyGet/PropertyAttribute.g.verified.cs diff --git a/PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.DoGeneratesPC01WithDontUseOnPropertyGet/RefFieldAttribute.g.verified.cs b/PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.DoGeneratesPC01WithDoNotUseOnPropertyGet/RefFieldAttribute.g.verified.cs similarity index 100% rename from PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.DoGeneratesPC01WithDontUseOnPropertyGet/RefFieldAttribute.g.verified.cs rename to PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.DoGeneratesPC01WithDoNotUseOnPropertyGet/RefFieldAttribute.g.verified.cs diff --git a/PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.DoGeneratesPC01WithDontUseOnPropertyGet/target.verified.txt b/PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.DoGeneratesPC01WithDoNotUseOnPropertyGet/target.verified.txt similarity index 71% rename from PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.DoGeneratesPC01WithDontUseOnPropertyGet/target.verified.txt rename to PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.DoGeneratesPC01WithDoNotUseOnPropertyGet/target.verified.txt index 7995783..cd12c0c 100644 --- a/PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.DoGeneratesPC01WithDontUseOnPropertyGet/target.verified.txt +++ b/PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.DoGeneratesPC01WithDoNotUseOnPropertyGet/target.verified.txt @@ -6,8 +6,8 @@ Severity: Error, WarningLevel: 0, Location: : (5,15)-(5,16), - MessageFormat: Can't access a primary parameter ('{0}') with a [Field] [RefField], [Property] or [DontUse] attribute, use {1}, - Message: Can't access a primary parameter ('i') with a [Field] [RefField], [Property] or [DontUse] attribute, use , + MessageFormat: Can't access a primary parameter ('{0}') with a [Field] [RefField], [Property] or [DoNotUse] attribute, use {1}, + Message: Can't access a primary parameter ('i') with a [Field] [RefField], [Property] or [DoNotUse] attribute, use , Category: tests } ] diff --git a/PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.DoGeneratesPC01WithDontUseOnPropertyBody/DontUseAttribute.g.verified.cs b/PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.DoGeneratesPC01WithDontUseOnPropertyBody/DontUseAttribute.g.verified.cs deleted file mode 100644 index 56e9a73..0000000 --- a/PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.DoGeneratesPC01WithDontUseOnPropertyBody/DontUseAttribute.g.verified.cs +++ /dev/null @@ -1,11 +0,0 @@ -//HintName: DontUseAttribute.g.cs -// -using global::System; -namespace PrimaryParameter.SG -{ - [AttributeUsage(AttributeTargets.Parameter, Inherited = false, AllowMultiple = false)] - sealed class DontUseAttribute : Attribute - { - public bool AllowInMemberInit { get; init; } - } -} diff --git a/PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.DoGeneratesPC01WithDontUseOnPropertyGet/DontUseAttribute.g.verified.cs b/PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.DoGeneratesPC01WithDontUseOnPropertyGet/DontUseAttribute.g.verified.cs deleted file mode 100644 index 56e9a73..0000000 --- a/PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.DoGeneratesPC01WithDontUseOnPropertyGet/DontUseAttribute.g.verified.cs +++ /dev/null @@ -1,11 +0,0 @@ -//HintName: DontUseAttribute.g.cs -// -using global::System; -namespace PrimaryParameter.SG -{ - [AttributeUsage(AttributeTargets.Parameter, Inherited = false, AllowMultiple = false)] - sealed class DontUseAttribute : Attribute - { - public bool AllowInMemberInit { get; init; } - } -} diff --git a/PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.DontGeneratesPC01UsingField/DoNotUseAttribute.g.verified.cs b/PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.DontGeneratesPC01UsingField/DoNotUseAttribute.g.verified.cs new file mode 100644 index 0000000..75ad135 --- /dev/null +++ b/PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.DontGeneratesPC01UsingField/DoNotUseAttribute.g.verified.cs @@ -0,0 +1,11 @@ +//HintName: DoNotUseAttribute.g.cs +// +using global::System; +namespace PrimaryParameter.SG +{ + [AttributeUsage(AttributeTargets.Parameter, Inherited = false, AllowMultiple = false)] + sealed class DoNotUseAttribute : Attribute + { + public bool AllowInMemberInit { get; init; } + } +} diff --git a/PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.DontGeneratesPC01UsingField/DontUseAttribute.g.verified.cs b/PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.DontGeneratesPC01UsingField/DontUseAttribute.g.verified.cs deleted file mode 100644 index 56e9a73..0000000 --- a/PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.DontGeneratesPC01UsingField/DontUseAttribute.g.verified.cs +++ /dev/null @@ -1,11 +0,0 @@ -//HintName: DontUseAttribute.g.cs -// -using global::System; -namespace PrimaryParameter.SG -{ - [AttributeUsage(AttributeTargets.Parameter, Inherited = false, AllowMultiple = false)] - sealed class DontUseAttribute : Attribute - { - public bool AllowInMemberInit { get; init; } - } -} diff --git a/PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.DontGeneratesPC01UsingParameter/DoNotUseAttribute.g.verified.cs b/PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.DontGeneratesPC01UsingParameter/DoNotUseAttribute.g.verified.cs new file mode 100644 index 0000000..75ad135 --- /dev/null +++ b/PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.DontGeneratesPC01UsingParameter/DoNotUseAttribute.g.verified.cs @@ -0,0 +1,11 @@ +//HintName: DoNotUseAttribute.g.cs +// +using global::System; +namespace PrimaryParameter.SG +{ + [AttributeUsage(AttributeTargets.Parameter, Inherited = false, AllowMultiple = false)] + sealed class DoNotUseAttribute : Attribute + { + public bool AllowInMemberInit { get; init; } + } +} diff --git a/PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.DontGeneratesPC01UsingParameter/DontUseAttribute.g.verified.cs b/PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.DontGeneratesPC01UsingParameter/DontUseAttribute.g.verified.cs deleted file mode 100644 index 56e9a73..0000000 --- a/PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.DontGeneratesPC01UsingParameter/DontUseAttribute.g.verified.cs +++ /dev/null @@ -1,11 +0,0 @@ -//HintName: DontUseAttribute.g.cs -// -using global::System; -namespace PrimaryParameter.SG -{ - [AttributeUsage(AttributeTargets.Parameter, Inherited = false, AllowMultiple = false)] - sealed class DontUseAttribute : Attribute - { - public bool AllowInMemberInit { get; init; } - } -} diff --git a/PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.DontGeneratesPC01WithDoNotUseOnMember_Complex/DoNotUseAttribute.g.verified.cs b/PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.DontGeneratesPC01WithDoNotUseOnMember_Complex/DoNotUseAttribute.g.verified.cs new file mode 100644 index 0000000..75ad135 --- /dev/null +++ b/PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.DontGeneratesPC01WithDoNotUseOnMember_Complex/DoNotUseAttribute.g.verified.cs @@ -0,0 +1,11 @@ +//HintName: DoNotUseAttribute.g.cs +// +using global::System; +namespace PrimaryParameter.SG +{ + [AttributeUsage(AttributeTargets.Parameter, Inherited = false, AllowMultiple = false)] + sealed class DoNotUseAttribute : Attribute + { + public bool AllowInMemberInit { get; init; } + } +} diff --git a/PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.DontGeneratesPC01WithDontUseOnMember_Complex/FaustVX.PrimaryParameter.SG.g.verified.cs b/PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.DontGeneratesPC01WithDoNotUseOnMember_Complex/FaustVX.PrimaryParameter.SG.g.verified.cs similarity index 100% rename from PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.DontGeneratesPC01WithDontUseOnMember_Complex/FaustVX.PrimaryParameter.SG.g.verified.cs rename to PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.DontGeneratesPC01WithDoNotUseOnMember_Complex/FaustVX.PrimaryParameter.SG.g.verified.cs diff --git a/PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.DontGeneratesPC01WithDontUseOnMember_Complex/FieldAttribute.g.verified.cs b/PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.DontGeneratesPC01WithDoNotUseOnMember_Complex/FieldAttribute.g.verified.cs similarity index 100% rename from PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.DontGeneratesPC01WithDontUseOnMember_Complex/FieldAttribute.g.verified.cs rename to PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.DontGeneratesPC01WithDoNotUseOnMember_Complex/FieldAttribute.g.verified.cs diff --git a/PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.DontGeneratesPC01WithDontUseOnMember_Complex/PropertyAttribute.g.verified.cs b/PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.DontGeneratesPC01WithDoNotUseOnMember_Complex/PropertyAttribute.g.verified.cs similarity index 100% rename from PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.DontGeneratesPC01WithDontUseOnMember_Complex/PropertyAttribute.g.verified.cs rename to PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.DontGeneratesPC01WithDoNotUseOnMember_Complex/PropertyAttribute.g.verified.cs diff --git a/PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.DontGeneratesPC01WithDontUseOnMember_Complex/RefFieldAttribute.g.verified.cs b/PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.DontGeneratesPC01WithDoNotUseOnMember_Complex/RefFieldAttribute.g.verified.cs similarity index 100% rename from PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.DontGeneratesPC01WithDontUseOnMember_Complex/RefFieldAttribute.g.verified.cs rename to PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.DontGeneratesPC01WithDoNotUseOnMember_Complex/RefFieldAttribute.g.verified.cs diff --git a/PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.DontGeneratesPC01WithDoNotUseOnMember_Simple/DoNotUseAttribute.g.verified.cs b/PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.DontGeneratesPC01WithDoNotUseOnMember_Simple/DoNotUseAttribute.g.verified.cs new file mode 100644 index 0000000..75ad135 --- /dev/null +++ b/PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.DontGeneratesPC01WithDoNotUseOnMember_Simple/DoNotUseAttribute.g.verified.cs @@ -0,0 +1,11 @@ +//HintName: DoNotUseAttribute.g.cs +// +using global::System; +namespace PrimaryParameter.SG +{ + [AttributeUsage(AttributeTargets.Parameter, Inherited = false, AllowMultiple = false)] + sealed class DoNotUseAttribute : Attribute + { + public bool AllowInMemberInit { get; init; } + } +} diff --git a/PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.DontGeneratesPC01WithDontUseOnMember_Simple/FaustVX.PrimaryParameter.SG.g.verified.cs b/PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.DontGeneratesPC01WithDoNotUseOnMember_Simple/FaustVX.PrimaryParameter.SG.g.verified.cs similarity index 100% rename from PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.DontGeneratesPC01WithDontUseOnMember_Simple/FaustVX.PrimaryParameter.SG.g.verified.cs rename to PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.DontGeneratesPC01WithDoNotUseOnMember_Simple/FaustVX.PrimaryParameter.SG.g.verified.cs diff --git a/PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.DontGeneratesPC01WithDontUseOnMember_Simple/FieldAttribute.g.verified.cs b/PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.DontGeneratesPC01WithDoNotUseOnMember_Simple/FieldAttribute.g.verified.cs similarity index 100% rename from PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.DontGeneratesPC01WithDontUseOnMember_Simple/FieldAttribute.g.verified.cs rename to PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.DontGeneratesPC01WithDoNotUseOnMember_Simple/FieldAttribute.g.verified.cs diff --git a/PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.DontGeneratesPC01WithDontUseOnMember_Simple/PropertyAttribute.g.verified.cs b/PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.DontGeneratesPC01WithDoNotUseOnMember_Simple/PropertyAttribute.g.verified.cs similarity index 100% rename from PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.DontGeneratesPC01WithDontUseOnMember_Simple/PropertyAttribute.g.verified.cs rename to PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.DontGeneratesPC01WithDoNotUseOnMember_Simple/PropertyAttribute.g.verified.cs diff --git a/PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.DontGeneratesPC01WithDontUseOnMember_Simple/RefFieldAttribute.g.verified.cs b/PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.DontGeneratesPC01WithDoNotUseOnMember_Simple/RefFieldAttribute.g.verified.cs similarity index 100% rename from PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.DontGeneratesPC01WithDontUseOnMember_Simple/RefFieldAttribute.g.verified.cs rename to PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.DontGeneratesPC01WithDoNotUseOnMember_Simple/RefFieldAttribute.g.verified.cs diff --git a/PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.DontGeneratesPC01WithDoNotUseOnPropertyInitializer/DoNotUseAttribute.g.verified.cs b/PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.DontGeneratesPC01WithDoNotUseOnPropertyInitializer/DoNotUseAttribute.g.verified.cs new file mode 100644 index 0000000..75ad135 --- /dev/null +++ b/PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.DontGeneratesPC01WithDoNotUseOnPropertyInitializer/DoNotUseAttribute.g.verified.cs @@ -0,0 +1,11 @@ +//HintName: DoNotUseAttribute.g.cs +// +using global::System; +namespace PrimaryParameter.SG +{ + [AttributeUsage(AttributeTargets.Parameter, Inherited = false, AllowMultiple = false)] + sealed class DoNotUseAttribute : Attribute + { + public bool AllowInMemberInit { get; init; } + } +} diff --git a/PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.DontGeneratesPC01WithDontUseOnPropertyInitializer/FaustVX.PrimaryParameter.SG.g.verified.cs b/PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.DontGeneratesPC01WithDoNotUseOnPropertyInitializer/FaustVX.PrimaryParameter.SG.g.verified.cs similarity index 100% rename from PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.DontGeneratesPC01WithDontUseOnPropertyInitializer/FaustVX.PrimaryParameter.SG.g.verified.cs rename to PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.DontGeneratesPC01WithDoNotUseOnPropertyInitializer/FaustVX.PrimaryParameter.SG.g.verified.cs diff --git a/PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.DontGeneratesPC01WithDontUseOnPropertyInitializer/FieldAttribute.g.verified.cs b/PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.DontGeneratesPC01WithDoNotUseOnPropertyInitializer/FieldAttribute.g.verified.cs similarity index 100% rename from PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.DontGeneratesPC01WithDontUseOnPropertyInitializer/FieldAttribute.g.verified.cs rename to PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.DontGeneratesPC01WithDoNotUseOnPropertyInitializer/FieldAttribute.g.verified.cs diff --git a/PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.DontGeneratesPC01WithDontUseOnPropertyInitializer/PropertyAttribute.g.verified.cs b/PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.DontGeneratesPC01WithDoNotUseOnPropertyInitializer/PropertyAttribute.g.verified.cs similarity index 100% rename from PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.DontGeneratesPC01WithDontUseOnPropertyInitializer/PropertyAttribute.g.verified.cs rename to PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.DontGeneratesPC01WithDoNotUseOnPropertyInitializer/PropertyAttribute.g.verified.cs diff --git a/PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.DontGeneratesPC01WithDontUseOnPropertyInitializer/RefFieldAttribute.g.verified.cs b/PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.DontGeneratesPC01WithDoNotUseOnPropertyInitializer/RefFieldAttribute.g.verified.cs similarity index 100% rename from PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.DontGeneratesPC01WithDontUseOnPropertyInitializer/RefFieldAttribute.g.verified.cs rename to PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.DontGeneratesPC01WithDoNotUseOnPropertyInitializer/RefFieldAttribute.g.verified.cs diff --git a/PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.DontGeneratesPC01WithDontUseOnMember_Complex/DontUseAttribute.g.verified.cs b/PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.DontGeneratesPC01WithDontUseOnMember_Complex/DontUseAttribute.g.verified.cs deleted file mode 100644 index 56e9a73..0000000 --- a/PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.DontGeneratesPC01WithDontUseOnMember_Complex/DontUseAttribute.g.verified.cs +++ /dev/null @@ -1,11 +0,0 @@ -//HintName: DontUseAttribute.g.cs -// -using global::System; -namespace PrimaryParameter.SG -{ - [AttributeUsage(AttributeTargets.Parameter, Inherited = false, AllowMultiple = false)] - sealed class DontUseAttribute : Attribute - { - public bool AllowInMemberInit { get; init; } - } -} diff --git a/PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.DontGeneratesPC01WithDontUseOnMember_Simple/DontUseAttribute.g.verified.cs b/PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.DontGeneratesPC01WithDontUseOnMember_Simple/DontUseAttribute.g.verified.cs deleted file mode 100644 index 56e9a73..0000000 --- a/PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.DontGeneratesPC01WithDontUseOnMember_Simple/DontUseAttribute.g.verified.cs +++ /dev/null @@ -1,11 +0,0 @@ -//HintName: DontUseAttribute.g.cs -// -using global::System; -namespace PrimaryParameter.SG -{ - [AttributeUsage(AttributeTargets.Parameter, Inherited = false, AllowMultiple = false)] - sealed class DontUseAttribute : Attribute - { - public bool AllowInMemberInit { get; init; } - } -} diff --git a/PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.DontGeneratesPC01WithDontUseOnPropertyInitializer/DontUseAttribute.g.verified.cs b/PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.DontGeneratesPC01WithDontUseOnPropertyInitializer/DontUseAttribute.g.verified.cs deleted file mode 100644 index 56e9a73..0000000 --- a/PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.DontGeneratesPC01WithDontUseOnPropertyInitializer/DontUseAttribute.g.verified.cs +++ /dev/null @@ -1,11 +0,0 @@ -//HintName: DontUseAttribute.g.cs -// -using global::System; -namespace PrimaryParameter.SG -{ - [AttributeUsage(AttributeTargets.Parameter, Inherited = false, AllowMultiple = false)] - sealed class DontUseAttribute : Attribute - { - public bool AllowInMemberInit { get; init; } - } -} diff --git a/PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.DontNeedPartialModifierOnType/DoNotUseAttribute.g.verified.cs b/PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.DontNeedPartialModifierOnType/DoNotUseAttribute.g.verified.cs new file mode 100644 index 0000000..75ad135 --- /dev/null +++ b/PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.DontNeedPartialModifierOnType/DoNotUseAttribute.g.verified.cs @@ -0,0 +1,11 @@ +//HintName: DoNotUseAttribute.g.cs +// +using global::System; +namespace PrimaryParameter.SG +{ + [AttributeUsage(AttributeTargets.Parameter, Inherited = false, AllowMultiple = false)] + sealed class DoNotUseAttribute : Attribute + { + public bool AllowInMemberInit { get; init; } + } +} diff --git a/PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.DontNeedPartialModifierOnType/DontUseAttribute.g.verified.cs b/PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.DontNeedPartialModifierOnType/DontUseAttribute.g.verified.cs deleted file mode 100644 index 56e9a73..0000000 --- a/PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.DontNeedPartialModifierOnType/DontUseAttribute.g.verified.cs +++ /dev/null @@ -1,11 +0,0 @@ -//HintName: DontUseAttribute.g.cs -// -using global::System; -namespace PrimaryParameter.SG -{ - [AttributeUsage(AttributeTargets.Parameter, Inherited = false, AllowMultiple = false)] - sealed class DontUseAttribute : Attribute - { - public bool AllowInMemberInit { get; init; } - } -} diff --git a/PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.GeneratesAttributesCorrectly/DoNotUseAttribute.g.verified.cs b/PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.GeneratesAttributesCorrectly/DoNotUseAttribute.g.verified.cs new file mode 100644 index 0000000..75ad135 --- /dev/null +++ b/PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.GeneratesAttributesCorrectly/DoNotUseAttribute.g.verified.cs @@ -0,0 +1,11 @@ +//HintName: DoNotUseAttribute.g.cs +// +using global::System; +namespace PrimaryParameter.SG +{ + [AttributeUsage(AttributeTargets.Parameter, Inherited = false, AllowMultiple = false)] + sealed class DoNotUseAttribute : Attribute + { + public bool AllowInMemberInit { get; init; } + } +} diff --git a/PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.GeneratesAttributesCorrectly/DontUseAttribute.g.verified.cs b/PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.GeneratesAttributesCorrectly/DontUseAttribute.g.verified.cs deleted file mode 100644 index 56e9a73..0000000 --- a/PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.GeneratesAttributesCorrectly/DontUseAttribute.g.verified.cs +++ /dev/null @@ -1,11 +0,0 @@ -//HintName: DontUseAttribute.g.cs -// -using global::System; -namespace PrimaryParameter.SG -{ - [AttributeUsage(AttributeTargets.Parameter, Inherited = false, AllowMultiple = false)] - sealed class DontUseAttribute : Attribute - { - public bool AllowInMemberInit { get; init; } - } -} diff --git a/PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.GeneratesFieldCorrectly/DoNotUseAttribute.g.verified.cs b/PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.GeneratesFieldCorrectly/DoNotUseAttribute.g.verified.cs new file mode 100644 index 0000000..75ad135 --- /dev/null +++ b/PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.GeneratesFieldCorrectly/DoNotUseAttribute.g.verified.cs @@ -0,0 +1,11 @@ +//HintName: DoNotUseAttribute.g.cs +// +using global::System; +namespace PrimaryParameter.SG +{ + [AttributeUsage(AttributeTargets.Parameter, Inherited = false, AllowMultiple = false)] + sealed class DoNotUseAttribute : Attribute + { + public bool AllowInMemberInit { get; init; } + } +} diff --git a/PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.GeneratesFieldCorrectly/DontUseAttribute.g.verified.cs b/PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.GeneratesFieldCorrectly/DontUseAttribute.g.verified.cs deleted file mode 100644 index 56e9a73..0000000 --- a/PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.GeneratesFieldCorrectly/DontUseAttribute.g.verified.cs +++ /dev/null @@ -1,11 +0,0 @@ -//HintName: DontUseAttribute.g.cs -// -using global::System; -namespace PrimaryParameter.SG -{ - [AttributeUsage(AttributeTargets.Parameter, Inherited = false, AllowMultiple = false)] - sealed class DontUseAttribute : Attribute - { - public bool AllowInMemberInit { get; init; } - } -} diff --git a/PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.GeneratesPC01/DoNotUseAttribute.g.verified.cs b/PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.GeneratesPC01/DoNotUseAttribute.g.verified.cs new file mode 100644 index 0000000..75ad135 --- /dev/null +++ b/PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.GeneratesPC01/DoNotUseAttribute.g.verified.cs @@ -0,0 +1,11 @@ +//HintName: DoNotUseAttribute.g.cs +// +using global::System; +namespace PrimaryParameter.SG +{ + [AttributeUsage(AttributeTargets.Parameter, Inherited = false, AllowMultiple = false)] + sealed class DoNotUseAttribute : Attribute + { + public bool AllowInMemberInit { get; init; } + } +} diff --git a/PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.GeneratesPC01/DontUseAttribute.g.verified.cs b/PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.GeneratesPC01/DontUseAttribute.g.verified.cs deleted file mode 100644 index 56e9a73..0000000 --- a/PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.GeneratesPC01/DontUseAttribute.g.verified.cs +++ /dev/null @@ -1,11 +0,0 @@ -//HintName: DontUseAttribute.g.cs -// -using global::System; -namespace PrimaryParameter.SG -{ - [AttributeUsage(AttributeTargets.Parameter, Inherited = false, AllowMultiple = false)] - sealed class DontUseAttribute : Attribute - { - public bool AllowInMemberInit { get; init; } - } -} diff --git a/PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.GeneratesPC01/target.verified.txt b/PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.GeneratesPC01/target.verified.txt index e608d10..593cdbf 100644 --- a/PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.GeneratesPC01/target.verified.txt +++ b/PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.GeneratesPC01/target.verified.txt @@ -6,8 +6,8 @@ Severity: Error, WarningLevel: 0, Location: : (3,15)-(3,16), - MessageFormat: Can't access a primary parameter ('{0}') with a [Field] [RefField], [Property] or [DontUse] attribute, use {1}, - Message: Can't access a primary parameter ('i') with a [Field] [RefField], [Property] or [DontUse] attribute, use '_i', + MessageFormat: Can't access a primary parameter ('{0}') with a [Field] [RefField], [Property] or [DoNotUse] attribute, use {1}, + Message: Can't access a primary parameter ('i') with a [Field] [RefField], [Property] or [DoNotUse] attribute, use '_i', Category: tests } ] diff --git a/PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.GeneratesPC01WithDoNotUse/DoNotUseAttribute.g.verified.cs b/PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.GeneratesPC01WithDoNotUse/DoNotUseAttribute.g.verified.cs new file mode 100644 index 0000000..75ad135 --- /dev/null +++ b/PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.GeneratesPC01WithDoNotUse/DoNotUseAttribute.g.verified.cs @@ -0,0 +1,11 @@ +//HintName: DoNotUseAttribute.g.cs +// +using global::System; +namespace PrimaryParameter.SG +{ + [AttributeUsage(AttributeTargets.Parameter, Inherited = false, AllowMultiple = false)] + sealed class DoNotUseAttribute : Attribute + { + public bool AllowInMemberInit { get; init; } + } +} diff --git a/PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.GeneratesPC01WithDontUse/FaustVX.PrimaryParameter.SG.g.verified.cs b/PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.GeneratesPC01WithDoNotUse/FaustVX.PrimaryParameter.SG.g.verified.cs similarity index 100% rename from PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.GeneratesPC01WithDontUse/FaustVX.PrimaryParameter.SG.g.verified.cs rename to PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.GeneratesPC01WithDoNotUse/FaustVX.PrimaryParameter.SG.g.verified.cs diff --git a/PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.GeneratesPC01WithDontUse/FieldAttribute.g.verified.cs b/PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.GeneratesPC01WithDoNotUse/FieldAttribute.g.verified.cs similarity index 100% rename from PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.GeneratesPC01WithDontUse/FieldAttribute.g.verified.cs rename to PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.GeneratesPC01WithDoNotUse/FieldAttribute.g.verified.cs diff --git a/PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.GeneratesPC01WithDontUse/PropertyAttribute.g.verified.cs b/PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.GeneratesPC01WithDoNotUse/PropertyAttribute.g.verified.cs similarity index 100% rename from PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.GeneratesPC01WithDontUse/PropertyAttribute.g.verified.cs rename to PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.GeneratesPC01WithDoNotUse/PropertyAttribute.g.verified.cs diff --git a/PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.GeneratesPC01WithDontUse/RefFieldAttribute.g.verified.cs b/PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.GeneratesPC01WithDoNotUse/RefFieldAttribute.g.verified.cs similarity index 100% rename from PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.GeneratesPC01WithDontUse/RefFieldAttribute.g.verified.cs rename to PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.GeneratesPC01WithDoNotUse/RefFieldAttribute.g.verified.cs diff --git a/PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.GeneratesPC01WithDontUse/target.verified.txt b/PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.GeneratesPC01WithDoNotUse/target.verified.txt similarity index 71% rename from PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.GeneratesPC01WithDontUse/target.verified.txt rename to PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.GeneratesPC01WithDoNotUse/target.verified.txt index 75c1639..4a7998d 100644 --- a/PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.GeneratesPC01WithDontUse/target.verified.txt +++ b/PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.GeneratesPC01WithDoNotUse/target.verified.txt @@ -6,8 +6,8 @@ Severity: Error, WarningLevel: 0, Location: : (3,15)-(3,16), - MessageFormat: Can't access a primary parameter ('{0}') with a [Field] [RefField], [Property] or [DontUse] attribute, use {1}, - Message: Can't access a primary parameter ('i') with a [Field] [RefField], [Property] or [DontUse] attribute, use , + MessageFormat: Can't access a primary parameter ('{0}') with a [Field] [RefField], [Property] or [DoNotUse] attribute, use {1}, + Message: Can't access a primary parameter ('i') with a [Field] [RefField], [Property] or [DoNotUse] attribute, use , Category: tests } ] diff --git a/PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.GeneratesPC01WithDontUse/DontUseAttribute.g.verified.cs b/PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.GeneratesPC01WithDontUse/DontUseAttribute.g.verified.cs deleted file mode 100644 index 56e9a73..0000000 --- a/PrimaryParameter.Tests/Verify/PrimaryParameterSnapshotTests.GeneratesPC01WithDontUse/DontUseAttribute.g.verified.cs +++ /dev/null @@ -1,11 +0,0 @@ -//HintName: DontUseAttribute.g.cs -// -using global::System; -namespace PrimaryParameter.SG -{ - [AttributeUsage(AttributeTargets.Parameter, Inherited = false, AllowMultiple = false)] - sealed class DontUseAttribute : Attribute - { - public bool AllowInMemberInit { get; init; } - } -} diff --git a/README.md b/README.md index 340d04f..2eb4cc0 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ [![Update NuGet](https://github.com/FaustVX/PrimaryParameter/actions/workflows/pushToNuget.yaml/badge.svg)](https://github.com/FaustVX/PrimaryParameter/actions/workflows/pushToNuget.yaml) ## Description -Using a `Field`, `RefField`, `Property` or `DontUse` attribute on parameters. +Using a `Field`, `RefField`, `Property` or `DoNotUse` attribute on parameters. Automatically generate `private readonly` fields or `private readonly ref readonly` fields or `public` properties. @@ -46,9 +46,9 @@ ref partial struct Ref([RefField(IsReadonlyRef = false, IsRefReadonly = false), } ``` -To enable the feature, type `[Field]` `[RefField]`, `[Property]`, or `[DontUse]` before the primary parameter you want. +To enable the feature, type `[Field]` `[RefField]`, `[Property]`, or `[DoNotUse]` before the primary parameter you want. -You can type as many attributes as you want on a single parameter (Except for `DontUse`). +You can type as many attributes as you want on a single parameter (Except for `DoNotUse`). ## Attribute Properties |Attribute|Property|Comments|Default value| @@ -67,12 +67,12 @@ You can type as many attributes as you want on a single parameter (Except for `D ||`Scope`|To change the scope of the generated property|`public`| ||`AssignFormat`|To change the assignment for that property|`{0}`| ||`Type`|To change the type for that property|same type as parameter| -|`DontUse`|`AllowInMemberInit`|Change to allow the use of parameter in member initializer|`true`| +|`DoNotUse`|`AllowInMemberInit`|Change to allow the use of parameter in member initializer|`true`| ## Reported Diagnostics |Code|Title|Message|Severity| |----|-----|-------|--------| -|`PC01`|Accessing a Primary Parameter|Can't access a primary parameter ('{0}') with a [Field], [RefField], [Property] or [DontUse] attribute, use {1}|`Error`| +|`PC01`|Accessing a Primary Parameter|Can't access a primary parameter ('{0}') with a [Field], [RefField], [Property] or [DoNotUse] attribute, use {1}|`Error`| |`PC02`|Attribute generate nothing|Use this attributes only on primary parameter|`Warning`| |`PC03`|Attribute generate nothing|This member's name ('{0}') is already used|`Warning`
`Error` when a member's name is already used in the type| |`PC04`|RefField in non ref struct|Can't apply [RefField] in non ref struct '{0}'|`Error`| @@ -95,6 +95,7 @@ You can type as many attributes as you want on a single parameter (Except for `D ## Versions |Version|Date|Comments| |-------|----|--------| +|v1.3.3|01/12/2023|Renamed `DontUse` to `DoNotUse`| |v1.3.2|19/11/2023|Don't generate the partial generated type if not needed| |v1.3.1|19/11/2023|Fix a bug with member initialization| |v1.3.0|19/11/2023|Added `DontUseAttribute`
Add a code-fix for `CS0282`
Changed `PropertyAttribute.WithInit` to `PropertyAttribute.Setter`| diff --git a/TODO.md b/TODO.md index 49305d1..5f05908 100644 --- a/TODO.md +++ b/TODO.md @@ -1,4 +1,4 @@ -- [x] Add `DontUseAttribute` +- [x] Add `DoNotUseAttribute` - Property: Disallow in members initialization - Just report an error without generation new member - [x] Add a code-fix for [CS0282](https://learn.microsoft.com/en-us/dotnet/csharp/misc/cs0282?f1url=%3FappId%3Droslyn%26k%3Dk(CS0282))