summaryrefslogtreecommitdiffstats
path: root/tests/experimental
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2022-08-17 23:08:34 -0700
committerGitHub <noreply@github.com>2022-08-17 23:08:34 -0700
commitadaea0e993fd8db351b5dad92802e47ed6d0ec77 (patch)
treedfad5201677b0202b0b890cbae066b5b2f3f033b /tests/experimental
parentd65c6183c0d8b365aa182c3d9026ba85522531f2 (diff)
Warning on lossy implicit casts. (#2367)
* Warning on bool to float conversion. * Fix test cases. * Improve. * LanguageServer: don't show constant value for non constant variables. * Fix tests. * Fix warnings in tests. Co-authored-by: Yong He <yhe@nvidia.com>
Diffstat (limited to 'tests/experimental')
-rw-r--r--tests/experimental/liveness/liveness-2.slang2
-rw-r--r--tests/experimental/liveness/liveness-3.slang4
-rw-r--r--tests/experimental/liveness/liveness-3.slang.expected2
-rw-r--r--tests/experimental/liveness/liveness-4.slang2
-rw-r--r--tests/experimental/liveness/liveness-5.slang2
-rw-r--r--tests/experimental/liveness/liveness-6.slang2
-rw-r--r--tests/experimental/liveness/liveness-7.slang4
-rw-r--r--tests/experimental/liveness/liveness-7.slang.expected2
-rw-r--r--tests/experimental/liveness/liveness.slang6
-rw-r--r--tests/experimental/liveness/liveness.slang.expected2
10 files changed, 14 insertions, 14 deletions
diff --git a/tests/experimental/liveness/liveness-2.slang b/tests/experimental/liveness/liveness-2.slang
index 9d4ab275d..06382971f 100644
--- a/tests/experimental/liveness/liveness-2.slang
+++ b/tests/experimental/liveness/liveness-2.slang
@@ -21,7 +21,7 @@ int calcThing(int offset)
[numthreads(4, 1, 1)]
void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID)
{
- int index = dispatchThreadID.x;
+ int index = int(dispatchThreadID.x);
outputBuffer[index] = calcThing(index);
}
diff --git a/tests/experimental/liveness/liveness-3.slang b/tests/experimental/liveness/liveness-3.slang
index 1d289aa68..a0c5c8604 100644
--- a/tests/experimental/liveness/liveness-3.slang
+++ b/tests/experimental/liveness/liveness-3.slang
@@ -20,7 +20,7 @@ int calcThing(int offset)
another[i & 1] += modRange;
- if (i % 3)
+ if (i % 3 != 0)
{
offset += 1;
}
@@ -43,7 +43,7 @@ int calcThing(int offset)
[numthreads(4, 1, 1)]
void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID)
{
- int index = dispatchThreadID.x;
+ int index = int(dispatchThreadID.x);
outputBuffer[index] = calcThing(index);
}
diff --git a/tests/experimental/liveness/liveness-3.slang.expected b/tests/experimental/liveness/liveness-3.slang.expected
index 614fd1387..58f562d86 100644
--- a/tests/experimental/liveness/liveness-3.slang.expected
+++ b/tests/experimental/liveness/liveness-3.slang.expected
@@ -72,7 +72,7 @@ int calcThing_0(int offset_0)
another_0[i_0 & 1] = another_0[i_0 & 1] + modRange_0;
int _S6 = i_0 % 3;
int _S7;
- if(bool(_S6))
+ if(_S6 != 0)
{
int _S8 = _S5;
livenessEnd_0(_S5, 0);
diff --git a/tests/experimental/liveness/liveness-4.slang b/tests/experimental/liveness/liveness-4.slang
index d18d127f6..a835f3a4e 100644
--- a/tests/experimental/liveness/liveness-4.slang
+++ b/tests/experimental/liveness/liveness-4.slang
@@ -29,7 +29,7 @@ int calcThing(int offset)
[numthreads(4, 1, 1)]
void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID)
{
- int index = dispatchThreadID.x;
+ int index = int(dispatchThreadID.x);
outputBuffer[index] = calcThing(index);
}
diff --git a/tests/experimental/liveness/liveness-5.slang b/tests/experimental/liveness/liveness-5.slang
index 52370d61b..98fa6ff6f 100644
--- a/tests/experimental/liveness/liveness-5.slang
+++ b/tests/experimental/liveness/liveness-5.slang
@@ -36,7 +36,7 @@ int calcThing(int offset)
[numthreads(4, 1, 1)]
void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID)
{
- int index = dispatchThreadID.x;
+ int index = int(dispatchThreadID.x);
outputBuffer[index] = calcThing(index);
}
diff --git a/tests/experimental/liveness/liveness-6.slang b/tests/experimental/liveness/liveness-6.slang
index 890b06fe5..d124efd35 100644
--- a/tests/experimental/liveness/liveness-6.slang
+++ b/tests/experimental/liveness/liveness-6.slang
@@ -41,7 +41,7 @@ int calcThing(int offset)
[numthreads(4, 1, 1)]
void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID)
{
- int index = dispatchThreadID.x;
+ int index = int(dispatchThreadID.x);
outputBuffer[index] = calcThing(index);
}
diff --git a/tests/experimental/liveness/liveness-7.slang b/tests/experimental/liveness/liveness-7.slang
index 0324f90b9..5d8ed48cc 100644
--- a/tests/experimental/liveness/liveness-7.slang
+++ b/tests/experimental/liveness/liveness-7.slang
@@ -12,7 +12,7 @@ int calcThing(int offset)
for (int k = 0; k < 20; ++k)
{
- if ((k + offset) & 1)
+ if (((k + offset) & 1) != 0)
{
return arr[0];
}
@@ -26,7 +26,7 @@ int calcThing(int offset)
[numthreads(4, 1, 1)]
void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID)
{
- int index = dispatchThreadID.x;
+ int index = int(dispatchThreadID.x);
outputBuffer[index] = calcThing(index);
}
diff --git a/tests/experimental/liveness/liveness-7.slang.expected b/tests/experimental/liveness/liveness-7.slang.expected
index 5b0c5b58a..52eafa5d1 100644
--- a/tests/experimental/liveness/liveness-7.slang.expected
+++ b/tests/experimental/liveness/liveness-7.slang.expected
@@ -35,7 +35,7 @@ int calcThing_0(int offset_0)
{
int _S3 = _S2;
livenessEnd_0(_S2, 0);
- if(bool(0 + _S3 & 1))
+ if((0 + _S3 & 1) != 0)
{
int _S4[2] = arr_0;
livenessEnd_1(arr_0, 0);
diff --git a/tests/experimental/liveness/liveness.slang b/tests/experimental/liveness/liveness.slang
index cf3d37a8f..a84cf268a 100644
--- a/tests/experimental/liveness/liveness.slang
+++ b/tests/experimental/liveness/liveness.slang
@@ -28,7 +28,7 @@ int someSlowFunc(int a)
{
v = ((v >> 1) | (v << 31)) * i;
}
- return v;
+ return int(v);
}
int somethingElse(inout SomeStruct s)
@@ -45,7 +45,7 @@ int doThing(SomeStruct s)
[numthreads(4, 1, 1)]
void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID)
{
- int index = dispatchThreadID.x;
+ int index = int(dispatchThreadID.x);
int res = index;
@@ -57,7 +57,7 @@ void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID)
SomeStruct t = makeSomeStruct();
SomeStruct u = {};
- if (v & 0x100)
+ if ((v & 0x100) != 0)
{
s.x = anotherBuffer[v & 3];
t.x = anotherBuffer[v & 3];
diff --git a/tests/experimental/liveness/liveness.slang.expected b/tests/experimental/liveness/liveness.slang.expected
index c74206573..0a39f0225 100644
--- a/tests/experimental/liveness/liveness.slang.expected
+++ b/tests/experimental/liveness/liveness.slang.expected
@@ -114,7 +114,7 @@ void main()
const int _S9[100] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
SomeStruct_0 u_0 = { 0, 0, _S9 };
SomeStruct_0 u_1;
- if(bool(v_1 & 256))
+ if((v_1 & 256) != 0)
{
s_3.x_0 = ((anotherBuffer_0)._data[(uint(v_1 & 3))]);
t_0.x_0 = ((anotherBuffer_0)._data[(uint(v_1 & 3))]);