From 2517996577343cbd64ca3e6187317ee3b371e95c Mon Sep 17 00:00:00 2001 From: Sergio Pedri Date: Mon, 30 Nov 2020 16:24:21 +0100 Subject: [PATCH] Fixed [AutoConstructor] repeating class attributes --- .../AutoConstructorGenerator.cs | 1 + tests/ComputeSharp.Tests/BufferTests.cs | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/ComputeSharp.SourceGenerators/AutoConstructorGenerator.cs b/src/ComputeSharp.SourceGenerators/AutoConstructorGenerator.cs index d58d9fd6..b82df4d0 100644 --- a/src/ComputeSharp.SourceGenerators/AutoConstructorGenerator.cs +++ b/src/ComputeSharp.SourceGenerators/AutoConstructorGenerator.cs @@ -75,6 +75,7 @@ namespace ComputeSharp.SourceGenerators .WithMembers(SingletonList(typeDeclarationSyntax)) .WithConstraintClauses(List()) .WithBaseList(null) + .WithAttributeLists(List()) .WithoutTrivia(); } diff --git a/tests/ComputeSharp.Tests/BufferTests.cs b/tests/ComputeSharp.Tests/BufferTests.cs index 5b6f8177..7810777e 100644 --- a/tests/ComputeSharp.Tests/BufferTests.cs +++ b/tests/ComputeSharp.Tests/BufferTests.cs @@ -98,7 +98,7 @@ namespace ComputeSharp.Tests [DataRow(typeof(ReadWriteBuffer<>), 2048, 2048)] public void GetData_RangeToArray_Ok(Type bufferType, int offset, int count) { - float[] array = Enumerable.Range(0, 4096).Select(i => (float)i).ToArray(); + float[] array = Enumerable.Range(0, 4096).Select(static i => (float)i).ToArray(); using Buffer buffer = Gpu.Default.AllocateBuffer(bufferType, array); @@ -125,7 +125,7 @@ namespace ComputeSharp.Tests [ExpectedException(typeof(ArgumentOutOfRangeException))] public void GetData_RangeToArray_Fail(Type bufferType, int offset, int count) { - float[] array = Enumerable.Range(0, 4096).Select(i => (float)i).ToArray(); + float[] array = Enumerable.Range(0, 4096).Select(static i => (float)i).ToArray(); using Buffer buffer = Gpu.Default.AllocateBuffer(bufferType, array); @@ -147,7 +147,7 @@ namespace ComputeSharp.Tests [DataRow(typeof(ReadWriteBuffer<>), 127, 1024, 587)] public void GetData_RangeToVoid_Ok(Type bufferType, int destinationOffset, int bufferOffset, int count) { - float[] array = Enumerable.Range(0, 4096).Select(i => (float)i).ToArray(); + float[] array = Enumerable.Range(0, 4096).Select(static i => (float)i).ToArray(); using Buffer buffer = Gpu.Default.AllocateBuffer(bufferType, array); @@ -180,7 +180,7 @@ namespace ComputeSharp.Tests [ExpectedException(typeof(ArgumentOutOfRangeException))] public void GetData_RangeToVoid_Fail(Type bufferType, int destinationOffset, int bufferOffset, int count) { - float[] array = Enumerable.Range(0, 4096).Select(i => (float)i).ToArray(); + float[] array = Enumerable.Range(0, 4096).Select(static i => (float)i).ToArray(); using Buffer buffer = Gpu.Default.AllocateBuffer(bufferType, array);