Add InvalidGroupSharedFieldDeclarationAnalyzer
Also move the diagnostics there from the source generator
このコミットが含まれているのは:
1 親
73f30af5eb
コミット
a6c4b05e43
7ファイル変更
+156
-102
検索条件に一致するファイルはありません
@@ -58,73 +58,6 @@ public class DiagnosticsTests
|
||||
VerifyGeneratedDiagnostics<ComputeShaderDescriptorGenerator>(source, "CMPS0001", "CMPS0047");
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void InvalidGroupSharedFieldType()
|
||||
{
|
||||
const string source = """
|
||||
using ComputeSharp;
|
||||
|
||||
namespace MyFancyApp.Sample;
|
||||
|
||||
[GeneratedComputeShaderDescriptor]
|
||||
public partial struct MyShader : IComputeShader
|
||||
{
|
||||
public ReadWriteBuffer<float> buffer;
|
||||
|
||||
[GroupShared]
|
||||
public static string text;
|
||||
|
||||
public void Execute() { }
|
||||
}
|
||||
""";
|
||||
|
||||
VerifyGeneratedDiagnostics<ComputeShaderDescriptorGenerator>(source, "CMPS0002", "CMPS0047");
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void InvalidGroupSharedFieldElementType()
|
||||
{
|
||||
const string source = """
|
||||
using ComputeSharp;
|
||||
|
||||
namespace MyFancyApp.Sample;
|
||||
|
||||
[GeneratedComputeShaderDescriptor]
|
||||
public partial struct MyShader : IComputeShader
|
||||
{
|
||||
public ReadWriteBuffer<float> buffer;
|
||||
|
||||
[GroupShared]
|
||||
public static string[] text;
|
||||
|
||||
public void Execute() { }
|
||||
}
|
||||
""";
|
||||
|
||||
VerifyGeneratedDiagnostics<ComputeShaderDescriptorGenerator>(source, "CMPS0003", "CMPS0047");
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void InvalidGroupSharedFieldDeclaration()
|
||||
{
|
||||
const string source = """
|
||||
using ComputeSharp;
|
||||
|
||||
namespace MyFancyApp.Sample;
|
||||
|
||||
[GeneratedComputeShaderDescriptor]
|
||||
public partial struct MyShader : IComputeShader
|
||||
{
|
||||
[GroupShared]
|
||||
public ReadWriteBuffer<float> buffer;
|
||||
|
||||
public void Execute() { }
|
||||
}
|
||||
""";
|
||||
|
||||
VerifyGeneratedDiagnostics<ComputeShaderDescriptorGenerator>(source, "CMPS0004", "CMPS0047");
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void MissingShaderResources()
|
||||
{
|
||||
|
||||
@@ -169,4 +169,88 @@ public class Test_Analyzers
|
||||
|
||||
await CSharpAnalyzerWithLanguageVersionTest<InvalidGloballyCoherentFieldDeclarationAnalyzer>.VerifyAnalyzerAsync(source);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public async Task GroupSharedAttribute_NotWithinShaderType()
|
||||
{
|
||||
const string source = """
|
||||
using ComputeSharp;
|
||||
|
||||
namespace MyFancyApp.Sample;
|
||||
|
||||
internal partial struct MyType
|
||||
{
|
||||
[{|CMPS0004:GroupShared|}]
|
||||
public static int[] numbers;
|
||||
}
|
||||
""";
|
||||
|
||||
await CSharpAnalyzerWithLanguageVersionTest<InvalidGroupSharedFieldDeclarationAnalyzer>.VerifyAnalyzerAsync(source);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public async Task GroupSharedAttribute_IncorrectType()
|
||||
{
|
||||
const string source = """
|
||||
using ComputeSharp;
|
||||
|
||||
namespace MyFancyApp.Sample;
|
||||
|
||||
internal partial struct MyType : IComputeShader
|
||||
{
|
||||
[{|CMPS0004:GroupShared|}]
|
||||
public static ReadWriteBuffer<int> numbers;
|
||||
|
||||
public void Execute()
|
||||
{
|
||||
}
|
||||
}
|
||||
""";
|
||||
|
||||
await CSharpAnalyzerWithLanguageVersionTest<InvalidGroupSharedFieldDeclarationAnalyzer>.VerifyAnalyzerAsync(source);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public async Task GroupSharedAttribute_InstanceField()
|
||||
{
|
||||
const string source = """
|
||||
using ComputeSharp;
|
||||
|
||||
namespace MyFancyApp.Sample;
|
||||
|
||||
internal partial struct MyType : IComputeShader
|
||||
{
|
||||
[{|CMPS0004:GroupShared|}]
|
||||
public int[] numbers;
|
||||
|
||||
public void Execute()
|
||||
{
|
||||
}
|
||||
}
|
||||
""";
|
||||
|
||||
await CSharpAnalyzerWithLanguageVersionTest<InvalidGroupSharedFieldDeclarationAnalyzer>.VerifyAnalyzerAsync(source);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public async Task GroupSharedAttribute_ValidField_DoesNotWarn()
|
||||
{
|
||||
const string source = """
|
||||
using ComputeSharp;
|
||||
|
||||
namespace MyFancyApp.Sample;
|
||||
|
||||
internal partial struct MyType : IComputeShader
|
||||
{
|
||||
[GroupShared]
|
||||
public static int[] numbers;
|
||||
|
||||
public void Execute()
|
||||
{
|
||||
}
|
||||
}
|
||||
""";
|
||||
|
||||
await CSharpAnalyzerWithLanguageVersionTest<InvalidGroupSharedFieldDeclarationAnalyzer>.VerifyAnalyzerAsync(source);
|
||||
}
|
||||
}
|
||||
@@ -896,6 +896,7 @@ public class Test_D2DPixelShaderSourceGenerator
|
||||
await CSharpAnalyzerWithLanguageVersionTest<InvalidComputeContextCopyAnalyzer>.VerifyAnalyzerAsync(source);
|
||||
await CSharpAnalyzerWithLanguageVersionTest<InvalidGeneratedComputeShaderDescriptorAttributeTargetAnalyzer>.VerifyAnalyzerAsync(source);
|
||||
await CSharpAnalyzerWithLanguageVersionTest<InvalidGloballyCoherentFieldDeclarationAnalyzer>.VerifyAnalyzerAsync(source);
|
||||
await CSharpAnalyzerWithLanguageVersionTest<InvalidGroupSharedFieldDeclarationAnalyzer>.VerifyAnalyzerAsync(source);
|
||||
await CSharpAnalyzerWithLanguageVersionTest<MissingAllowUnsafeBlocksCompilationOptionAnalyzer>.VerifyAnalyzerAsync(source);
|
||||
await CSharpAnalyzerWithLanguageVersionTest<MissingComputeShaderDescriptorOnComputeShaderAnalyzer>.VerifyAnalyzerAsync(source);
|
||||
await CSharpAnalyzerWithLanguageVersionTest<NotAccessibleFieldTypeInGeneratedShaderDescriptorAttributeTargetAnalyzer>.VerifyAnalyzerAsync(source);
|
||||
|
||||
新しいイシューから参照
ユーザーをブロックする