Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Match failure when combining Unions and expression types #36

Open
rdeits opened this issue Apr 3, 2017 · 2 comments · May be fixed by #37
Open

Match failure when combining Unions and expression types #36

rdeits opened this issue Apr 3, 2017 · 2 comments · May be fixed by #37

Comments

@rdeits
Copy link
Contributor

rdeits commented Apr 3, 2017

It appears that attempting to create an @match that uses unions and expression types results in no matches being found. A few examples:

This works:

julia> @match :(x[1]) begin
           (v_ref) => (v)
       end
:(x[1])

But adding a union gives no match:

julia> @match :(x[1]) begin
           (v_ref |
           (v_ref <= ub_)) => (v)
       end

Removing the _ref tag fixes it:

julia> @match :(x[1]) begin
           (v_ |
           (v_ <= ub_)) => (v)
       end
:(x[1])

Similarly, with a _Symbol tag, this works:

julia> @match :(x) begin
           (v_Symbol) => (v)
       end
:x

and this doesn't:

@match :(x) begin
    (v_Symbol |
    (v_Symbol <= ub_)) => (v)
end

Do unions just not support type restrictions?

@MikeInnes
Copy link
Member

There's no intentional reason why this couldn't be supported, but it may just be that we parse the unions before the types and then the types parser can't see inside the union. Not sure, but it should be fixable at any rate.

@rdeits
Copy link
Contributor Author

rdeits commented Apr 17, 2017

Ok, thanks! I think I may have a fix for this...

@rdeits rdeits linked a pull request Apr 17, 2017 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants