Error if an unexpected named argument was received (#6192)

This commit is contained in:
frozolotl 2025-05-20 18:24:46 +02:00 committed by GitHub
parent e90c2f74ef
commit d42d2ed200
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 17 additions and 6 deletions

View File

@ -404,12 +404,14 @@ fn wrap_args_in_math(
if trailing_comma {
body += SymbolElem::packed(',');
}
Ok(Value::Content(
callee.display().spanned(callee_span)
+ LrElem::new(SymbolElem::packed('(') + body + SymbolElem::packed(')'))
.pack()
.spanned(args.span),
))
let formatted = callee.display().spanned(callee_span)
+ LrElem::new(SymbolElem::packed('(') + body + SymbolElem::packed(')'))
.pack()
.spanned(args.span);
args.finish()?;
Ok(Value::Content(formatted))
}
/// Provide a hint if the callee is a shadowed standard library function.

Binary file not shown.

After

Width:  |  Height:  |  Size: 703 B

View File

@ -221,6 +221,15 @@ $
// Hint: 4-6 or if you meant to display this as text, try placing it in quotes: `"ab"`
$ 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 ---
$ mat(;,) $
// Add some whitespace/trivia: