diff --git a/crates/typst-syntax/src/parser.rs b/crates/typst-syntax/src/parser.rs index 56fe3c9b7..f1c798c67 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 779a56ddc..e709d6a7c 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 +]