Add InvalidGloballyCoherentFieldDeclarationAnalyzer
このコミットが含まれているのは:
1 親
2f0d7911d6
コミット
e1ca46aa4c
5ファイル変更
+164
検索条件に一致するファイルはありません
@@ -85,4 +85,88 @@ public class Test_Analyzers
|
||||
|
||||
await CSharpAnalyzerWithLanguageVersionTest<NotReadOnlyComputeShaderTypeWithFieldsAnalyzer>.VerifyAnalyzerAsync(source);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public async Task GloballyCoherentAttribute_NotWithinShaderType()
|
||||
{
|
||||
const string source = """
|
||||
using ComputeSharp;
|
||||
|
||||
namespace MyFancyApp.Sample;
|
||||
|
||||
internal partial struct MyType
|
||||
{
|
||||
[{|CMPS0058:GloballyCoherent|}]
|
||||
public ReadWriteBuffer<float> buffer;
|
||||
}
|
||||
""";
|
||||
|
||||
await CSharpAnalyzerWithLanguageVersionTest<InvalidGloballyCoherentFieldDeclarationAnalyzer>.VerifyAnalyzerAsync(source);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public async Task GloballyCoherentAttribute_IncorrectType()
|
||||
{
|
||||
const string source = """
|
||||
using ComputeSharp;
|
||||
|
||||
namespace MyFancyApp.Sample;
|
||||
|
||||
internal partial struct MyType : IComputeShader
|
||||
{
|
||||
[{|CMPS0058:GloballyCoherent|}]
|
||||
public ReadOnlyBuffer<float> buffer;
|
||||
|
||||
public void Execute()
|
||||
{
|
||||
}
|
||||
}
|
||||
""";
|
||||
|
||||
await CSharpAnalyzerWithLanguageVersionTest<InvalidGloballyCoherentFieldDeclarationAnalyzer>.VerifyAnalyzerAsync(source);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public async Task GloballyCoherentAttribute_StaticField()
|
||||
{
|
||||
const string source = """
|
||||
using ComputeSharp;
|
||||
|
||||
namespace MyFancyApp.Sample;
|
||||
|
||||
internal partial struct MyType : IComputeShader
|
||||
{
|
||||
[{|CMPS0058:GloballyCoherent|}]
|
||||
public static ReadWriteBuffer<float> buffer;
|
||||
|
||||
public void Execute()
|
||||
{
|
||||
}
|
||||
}
|
||||
""";
|
||||
|
||||
await CSharpAnalyzerWithLanguageVersionTest<InvalidGloballyCoherentFieldDeclarationAnalyzer>.VerifyAnalyzerAsync(source);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public async Task GloballyCoherentAttribute_ValidField_DoesNotWarn()
|
||||
{
|
||||
const string source = """
|
||||
using ComputeSharp;
|
||||
|
||||
namespace MyFancyApp.Sample;
|
||||
|
||||
internal partial struct MyType : IComputeShader
|
||||
{
|
||||
[GloballyCoherent]
|
||||
public ReadWriteBuffer<float> buffer;
|
||||
|
||||
public void Execute()
|
||||
{
|
||||
}
|
||||
}
|
||||
""";
|
||||
|
||||
await CSharpAnalyzerWithLanguageVersionTest<InvalidGloballyCoherentFieldDeclarationAnalyzer>.VerifyAnalyzerAsync(source);
|
||||
}
|
||||
}
|
||||
@@ -895,6 +895,7 @@ public class Test_D2DPixelShaderSourceGenerator
|
||||
// Also validate all analyzers
|
||||
await CSharpAnalyzerWithLanguageVersionTest<InvalidComputeContextCopyAnalyzer>.VerifyAnalyzerAsync(source);
|
||||
await CSharpAnalyzerWithLanguageVersionTest<InvalidGeneratedComputeShaderDescriptorAttributeTargetAnalyzer>.VerifyAnalyzerAsync(source);
|
||||
await CSharpAnalyzerWithLanguageVersionTest<InvalidGloballyCoherentFieldDeclarationAnalyzer>.VerifyAnalyzerAsync(source);
|
||||
await CSharpAnalyzerWithLanguageVersionTest<MissingAllowUnsafeBlocksCompilationOptionAnalyzer>.VerifyAnalyzerAsync(source);
|
||||
await CSharpAnalyzerWithLanguageVersionTest<MissingComputeShaderDescriptorOnComputeShaderAnalyzer>.VerifyAnalyzerAsync(source);
|
||||
await CSharpAnalyzerWithLanguageVersionTest<NotAccessibleFieldTypeInGeneratedShaderDescriptorAttributeTargetAnalyzer>.VerifyAnalyzerAsync(source);
|
||||
|
||||
新しいイシューから参照
ユーザーをブロックする