From 7cd8130e1a3dbcca8746e0577fb8df3bf2975bf8 Mon Sep 17 00:00:00 2001 From: Yong He Date: Thu, 7 Aug 2025 08:10:02 -0700 Subject: Support `expand` on concrete tuple values. (#8106) Closes #8061. Along with the fix, also enhanced coercion/overload resolution to filter candidates based on the target type, allowing `tests\language-feature\higher-order-functions\overloaded.slang` to pass. --- .../language-feature/tuple/tuple-expand-call.slang | 26 ++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 tests/language-feature/tuple/tuple-expand-call.slang (limited to 'tests/language-feature/tuple') diff --git a/tests/language-feature/tuple/tuple-expand-call.slang b/tests/language-feature/tuple/tuple-expand-call.slang new file mode 100644 index 000000000..f2293f03f --- /dev/null +++ b/tests/language-feature/tuple/tuple-expand-call.slang @@ -0,0 +1,26 @@ +//TEST:COMPARE_COMPUTE(filecheck-buffer=CHECK): -output-using-type + +//TEST_INPUT: set outputBuffer = out ubuffer(data=[0 0], stride=4) + +#lang 2026 + +RWStructuredBuffer outputBuffer; + +int f(int x, float y) { return x + int(y); } + +int g(expand each Tuple t) +{ + return countof(t); +} + +[numthreads(1,1,1)] +void computeMain() +{ + Tuple> x = (2, 3.0f); + + // CHECK: 2 + outputBuffer[0] = g(expand each x); + + // CHECK: 5 + outputBuffer[1] = f(expand each x); +} -- cgit v1.2.3