From e19e0474639d579e6f0dc33d6b0c9b2a6d723fae Mon Sep 17 00:00:00 2001 From: Jay Kwak <82421531+jkwak-work@users.noreply.github.com> Date: Fri, 28 Jun 2024 21:20:43 -0700 Subject: Parse scope for local variable declaration (#4507) When a local variable is declaraed, a scope(::) was not properly parsed for its type name. This commit fixes it. Close #4457 --- tests/bugs/gh-4457.slang | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 tests/bugs/gh-4457.slang (limited to 'tests') diff --git a/tests/bugs/gh-4457.slang b/tests/bugs/gh-4457.slang new file mode 100644 index 000000000..e456b14f3 --- /dev/null +++ b/tests/bugs/gh-4457.slang @@ -0,0 +1,27 @@ +//TEST(compute, vulkan):COMPARE_COMPUTE_EX(filecheck-buffer=CHK):-vk -compute -shaderobj -output-using-type + +// This tests if the scope(::) is recognized for a local variable declaration. + +//TEST_INPUT: ubuffer(data=[0 0], stride=4):out,name outputBuffer +RWStructuredBuffer outputBuffer; + +[UnscopedEnum] +enum Number { + First = 1, + Second, +}; + +static ::Number foo = First; + +[numthreads(4, 1, 1)] +void computeMain(int3 dispatchThreadID: SV_DispatchThreadID) +{ + // The scope(::) should be recognized + static ::Number bar = Second; + + //CHK:1 + //CHK-NEXT:2 + outputBuffer[0] = int(foo); + outputBuffer[1] = int(bar); +} + -- cgit v1.2.3