RelationalAI-oss / Rematch.jl

Pattern matching
Other
52 stars 6 forks source link

Internal error when using & nested in a pattern #1

Closed mbravenboer closed 6 years ago

mbravenboer commented 6 years ago

Writing something like this: Foo(Bar(e, xs, as1) & b, [], as2)

Results in: ERROR: MethodError: no method matching assert_num_fields(::Base.#&, ::Int64)

jamii commented 6 years ago

Hmmm. Maybe I should explicitly catch infix operators - they're never going to be valid struct names.

jamii commented 6 years ago

On master:

julia> x = 1
1

julia> @match (a && 1) = x
1

julia> @match (a & 1) = x
1

julia> @match (a + 1) = x
ERROR: AssertionError: Pattern a + 1 looks like a struct pattern but + is probably not a struct type.
mbravenboer commented 6 years ago

Thanks, looks great