refine: remove the unused UnOp enum from the RQ IR - #6310
Open
prql-bot wants to merge 1 commit into
Open
Conversation
RQ represents unary operations as ExprKind::Operator, so rq::UnOp is never constructed, matched, or folded anywhere in the workspace. The live UnOp is prqlc_parser's pr::UnOp, re-exported through ir::pl.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
prqlc::ir::rq::UnOphas no producers or consumers. RQ models unary operations the same way it models every other operation —ExprKind::Operator { name: "std.neg", args }, lowered from PL inlowering.rsand translated insql/gen_expr.rs— so nothing ever builds anrq::UnOp, matches on one, or folds one. The onlyUnOpthe compiler actually uses isprqlc_parser'spr::UnOp, re-exported throughir::pl; the RQ copy carries a different variant set (Neg/Notagainstpr::UnOp'sNeg/Not/Add/EqSelf), which makes the shared name an active confusion hazard for anyone reading both IRs.This deletes the enum and drops it from the
ir::rqre-export list. It is a public item of theprqlccrate, so this is technically a breaking change to that surface — but since no API in the crate accepts or returns the type, nothing downstream can be holding a value of it that anyprqlccall would consume.No regression test: the removal is a pure deletion of an unreferenced type, and
cargo check -p prqlc --all-targetsis the check that it was in fact unreferenced. Found by the nightly rolling survey.How "unused" was established
A workspace-wide search for
UnOp(and forun_op/unop, case-insensitive) returns only the parser'spr::UnOpdefinition inparser/pr/ops.rsand its uses —parser/expr.rs,parser/pr/expr.rs,ir/pl/mod.rs,semantic/ast_expand.rs,codegen/ast.rs— plus the two lines this PR removes.RqFoldhas no fold method for it, and no field ofExprorExprKindreferences it, so it is unreachable fromschema_for!(rq::RelationalQuery)and the generated RQ JSON schema is unchanged despite theJsonSchemaderive. No committed schema or snapshot mentions it either.