FluxML / FluxML/MacroTools.jl

Match failure when combining Unions and expression types

Open
#36 2 comments 1 reaction 0 assignees View on GitHub
Dominant language
Julia
Stars
320
Forks
84
PR merge metrics
No merged PRs in 30d

Description

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
julia> @match :(x[1]) begin
(v_ref) => (v)
end
:(x[1])
```

But adding a union gives no match:

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

Removing the `_ref` tag fixes it:

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

Similarly, with a `_Symbol` tag, this works:

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

and this doesn't:

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

Do unions just not support type restrictions?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.