diff options
Diffstat (limited to 'tests/language-feature/spirv-asm/wrong-assignment-opcode.slang')
| -rw-r--r-- | tests/language-feature/spirv-asm/wrong-assignment-opcode.slang | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/tests/language-feature/spirv-asm/wrong-assignment-opcode.slang b/tests/language-feature/spirv-asm/wrong-assignment-opcode.slang new file mode 100644 index 000000000..4afbb0417 --- /dev/null +++ b/tests/language-feature/spirv-asm/wrong-assignment-opcode.slang @@ -0,0 +1,41 @@ +//DIAGNOSTIC_TEST:SIMPLE(filecheck=CHECK): + +RWStructuredBuffer<float> buf; + +// +// This test checks that we correctly diagnose trying to use the assignment and +// typed assignment syntax with operands with no result type or id. +// +// By virtue of these tests being in the same file, we also check the error +// recovery for the asm block parser. +// +int foo(const int constParam) +{ + // Doesn't have a result type + spirv_asm + { + %bar : %wrong = OpTypeInt 32 0 + // CHECK: wrong-assignment-opcode.slang([[#@LINE-1]]): error 29104: cannot use this 'x : <type> = OpTypeInt...' syntax because OpTypeInt does not have a <result-type-id> operand + + }; + + // Doesn't have a result value + spirv_asm + { + %foo = OpStore 1 2; + // CHECK: wrong-assignment-opcode.slang([[#@LINE-1]]): error 29104: cannot use this 'x = OpStore...' syntax because OpStore does not have a <result-id> operand + }; + + // garbage + spirv_asm + { + %foo =; + // CHECK: wrong-assignment-opcode.slang([[#@LINE-1]]): error 20003: unexpected ';' + %foo :; + // CHECK: wrong-assignment-opcode.slang([[#@LINE-1]]): error 20003: unexpected ';' + %foo : bar; + // CHECK: wrong-assignment-opcode.slang([[#@LINE-1]]): error 20001: unexpected ';', expected '=' + %foo : bar =; + // CHECK: wrong-assignment-opcode.slang([[#@LINE-1]]): error 20003: unexpected ';' + }; +} |
