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

Better error message for calling @match on non-record struct instance #179

Open
jariji opened this issue Feb 10, 2024 · 0 comments
Open

Comments

@jariji
Copy link
Contributor

jariji commented Feb 10, 2024

Give a better error message, recommending @as_record B.

julia> struct B
           a
           b
           c
       end


julia> @match B(1,2,3) begin
           B(a,b,c) => (a,b,c)
       end
ERROR: LoadError: PatternCompilationError(:(#= REPL[5]:2 =#), MethodError(MLStyle.MatchImpl.pattern_uncall, (B, MLStyle.MatchImpl.ModuleBoundedEx2tf(Main), Any[], Any[], Any[:a, :b, :c]), 0x0000000000007b2f))
in expression starting at REPL[5]:1

caused by: MethodError: no method matching pattern_uncall(::Type{B}, ::MLStyle.MatchImpl.ModuleBoundedEx2tf, ::Vector{Any}, ::Vector{Any}, ::SubArray{Any, 1, Vector{Any}, Tuple{UnitRange{Int64}}, true})
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

1 participant