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

dot syntax is not recognized as a pattern #156

Open
Roger-luo opened this issue Mar 6, 2023 · 2 comments · May be fixed by #157
Open

dot syntax is not recognized as a pattern #156

Roger-luo opened this issue Mar 6, 2023 · 2 comments · May be fixed by #157
Milestone

Comments

@Roger-luo
Copy link
Collaborator

Roger-luo commented Mar 6, 2023

MWE:

module Foo
const Bar = 1
end

@match 1 begin
    Foo.Bar => true    
end

causing it fail to support pattern match for singleton variants in Roger-luo/Expronicon.jl#47

@Roger-luo
Copy link
Collaborator Author

Roger-luo commented Mar 6, 2023

This requires one to write

@match 1 begin
   &Foo.Bar => true
end

to trigger the evaluation of Foo, but I think Foo.Bar has no ambiguity here, and should just be eval-ed inside the macro. And for example, if it's a function call, currently we will evaluate the dot expression, thus the error is different

caused by: MethodError: no method matching pattern_uncall(::Type{Main.Foo.Baz}, ::MLStyle.MatchImpl.ModuleBoundedEx2tf, ::Vector{Any}, ::Vector{Any}, ::SubArray{Any, 1, Vector{Any}, Tuple{UnitRange{Int64}}, true})
Closest candidates are:

another test case

module Foo

@enum Bar begin
    Baz
    Qux
end

end

@match Foo.Baz begin
    Foo.Baz => true
end

@Roger-luo
Copy link
Collaborator Author

seems you are aware of this in #140, what's the issue of support it in the current version?

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