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

Matching on fully qualified function call in 3.0 #209

Open
HectorPeeters opened this issue May 26, 2024 · 1 comment
Open

Matching on fully qualified function call in 3.0 #209

HectorPeeters opened this issue May 26, 2024 · 1 comment

Comments

@HectorPeeters
Copy link

HectorPeeters commented May 26, 2024

When creating a rule with a fully qualified function call in the ale/3.0 branch, Metatheory fails to compile the pattern.

A rule defined like so:

@rule Main.identity(~a) --> ~a

Results in the following error:

ERROR: LoadError: MethodError: no method matching match_term_op(::PatExpr, ::Symbol, ::PatExpr)
The function `match_term_op` exists, but no method is defined for this combination of argument types.

Closest candidates are:
  match_term_op(::AbstractPat, ::Any, ::PatVar)
   @ Metatheory ~/.julia/packages/Metatheory/Wu6kK/src/match_compiler.jl:208
  match_term_op(::Any, ::Any, ::Union{Expr, Symbol})
   @ Metatheory ~/.julia/packages/Metatheory/Wu6kK/src/match_compiler.jl:205
  match_term_op(::Any, ::Any, ::Union{DataType, Function})
   @ Metatheory ~/.julia/packages/Metatheory/Wu6kK/src/match_compiler.jl:200

Stacktrace:
 [1] match_term_expr(pattern::PatExpr, coordinate::Vector{Int64}, segments_so_far::Vector{Symbol})
   @ Metatheory ~/.julia/packages/Metatheory/Wu6kK/src/match_compiler.jl:217
 [2] match_compile!(pattern::PatExpr, state::Metatheory.MatchCompilerState, coordinate::Vector{Int64}, parent_segments::Vector{Symbol})
   @ Metatheory ~/.julia/packages/Metatheory/Wu6kK/src/match_compiler.jl:137
 [3] match_compile(p::PatExpr, pvars::Vector{Symbol})
   @ Metatheory ~/.julia/packages/Metatheory/Wu6kK/src/match_compiler.jl:34
@0x0f0f0f
Copy link
Member

0x0f0f0f commented Jun 2, 2024

Added support for it in #185 - the function must be defined though

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

No branches or pull requests

2 participants