diff options
| author | Yong He <yonghe@outlook.com> | 2025-02-05 12:32:56 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-02-05 12:32:56 -0800 |
| commit | 7911c9437333692db275d2dff41264f4c8023be8 (patch) | |
| tree | dd83ca191f47aed0bd512dfb9412038a7b7d3f0e /tests/front-end | |
| parent | 613f43a080f84e2680fb78dc4ed60a553da3b418 (diff) | |
Use two-stage parsing to disambiguate generic app and comparison. (#6281)
* Use two-stage parsing to disambiguate generic app and comparison.
* Typo fix.
* Update doc.
Diffstat (limited to 'tests/front-end')
| -rw-r--r-- | tests/front-end/generic-disambiguate-2.slang | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/front-end/generic-disambiguate-2.slang b/tests/front-end/generic-disambiguate-2.slang new file mode 100644 index 000000000..81fd9bc20 --- /dev/null +++ b/tests/front-end/generic-disambiguate-2.slang @@ -0,0 +1,28 @@ +//TEST:COMPARE_COMPUTE(filecheck-buffer=CHECK): -output-using-type + +static const uint X_SIZE = 32; + +uint y<int x> (int y){return 0;} + +uint test(uint x) +{ + uint y = 0; + // With two stage parsing, we should be able to disambiguate this + // from a generic function call. + uint surround_mask = x + + y<3?1:x>(X_SIZE) // generic call or comparison? + ? 5 : 0; + return surround_mask; +} + +//TEST_INPUT: set outputBuffer = out ubuffer(data=[0 0 0 0], stride=4) +RWStructuredBuffer<uint> outputBuffer; + +[numthreads(1,1,1)] +void computeMain() +{ + // CHECK: 1 + outputBuffer[0] = test(1); + // CHECK: 5 + outputBuffer[1] = test(33); +}
\ No newline at end of file |
