Ver código fonte

Definitions of enum types for use in tests

Brandon Thetford 1 ano atrás
pai
commit
b47aebb934
16 arquivos alterados com 763 adições e 0 exclusões
  1. 48 0
      Analyzers/Terminal.Gui.Analyzers.Internal.Tests/Generators/EnumExtensions/EnumDefinitions/EnumMemberValues.cs
  2. 49 0
      Analyzers/Terminal.Gui.Analyzers.Internal.Tests/Generators/EnumExtensions/EnumDefinitions/WithGenerator/BetterEnum.cs
  3. 49 0
      Analyzers/Terminal.Gui.Analyzers.Internal.Tests/Generators/EnumExtensions/EnumDefinitions/WithGenerator/BetterEnum_ExplicitInt.cs
  4. 50 0
      Analyzers/Terminal.Gui.Analyzers.Internal.Tests/Generators/EnumExtensions/EnumDefinitions/WithGenerator/BetterEnum_ExplicitInt_NoFastIsDefined.cs
  5. 49 0
      Analyzers/Terminal.Gui.Analyzers.Internal.Tests/Generators/EnumExtensions/EnumDefinitions/WithGenerator/BetterEnum_ExplicitUInt.cs
  6. 49 0
      Analyzers/Terminal.Gui.Analyzers.Internal.Tests/Generators/EnumExtensions/EnumDefinitions/WithGenerator/BetterEnum_ExplicitUInt_NoFastIsDefined.cs
  7. 49 0
      Analyzers/Terminal.Gui.Analyzers.Internal.Tests/Generators/EnumExtensions/EnumDefinitions/WithGenerator/BetterEnum_NoFastIsDefined.cs
  8. 50 0
      Analyzers/Terminal.Gui.Analyzers.Internal.Tests/Generators/EnumExtensions/EnumDefinitions/WithGenerator/BetterFlagsEnum.cs
  9. 51 0
      Analyzers/Terminal.Gui.Analyzers.Internal.Tests/Generators/EnumExtensions/EnumDefinitions/WithGenerator/BetterFlagsEnum_ExplicitInt.cs
  10. 50 0
      Analyzers/Terminal.Gui.Analyzers.Internal.Tests/Generators/EnumExtensions/EnumDefinitions/WithGenerator/BetterFlagsEnum_ExplicitUInt.cs
  11. 46 0
      Analyzers/Terminal.Gui.Analyzers.Internal.Tests/Generators/EnumExtensions/EnumDefinitions/WithoutGenerator/BasicEnum.cs
  12. 48 0
      Analyzers/Terminal.Gui.Analyzers.Internal.Tests/Generators/EnumExtensions/EnumDefinitions/WithoutGenerator/BasicEnum_ExplicitInt.cs
  13. 46 0
      Analyzers/Terminal.Gui.Analyzers.Internal.Tests/Generators/EnumExtensions/EnumDefinitions/WithoutGenerator/BasicEnum_ExplicitUint.cs
  14. 43 0
      Analyzers/Terminal.Gui.Analyzers.Internal.Tests/Generators/EnumExtensions/EnumDefinitions/WithoutGenerator/FlagsEnum.cs
  15. 43 0
      Analyzers/Terminal.Gui.Analyzers.Internal.Tests/Generators/EnumExtensions/EnumDefinitions/WithoutGenerator/FlagsEnum_ExplicitInt.cs
  16. 43 0
      Analyzers/Terminal.Gui.Analyzers.Internal.Tests/Generators/EnumExtensions/EnumDefinitions/WithoutGenerator/FlagsEnum_ExplicitUInt.cs

+ 48 - 0
Analyzers/Terminal.Gui.Analyzers.Internal.Tests/Generators/EnumExtensions/EnumDefinitions/EnumMemberValues.cs

@@ -0,0 +1,48 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Terminal.Gui.Analyzers.Internal.Tests.Generators.EnumExtensions.EnumDefinitions;
+internal class SignedEnumMemberValues
+{
+    internal const int Bit31 = ~0b_01111111_11111111_11111111_11111111;
+    internal const int Bit30 =  0b_01000000_00000000_00000000_00000000;
+    internal const int Bit29 =  0b_00100000_00000000_00000000_00000000;
+    internal const int Bit28 =  0b_00010000_00000000_00000000_00000000;
+    internal const int Bit27 =  0b_00001000_00000000_00000000_00000000;
+    internal const int Bit26 =  0b_00000100_00000000_00000000_00000000;
+    internal const int Bit25 =  0b_00000010_00000000_00000000_00000000;
+    internal const int Bit24 =  0b_00000001_00000000_00000000_00000000;
+    internal const int Bit23 =  0b_00000000_10000000_00000000_00000000;
+    internal const int Bit22 =  0b_00000000_01000000_00000000_00000000;
+    internal const int Bit21 =  0b_00000000_00100000_00000000_00000000;
+    internal const int Bit20 =  0b_00000000_00010000_00000000_00000000;
+    internal const int Bit19 =  0b_00000000_00001000_00000000_00000000;
+    internal const int Bit18 =  0b_00000000_00000100_00000000_00000000;
+    internal const int Bit17 =  0b_00000000_00000010_00000000_00000000;
+    internal const int Bit16 =  0b_00000000_00000001_00000000_00000000;
+    internal const int Bit15 =  0b_00000000_00000000_10000000_00000000;
+    internal const int Bit14 =  0b_00000000_00000000_01000000_00000000;
+    internal const int Bit13 =  0b_00000000_00000000_00100000_00000000;
+    internal const int Bit12 =  0b_00000000_00000000_00010000_00000000;
+    internal const int Bit11 =  0b_00000000_00000000_00001000_00000000;
+    internal const int Bit10 =  0b_00000000_00000000_00000100_00000000;
+    internal const int Bit09 =  0b_00000000_00000000_00000010_00000000;
+    internal const int Bit08 =  0b_00000000_00000000_00000001_00000000;
+    internal const int Bit07 =  0b_00000000_00000000_00000000_10000000;
+    internal const int Bit06 =  0b_00000000_00000000_00000000_01000000;
+    internal const int Bit05 =  0b_00000000_00000000_00000000_00100000;
+    internal const int Bit04 =  0b_00000000_00000000_00000000_00010000;
+    internal const int Bit03 =  0b_00000000_00000000_00000000_00001000;
+    internal const int Bit02 =  0b_00000000_00000000_00000000_00000100;
+    internal const int Bit01 =  0b_00000000_00000000_00000000_00000010;
+    internal const int Bit00 =  0b_00000000_00000000_00000000_00000001;
+    internal const int All_0 =  0;
+    internal const int All_1 =  ~All_0;
+    internal const int Alternating_01 = 0b_01010101_01010101_01010101_01010101;
+    internal const int Alternating_10 = ~Alternating_01;
+    internal const int EvenBytesHigh = 0b_00000000_11111111_00000000_11111111;
+    internal const int OddBytesHigh = ~EvenBytesHigh;
+}

+ 49 - 0
Analyzers/Terminal.Gui.Analyzers.Internal.Tests/Generators/EnumExtensions/EnumDefinitions/WithGenerator/BetterEnum.cs

@@ -0,0 +1,49 @@
+using Terminal.Gui.Analyzers.Internal.Attributes;
+
+namespace Terminal.Gui.Analyzers.Internal.Tests.Generators.EnumExtensions.EnumDefinitions;
+
+/// <summary>
+///     Same as <see cref="BasicEnum"/>, but with <see cref="GenerateEnumExtensionMethodsAttribute"/> applied.
+/// </summary>
+[GenerateEnumExtensionMethods]
+public enum BetterEnum
+{
+    Bit31 = -0b_10000000_00000000_00000000_00000000,
+    Bit30 =  0b_01000000_00000000_00000000_00000000,
+    Bit29 =  0b_00100000_00000000_00000000_00000000,
+    Bit28 =  0b_00010000_00000000_00000000_00000000,
+    Bit27 =  0b_00001000_00000000_00000000_00000000,
+    Bit26 =  0b_00000100_00000000_00000000_00000000,
+    Bit25 =  0b_00000010_00000000_00000000_00000000,
+    Bit24 =  0b_00000001_00000000_00000000_00000000,
+    Bit23 =  0b_00000000_10000000_00000000_00000000,
+    Bit22 =  0b_00000000_01000000_00000000_00000000,
+    Bit21 =  0b_00000000_00100000_00000000_00000000,
+    Bit20 =  0b_00000000_00010000_00000000_00000000,
+    Bit19 =  0b_00000000_00001000_00000000_00000000,
+    Bit18 =  0b_00000000_00000100_00000000_00000000,
+    Bit17 =  0b_00000000_00000010_00000000_00000000,
+    Bit16 =  0b_00000000_00000001_00000000_00000000,
+    Bit15 =  0b_00000000_00000000_10000000_00000000,
+    Bit14 =  0b_00000000_00000000_01000000_00000000,
+    Bit13 =  0b_00000000_00000000_00100000_00000000,
+    Bit12 =  0b_00000000_00000000_00010000_00000000,
+    Bit11 =  0b_00000000_00000000_00001000_00000000,
+    Bit10 =  0b_00000000_00000000_00000100_00000000,
+    Bit09 =  0b_00000000_00000000_00000010_00000000,
+    Bit08 =  0b_00000000_00000000_00000001_00000000,
+    Bit07 =  0b_00000000_00000000_00000000_10000000,
+    Bit06 =  0b_00000000_00000000_00000000_01000000,
+    Bit05 =  0b_00000000_00000000_00000000_00100000,
+    Bit04 =  0b_00000000_00000000_00000000_00010000,
+    Bit03 =  0b_00000000_00000000_00000000_00001000,
+    Bit02 =  0b_00000000_00000000_00000000_00000100,
+    Bit01 =  0b_00000000_00000000_00000000_00000010,
+    Bit00 =  0b_00000000_00000000_00000000_00000001,
+    All_0  =  0,
+    All_1  = ~All_0,
+    Alternating_01 = 0b_01010101_01010101_01010101_01010101,
+    Alternating_10 = ~Alternating_01,
+    EvenBytesHigh = 0b_00000000_11111111_00000000_11111111,
+    OddBytesHigh = ~EvenBytesHigh,
+}

+ 49 - 0
Analyzers/Terminal.Gui.Analyzers.Internal.Tests/Generators/EnumExtensions/EnumDefinitions/WithGenerator/BetterEnum_ExplicitInt.cs

@@ -0,0 +1,49 @@
+using Terminal.Gui.Analyzers.Internal.Attributes;
+
+namespace Terminal.Gui.Analyzers.Internal.Tests.Generators.EnumExtensions.EnumDefinitions;
+
+/// <summary>
+///     Same as <see cref="BasicEnum_ExplicitInt"/>, but with <see cref="GenerateEnumExtensionMethodsAttribute"/> applied.
+/// </summary>
+[GenerateEnumExtensionMethods]
+public enum BetterEnum_ExplicitInt
+{
+    Bit31 = BasicEnum_ExplicitInt.Bit31,
+    Bit30 = BasicEnum_ExplicitInt.Bit30,
+    Bit29 = BasicEnum_ExplicitInt.Bit29,
+    Bit28 = BasicEnum_ExplicitInt.Bit28,
+    Bit27 = BasicEnum_ExplicitInt.Bit27,
+    Bit26 = BasicEnum_ExplicitInt.Bit26,
+    Bit25 = BasicEnum_ExplicitInt.Bit25,
+    Bit24 = BasicEnum_ExplicitInt.Bit24,
+    Bit23 = BasicEnum_ExplicitInt.Bit23,
+    Bit22 = BasicEnum_ExplicitInt.Bit22,
+    Bit21 = BasicEnum_ExplicitInt.Bit21,
+    Bit20 = BasicEnum_ExplicitInt.Bit20,
+    Bit19 = BasicEnum_ExplicitInt.Bit19,
+    Bit18 = BasicEnum_ExplicitInt.Bit18,
+    Bit17 = BasicEnum_ExplicitInt.Bit17,
+    Bit16 = BasicEnum_ExplicitInt.Bit16,
+    Bit15 = BasicEnum_ExplicitInt.Bit15,
+    Bit14 = BasicEnum_ExplicitInt.Bit14,
+    Bit13 = BasicEnum_ExplicitInt.Bit13,
+    Bit12 = BasicEnum_ExplicitInt.Bit12,
+    Bit11 = BasicEnum_ExplicitInt.Bit11,
+    Bit10 = BasicEnum_ExplicitInt.Bit10,
+    Bit09 = BasicEnum_ExplicitInt.Bit09,
+    Bit08 = BasicEnum_ExplicitInt.Bit08,
+    Bit07 = BasicEnum_ExplicitInt.Bit07,
+    Bit06 = BasicEnum_ExplicitInt.Bit06,
+    Bit05 = BasicEnum_ExplicitInt.Bit05,
+    Bit04 = BasicEnum_ExplicitInt.Bit04,
+    Bit03 = BasicEnum_ExplicitInt.Bit03,
+    Bit02 = BasicEnum_ExplicitInt.Bit02,
+    Bit01 = BasicEnum_ExplicitInt.Bit01,
+    Bit00 = BasicEnum_ExplicitInt.Bit00,
+    All_0 = BasicEnum_ExplicitInt.All_0,
+    All_1 = BasicEnum_ExplicitInt.All_1,
+    Alternating_01 = BasicEnum_ExplicitInt.Alternating_01,
+    Alternating_10 = BasicEnum_ExplicitInt.Alternating_10,
+    EvenBytesHigh = BasicEnum_ExplicitInt.EvenBytesHigh,
+    OddBytesHigh = BasicEnum_ExplicitInt.OddBytesHigh
+}

+ 50 - 0
Analyzers/Terminal.Gui.Analyzers.Internal.Tests/Generators/EnumExtensions/EnumDefinitions/WithGenerator/BetterEnum_ExplicitInt_NoFastIsDefined.cs

@@ -0,0 +1,50 @@
+// ReSharper disable EnumUnderlyingTypeIsInt
+using Terminal.Gui.Analyzers.Internal.Attributes;
+
+namespace Terminal.Gui.Analyzers.Internal.Tests.Generators.EnumExtensions.EnumDefinitions;
+
+/// <summary>
+///     Same as <see cref="BetterEnum_ExplicitInt"/>, but with <see cref="GenerateEnumExtensionMethodsAttribute.FastIsDefined"/> = <see langword="false" />.
+/// </summary>
+[GenerateEnumExtensionMethods (FastIsDefined = false)]
+public enum BetterEnum_ExplicitInt_NoFastIsDefined : int
+{
+    Bit31 = -0b_10000000_00000000_00000000_00000000,
+    Bit30 = 0b_01000000_00000000_00000000_00000000,
+    Bit29 = 0b_00100000_00000000_00000000_00000000,
+    Bit28 = 0b_00010000_00000000_00000000_00000000,
+    Bit27 = 0b_00001000_00000000_00000000_00000000,
+    Bit26 = 0b_00000100_00000000_00000000_00000000,
+    Bit25 = 0b_00000010_00000000_00000000_00000000,
+    Bit24 = 0b_00000001_00000000_00000000_00000000,
+    Bit23 = 0b_00000000_10000000_00000000_00000000,
+    Bit22 = 0b_00000000_01000000_00000000_00000000,
+    Bit21 = 0b_00000000_00100000_00000000_00000000,
+    Bit20 = 0b_00000000_00010000_00000000_00000000,
+    Bit19 = 0b_00000000_00001000_00000000_00000000,
+    Bit18 = 0b_00000000_00000100_00000000_00000000,
+    Bit17 = 0b_00000000_00000010_00000000_00000000,
+    Bit16 = 0b_00000000_00000001_00000000_00000000,
+    Bit15 = 0b_00000000_00000000_10000000_00000000,
+    Bit14 = 0b_00000000_00000000_01000000_00000000,
+    Bit13 = 0b_00000000_00000000_00100000_00000000,
+    Bit12 = 0b_00000000_00000000_00010000_00000000,
+    Bit11 = 0b_00000000_00000000_00001000_00000000,
+    Bit10 = 0b_00000000_00000000_00000100_00000000,
+    Bit09 = 0b_00000000_00000000_00000010_00000000,
+    Bit08 = 0b_00000000_00000000_00000001_00000000,
+    Bit07 = 0b_00000000_00000000_00000000_10000000,
+    Bit06 = 0b_00000000_00000000_00000000_01000000,
+    Bit05 = 0b_00000000_00000000_00000000_00100000,
+    Bit04 = 0b_00000000_00000000_00000000_00010000,
+    Bit03 = 0b_00000000_00000000_00000000_00001000,
+    Bit02 = 0b_00000000_00000000_00000000_00000100,
+    Bit01 = 0b_00000000_00000000_00000000_00000010,
+    Bit00 = 0b_00000000_00000000_00000000_00000001,
+    All_0  =  0,
+    All_1  = ~All_0,
+    Alternating_01 = 0b_01010101_01010101_01010101_01010101,
+    Alternating_10 = ~Alternating_01,
+    EvenBytesHigh = 0b_00000000_11111111_00000000_11111111,
+    OddBytesHigh = ~EvenBytesHigh,
+}

+ 49 - 0
Analyzers/Terminal.Gui.Analyzers.Internal.Tests/Generators/EnumExtensions/EnumDefinitions/WithGenerator/BetterEnum_ExplicitUInt.cs

@@ -0,0 +1,49 @@
+using Terminal.Gui.Analyzers.Internal.Attributes;
+
+namespace Terminal.Gui.Analyzers.Internal.Tests.Generators.EnumExtensions.EnumDefinitions;
+
+/// <summary>
+///     Same as <see cref="BasicEnum_ExplicitUInt"/>, but with <see cref="GenerateEnumExtensionMethodsAttribute"/> applied.
+/// </summary>
+[GenerateEnumExtensionMethods]
+public enum BetterEnum_ExplicitUInt : uint
+{
+    Bit31 = 0b_10000000_00000000_00000000_00000000u,
+    Bit30 = 0b_01000000_00000000_00000000_00000000u,
+    Bit29 = 0b_00100000_00000000_00000000_00000000u,
+    Bit28 = 0b_00010000_00000000_00000000_00000000u,
+    Bit27 = 0b_00001000_00000000_00000000_00000000u,
+    Bit26 = 0b_00000100_00000000_00000000_00000000u,
+    Bit25 = 0b_00000010_00000000_00000000_00000000u,
+    Bit24 = 0b_00000001_00000000_00000000_00000000u,
+    Bit23 = 0b_00000000_10000000_00000000_00000000u,
+    Bit22 = 0b_00000000_01000000_00000000_00000000u,
+    Bit21 = 0b_00000000_00100000_00000000_00000000u,
+    Bit20 = 0b_00000000_00010000_00000000_00000000u,
+    Bit19 = 0b_00000000_00001000_00000000_00000000u,
+    Bit18 = 0b_00000000_00000100_00000000_00000000u,
+    Bit17 = 0b_00000000_00000010_00000000_00000000u,
+    Bit16 = 0b_00000000_00000001_00000000_00000000u,
+    Bit15 = 0b_00000000_00000000_10000000_00000000u,
+    Bit14 = 0b_00000000_00000000_01000000_00000000u,
+    Bit13 = 0b_00000000_00000000_00100000_00000000u,
+    Bit12 = 0b_00000000_00000000_00010000_00000000u,
+    Bit11 = 0b_00000000_00000000_00001000_00000000u,
+    Bit10 = 0b_00000000_00000000_00000100_00000000u,
+    Bit09 = 0b_00000000_00000000_00000010_00000000u,
+    Bit08 = 0b_00000000_00000000_00000001_00000000u,
+    Bit07 = 0b_00000000_00000000_00000000_10000000u,
+    Bit06 = 0b_00000000_00000000_00000000_01000000u,
+    Bit05 = 0b_00000000_00000000_00000000_00100000u,
+    Bit04 = 0b_00000000_00000000_00000000_00010000u,
+    Bit03 = 0b_00000000_00000000_00000000_00001000u,
+    Bit02 = 0b_00000000_00000000_00000000_00000100u,
+    Bit01 = 0b_00000000_00000000_00000000_00000010u,
+    Bit00 = 0b_00000000_00000000_00000000_00000001u,
+    All_0  =  0,
+    All_1  = ~All_0,
+    Alternating_01 = 0b_01010101_01010101_01010101_01010101,
+    Alternating_10 = ~Alternating_01,
+    EvenBytesHigh = 0b_00000000_11111111_00000000_11111111,
+    OddBytesHigh = ~EvenBytesHigh,
+}

+ 49 - 0
Analyzers/Terminal.Gui.Analyzers.Internal.Tests/Generators/EnumExtensions/EnumDefinitions/WithGenerator/BetterEnum_ExplicitUInt_NoFastIsDefined.cs

@@ -0,0 +1,49 @@
+using Terminal.Gui.Analyzers.Internal.Attributes;
+
+namespace Terminal.Gui.Analyzers.Internal.Tests.Generators.EnumExtensions.EnumDefinitions;
+
+/// <summary>
+///     Same as <see cref="BetterEnum_ExplicitUInt"/>, but with <see cref="GenerateEnumExtensionMethodsAttribute.FastIsDefined"/> = <see langword="false" />.
+/// </summary>
+[GenerateEnumExtensionMethods (FastIsDefined = false)]
+public enum BetterEnum_ExplicitUInt_NoFastIsDefined : uint
+{
+    Bit31 = 0b_10000000_00000000_00000000_00000000u,
+    Bit30 = 0b_01000000_00000000_00000000_00000000u,
+    Bit29 = 0b_00100000_00000000_00000000_00000000u,
+    Bit28 = 0b_00010000_00000000_00000000_00000000u,
+    Bit27 = 0b_00001000_00000000_00000000_00000000u,
+    Bit26 = 0b_00000100_00000000_00000000_00000000u,
+    Bit25 = 0b_00000010_00000000_00000000_00000000u,
+    Bit24 = 0b_00000001_00000000_00000000_00000000u,
+    Bit23 = 0b_00000000_10000000_00000000_00000000u,
+    Bit22 = 0b_00000000_01000000_00000000_00000000u,
+    Bit21 = 0b_00000000_00100000_00000000_00000000u,
+    Bit20 = 0b_00000000_00010000_00000000_00000000u,
+    Bit19 = 0b_00000000_00001000_00000000_00000000u,
+    Bit18 = 0b_00000000_00000100_00000000_00000000u,
+    Bit17 = 0b_00000000_00000010_00000000_00000000u,
+    Bit16 = 0b_00000000_00000001_00000000_00000000u,
+    Bit15 = 0b_00000000_00000000_10000000_00000000u,
+    Bit14 = 0b_00000000_00000000_01000000_00000000u,
+    Bit13 = 0b_00000000_00000000_00100000_00000000u,
+    Bit12 = 0b_00000000_00000000_00010000_00000000u,
+    Bit11 = 0b_00000000_00000000_00001000_00000000u,
+    Bit10 = 0b_00000000_00000000_00000100_00000000u,
+    Bit09 = 0b_00000000_00000000_00000010_00000000u,
+    Bit08 = 0b_00000000_00000000_00000001_00000000u,
+    Bit07 = 0b_00000000_00000000_00000000_10000000u,
+    Bit06 = 0b_00000000_00000000_00000000_01000000u,
+    Bit05 = 0b_00000000_00000000_00000000_00100000u,
+    Bit04 = 0b_00000000_00000000_00000000_00010000u,
+    Bit03 = 0b_00000000_00000000_00000000_00001000u,
+    Bit02 = 0b_00000000_00000000_00000000_00000100u,
+    Bit01 = 0b_00000000_00000000_00000000_00000010u,
+    Bit00 = 0b_00000000_00000000_00000000_00000001u,
+    All_0  =  0,
+    All_1  = ~All_0,
+    Alternating_01 = 0b_01010101_01010101_01010101_01010101,
+    Alternating_10 = ~Alternating_01,
+    EvenBytesHigh = 0b_00000000_11111111_00000000_11111111,
+    OddBytesHigh = ~EvenBytesHigh,
+}

+ 49 - 0
Analyzers/Terminal.Gui.Analyzers.Internal.Tests/Generators/EnumExtensions/EnumDefinitions/WithGenerator/BetterEnum_NoFastIsDefined.cs

@@ -0,0 +1,49 @@
+using Terminal.Gui.Analyzers.Internal.Attributes;
+
+namespace Terminal.Gui.Analyzers.Internal.Tests.Generators.EnumExtensions.EnumDefinitions;
+
+/// <summary>
+///     Same as <see cref="BetterEnum"/>, but with <see cref="GenerateEnumExtensionMethodsAttribute.FastIsDefined"/> = <see langword="false" />.
+/// </summary>
+[GenerateEnumExtensionMethods (FastIsDefined = false)]
+public enum BetterEnum_NoFastIsDefined
+{
+    Bit31 = -0b_10000000_00000000_00000000_00000000,
+    Bit30 =  0b_01000000_00000000_00000000_00000000,
+    Bit29 =  0b_00100000_00000000_00000000_00000000,
+    Bit28 =  0b_00010000_00000000_00000000_00000000,
+    Bit27 =  0b_00001000_00000000_00000000_00000000,
+    Bit26 =  0b_00000100_00000000_00000000_00000000,
+    Bit25 =  0b_00000010_00000000_00000000_00000000,
+    Bit24 =  0b_00000001_00000000_00000000_00000000,
+    Bit23 =  0b_00000000_10000000_00000000_00000000,
+    Bit22 =  0b_00000000_01000000_00000000_00000000,
+    Bit21 =  0b_00000000_00100000_00000000_00000000,
+    Bit20 =  0b_00000000_00010000_00000000_00000000,
+    Bit19 =  0b_00000000_00001000_00000000_00000000,
+    Bit18 =  0b_00000000_00000100_00000000_00000000,
+    Bit17 =  0b_00000000_00000010_00000000_00000000,
+    Bit16 =  0b_00000000_00000001_00000000_00000000,
+    Bit15 =  0b_00000000_00000000_10000000_00000000,
+    Bit14 =  0b_00000000_00000000_01000000_00000000,
+    Bit13 =  0b_00000000_00000000_00100000_00000000,
+    Bit12 =  0b_00000000_00000000_00010000_00000000,
+    Bit11 =  0b_00000000_00000000_00001000_00000000,
+    Bit10 =  0b_00000000_00000000_00000100_00000000,
+    Bit09 =  0b_00000000_00000000_00000010_00000000,
+    Bit08 =  0b_00000000_00000000_00000001_00000000,
+    Bit07 =  0b_00000000_00000000_00000000_10000000,
+    Bit06 =  0b_00000000_00000000_00000000_01000000,
+    Bit05 =  0b_00000000_00000000_00000000_00100000,
+    Bit04 =  0b_00000000_00000000_00000000_00010000,
+    Bit03 =  0b_00000000_00000000_00000000_00001000,
+    Bit02 =  0b_00000000_00000000_00000000_00000100,
+    Bit01 =  0b_00000000_00000000_00000000_00000010,
+    Bit00 =  0b_00000000_00000000_00000000_00000001,
+    All_0  =  0,
+    All_1  = ~All_0,
+    Alternating_01 = 0b_01010101_01010101_01010101_01010101,
+    Alternating_10 = ~Alternating_01,
+    EvenBytesHigh = 0b_00000000_11111111_00000000_11111111,
+    OddBytesHigh = ~EvenBytesHigh,
+}

+ 50 - 0
Analyzers/Terminal.Gui.Analyzers.Internal.Tests/Generators/EnumExtensions/EnumDefinitions/WithGenerator/BetterFlagsEnum.cs

@@ -0,0 +1,50 @@
+using Terminal.Gui.Analyzers.Internal.Attributes;
+
+namespace Terminal.Gui.Analyzers.Internal.Tests.Generators.EnumExtensions.EnumDefinitions;
+
+/// <summary>
+///     Same as <see cref="FlagsEnum"/>, but with <see cref="GenerateEnumExtensionMethodsAttribute"/> applied.
+/// </summary>
+[Flags]
+[GenerateEnumExtensionMethods]
+public enum BetterFlagsEnum
+{
+    Bit31 = -0b_10000000_00000000_00000000_00000000,
+    Bit30 =  0b_01000000_00000000_00000000_00000000,
+    Bit29 =  0b_00100000_00000000_00000000_00000000,
+    Bit28 =  0b_00010000_00000000_00000000_00000000,
+    Bit27 =  0b_00001000_00000000_00000000_00000000,
+    Bit26 =  0b_00000100_00000000_00000000_00000000,
+    Bit25 =  0b_00000010_00000000_00000000_00000000,
+    Bit24 =  0b_00000001_00000000_00000000_00000000,
+    Bit23 = -0b_00000000_10000000_00000000_00000000,
+    Bit22 =  0b_00000000_01000000_00000000_00000000,
+    Bit21 =  0b_00000000_00100000_00000000_00000000,
+    Bit20 =  0b_00000000_00010000_00000000_00000000,
+    Bit19 =  0b_00000000_00001000_00000000_00000000,
+    Bit18 =  0b_00000000_00000100_00000000_00000000,
+    Bit17 =  0b_00000000_00000010_00000000_00000000,
+    Bit16 =  0b_00000000_00000001_00000000_00000000,
+    Bit15 = -0b_00000000_00000000_10000000_00000000,
+    Bit14 =  0b_00000000_00000000_01000000_00000000,
+    Bit13 =  0b_00000000_00000000_00100000_00000000,
+    Bit12 =  0b_00000000_00000000_00010000_00000000,
+    Bit11 =  0b_00000000_00000000_00001000_00000000,
+    Bit10 =  0b_00000000_00000000_00000100_00000000,
+    Bit09 =  0b_00000000_00000000_00000010_00000000,
+    Bit08 =  0b_00000000_00000000_00000001_00000000,
+    Bit07 = -0b_00000000_00000000_00000000_10000000,
+    Bit06 =  0b_00000000_00000000_00000000_01000000,
+    Bit05 =  0b_00000000_00000000_00000000_00100000,
+    Bit04 =  0b_00000000_00000000_00000000_00010000,
+    Bit03 =  0b_00000000_00000000_00000000_00001000,
+    Bit02 =  0b_00000000_00000000_00000000_00000100,
+    Bit01 =  0b_00000000_00000000_00000000_00000010,
+    Bit00 =  0b_00000000_00000000_00000000_00000001,
+    All_0  =  0,
+    All_1  = ~All_0,
+    Alternating_01 = 0b_01010101_01010101_01010101_01010101,
+    Alternating_10 = ~Alternating_01,
+    EvenBytesHigh = 0b_00000000_11111111_00000000_11111111,
+    OddBytesHigh = ~EvenBytesHigh,
+}

+ 51 - 0
Analyzers/Terminal.Gui.Analyzers.Internal.Tests/Generators/EnumExtensions/EnumDefinitions/WithGenerator/BetterFlagsEnum_ExplicitInt.cs

@@ -0,0 +1,51 @@
+using Terminal.Gui.Analyzers.Internal.Attributes;
+
+namespace Terminal.Gui.Analyzers.Internal.Tests.Generators.EnumExtensions.EnumDefinitions;
+
+/// <summary>
+/// <summary>
+///     Same as <see cref="FlagsEnum_ExplicitInt"/>, but with <see cref="GenerateEnumExtensionMethodsAttribute"/> applied.
+/// </summary>
+[Flags]
+[GenerateEnumExtensionMethods]
+public enum BetterFlagsEnum_ExplicitInt : int
+{
+    Bit31 = -0b_10000000_00000000_00000000_00000000,
+    Bit30 =  0b_01000000_00000000_00000000_00000000,
+    Bit29 =  0b_00100000_00000000_00000000_00000000,
+    Bit28 =  0b_00010000_00000000_00000000_00000000,
+    Bit27 =  0b_00001000_00000000_00000000_00000000,
+    Bit26 =  0b_00000100_00000000_00000000_00000000,
+    Bit25 =  0b_00000010_00000000_00000000_00000000,
+    Bit24 =  0b_00000001_00000000_00000000_00000000,
+    Bit23 = -0b_00000000_10000000_00000000_00000000,
+    Bit22 =  0b_00000000_01000000_00000000_00000000,
+    Bit21 =  0b_00000000_00100000_00000000_00000000,
+    Bit20 =  0b_00000000_00010000_00000000_00000000,
+    Bit19 =  0b_00000000_00001000_00000000_00000000,
+    Bit18 =  0b_00000000_00000100_00000000_00000000,
+    Bit17 =  0b_00000000_00000010_00000000_00000000,
+    Bit16 =  0b_00000000_00000001_00000000_00000000,
+    Bit15 = -0b_00000000_00000000_10000000_00000000,
+    Bit14 =  0b_00000000_00000000_01000000_00000000,
+    Bit13 =  0b_00000000_00000000_00100000_00000000,
+    Bit12 =  0b_00000000_00000000_00010000_00000000,
+    Bit11 =  0b_00000000_00000000_00001000_00000000,
+    Bit10 =  0b_00000000_00000000_00000100_00000000,
+    Bit09 =  0b_00000000_00000000_00000010_00000000,
+    Bit08 =  0b_00000000_00000000_00000001_00000000,
+    Bit07 = -0b_00000000_00000000_00000000_10000000,
+    Bit06 =  0b_00000000_00000000_00000000_01000000,
+    Bit05 =  0b_00000000_00000000_00000000_00100000,
+    Bit04 =  0b_00000000_00000000_00000000_00010000,
+    Bit03 =  0b_00000000_00000000_00000000_00001000,
+    Bit02 =  0b_00000000_00000000_00000000_00000100,
+    Bit01 =  0b_00000000_00000000_00000000_00000010,
+    Bit00 =  0b_00000000_00000000_00000000_00000001,
+    All_0  =  0,
+    All_1  = ~All_0,
+    Alternating_01 = 0b_01010101_01010101_01010101_01010101,
+    Alternating_10 = ~Alternating_01,
+    EvenBytesHigh = 0b_00000000_11111111_00000000_11111111,
+    OddBytesHigh = ~EvenBytesHigh,
+}

+ 50 - 0
Analyzers/Terminal.Gui.Analyzers.Internal.Tests/Generators/EnumExtensions/EnumDefinitions/WithGenerator/BetterFlagsEnum_ExplicitUInt.cs

@@ -0,0 +1,50 @@
+using Terminal.Gui.Analyzers.Internal.Attributes;
+
+namespace Terminal.Gui.Analyzers.Internal.Tests.Generators.EnumExtensions.EnumDefinitions;
+
+/// <summary>
+///     Same as <see cref="FlagsEnum_ExplicitUInt"/>, but with <see cref="GenerateEnumExtensionMethodsAttribute"/> applied.
+/// </summary>
+[Flags]
+[GenerateEnumExtensionMethods]
+public enum BetterFlagsEnum_ExplicitUInt : uint
+{
+    Bit31 = 0b_10000000_00000000_00000000_00000000u,
+    Bit30 = 0b_01000000_00000000_00000000_00000000u,
+    Bit29 = 0b_00100000_00000000_00000000_00000000u,
+    Bit28 = 0b_00010000_00000000_00000000_00000000u,
+    Bit27 = 0b_00001000_00000000_00000000_00000000u,
+    Bit26 = 0b_00000100_00000000_00000000_00000000u,
+    Bit25 = 0b_00000010_00000000_00000000_00000000u,
+    Bit24 = 0b_00000001_00000000_00000000_00000000u,
+    Bit23 = 0b_00000000_10000000_00000000_00000000u,
+    Bit22 = 0b_00000000_01000000_00000000_00000000u,
+    Bit21 = 0b_00000000_00100000_00000000_00000000u,
+    Bit20 = 0b_00000000_00010000_00000000_00000000u,
+    Bit19 = 0b_00000000_00001000_00000000_00000000u,
+    Bit18 = 0b_00000000_00000100_00000000_00000000u,
+    Bit17 = 0b_00000000_00000010_00000000_00000000u,
+    Bit16 = 0b_00000000_00000001_00000000_00000000u,
+    Bit15 = 0b_00000000_00000000_10000000_00000000u,
+    Bit14 = 0b_00000000_00000000_01000000_00000000u,
+    Bit13 = 0b_00000000_00000000_00100000_00000000u,
+    Bit12 = 0b_00000000_00000000_00010000_00000000u,
+    Bit11 = 0b_00000000_00000000_00001000_00000000u,
+    Bit10 = 0b_00000000_00000000_00000100_00000000u,
+    Bit09 = 0b_00000000_00000000_00000010_00000000u,
+    Bit08 = 0b_00000000_00000000_00000001_00000000u,
+    Bit07 = 0b_00000000_00000000_00000000_10000000u,
+    Bit06 = 0b_00000000_00000000_00000000_01000000u,
+    Bit05 = 0b_00000000_00000000_00000000_00100000u,
+    Bit04 = 0b_00000000_00000000_00000000_00010000u,
+    Bit03 = 0b_00000000_00000000_00000000_00001000u,
+    Bit02 = 0b_00000000_00000000_00000000_00000100u,
+    Bit01 = 0b_00000000_00000000_00000000_00000010u,
+    Bit00 = 0b_00000000_00000000_00000000_00000001u,
+    All_0  =  0,
+    All_1  = ~All_0,
+    Alternating_01 = 0b_01010101_01010101_01010101_01010101,
+    Alternating_10 = ~Alternating_01,
+    EvenBytesHigh = 0b_00000000_11111111_00000000_11111111,
+    OddBytesHigh = ~EvenBytesHigh,
+}

+ 46 - 0
Analyzers/Terminal.Gui.Analyzers.Internal.Tests/Generators/EnumExtensions/EnumDefinitions/WithoutGenerator/BasicEnum.cs

@@ -0,0 +1,46 @@
+namespace Terminal.Gui.Analyzers.Internal.Tests.Generators.EnumExtensions.EnumDefinitions;
+
+/// <summary>
+///     Basic enum without explicitly-defined backing type and no attributes on the enum or any of its members.
+/// </summary>
+public enum BasicEnum
+{
+    Bit31 = -0b_10000000_00000000_00000000_00000000,
+    Bit30 =  0b_01000000_00000000_00000000_00000000,
+    Bit29 =  0b_00100000_00000000_00000000_00000000,
+    Bit28 =  0b_00010000_00000000_00000000_00000000,
+    Bit27 =  0b_00001000_00000000_00000000_00000000,
+    Bit26 =  0b_00000100_00000000_00000000_00000000,
+    Bit25 =  0b_00000010_00000000_00000000_00000000,
+    Bit24 =  0b_00000001_00000000_00000000_00000000,
+    Bit23 =  0b_00000000_10000000_00000000_00000000,
+    Bit22 =  0b_00000000_01000000_00000000_00000000,
+    Bit21 =  0b_00000000_00100000_00000000_00000000,
+    Bit20 =  0b_00000000_00010000_00000000_00000000,
+    Bit19 =  0b_00000000_00001000_00000000_00000000,
+    Bit18 =  0b_00000000_00000100_00000000_00000000,
+    Bit17 =  0b_00000000_00000010_00000000_00000000,
+    Bit16 =  0b_00000000_00000001_00000000_00000000,
+    Bit15 =  0b_00000000_00000000_10000000_00000000,
+    Bit14 =  0b_00000000_00000000_01000000_00000000,
+    Bit13 =  0b_00000000_00000000_00100000_00000000,
+    Bit12 =  0b_00000000_00000000_00010000_00000000,
+    Bit11 =  0b_00000000_00000000_00001000_00000000,
+    Bit10 =  0b_00000000_00000000_00000100_00000000,
+    Bit09 =  0b_00000000_00000000_00000010_00000000,
+    Bit08 =  0b_00000000_00000000_00000001_00000000,
+    Bit07 =  0b_00000000_00000000_00000000_10000000,
+    Bit06 =  0b_00000000_00000000_00000000_01000000,
+    Bit05 =  0b_00000000_00000000_00000000_00100000,
+    Bit04 =  0b_00000000_00000000_00000000_00010000,
+    Bit03 =  0b_00000000_00000000_00000000_00001000,
+    Bit02 =  0b_00000000_00000000_00000000_00000100,
+    Bit01 =  0b_00000000_00000000_00000000_00000010,
+    Bit00 =  0b_00000000_00000000_00000000_00000001,
+    All_0  =  0,
+    All_1  = -1,
+    Alternating_01 = 0b_01010101_01010101_01010101_01010101,
+    Alternating_10 = unchecked((int)0b_10101010_10101010_10101010_10101010),
+    OddBytesHigh = unchecked((int)0b_11111111_00000000_11111111_00000000),
+    EvenBytesHigh = 0b_00000000_11111111_00000000_11111111,
+}

+ 48 - 0
Analyzers/Terminal.Gui.Analyzers.Internal.Tests/Generators/EnumExtensions/EnumDefinitions/WithoutGenerator/BasicEnum_ExplicitInt.cs

@@ -0,0 +1,48 @@
+using Terminal.Gui.Analyzers.Internal.Attributes;
+
+namespace Terminal.Gui.Analyzers.Internal.Tests.Generators.EnumExtensions.EnumDefinitions;
+
+/// <summary>
+///     Basic enum with explicitly-defined backing type of int and no attributes on the enum or any of its members.
+/// </summary>
+public enum BasicEnum_ExplicitInt : int
+{
+    Bit31 = -0b_10000000_00000000_00000000_00000000,
+    Bit30 =  0b_01000000_00000000_00000000_00000000,
+    Bit29 =  0b_00100000_00000000_00000000_00000000,
+    Bit28 =  0b_00010000_00000000_00000000_00000000,
+    Bit27 =  0b_00001000_00000000_00000000_00000000,
+    Bit26 =  0b_00000100_00000000_00000000_00000000,
+    Bit25 =  0b_00000010_00000000_00000000_00000000,
+    Bit24 =  0b_00000001_00000000_00000000_00000000,
+    Bit23 =  0b_00000000_10000000_00000000_00000000,
+    Bit22 =  0b_00000000_01000000_00000000_00000000,
+    Bit21 =  0b_00000000_00100000_00000000_00000000,
+    Bit20 =  0b_00000000_00010000_00000000_00000000,
+    Bit19 =  0b_00000000_00001000_00000000_00000000,
+    Bit18 =  0b_00000000_00000100_00000000_00000000,
+    Bit17 =  0b_00000000_00000010_00000000_00000000,
+    Bit16 =  0b_00000000_00000001_00000000_00000000,
+    Bit15 =  0b_00000000_00000000_10000000_00000000,
+    Bit14 =  0b_00000000_00000000_01000000_00000000,
+    Bit13 =  0b_00000000_00000000_00100000_00000000,
+    Bit12 =  0b_00000000_00000000_00010000_00000000,
+    Bit11 =  0b_00000000_00000000_00001000_00000000,
+    Bit10 =  0b_00000000_00000000_00000100_00000000,
+    Bit09 =  0b_00000000_00000000_00000010_00000000,
+    Bit08 =  0b_00000000_00000000_00000001_00000000,
+    Bit07 =  0b_00000000_00000000_00000000_10000000,
+    Bit06 =  0b_00000000_00000000_00000000_01000000,
+    Bit05 =  0b_00000000_00000000_00000000_00100000,
+    Bit04 =  0b_00000000_00000000_00000000_00010000,
+    Bit03 =  0b_00000000_00000000_00000000_00001000,
+    Bit02 =  0b_00000000_00000000_00000000_00000100,
+    Bit01 =  0b_00000000_00000000_00000000_00000010,
+    Bit00 =  0b_00000000_00000000_00000000_00000001,
+    All_0  =  0,
+    All_1  = -1,
+    Alternating_01 = 0b_01010101_01010101_01010101_01010101,
+    Alternating_10 = unchecked((int)0b_10101010_10101010_10101010_10101010),
+    OddBytesHigh = unchecked((int)0b_11111111_00000000_11111111_00000000),
+    EvenBytesHigh = unchecked((int)0b_00000000_11111111_00000000_11111111),
+}

+ 46 - 0
Analyzers/Terminal.Gui.Analyzers.Internal.Tests/Generators/EnumExtensions/EnumDefinitions/WithoutGenerator/BasicEnum_ExplicitUint.cs

@@ -0,0 +1,46 @@
+namespace Terminal.Gui.Analyzers.Internal.Tests.Generators.EnumExtensions.EnumDefinitions;
+
+/// <summary>
+///     Basic enum with explicitly-defined backing type of uint and no attributes on the enum or any of its members.
+/// </summary>
+public enum BasicEnum_ExplicitUInt : uint
+{
+    Bit31 = 0b_10000000_00000000_00000000_00000000u,
+    Bit30 = 0b_01000000_00000000_00000000_00000000u,
+    Bit29 = 0b_00100000_00000000_00000000_00000000u,
+    Bit28 = 0b_00010000_00000000_00000000_00000000u,
+    Bit27 = 0b_00001000_00000000_00000000_00000000u,
+    Bit26 = 0b_00000100_00000000_00000000_00000000u,
+    Bit25 = 0b_00000010_00000000_00000000_00000000u,
+    Bit24 = 0b_00000001_00000000_00000000_00000000u,
+    Bit23 = 0b_00000000_10000000_00000000_00000000u,
+    Bit22 = 0b_00000000_01000000_00000000_00000000u,
+    Bit21 = 0b_00000000_00100000_00000000_00000000u,
+    Bit20 = 0b_00000000_00010000_00000000_00000000u,
+    Bit19 = 0b_00000000_00001000_00000000_00000000u,
+    Bit18 = 0b_00000000_00000100_00000000_00000000u,
+    Bit17 = 0b_00000000_00000010_00000000_00000000u,
+    Bit16 = 0b_00000000_00000001_00000000_00000000u,
+    Bit15 = 0b_00000000_00000000_10000000_00000000u,
+    Bit14 = 0b_00000000_00000000_01000000_00000000u,
+    Bit13 = 0b_00000000_00000000_00100000_00000000u,
+    Bit12 = 0b_00000000_00000000_00010000_00000000u,
+    Bit11 = 0b_00000000_00000000_00001000_00000000u,
+    Bit10 = 0b_00000000_00000000_00000100_00000000u,
+    Bit09 = 0b_00000000_00000000_00000010_00000000u,
+    Bit08 = 0b_00000000_00000000_00000001_00000000u,
+    Bit07 = 0b_00000000_00000000_00000000_10000000u,
+    Bit06 = 0b_00000000_00000000_00000000_01000000u,
+    Bit05 = 0b_00000000_00000000_00000000_00100000u,
+    Bit04 = 0b_00000000_00000000_00000000_00010000u,
+    Bit03 = 0b_00000000_00000000_00000000_00001000u,
+    Bit02 = 0b_00000000_00000000_00000000_00000100u,
+    Bit01 = 0b_00000000_00000000_00000000_00000010u,
+    Bit00 = 0b_00000000_00000000_00000000_00000001u,
+    All_0 = 0b_00000000_00000000_00000000_00000000u,
+    All_1 = 0b_11111111_11111111_11111111_11111111u,
+    Alternating_01 = 0b_01010101_01010101_01010101_01010101u,
+    Alternating_10 = 0b_10101010_10101010_10101010_10101010u,
+    OddBytesHigh   = 0b_11111111_00000000_11111111_00000000u,
+    EvenBytesHigh  = 0b_00000000_11111111_00000000_11111111u,
+}

+ 43 - 0
Analyzers/Terminal.Gui.Analyzers.Internal.Tests/Generators/EnumExtensions/EnumDefinitions/WithoutGenerator/FlagsEnum.cs

@@ -0,0 +1,43 @@
+namespace Terminal.Gui.Analyzers.Internal.Tests.Generators.EnumExtensions.EnumDefinitions;
+
+/// <summary>
+///     Flags enum without explicitly-defined backing type and only a <see cref="FlagsAttribute"/> on the enum declaration No other attributes on the enum or its members..
+/// </summary>
+[Flags]
+public enum FlagsEnum
+{
+    Bit31 = -0b_10000000_00000000_00000000_00000000,
+    Bit30 =  0b_01000000_00000000_00000000_00000000,
+    Bit29 =  0b_00100000_00000000_00000000_00000000,
+    Bit28 =  0b_00010000_00000000_00000000_00000000,
+    Bit27 =  0b_00001000_00000000_00000000_00000000,
+    Bit26 =  0b_00000100_00000000_00000000_00000000,
+    Bit25 =  0b_00000010_00000000_00000000_00000000,
+    Bit24 =  0b_00000001_00000000_00000000_00000000,
+    Bit23 = -0b_00000000_10000000_00000000_00000000,
+    Bit22 =  0b_00000000_01000000_00000000_00000000,
+    Bit21 =  0b_00000000_00100000_00000000_00000000,
+    Bit20 =  0b_00000000_00010000_00000000_00000000,
+    Bit19 =  0b_00000000_00001000_00000000_00000000,
+    Bit18 =  0b_00000000_00000100_00000000_00000000,
+    Bit17 =  0b_00000000_00000010_00000000_00000000,
+    Bit16 =  0b_00000000_00000001_00000000_00000000,
+    Bit15 = -0b_00000000_00000000_10000000_00000000,
+    Bit14 =  0b_00000000_00000000_01000000_00000000,
+    Bit13 =  0b_00000000_00000000_00100000_00000000,
+    Bit12 =  0b_00000000_00000000_00010000_00000000,
+    Bit11 =  0b_00000000_00000000_00001000_00000000,
+    Bit10 =  0b_00000000_00000000_00000100_00000000,
+    Bit09 =  0b_00000000_00000000_00000010_00000000,
+    Bit08 =  0b_00000000_00000000_00000001_00000000,
+    Bit07 = -0b_00000000_00000000_00000000_10000000,
+    Bit06 =  0b_00000000_00000000_00000000_01000000,
+    Bit05 =  0b_00000000_00000000_00000000_00100000,
+    Bit04 =  0b_00000000_00000000_00000000_00010000,
+    Bit03 =  0b_00000000_00000000_00000000_00001000,
+    Bit02 =  0b_00000000_00000000_00000000_00000100,
+    Bit01 =  0b_00000000_00000000_00000000_00000010,
+    Bit00 =  0b_00000000_00000000_00000000_00000001,
+    All_0  =  0,
+    All_1  = -1
+}

+ 43 - 0
Analyzers/Terminal.Gui.Analyzers.Internal.Tests/Generators/EnumExtensions/EnumDefinitions/WithoutGenerator/FlagsEnum_ExplicitInt.cs

@@ -0,0 +1,43 @@
+namespace Terminal.Gui.Analyzers.Internal.Tests.Generators.EnumExtensions.EnumDefinitions;
+
+/// <summary>
+///     Flags enum with explicitly-defined backing type of int and only a <see cref="FlagsAttribute"/> on the enum declaration No other attributes on the enum or its members..
+/// </summary>
+[Flags]
+public enum FlagsEnum_ExplicitInt : int
+{
+    Bit31 = -0b_10000000_00000000_00000000_00000000,
+    Bit30 =  0b_01000000_00000000_00000000_00000000,
+    Bit29 =  0b_00100000_00000000_00000000_00000000,
+    Bit28 =  0b_00010000_00000000_00000000_00000000,
+    Bit27 =  0b_00001000_00000000_00000000_00000000,
+    Bit26 =  0b_00000100_00000000_00000000_00000000,
+    Bit25 =  0b_00000010_00000000_00000000_00000000,
+    Bit24 =  0b_00000001_00000000_00000000_00000000,
+    Bit23 = -0b_00000000_10000000_00000000_00000000,
+    Bit22 =  0b_00000000_01000000_00000000_00000000,
+    Bit21 =  0b_00000000_00100000_00000000_00000000,
+    Bit20 =  0b_00000000_00010000_00000000_00000000,
+    Bit19 =  0b_00000000_00001000_00000000_00000000,
+    Bit18 =  0b_00000000_00000100_00000000_00000000,
+    Bit17 =  0b_00000000_00000010_00000000_00000000,
+    Bit16 =  0b_00000000_00000001_00000000_00000000,
+    Bit15 = -0b_00000000_00000000_10000000_00000000,
+    Bit14 =  0b_00000000_00000000_01000000_00000000,
+    Bit13 =  0b_00000000_00000000_00100000_00000000,
+    Bit12 =  0b_00000000_00000000_00010000_00000000,
+    Bit11 =  0b_00000000_00000000_00001000_00000000,
+    Bit10 =  0b_00000000_00000000_00000100_00000000,
+    Bit09 =  0b_00000000_00000000_00000010_00000000,
+    Bit08 =  0b_00000000_00000000_00000001_00000000,
+    Bit07 = -0b_00000000_00000000_00000000_10000000,
+    Bit06 =  0b_00000000_00000000_00000000_01000000,
+    Bit05 =  0b_00000000_00000000_00000000_00100000,
+    Bit04 =  0b_00000000_00000000_00000000_00010000,
+    Bit03 =  0b_00000000_00000000_00000000_00001000,
+    Bit02 =  0b_00000000_00000000_00000000_00000100,
+    Bit01 =  0b_00000000_00000000_00000000_00000010,
+    Bit00 =  0b_00000000_00000000_00000000_00000001,
+    All_0  =  0,
+    All_1  = -1
+}

+ 43 - 0
Analyzers/Terminal.Gui.Analyzers.Internal.Tests/Generators/EnumExtensions/EnumDefinitions/WithoutGenerator/FlagsEnum_ExplicitUInt.cs

@@ -0,0 +1,43 @@
+namespace Terminal.Gui.Analyzers.Internal.Tests.Generators.EnumExtensions.EnumDefinitions;
+
+/// <summary>
+///     Flags enum with explicitly-defined backing type of uint and only a <see cref="FlagsAttribute"/> on the enum declaration No other attributes on the enum or its members..
+/// </summary>
+[Flags]
+public enum FlagsEnum_ExplicitUInt : uint
+{
+    Bit31 = 0b_10000000_00000000_00000000_00000000u,
+    Bit30 = 0b_01000000_00000000_00000000_00000000u,
+    Bit29 = 0b_00100000_00000000_00000000_00000000u,
+    Bit28 = 0b_00010000_00000000_00000000_00000000u,
+    Bit27 = 0b_00001000_00000000_00000000_00000000u,
+    Bit26 = 0b_00000100_00000000_00000000_00000000u,
+    Bit25 = 0b_00000010_00000000_00000000_00000000u,
+    Bit24 = 0b_00000001_00000000_00000000_00000000u,
+    Bit23 = 0b_00000000_10000000_00000000_00000000u,
+    Bit22 = 0b_00000000_01000000_00000000_00000000u,
+    Bit21 = 0b_00000000_00100000_00000000_00000000u,
+    Bit20 = 0b_00000000_00010000_00000000_00000000u,
+    Bit19 = 0b_00000000_00001000_00000000_00000000u,
+    Bit18 = 0b_00000000_00000100_00000000_00000000u,
+    Bit17 = 0b_00000000_00000010_00000000_00000000u,
+    Bit16 = 0b_00000000_00000001_00000000_00000000u,
+    Bit15 = 0b_00000000_00000000_10000000_00000000u,
+    Bit14 = 0b_00000000_00000000_01000000_00000000u,
+    Bit13 = 0b_00000000_00000000_00100000_00000000u,
+    Bit12 = 0b_00000000_00000000_00010000_00000000u,
+    Bit11 = 0b_00000000_00000000_00001000_00000000u,
+    Bit10 = 0b_00000000_00000000_00000100_00000000u,
+    Bit09 = 0b_00000000_00000000_00000010_00000000u,
+    Bit08 = 0b_00000000_00000000_00000001_00000000u,
+    Bit07 = 0b_00000000_00000000_00000000_10000000u,
+    Bit06 = 0b_00000000_00000000_00000000_01000000u,
+    Bit05 = 0b_00000000_00000000_00000000_00100000u,
+    Bit04 = 0b_00000000_00000000_00000000_00010000u,
+    Bit03 = 0b_00000000_00000000_00000000_00001000u,
+    Bit02 = 0b_00000000_00000000_00000000_00000100u,
+    Bit01 = 0b_00000000_00000000_00000000_00000010u,
+    Bit00 = 0b_00000000_00000000_00000000_00000001u,
+    All_0 = 0b_00000000_00000000_00000000_00000000u,
+    All_1 = 0b_11111111_11111111_11111111_11111111u
+}