MacroTools.jl icon indicating copy to clipboard operation
MacroTools.jl copied to clipboard

@capture union problem

Open cstjean opened this issue 3 years ago • 1 comments

Similar to what was noted in https://github.com/FluxML/MacroTools.jl/issues/40#issuecomment-357466077,

julia> @capture :(myvariable = 2) (lhs_Symbol = rhs_)
true

julia> @capture :(myvariable = 2) (lhs_Symbol = rhs_) | someotherpat
false

julia> @capture :(myvariable = 2) (lhs_ = rhs_) | someotherpat
true

The second match should be true as well.

cstjean avatar Mar 30 '22 15:03 cstjean

There's a much simpler example:

julia> @capture(:x, a_Symbol)
true

julia> @capture(:x, (a_Symbol) | (a_::b_))
false

heyx3 avatar Nov 07 '23 08:11 heyx3