Skip to content

fix: name the function and add a span to unknown-named-argument errors - #6142

Open
prql-bot wants to merge 1 commit into
mainfrom
fix/named-arg-error-message
Open

fix: name the function and add a span to unknown-named-argument errors#6142
prql-bot wants to merge 1 commit into
mainfrom
fix/named-arg-error-message

Conversation

@prql-bot

@prql-bot prql-bot commented Aug 5, 2026

Copy link
Copy Markdown
Collaborator

Passing a named argument that no parameter matches produced an error with no span and a Debug-printed ident. From the snapshot #6136 added yesterday:

Error: unknown named argument `b` to closure Some(["std", "not"])

Two fixes, in apply_args_to_closure and at its call site in the resolver:

  • Use closure.as_debug_name() instead of {:?} on name_hint, matching the phrasing of the sibling arity error a few lines above (Too many arguments to function \not``).
  • Attach the call-site span via with_span_fallback, so the error renders with the usual ariadne caret instead of a bare one-liner. with_span_fallback rather than with_span, so a span set deeper in the error isn't clobbered.

Same input now reads:

Error:
   ╭─[ :1:18 ]
   │
 1 │ from x | select (std.not {a} b:1)
   │                  ───────┬───────
   │                         ╰───────── unknown named argument `b` to function `not`
───╯

bad_error_messages::not_with_named_arg — added in #6136, which flagged exactly this ("the message has no span and Debug-prints the ident") — moves to error_messages::unknown_named_arg with updated snapshots, plus a third case (from x | take 1 b:2) so the coverage isn't all std.not.

Found during the nightly survey of semantic/resolver/functions.rs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant