From 3ca27faa23a92124f26875a6f00bcfc3a1c6431e Mon Sep 17 00:00:00 2001 From: ArielG-NV <159081215+ArielG-NV@users.noreply.github.com> Date: Fri, 30 May 2025 14:54:31 -0700 Subject: 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> --- tests/bugs/static-const-init-expr-with-interface-1.slang | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 tests/bugs/static-const-init-expr-with-interface-1.slang (limited to 'tests/bugs/static-const-init-expr-with-interface-1.slang') 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 b; +[numthreads(1, 1, 1)] +void computeMain(uint3 dispatchThreadID: SV_DispatchThreadID) +{ + b[0] = Bug::badVar; +} -- cgit v1.2.3