From 9c2815b507c3b21cc3b09d3a031ee91fa4610a8e Mon Sep 17 00:00:00 2001 From: GitHub Actions Autoformatter Date: Tue, 21 Jan 2025 16:33:30 +0000 Subject: [PATCH] Auto-format source code --- .../Availability/SymbolAvailabilityBuilder.cs | 2 +- .../Extensions/TypeSymbolExtensions.Core.cs | 2 +- .../Extensions/TypeSymbolExtensions.Generator.cs | 2 +- .../Attributes/XamarinAvailabilityData.cs | 16 ++++++++-------- .../TypeSymbolExtensions.Transformer.cs | 12 ++++++------ .../Attributes/AvailabilityTests.cs | 14 +++++++------- 6 files changed, 24 insertions(+), 24 deletions(-) diff --git a/src/rgen/Microsoft.Macios.Generator/Availability/SymbolAvailabilityBuilder.cs b/src/rgen/Microsoft.Macios.Generator/Availability/SymbolAvailabilityBuilder.cs index 320a4eefcaf6..bc73eaba8a95 100644 --- a/src/rgen/Microsoft.Macios.Generator/Availability/SymbolAvailabilityBuilder.cs +++ b/src/rgen/Microsoft.Macios.Generator/Availability/SymbolAvailabilityBuilder.cs @@ -33,7 +33,7 @@ public IEnumerable PlatformAvailabilities { } } } - + /// /// Returns the PlatformAvailability for the given platform. If we did not have a builder for the /// platform, a new one is created and added to the dictionary. diff --git a/src/rgen/Microsoft.Macios.Generator/Extensions/TypeSymbolExtensions.Core.cs b/src/rgen/Microsoft.Macios.Generator/Extensions/TypeSymbolExtensions.Core.cs index 05b51420c114..db780d22e901 100644 --- a/src/rgen/Microsoft.Macios.Generator/Extensions/TypeSymbolExtensions.Core.cs +++ b/src/rgen/Microsoft.Macios.Generator/Extensions/TypeSymbolExtensions.Core.cs @@ -237,7 +237,7 @@ public static void GetInheritance ( parents = parentsBuilder.ToImmutable (); interfaces = [.. interfacesSet]; } - + /// /// Returns the symbol availability taking into account the parent symbols availability. /// diff --git a/src/rgen/Microsoft.Macios.Generator/Extensions/TypeSymbolExtensions.Generator.cs b/src/rgen/Microsoft.Macios.Generator/Extensions/TypeSymbolExtensions.Generator.cs index ccc7e64fec6c..861d4571f9b0 100644 --- a/src/rgen/Microsoft.Macios.Generator/Extensions/TypeSymbolExtensions.Generator.cs +++ b/src/rgen/Microsoft.Macios.Generator/Extensions/TypeSymbolExtensions.Generator.cs @@ -58,7 +58,7 @@ static SymbolAvailability GetAvailabilityForSymbol (this ISymbol symbol) return builder.ToImmutable (); } - + public static bool IsSmartEnum (this ITypeSymbol symbol) { // a type is a smart enum if its type is a enum one AND it was decorated with the diff --git a/src/rgen/Microsoft.Macios.Transformer/Attributes/XamarinAvailabilityData.cs b/src/rgen/Microsoft.Macios.Transformer/Attributes/XamarinAvailabilityData.cs index b58682ff5f75..c9336a522575 100644 --- a/src/rgen/Microsoft.Macios.Transformer/Attributes/XamarinAvailabilityData.cs +++ b/src/rgen/Microsoft.Macios.Transformer/Attributes/XamarinAvailabilityData.cs @@ -23,7 +23,7 @@ static class XamarinAvailabilityData { { AttributesNames.NoMacAttribute, ApplePlatform.MacOSX }, { AttributesNames.NoMacCatalystAttribute, ApplePlatform.MacCatalyst }, }; - + public static bool TryParseSupportedOSData (string attributeName, AttributeData attributeData, [NotNullWhen (true)] out SupportedOSPlatformData? data) { @@ -32,12 +32,12 @@ public static bool TryParseSupportedOSData (string attributeName, AttributeData // not a supported attribute return false; } - + var count = attributeData.ConstructorArguments.Length; int major = 0; int? minor = null; int? subminor = null; - + // custom marshal directive values switch (count) { @@ -45,11 +45,11 @@ public static bool TryParseSupportedOSData (string attributeName, AttributeData major = (byte) attributeData.ConstructorArguments [0].Value!; break; case 2: - major = (byte) attributeData.ConstructorArguments [0].Value!; + major = (byte) attributeData.ConstructorArguments [0].Value!; minor = (byte) attributeData.ConstructorArguments [1].Value!; break; case 3: - major = (byte) attributeData.ConstructorArguments [0].Value!; + major = (byte) attributeData.ConstructorArguments [0].Value!; minor = (byte) attributeData.ConstructorArguments [1].Value!; subminor = (byte) attributeData.ConstructorArguments [2].Value!; break; @@ -59,9 +59,9 @@ public static bool TryParseSupportedOSData (string attributeName, AttributeData } data = (major, minor, subminor) switch { - (_, null, null) => new(platform, new($"{major}")), - (_, not null, null) => new(platform, new(major, minor.Value)), - (_,not null, not null) => new(platform, new(major, minor.Value, subminor.Value)), + (_, null, null) => new (platform, new ($"{major}")), + (_, not null, null) => new (platform, new (major, minor.Value)), + (_, not null, not null) => new (platform, new (major, minor.Value, subminor.Value)), _ => throw new ArgumentOutOfRangeException ("Could not parse the version") }; return true; diff --git a/src/rgen/Microsoft.Macios.Transformer/Extensions/TypeSymbolExtensions.Transformer.cs b/src/rgen/Microsoft.Macios.Transformer/Extensions/TypeSymbolExtensions.Transformer.cs index f6062e68bd21..c42210997dd1 100644 --- a/src/rgen/Microsoft.Macios.Transformer/Extensions/TypeSymbolExtensions.Transformer.cs +++ b/src/rgen/Microsoft.Macios.Transformer/Extensions/TypeSymbolExtensions.Transformer.cs @@ -18,7 +18,7 @@ static partial class TypeSymbolExtensions { ApplePlatform.MacOSX, ApplePlatform.MacCatalyst ]; - + /// /// Return the symbol availability WITHOUT taking into account the parent symbols availability. /// @@ -40,25 +40,25 @@ internal static SymbolAvailability GetAvailabilityForSymbol (this ISymbol symbol var attrName = attributeData.AttributeClass?.ToDisplayString (); if (string.IsNullOrEmpty (attrName)) continue; - + if (XamarinAvailabilityData.TryParseSupportedOSData (attrName, attributeData, out var availabilityData)) { builder.Add (availabilityData.Value); } if (XamarinAvailabilityData.TryParseUnsupportedOSData (attrName, attributeData, - out var unsupportedOsPlatformData)) { + out var unsupportedOsPlatformData)) { builder.Add (unsupportedOsPlatformData.Value); } } - + // if a platform was not ignore or had a specific version, then it is supported, loop over what we got // and add the missing platforms with the default version var supportedPlatforms = builder.PlatformAvailabilities.ToArray () .Select (a => a.Platform); - + // add data to all not added platforms foreach (var platform in allSupportedPlatforms.Except (supportedPlatforms)) { - builder.Add (new SupportedOSPlatformData(platform, new Version())); + builder.Add (new SupportedOSPlatformData (platform, new Version ())); } return builder.ToImmutable (); diff --git a/tests/rgen/Microsoft.Macios.Transformer.Tests/Attributes/AvailabilityTests.cs b/tests/rgen/Microsoft.Macios.Transformer.Tests/Attributes/AvailabilityTests.cs index 4800b0823d04..ec7d680fc4fd 100644 --- a/tests/rgen/Microsoft.Macios.Transformer.Tests/Attributes/AvailabilityTests.cs +++ b/tests/rgen/Microsoft.Macios.Transformer.Tests/Attributes/AvailabilityTests.cs @@ -85,9 +85,9 @@ interface UIFeedbackGenerator : UIInteraction { void Prepare (); } "; - + builder.Add (new SupportedOSPlatformData ("ios")); - builder.Add (new SupportedOSPlatformData("tvos")); + builder.Add (new SupportedOSPlatformData ("tvos")); builder.Add (new SupportedOSPlatformData ("macos")); builder.Add (new SupportedOSPlatformData ("maccatalyst13.1")); yield return [(Source: onePlatformSpecificVersion, Path: path), builder.ToImmutable ()]; @@ -110,10 +110,10 @@ interface UIFeedbackGenerator : UIInteraction { } "; - builder.Add (new UnsupportedOSPlatformData("ios")); - builder.Add (new UnsupportedOSPlatformData("tvos")); + builder.Add (new UnsupportedOSPlatformData ("ios")); + builder.Add (new UnsupportedOSPlatformData ("tvos")); builder.Add (new SupportedOSPlatformData ("macos")); - builder.Add (new UnsupportedOSPlatformData("maccatalyst")); + builder.Add (new UnsupportedOSPlatformData ("maccatalyst")); yield return [(Source: allPlatformsRemovedButOne, Path: path), builder.ToImmutable ()]; } @@ -126,13 +126,13 @@ void TryCreateTests (ApplePlatform platform, (string Source, string Path) source { var compilation = CreateCompilation (platform, sources: source); var x = compilation.GetDiagnostics (); - var syntaxTree = compilation.SyntaxTrees.FirstOrDefault(t => t.FilePath == source.Path); + var syntaxTree = compilation.SyntaxTrees.FirstOrDefault (t => t.FilePath == source.Path); Assert.NotNull (syntaxTree); var declaration = syntaxTree.GetRoot () .DescendantNodes ().OfType () .FirstOrDefault (); Assert.NotNull (declaration); - + var semanticModel = compilation.GetSemanticModel (syntaxTree); Assert.NotNull (semanticModel);