diff --git a/src/Bicep.Core.IntegrationTests/RegistryProviderTests.cs b/src/Bicep.Core.IntegrationTests/RegistryProviderTests.cs index e1d49e20a56..a55e32c86b6 100644 --- a/src/Bicep.Core.IntegrationTests/RegistryProviderTests.cs +++ b/src/Bicep.Core.IntegrationTests/RegistryProviderTests.cs @@ -111,7 +111,7 @@ public async Task Providers_published_to_filesystem_can_be_compiled() var typesTgz = ThirdPartyTypeHelper.GetTestTypesTgz(); var tempDirectory = FileHelper.GetUniqueTestOutputPath(TestContext); Directory.CreateDirectory(tempDirectory); - + var providerPath = Path.Combine(tempDirectory, "provider.tgz"); await RegistryHelper.PublishProviderToRegistryAsync(services.Build(), Path.Combine(tempDirectory, providerPath), typesTgz); diff --git a/src/Bicep.Core.UnitTests/Utils/ThirdPartyTypeHelper.cs b/src/Bicep.Core.UnitTests/Utils/ThirdPartyTypeHelper.cs index 68cf3337961..19277033400 100644 --- a/src/Bicep.Core.UnitTests/Utils/ThirdPartyTypeHelper.cs +++ b/src/Bicep.Core.UnitTests/Utils/ThirdPartyTypeHelper.cs @@ -318,7 +318,7 @@ public static void WriteTypesTgzToFs(IFileSystem fileSystem, string basePath, Bi } var outputPath = Path.Combine(basePath, entry.Name); - if (Path.GetDirectoryName(outputPath) is {} outputParentDir && + if (Path.GetDirectoryName(outputPath) is { } outputParentDir && !fileSystem.Directory.Exists(outputParentDir)) { fileSystem.Directory.CreateDirectory(outputParentDir); diff --git a/src/Bicep.Core/Registry/LocalModuleRegistry.cs b/src/Bicep.Core/Registry/LocalModuleRegistry.cs index 6c530af39c4..b1cb7445c42 100644 --- a/src/Bicep.Core/Registry/LocalModuleRegistry.cs +++ b/src/Bicep.Core/Registry/LocalModuleRegistry.cs @@ -2,17 +2,17 @@ // Licensed under the MIT License. using System.Collections.Immutable; +using System.Diagnostics; using System.IO; using System.Threading.Tasks; -using System.Diagnostics; using Bicep.Core.Diagnostics; using Bicep.Core.Extensions; using Bicep.Core.FileSystem; using Bicep.Core.Modules; +using Bicep.Core.Registry.Providers; using Bicep.Core.Semantics; using Bicep.Core.SourceCode; using Bicep.Core.Utils; -using Bicep.Core.Registry.Providers; namespace Bicep.Core.Registry { @@ -32,7 +32,8 @@ public LocalModuleRegistry(IFileResolver fileResolver, Uri parentModuleUri, Bice public override string Scheme => ArtifactReferenceSchemes.Local; public override RegistryCapabilities GetCapabilities(ArtifactType artifactType, LocalModuleReference reference) - => artifactType switch { + => artifactType switch + { ArtifactType.Module => RegistryCapabilities.Default, ArtifactType.Provider => RegistryCapabilities.Publish, _ => throw new UnreachableException(), @@ -44,7 +45,7 @@ public override ResultWithDiagnostic TryParseArtifactReferenc { return new(x => x.UnsupportedArtifactType(artifactType)); } - + if (!LocalModuleReference.TryParse(reference, parentModuleUri).IsSuccess(out var @ref, out var failureBuilder)) { return new(failureBuilder); @@ -93,7 +94,8 @@ public override async Task PublishProvider(LocalModuleReference reference, Binar } public override Task CheckArtifactExists(ArtifactType artifactType, LocalModuleReference reference) - => artifactType switch { + => artifactType switch + { ArtifactType.Module => throw new NotSupportedException("Local modules cannot be published."), ArtifactType.Provider => Task.FromResult(false), _ => throw new UnreachableException(), diff --git a/src/Bicep.Core/Registry/Providers/TypesV1Archive.cs b/src/Bicep.Core/Registry/Providers/TypesV1Archive.cs index 9a93defc6c8..dde4ceaa669 100644 --- a/src/Bicep.Core/Registry/Providers/TypesV1Archive.cs +++ b/src/Bicep.Core/Registry/Providers/TypesV1Archive.cs @@ -84,11 +84,11 @@ private static IEnumerable GetAllUniqueTypePaths(string pathToIndex, IFi var index = TypeSerializer.DeserializeIndex(indexStream); var typeReferences = index.Resources.Values.ToList(); - if (index.Settings?.ConfigurationType is {} configType) + if (index.Settings?.ConfigurationType is { } configType) { typeReferences.Add(configType); } - if (index.FallbackResourceType is {} fallbackType) + if (index.FallbackResourceType is { } fallbackType) { typeReferences.Add(fallbackType); } diff --git a/src/Bicep.Core/TypeSystem/TypeAssignmentVisitor.cs b/src/Bicep.Core/TypeSystem/TypeAssignmentVisitor.cs index 62deaf8d7f4..6e48c5416f8 100644 --- a/src/Bicep.Core/TypeSystem/TypeAssignmentVisitor.cs +++ b/src/Bicep.Core/TypeSystem/TypeAssignmentVisitor.cs @@ -1782,12 +1782,12 @@ private TypeSymbol GetAccessedType(AccessExpressionSyntax syntax, IDiagnosticWri private static TypeSymbol? TryGetReadablePropertyType(ObjectType objectType, string propertyName) { - if (objectType.Properties.TryGetValue(propertyName) is {} property && !property.Flags.HasFlag(TypePropertyFlags.WriteOnly)) + if (objectType.Properties.TryGetValue(propertyName) is { } property && !property.Flags.HasFlag(TypePropertyFlags.WriteOnly)) { return property.TypeReference.Type; } - if (objectType.AdditionalPropertiesType is {} additionalPropertiesType && !objectType.AdditionalPropertiesFlags.HasFlag(TypePropertyFlags.WriteOnly)) + if (objectType.AdditionalPropertiesType is { } additionalPropertiesType && !objectType.AdditionalPropertiesFlags.HasFlag(TypePropertyFlags.WriteOnly)) { return additionalPropertiesType.Type; } @@ -1801,7 +1801,7 @@ private static TypeSymbol GetNamedPropertyType(UnionType unionType, string prope foreach (var member in unionType.Members) { if (member is not ObjectType objectType || - TryGetReadablePropertyType(objectType, propertyName) is not {} propertyType) + TryGetReadablePropertyType(objectType, propertyName) is not { } propertyType) { // fall back to any if we can't definitively obtain the property type. // this may give some false positives - we can further refine this if desired.