Skip to content

Commit 260114a

Browse files
authored
Bugfix: Fixes @filter() involving multiple comparison operators (#148)
1 parent 1163b98 commit 260114a

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

NEWS.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
## v.0.17.0 - 2025-03-24
44
- Bugfix: `@count()` can now be called multiple times. If column `n` already exists, then the new column containing the count will be `nn` (and so on).
55
- Bugfix: `@unnest_wider()` now works on data where keys are missing
6+
- Bugfix: Fixes `@filter()` involving multiple comparison operators (e.g., `3 <= a < 5`), which have a `:head` of `:comparison` and are parsed differently than `(3 <= a) && (a < 5)`
67
- Adds logging ability to track changes to data frames with `TidierData_set("log", true)`
78
- Adds docs describing logging and code printing
89

src/parsing.jl

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,12 @@ function parse_function(lhs::Union{Symbol, Expr}, rhs::Expr; autovec::Bool=true,
143143
if @capture(x, (fn_(args__)) | (fn_.(args__))) && fn != :esc
144144
args = args[isa.(args, Symbol)]
145145
push!(src, args...)
146+
elseif hasproperty(x, :head) && x.head == :comparison
147+
for (index, value) in enumerate(x.args)
148+
if index % 2 == 1 && value isa Symbol
149+
push!(src, value)
150+
end
151+
end
146152
end
147153
return x
148154
end
@@ -357,6 +363,15 @@ function parse_autovec(tidy_expr::Union{Expr,Symbol})
357363
elseif hasproperty(x, :head) && (x.head == :&& || x.head == :||)
358364
x.head = Symbol("." * string(x.head))
359365
return x
366+
elseif hasproperty(x, :head) && x.head == :comparison
367+
for (index, value) in enumerate(x.args)
368+
if index % 2 == 0
369+
if first(string(value), 1) != "."
370+
x.args[index] = Symbol("." * string(value))
371+
end
372+
end
373+
end
374+
return x
360375
end
361376
return x
362377
end

0 commit comments

Comments
 (0)