diff options
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/front-end/link-time-struct-same-line.slang | 9 | ||||
| -rw-r--r-- | tests/front-end/modern-syntax-semantic.slang | 11 | ||||
| -rw-r--r-- | tests/front-end/struct-result-type.slang | 16 |
3 files changed, 36 insertions, 0 deletions
diff --git a/tests/front-end/link-time-struct-same-line.slang b/tests/front-end/link-time-struct-same-line.slang new file mode 100644 index 000000000..790e1e165 --- /dev/null +++ b/tests/front-end/link-time-struct-same-line.slang @@ -0,0 +1,9 @@ +// Check that we can correctly parse link-time struct definitions on the same line. +// There was a bug where the parser is expecting an identifier after `struct` definition, +// even if the struct is a link-time struct ending with a `;`. + +//TEST:SIMPLE: -target slangvm + +interface IFoo{} +struct FooImpl : IFoo{} +export struct Foo1 : IFoo = FooImpl; export struct Foo2 : IFoo = FooImpl;
\ No newline at end of file diff --git a/tests/front-end/modern-syntax-semantic.slang b/tests/front-end/modern-syntax-semantic.slang new file mode 100644 index 000000000..6ff85c29c --- /dev/null +++ b/tests/front-end/modern-syntax-semantic.slang @@ -0,0 +1,11 @@ +//TEST:COMPARE_COMPUTE(filecheck-buffer=CHECK): -output-using-type + +//TEST_INPUT: set outputBuffer = out ubuffer(data=[0], stride=4) +RWStructuredBuffer<int> outputBuffer; + +[numthreads(1,1,1)] +func computeMain(tid : int : SV_DispatchThreadID) -> void +{ + // CHECK: 1 + outputBuffer[0] = tid + 1; +}
\ No newline at end of file diff --git a/tests/front-end/struct-result-type.slang b/tests/front-end/struct-result-type.slang new file mode 100644 index 000000000..35919a78a --- /dev/null +++ b/tests/front-end/struct-result-type.slang @@ -0,0 +1,16 @@ +// Check that we can parse and check an anonymous struct declaration as function return type. + +//TEST:INTERPRET(filecheck=CHECK): + +module testa; + +func test(int a) -> struct{ int a,b; } { + return {a,2}; +} + +void main() +{ + let m = test(1); + // CHECK: 3 + printf("%d\n", m.a + m.b); +} |
