summaryrefslogtreecommitdiffstats
path: root/tests/bugs
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2024-07-25 11:49:07 -0700
committerGitHub <noreply@github.com>2024-07-25 11:49:07 -0700
commit1343ab79fcd0ff9e5ffebbcf95414e51ab19e9cd (patch)
treeccb40045b16e83aaac126b7a47cff46b0f02ecf4 /tests/bugs
parent3c03d279ee4ccf4796901f4ea6640787d341d11d (diff)
Fix around extensions and `IDifferentiable` requirement synthesis. (#4729)
* Check extensions before function parameters. Fix decl ref formation for synthesized differentiable requirements that are inside an extension. * Fix clang errors. * More clang fix. * Fix warnings. * Fix build error. * Fix. * Fix typo.
Diffstat (limited to 'tests/bugs')
-rw-r--r--tests/bugs/extended-type-in-param.slang28
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/bugs/extended-type-in-param.slang b/tests/bugs/extended-type-in-param.slang
new file mode 100644
index 000000000..b3631d36e
--- /dev/null
+++ b/tests/bugs/extended-type-in-param.slang
@@ -0,0 +1,28 @@
+//TEST:SIMPLE(filecheck=CHECK): -target spirv
+struct ArrayLike<T>
+{
+}
+__generic<T : IDifferentiable>
+extension ArrayLike<T> : IDifferentiable
+{
+}
+
+struct ExpectsDiff<T : IDifferentiable>
+{
+}
+
+// test that using `ExpectsDiff<ArrayLike<T>>` is fine to the type system.
+// this means that we must have checked the extension for `ArrayLike<T>` before
+// we check the `t3` parameter for `test`.
+void test<T : IDifferentiable>(ExpectsDiff<ArrayLike<T>> t3)
+{
+}
+
+// CHECK: OpEntryPoint
+
+[numthreads(1, 1, 1)]
+void main()
+{
+ ExpectsDiff<ArrayLike<float>> v = {};
+ test<float>(v);
+} \ No newline at end of file