yum-mirror/slang

Making it easier to work with shaders

git clone https://git.yummers.dev/yum-mirror/slang

Ellie HermaszewskaImplement FileCheck tests for several test commands (#2747)d6dd38f52

master
971 B32 linesraw
1// gh-449.slang
2//TEST:SIMPLE:
3//TEST:SIMPLE(filecheck=CHECK):
4
5// Issue when dealing with binary operations that
6// mix scalars with vectors that have a different
7// element type.
8
9struct S { int dummy; };
10
11void foo(S s);
12
13void main()
14{
15    // This works fine right now. The `uint` gets converted to a
16    // `float`, and then we do the addition.
17    float2 a = float2(1, 2);
18    uint   b = 3;
19    foo(a + b);
20    // CHECK:      tests/bugs/gh-449.slang([[#@LINE-1]]): error 30019: expected an expression of type 'S', got 'vector<float,2>'
21    // CHECK-NEXT:     foo(a + b);
22    // CHECK-NEXT:           ^
23
24    // This used to get confused, with the `f` getting converted
25    // to a `uint` before the addition.
26    uint2 u = uint2(1, 2);
27    float f = 3.0;
28    foo(u + f);
29    // CHECK:      tests/bugs/gh-449.slang([[#@LINE-1]]): error 30019: expected an expression of type 'S', got 'vector<float,2>'
30    // CHECK-NEXT:     foo(u + f);
31    // CHECK-NEXT:           ^
32}