From ec0224edc3a867bbf059e790ad7b2a1a881a0705 Mon Sep 17 00:00:00 2001 From: Yong He Date: Mon, 11 Dec 2023 16:13:32 -0800 Subject: Diagnose for invalid decl nesting + namespace lookup fixes. (#3397) * Diagnose for invalid decl nesting. * Fix. * Fix. * Fix. * Fix `namespace` lookup and `using` resolution. * fix project files. * revert project files. * Enhance namespace syntax, docs. * Fixes. --------- Co-authored-by: Yong He --- .../namespaces/namespace-include/a.slang | 28 ++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 tests/language-feature/namespaces/namespace-include/a.slang (limited to 'tests/language-feature/namespaces/namespace-include/a.slang') diff --git a/tests/language-feature/namespaces/namespace-include/a.slang b/tests/language-feature/namespaces/namespace-include/a.slang new file mode 100644 index 000000000..6660f590d --- /dev/null +++ b/tests/language-feature/namespaces/namespace-include/a.slang @@ -0,0 +1,28 @@ +//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK): -shaderobj + +module a; + +__include b; + +namespace ns1 +{ +namespace ns2 +{ + int l() { return k(); } // should be able to find k() in b. +} +} + +using ns1.ns2; + +//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer +RWStructuredBuffer outputBuffer; + +[numthreads(4, 1, 1)] +void computeMain(int3 dispatchThreadID: SV_DispatchThreadID) +{ + int tid = dispatchThreadID.x; + int inVal = tid; + int outVal = k() + l() + ns1.ns2.f(); + outputBuffer[tid] = outVal; + // CHECK: 7 +} -- cgit v1.2.3