summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2020-08-07 18:36:01 -0700
committerGitHub <noreply@github.com>2020-08-07 18:36:01 -0700
commitdd980b492aba9ea1540193434184489d9d04608d (patch)
tree2974ad7462bc540729f1685ea6cf31d337f39648 /tests
parent20af567033dedea15abb22fb7d344d116d7b99c5 (diff)
AnyValue packing/unpacking pass. (#1480)
* AnyValue packing/unpacking pass. * Add diagnostic for types that does not fit in required AnyValueSize. * Add expected test result * Fix warnings.
Diffstat (limited to 'tests')
-rw-r--r--tests/diagnostics/interfaces/anyvalue-size-validation.slang29
-rw-r--r--tests/diagnostics/interfaces/anyvalue-size-validation.slang.expected6
2 files changed, 35 insertions, 0 deletions
diff --git a/tests/diagnostics/interfaces/anyvalue-size-validation.slang b/tests/diagnostics/interfaces/anyvalue-size-validation.slang
new file mode 100644
index 000000000..b7cd5ba34
--- /dev/null
+++ b/tests/diagnostics/interfaces/anyvalue-size-validation.slang
@@ -0,0 +1,29 @@
+// anyvalue-size-validation.slang
+
+//DIAGNOSTIC_TEST:SIMPLE:-target cpp -stage compute -entry main -allow-dynamic-code
+
+[anyValueSize(8)]
+interface IInterface
+{
+ int doSomething();
+};
+
+struct S : IInterface
+{
+ uint a;
+ uint b;
+ uint c;
+ int doSomething() { return 5; }
+};
+
+T test<T:IInterface>(T s)
+{
+ return s;
+}
+
+[numthreads(4, 1, 1)]
+void main()
+{
+ S s;
+ test(s);
+} \ No newline at end of file
diff --git a/tests/diagnostics/interfaces/anyvalue-size-validation.slang.expected b/tests/diagnostics/interfaces/anyvalue-size-validation.slang.expected
new file mode 100644
index 000000000..e88b6bd5d
--- /dev/null
+++ b/tests/diagnostics/interfaces/anyvalue-size-validation.slang.expected
@@ -0,0 +1,6 @@
+result code = -1
+standard error = {
+tests/diagnostics/interfaces/anyvalue-size-validation.slang(11): error 41011: type 'S' does not fit in the size required by its conforming interface.
+}
+standard output = {
+}