summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorArielG-NV <159081215+ArielG-NV@users.noreply.github.com>2025-05-30 14:54:31 -0700
committerGitHub <noreply@github.com>2025-05-30 21:54:31 +0000
commit3ca27faa23a92124f26875a6f00bcfc3a1c6431e (patch)
treea2fad6f0e0bbf99a574a5a6d0348970dcd16ddf2 /tests
parentb16eb592cc31b7cc9ba3d2f9525486c282996a9e (diff)
Ensure we do not have an `initExpr` on a `VarDecl` inside an `InterfaceDecl` (#7283)
* Ensure we do not have an initExpr on a var inside an InterfaceDecl Ensure we do not have an initExpr on a var inside an InterfaceDecl. If we do, send an error. Ensure the language server does not segfault with this error as per the issue. * format code * split tests --------- Co-authored-by: slangbot <186143334+slangbot@users.noreply.github.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/bugs/static-const-init-expr-with-interface-1.slang15
-rw-r--r--tests/bugs/static-const-init-expr-with-interface-2.slang15
2 files changed, 30 insertions, 0 deletions
diff --git a/tests/bugs/static-const-init-expr-with-interface-1.slang b/tests/bugs/static-const-init-expr-with-interface-1.slang
new file mode 100644
index 000000000..bab63c167
--- /dev/null
+++ b/tests/bugs/static-const-init-expr-with-interface-1.slang
@@ -0,0 +1,15 @@
+//TEST:LANG_SERVER(filecheck=CHECK):
+
+//HOVER:7,25
+//CHECK:Bug.badVar = 0
+interface Bug
+{
+ static const int badVar = 0;
+}
+
+RWStructuredBuffer<int> b;
+[numthreads(1, 1, 1)]
+void computeMain(uint3 dispatchThreadID: SV_DispatchThreadID)
+{
+ b[0] = Bug::badVar;
+}
diff --git a/tests/bugs/static-const-init-expr-with-interface-2.slang b/tests/bugs/static-const-init-expr-with-interface-2.slang
new file mode 100644
index 000000000..6976f1303
--- /dev/null
+++ b/tests/bugs/static-const-init-expr-with-interface-2.slang
@@ -0,0 +1,15 @@
+//TEST:SIMPLE(filecheck=CHECK): -stage compute -entry computeMain -target spirv
+
+//CHECK: error 30623
+
+interface Bug
+{
+ static const int badVar = 0;
+}
+
+RWStructuredBuffer<int> b;
+[numthreads(1, 1, 1)]
+void computeMain(uint3 dispatchThreadID: SV_DispatchThreadID)
+{
+ b[0] = Bug::badVar;
+}