summaryrefslogtreecommitdiffstats
path: root/tests/front-end/struct-result-type.slang
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2025-10-01 09:23:48 -0700
committerGitHub <noreply@github.com>2025-10-01 16:23:48 +0000
commit5793b6d864b572e464dd5e17dc842e99d13d310d (patch)
tree18c67a633385f5db5d9fc673d99ee4b39d42e705 /tests/front-end/struct-result-type.slang
parent4d241f2ccc2b07673615e94ea8e99060cf2da66c (diff)
Misc parser improvements. (#8563)
- Fix bug parsing multiple link-time structs on the same line. Closes #8553. - Fix bug parsing anonymous struct type as function return type in modern syntax. Closes #8558 - Support semantics on modern style param/var declarations.
Diffstat (limited to 'tests/front-end/struct-result-type.slang')
-rw-r--r--tests/front-end/struct-result-type.slang16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/front-end/struct-result-type.slang b/tests/front-end/struct-result-type.slang
new file mode 100644
index 000000000..35919a78a
--- /dev/null
+++ b/tests/front-end/struct-result-type.slang
@@ -0,0 +1,16 @@
+// Check that we can parse and check an anonymous struct declaration as function return type.
+
+//TEST:INTERPRET(filecheck=CHECK):
+
+module testa;
+
+func test(int a) -> struct{ int a,b; } {
+ return {a,2};
+}
+
+void main()
+{
+ let m = test(1);
+ // CHECK: 3
+ printf("%d\n", m.a + m.b);
+}