mirror of
https://github.com/typst/typst
synced 2025-05-22 04:55:29 +08:00
Error if an unexpected named argument was received (#6192)
This commit is contained in:
parent
e90c2f74ef
commit
d42d2ed200
@ -404,12 +404,14 @@ fn wrap_args_in_math(
|
|||||||
if trailing_comma {
|
if trailing_comma {
|
||||||
body += SymbolElem::packed(',');
|
body += SymbolElem::packed(',');
|
||||||
}
|
}
|
||||||
Ok(Value::Content(
|
|
||||||
callee.display().spanned(callee_span)
|
let formatted = callee.display().spanned(callee_span)
|
||||||
+ LrElem::new(SymbolElem::packed('(') + body + SymbolElem::packed(')'))
|
+ LrElem::new(SymbolElem::packed('(') + body + SymbolElem::packed(')'))
|
||||||
.pack()
|
.pack()
|
||||||
.spanned(args.span),
|
.spanned(args.span);
|
||||||
))
|
|
||||||
|
args.finish()?;
|
||||||
|
Ok(Value::Content(formatted))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Provide a hint if the callee is a shadowed standard library function.
|
/// Provide a hint if the callee is a shadowed standard library function.
|
||||||
|
BIN
tests/ref/math-call-symbol.png
Normal file
BIN
tests/ref/math-call-symbol.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 703 B |
@ -221,6 +221,15 @@ $
|
|||||||
// Hint: 4-6 or if you meant to display this as text, try placing it in quotes: `"ab"`
|
// Hint: 4-6 or if you meant to display this as text, try placing it in quotes: `"ab"`
|
||||||
$ 5ab $
|
$ 5ab $
|
||||||
|
|
||||||
|
--- math-call-symbol ---
|
||||||
|
$ phi(x) $
|
||||||
|
$ phi(x, y) $
|
||||||
|
$ phi(1,2,,3,) $
|
||||||
|
|
||||||
|
--- math-call-symbol-named-argument ---
|
||||||
|
// Error: 10-18 unexpected argument: alpha
|
||||||
|
$ phi(x, alpha: y) $
|
||||||
|
|
||||||
--- issue-3774-math-call-empty-2d-args ---
|
--- issue-3774-math-call-empty-2d-args ---
|
||||||
$ mat(;,) $
|
$ mat(;,) $
|
||||||
// Add some whitespace/trivia:
|
// Add some whitespace/trivia:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user