diff --git a/src/Underscores.jl b/src/Underscores.jl index 8de3db1..4755d8f 100644 --- a/src/Underscores.jl +++ b/src/Underscores.jl @@ -7,7 +7,7 @@ end Underscores export @_ -isquoted(ex) = ex isa Expr && ex.head in (:quote, :inert, :meta) +isquoted(ex) = ex isa Expr && ex.head in (:inert, :meta) function _replacesyms(sym_map, ex) if ex isa Symbol @@ -102,9 +102,7 @@ const _pipeline_ops = [:|>, :<|, :∘, :.|>, :.<|] function lower_underscores(ex) if ex isa Expr - if isquoted(ex) - return ex - elseif ex.head == :call && length(ex.args) > 1 && + if ex.head == :call && length(ex.args) > 1 && ex.args[1] in _pipeline_ops # Special case for pipelining and composition operators return Expr(ex.head, ex.args[1], diff --git a/test/runtests.jl b/test/runtests.jl index 79e0899..86d0c04 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -169,6 +169,9 @@ end @test lower(:(f(g(_[3]),h)[4])) == cleanup!(:(f((_1,)->g(_1[3]),h)[4])) @test lower(:(f(__)[5])) == cleanup!(:((__1,)->f(__1)[5])) + # Quote + @test lower(:(map(:(a[$_]), 1:4))) == cleanup!(:(map((_1,)->:(a[$_1]), 1:4))) + # Random sample of other syntax @test lower(:([_])) == cleanup!(:([(_1,)->_1])) @test lower(:((f(_), g(_)))) == cleanup!(:(((_1,)->f(_1)), ((_1,)->g(_1))))