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

Pattern matching a namespaced type

Open yurivish opened this issue 7 years ago • 1 comments

It seems the pattern-matching syntax gets confused by the . in the type:

julia> using MacroTools, Markdown

julia> @capture(md"_hello_", x_Markdown.MD)
false

julia> using Markdown: MD

julia> @capture(md"_hello_", x_MD)
true

yurivish avatar Aug 27 '18 16:08 yurivish

I can see why this is confusing, but it's unavoidable; the x_Markdown is actually parsed as all one symbol and @capture parses it further.

MikeInnes avatar Sep 17 '18 14:09 MikeInnes