summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--crates/typst-syntax/src/parser.rs1
-rw-r--r--tests/typ/compiler/return.typ7
2 files changed, 8 insertions, 0 deletions
diff --git a/crates/typst-syntax/src/parser.rs b/crates/typst-syntax/src/parser.rs
index 56fe3c9b..f1c798c6 100644
--- a/crates/typst-syntax/src/parser.rs
+++ b/crates/typst-syntax/src/parser.rs
@@ -605,6 +605,7 @@ fn embedded_code_expr(p: &mut Parser) {
| SyntaxKind::Show
| SyntaxKind::Import
| SyntaxKind::Include
+ | SyntaxKind::Return
);
let prev = p.prev_end();
diff --git a/tests/typ/compiler/return.typ b/tests/typ/compiler/return.typ
index 779a56dd..e709d6a7 100644
--- a/tests/typ/compiler/return.typ
+++ b/tests/typ/compiler/return.typ
@@ -80,3 +80,10 @@
]
#test(f(), "nope")
+
+---
+// Test rejection of extra value
+#let f() = [
+ // Error: 16-16 expected semicolon or line break
+ #return a + b Hello World
+]