summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/bugs/gh-4150.slang6
-rw-r--r--tests/front-end/generic-disambiguate-2.slang28
2 files changed, 31 insertions, 3 deletions
diff --git a/tests/bugs/gh-4150.slang b/tests/bugs/gh-4150.slang
index 031d778a9..a6c9f7a0b 100644
--- a/tests/bugs/gh-4150.slang
+++ b/tests/bugs/gh-4150.slang
@@ -27,15 +27,15 @@ void main(uint3 pixel_i : SV_DispatchThreadID)
output[0] =
#ifdef ERROR1
// expect error: trying to specialize RWTex, which has two arguments, with only one argument.
- // CHECK1:([[# @LINE+1]]): error 30075
+ // CHECK1-DAG:([[# @LINE+1]]): error 30075
RWTex<float3>::get(p.image_id);
#else
RWTex<float, 3>::get(p.image_id);
#endif
- //CHECK1:([[# @LINE+1]]): error 30071
+ //CHECK1-DAG:([[# @LINE+1]]): error 30071
static float sa1[];
- //CHECK1:([[# @LINE+1]]): error 30071
+ //CHECK1-DAG:([[# @LINE+1]]): error 30071
float sa2[];
//CHECK1-NOT:([[# @LINE+1]]): error
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