diff --git a/samples/ComputeSharp.SwapChain.WinUI/ViewModels/MainViewModel.cs b/samples/ComputeSharp.SwapChain.WinUI/ViewModels/MainViewModel.cs
index f07d4e82..677b70ad 100644
--- a/samples/ComputeSharp.SwapChain.WinUI/ViewModels/MainViewModel.cs
+++ b/samples/ComputeSharp.SwapChain.WinUI/ViewModels/MainViewModel.cs
@@ -79,7 +79,7 @@ public sealed partial class MainViewModel : ObservableObject
///
/// Gets the available resolution scaling options (as percentage values).
///
- public IList ResolutionScaleOptions { get; } = new[] { 25, 50, 75, 100 };
+ public IList ResolutionScaleOptions { get; } = [25, 50, 75, 100];
///
/// Gets the collection of available compute shader.
diff --git a/samples/ComputeSharp.SwapChain/Program.cs b/samples/ComputeSharp.SwapChain/Program.cs
index 176e6dd7..6362852d 100644
--- a/samples/ComputeSharp.SwapChain/Program.cs
+++ b/samples/ComputeSharp.SwapChain/Program.cs
@@ -16,8 +16,8 @@ class Program
static void Main()
{
// Prepare the mapping of available samples to choose from
- (string ShaderName, Win32Application Application)[] samples = new[]
- {
+ (string ShaderName, Win32Application Application)[] samples =
+ [
(nameof(HelloWorld), Win32ApplicationFactory.Create(static time => new((float)time.TotalSeconds))),
(nameof(FourColorGradient), Win32ApplicationFactory.Create(static time => new((float)time.TotalSeconds))),
(nameof(ColorfulInfinity), Win32ApplicationFactory.Create(static time => new((float)time.TotalSeconds))),
@@ -31,7 +31,7 @@ class Program
(nameof(TriangleGridContouring), Win32ApplicationFactory.Create(static time => new((float)time.TotalSeconds))),
(nameof(ContouredLayers), Win32ApplicationFactory.Create(static time => new((float)time.TotalSeconds, RustyMetal.Value))),
(nameof(TerracedHills), Win32ApplicationFactory.Create(static time => new((float)time.TotalSeconds))),
- };
+ ];
int index;
diff --git a/src/ComputeSharp.D2D1.SourceGenerators/D2DPixelShaderDescriptorGenerator.cs b/src/ComputeSharp.D2D1.SourceGenerators/D2DPixelShaderDescriptorGenerator.cs
index 2358e15b..619708f1 100644
--- a/src/ComputeSharp.D2D1.SourceGenerators/D2DPixelShaderDescriptorGenerator.cs
+++ b/src/ComputeSharp.D2D1.SourceGenerators/D2DPixelShaderDescriptorGenerator.cs
@@ -246,7 +246,7 @@ public sealed partial class D2DPixelShaderDescriptorGenerator : IIncrementalGene
item.Hierarchy.WriteSyntax(
state: item,
writer: writer,
- baseTypes: new[] { $"global::ComputeSharp.D2D1.Descriptors.ID2D1PixelShaderDescriptor<{item.Hierarchy.Hierarchy[0].QualifiedName}>" },
+ baseTypes: [$"global::ComputeSharp.D2D1.Descriptors.ID2D1PixelShaderDescriptor<{item.Hierarchy.Hierarchy[0].QualifiedName}>"],
memberCallbacks: declaredMembers.WrittenSpan);
// If any generated types are needed, they go into a separate namespace
diff --git a/src/ComputeSharp.D2D1.SourceGenerators/D2DPixelShaderSourceGenerator.cs b/src/ComputeSharp.D2D1.SourceGenerators/D2DPixelShaderSourceGenerator.cs
index cb3686f2..f861bea0 100644
--- a/src/ComputeSharp.D2D1.SourceGenerators/D2DPixelShaderSourceGenerator.cs
+++ b/src/ComputeSharp.D2D1.SourceGenerators/D2DPixelShaderSourceGenerator.cs
@@ -94,7 +94,7 @@ public sealed partial class D2DPixelShaderSourceGenerator : IIncrementalGenerato
state: item,
writer: writer,
baseTypes: [],
- memberCallbacks: new IndentedTextWriter.Callback[] { Execute.WriteSyntax });
+ memberCallbacks: [Execute.WriteSyntax]);
context.AddSource($"{item.Hierarchy.FullyQualifiedMetadataName}.{item.MethodName}.g.cs", writer.ToString());
});
diff --git a/src/ComputeSharp.D2D1.SourceGenerators/Diagnostics/Analyzers/InvalidEffectMetadataValueAnalyzer.cs b/src/ComputeSharp.D2D1.SourceGenerators/Diagnostics/Analyzers/InvalidEffectMetadataValueAnalyzer.cs
index 085603ed..5067edb0 100644
--- a/src/ComputeSharp.D2D1.SourceGenerators/Diagnostics/Analyzers/InvalidEffectMetadataValueAnalyzer.cs
+++ b/src/ComputeSharp.D2D1.SourceGenerators/Diagnostics/Analyzers/InvalidEffectMetadataValueAnalyzer.cs
@@ -26,13 +26,13 @@ public sealed class InvalidEffectMetadataValueAnalyzer : DiagnosticAnalyzer
///
/// The mapping of diagnostics to their attribute type names.
///
- private static readonly ImmutableDictionary AttributeTypeNameToDiagnosticMapping = ImmutableDictionary.CreateRange(new[]
- {
+ private static readonly ImmutableDictionary AttributeTypeNameToDiagnosticMapping = ImmutableDictionary.CreateRange(
+ [
new KeyValuePair("D2DEffectDisplayNameAttribute", InvalidD2DEffectDisplayNameAttributeValue),
new KeyValuePair("D2DEffectDescriptionAttribute", InvalidD2DEffectDescriptionAttributeValue),
new KeyValuePair("D2DEffectCategoryAttribute", InvalidD2DEffectCategoryAttributeValue),
new KeyValuePair("D2DEffectAuthorAttribute", InvalidD2DEffectAuthorAttributeValue)
- });
+ ]);
///
public override ImmutableArray SupportedDiagnostics { get; } = ImmutableArray.Create(
diff --git a/src/ComputeSharp.SourceGeneration.Hlsl/Mappings/HlslKnownTypes.cs b/src/ComputeSharp.SourceGeneration.Hlsl/Mappings/HlslKnownTypes.cs
index 1fad2424..07142e45 100644
--- a/src/ComputeSharp.SourceGeneration.Hlsl/Mappings/HlslKnownTypes.cs
+++ b/src/ComputeSharp.SourceGeneration.Hlsl/Mappings/HlslKnownTypes.cs
@@ -7,7 +7,7 @@ using System.Text.RegularExpressions;
using ComputeSharp.SourceGeneration.Extensions;
using Microsoft.CodeAnalysis;
-#pragma warning disable RS1024
+#pragma warning disable IDE0055, RS1024
namespace ComputeSharp.SourceGeneration.Mappings;
@@ -19,20 +19,20 @@ internal static partial class HlslKnownTypes
///
/// Gets the set of HLSL vector types.
///
- public static IReadOnlyCollection KnownVectorTypes { get; } = new[]
- {
+ public static IReadOnlyCollection KnownVectorTypes { get; } =
+ [
typeof(Bool2), typeof(Bool3), typeof(Bool4),
typeof(Int2), typeof(Int3), typeof(Int4),
typeof(UInt2), typeof(UInt3), typeof(UInt4),
typeof(Float2), typeof(Float3), typeof(Float4),
typeof(Double2), typeof(Double3), typeof(Double4)
- };
+ ];
///
/// Gets the set of HLSL matrix types.
///
- public static IReadOnlyCollection KnownMatrixTypes { get; } = new[]
- {
+ public static IReadOnlyCollection KnownMatrixTypes { get; } =
+ [
typeof(Bool1x1), typeof(Bool1x2), typeof(Bool1x3), typeof(Bool1x4),
typeof(Bool2x1), typeof(Bool2x2), typeof(Bool2x3), typeof(Bool2x4),
typeof(Bool3x1), typeof(Bool3x2), typeof(Bool3x3), typeof(Bool3x4),
@@ -53,7 +53,7 @@ internal static partial class HlslKnownTypes
typeof(Double2x1), typeof(Double2x2), typeof(Double2x3), typeof(Double2x4),
typeof(Double3x1), typeof(Double3x2), typeof(Double3x3), typeof(Double3x4),
typeof(Double4x1), typeof(Double4x2), typeof(Double4x3), typeof(Double4x4)
- };
+ ];
///
/// The mapping of supported known types to HLSL types.
diff --git a/src/ComputeSharp.SourceGenerators/ComputeShaderDescriptorGenerator.cs b/src/ComputeSharp.SourceGenerators/ComputeShaderDescriptorGenerator.cs
index 0c070ebc..baa69f59 100644
--- a/src/ComputeSharp.SourceGenerators/ComputeShaderDescriptorGenerator.cs
+++ b/src/ComputeSharp.SourceGenerators/ComputeShaderDescriptorGenerator.cs
@@ -183,7 +183,7 @@ public sealed partial class ComputeShaderDescriptorGenerator : IIncrementalGener
item.Hierarchy.WriteSyntax(
state: item,
writer: writer,
- baseTypes: new[] { $"global::ComputeSharp.Descriptors.IComputeShaderDescriptor<{item.Hierarchy.Hierarchy[0].QualifiedName}>" },
+ baseTypes: [$"global::ComputeSharp.Descriptors.IComputeShaderDescriptor<{item.Hierarchy.Hierarchy[0].QualifiedName}>"],
memberCallbacks: declaredMembers.WrittenSpan);
// Append any additional types as well
diff --git a/src/ComputeSharp.SourceGenerators/Mappings/HlslKnownTypes.cs b/src/ComputeSharp.SourceGenerators/Mappings/HlslKnownTypes.cs
index 3f9b8879..4aabfd98 100644
--- a/src/ComputeSharp.SourceGenerators/Mappings/HlslKnownTypes.cs
+++ b/src/ComputeSharp.SourceGenerators/Mappings/HlslKnownTypes.cs
@@ -12,12 +12,12 @@ partial class HlslKnownTypes
///
/// Gets the known HLSL dispatch types.
///
- public static IReadOnlyCollection HlslDispatchTypes { get; } = new[]
- {
+ public static IReadOnlyCollection HlslDispatchTypes { get; } =
+ [
typeof(ThreadIds),
typeof(GroupIds),
typeof(GridIds)
- };
+ ];
///
/// Checks whether or not a given type name matches a constant buffer type.
diff --git a/tests/ComputeSharp.D2D1.Tests.SourceGenerators/Test_D2DPixelShaderSourceGenerator.cs b/tests/ComputeSharp.D2D1.Tests.SourceGenerators/Test_D2DPixelShaderSourceGenerator.cs
index 26f08a89..6d4a81c8 100644
--- a/tests/ComputeSharp.D2D1.Tests.SourceGenerators/Test_D2DPixelShaderSourceGenerator.cs
+++ b/tests/ComputeSharp.D2D1.Tests.SourceGenerators/Test_D2DPixelShaderSourceGenerator.cs
@@ -1830,7 +1830,7 @@ public class Test_D2DPixelShaderSourceGenerator
// Create the original compilation
CSharpCompilation compilation = CSharpCompilation.Create(
"original",
- new SyntaxTree[] { sourceTree },
+ [sourceTree],
metadataReferences,
new CSharpCompilationOptions(OutputKind.DynamicallyLinkedLibrary, allowUnsafe: true));
diff --git a/tests/ComputeSharp.D2D1.Tests/D2D1PixelShaderTests.cs b/tests/ComputeSharp.D2D1.Tests/D2D1PixelShaderTests.cs
index ce71764e..b678afca 100644
--- a/tests/ComputeSharp.D2D1.Tests/D2D1PixelShaderTests.cs
+++ b/tests/ComputeSharp.D2D1.Tests/D2D1PixelShaderTests.cs
@@ -101,14 +101,14 @@ namespace ComputeSharp.D2D1.Tests
{
CollectionAssert.AreEqual(new[]
{
- D2D1PixelShaderInputType.Simple,
- D2D1PixelShaderInputType.Complex,
- D2D1PixelShaderInputType.Simple,
- D2D1PixelShaderInputType.Complex,
- D2D1PixelShaderInputType.Complex,
- D2D1PixelShaderInputType.Complex,
- D2D1PixelShaderInputType.Simple
- }, D2D1PixelShader.GetInputTypes().ToArray());
+ D2D1PixelShaderInputType.Simple,
+ D2D1PixelShaderInputType.Complex,
+ D2D1PixelShaderInputType.Simple,
+ D2D1PixelShaderInputType.Complex,
+ D2D1PixelShaderInputType.Complex,
+ D2D1PixelShaderInputType.Complex,
+ D2D1PixelShaderInputType.Simple
+ }, D2D1PixelShader.GetInputTypes().ToArray());
}
[TestMethod]
diff --git a/tests/ComputeSharp.Tests.SourceGenerators/DiagnosticsTests.cs b/tests/ComputeSharp.Tests.SourceGenerators/DiagnosticsTests.cs
index 1e91f772..ffbd74c8 100644
--- a/tests/ComputeSharp.Tests.SourceGenerators/DiagnosticsTests.cs
+++ b/tests/ComputeSharp.Tests.SourceGenerators/DiagnosticsTests.cs
@@ -1574,7 +1574,7 @@ public class DiagnosticsTests
// Create the original compilation
CSharpCompilation compilation = CSharpCompilation.Create(
"original",
- new SyntaxTree[] { sourceTree },
+ [sourceTree],
metadataReferences,
new CSharpCompilationOptions(OutputKind.DynamicallyLinkedLibrary, allowUnsafe: true));
diff --git a/tests/ComputeSharp.Tests.SourceGenerators/Test_ComputeShaderDescriptorGenerator.cs b/tests/ComputeSharp.Tests.SourceGenerators/Test_ComputeShaderDescriptorGenerator.cs
index 0a8c5d24..4ddd5cf4 100644
--- a/tests/ComputeSharp.Tests.SourceGenerators/Test_ComputeShaderDescriptorGenerator.cs
+++ b/tests/ComputeSharp.Tests.SourceGenerators/Test_ComputeShaderDescriptorGenerator.cs
@@ -920,7 +920,7 @@ public class Test_ComputeShaderDescriptorGenerator
// Create the original compilation
CSharpCompilation compilation = CSharpCompilation.Create(
"original",
- new SyntaxTree[] { sourceTree },
+ [sourceTree],
metadataReferences,
new CSharpCompilationOptions(OutputKind.DynamicallyLinkedLibrary, allowUnsafe: true));
diff --git a/tests/ComputeSharp.Tests/ShadersTests.cs b/tests/ComputeSharp.Tests/ShadersTests.cs
index 38366d53..2c7eb855 100644
--- a/tests/ComputeSharp.Tests/ShadersTests.cs
+++ b/tests/ComputeSharp.Tests/ShadersTests.cs
@@ -180,7 +180,7 @@ public class ShadersTests
Action> action = new(RunComputeShader);
- _ = action.Method.GetGenericMethodDefinition().MakeGenericMethod(shaderType).Invoke(null, new[] { texture });
+ _ = action.Method.GetGenericMethodDefinition().MakeGenericMethod(shaderType).Invoke(null, [texture]);
}
else
{
@@ -196,7 +196,7 @@ public class ShadersTests
Action> action = new(RunPixelShader);
- _ = action.Method.GetGenericMethodDefinition().MakeGenericMethod(shaderType).Invoke(null, new[] { texture });
+ _ = action.Method.GetGenericMethodDefinition().MakeGenericMethod(shaderType).Invoke(null, [texture]);
}
_ = image.DangerousTryGetSinglePixelMemory(out Memory memory);