summaryrefslogtreecommitdiff
path: root/tests/language-feature/interfaces/static-method-not-implemented.slang
diff options
context:
space:
mode:
authorDarren Wihandi <65404740+fairywreath@users.noreply.github.com>2025-01-28 21:24:35 -0500
committerGitHub <noreply@github.com>2025-01-29 02:24:35 +0000
commitcf66563cfdcff9b7d76017e5b73319705ccdb735 (patch)
tree41c8a5d3706a912049a8c491fd2e7d593d4aa450 /tests/language-feature/interfaces/static-method-not-implemented.slang
parent1f99c2086cab3a259c786373ba8d5608e0e1f430 (diff)
Fix exact-match witness synthesis for static functions (#6204)
* fix non-static methods when trying to synthesize method requirement witness * add tests * update test * improve test --------- Co-authored-by: Yong He <yonghe@outlook.com>
Diffstat (limited to 'tests/language-feature/interfaces/static-method-not-implemented.slang')
-rw-r--r--tests/language-feature/interfaces/static-method-not-implemented.slang27
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/language-feature/interfaces/static-method-not-implemented.slang b/tests/language-feature/interfaces/static-method-not-implemented.slang
new file mode 100644
index 000000000..1d46c1be6
--- /dev/null
+++ b/tests/language-feature/interfaces/static-method-not-implemented.slang
@@ -0,0 +1,27 @@
+//DIAGNOSTIC_TEST:SIMPLE(filecheck=CHECK): -target spirv
+
+interface Base
+{
+ static int getValue();
+}
+
+struct Impl : Base
+{
+ // This is not static and not allowed to implement the interface's static method.
+ // CHECK: error 38105: member 'getValue' does not match interface requirement
+ int getValue() { return 5; }
+}
+
+int callGet<Foo : Base>()
+{
+ return Foo::getValue();
+}
+
+RWStructuredBuffer<int> result;
+
+[numthreads(1, 1, 1)]
+void computeMain()
+{
+ result[0] = callGet<Impl>();
+}
+