fix: only treat a lone tuple arg to std.not as column exclusion - #6136
Conversation
The exclusion-syntax guard ignored `named_args`, so `std.not {a} b:1` took the column-exclusion branch and the named argument vanished. Requiring `named_args.is_empty()` sends it down the ordinary call path, which reports it.
prql-bot
left a comment
There was a problem hiding this comment.
Fix is right and I confirmed it locally: both panics reproduce on 81dceef and are gone here, select !{a} / select {a, b} | select !{a} / filter !(a == 1) / derive y = !true are unaffected, and the named-arg tightening turns a silent drop (std.not {a} b:1 compiled to SELECT *) into a real error. One test gap inline.
Two coordination notes:
- #6125 adds a
// special case: handle the syntax !{tuple..}comment directly above this same match arm, and #6137 appends to the same spot at the end oferror_messages.rs. Both will conflict textually with this PR; whichever lands second needs a trivial resolution, and #6125's comment then duplicates the one added here. - The third snapshot pins the
unknown named argument ... to closure Some([...])message, which has no span andDebug-prints the ident. That's pre-existing (theunknown named argumentbranch infunctions.rs) and not this PR's job to fix, but the repo keepsbad_error_messages.rsfor exactly this shape — so it may be worth recording there rather than pinning it in the good-messages file.
|
Took the On the conflicts: #6125 and #6137 are both still open, so whichever of the three lands last does the resolution. #6125's comment above the match arm says the same thing as the one here — if that one merges first I'll drop mine when rebasing rather than leave both. |
std.not with multiple argumentsstd.not as column exclusion
# Conflicts: # prqlc/prqlc/src/semantic/resolver/expr.rs
|
Done — 0c47ef4 merges #6137 still appends to the same spot at the end of |
select !{a}desugars to astd.notcall with a single tuple argument, and the resolver special-cases that shape to turn it into a column exclusion. The guard only looked atargs[0], so it claimed calls it wasn't written for — with three different bad outcomes:std.not {a} bexactly_onenot"std.not b:1args[0](emptyargs)b"std.not {a} b:1SELECT *b"Requiring
args.len() == 1andnamed_args.is_empty()keeps the exclusion path for exactly the shape it was written for and sends everything else down the ordinary call path, which already reports these properly:select !{a},select {a, b} | select !{a},filter !(a == 1)andderive y = !trueare unaffected. Regression tests inerror_messages.rscover the two spanned "Too many arguments" cases; the two named-argument snapshots live inbad_error_messages.rs, since that message still has no span andDebug-prints the ident.Found during the nightly survey of
prqlc/prqlc/src/semantic/resolver/expr.rs.Note for whoever merges: #6125 has merged and is merged in here — its
// special case: handle the syntax !{tuple..}comment is kept and the duplicate one this PR had added is gone. #6137 is still open and appends to the same spot at the end oferror_messages.rs, so whichever of the two lands second needs a trivial conflict resolution.