Fixed source generator unit tests
このコミットが含まれているのは:
1 親
3147e8fade
コミット
b330616aa9
2ファイル変更
+8
-39
検索条件に一致するファイルはありません
@@ -206,6 +206,10 @@ namespace ComputeSharp.SourceGenerators
|
||||
continue;
|
||||
}
|
||||
|
||||
AttributeData? attribute = fieldSymbol.GetAttributes().FirstOrDefault(static a => a.AttributeClass is { Name: nameof(GroupSharedAttribute) });
|
||||
|
||||
if (attribute is not null) continue;
|
||||
|
||||
// Constant properties must be of a primitive, vector or matrix type
|
||||
if (fieldSymbol.Type is not INamedTypeSymbol typeSymbol ||
|
||||
!HlslKnownTypes.IsKnownHlslType(typeSymbol.GetFullMetadataName()))
|
||||
|
||||
@@ -142,7 +142,7 @@ namespace ComputeSharp.Tests.SourceGenerators
|
||||
[DataRow(nameof(GroupIds), "CMPS0007")]
|
||||
[DataRow(nameof(GroupSize), "CMPS0008")]
|
||||
[DataRow(nameof(GridIds), "CMPS0009")]
|
||||
[DataRow(nameof(DispatchSize), "CMPS0047")]
|
||||
[DataRow(nameof(DispatchSize), "CMPS0044")]
|
||||
public void InvalidDispatchInfoUsage_LocalFunction(string typeName, string diagnosticsId)
|
||||
{
|
||||
string source = $@"
|
||||
@@ -177,7 +177,7 @@ namespace ComputeSharp.Tests.SourceGenerators
|
||||
[DataRow(nameof(GroupIds), "CMPS0007")]
|
||||
[DataRow(nameof(GroupSize), "CMPS0008")]
|
||||
[DataRow(nameof(GridIds), "CMPS0009")]
|
||||
[DataRow(nameof(DispatchSize), "CMPS0047")]
|
||||
[DataRow(nameof(DispatchSize), "CMPS0044")]
|
||||
public void InvalidDispatchInfoUsage_StaticMethod(string typeName, string diagnosticsId)
|
||||
{
|
||||
string source = $@"
|
||||
@@ -204,41 +204,6 @@ namespace ComputeSharp.Tests.SourceGenerators
|
||||
VerifyGeneratedDiagnostics<IComputeShaderSourceGenerator>(source, diagnosticsId);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
[DataRow(nameof(ThreadIds), "CMPS0006")]
|
||||
[DataRow(nameof(GroupIds), "CMPS0007")]
|
||||
[DataRow(nameof(GroupSize), "CMPS0008")]
|
||||
[DataRow(nameof(GridIds), "CMPS0009")]
|
||||
[DataRow(nameof(DispatchSize), "CMPS0047")]
|
||||
public void InvalidDispatchInfoUsage_ConstantProperty(string typeName, string diagnosticsId)
|
||||
{
|
||||
string source = $@"
|
||||
using ComputeSharp;
|
||||
|
||||
namespace ComputeSharp
|
||||
{{
|
||||
public class ReadWriteBuffer<T> {{ }}
|
||||
public static class {typeName} {{ public static int X => 0; }}
|
||||
}}
|
||||
|
||||
namespace MyFancyApp.Sample
|
||||
{{
|
||||
public struct MyShader : IComputeShader
|
||||
{{
|
||||
public ReadWriteBuffer<float> buffer;
|
||||
|
||||
private static int Foo => {typeName}.X;
|
||||
|
||||
public void Execute()
|
||||
{{
|
||||
buffer[0] = Foo;
|
||||
}}
|
||||
}}
|
||||
}}";
|
||||
|
||||
VerifyGeneratedDiagnostics<IComputeShaderSourceGenerator>(source, diagnosticsId);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void InvalidThreadIdsNormalizedUsage()
|
||||
{
|
||||
@@ -257,11 +222,11 @@ namespace ComputeSharp.Tests.SourceGenerators
|
||||
{{
|
||||
public ReadWriteBuffer<float> buffer;
|
||||
|
||||
private static int Foo => ThreadIds.Normalized.X;
|
||||
public static int Fail() => ThreadIds.Normalized.X;
|
||||
|
||||
public void Execute()
|
||||
{{
|
||||
buffer[0] = Foo;
|
||||
buffer[0] = Fail();
|
||||
}}
|
||||
}}
|
||||
}}";
|
||||
|
||||
新しいイシューから参照
ユーザーをブロックする