Skip to content

Commit

Permalink
Improved error messages during the lowering of match/matchcontinue (#57)
Browse files Browse the repository at this point in the history
  • Loading branch information
JKRT committed Jan 6, 2022
1 parent 1770d6a commit 2e59272
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/matchcontinue.jl
Original file line number Diff line number Diff line change
Expand Up @@ -178,11 +178,12 @@ function handle_destruct(value::Symbol, pattern, bound::Set{Symbol}, asserts::Ve
#= NONE is a function. However, we treat it a bit special=#
if $(esc(T)) !== NONE && typeof($(esc(T))) <: Function
func = $(esc(T))
throw(LoadError("Attempted to match on a function", @__LINE__,
file = @__FILE__
throw(LoadError("Attempted to match on a function at $(file)", @__LINE__,
AssertionError("Incorrect match usage attempted to match on: $func")))
end
if !(isstructtype(typeof($(esc(T)))) || issabstracttype(typeof($(esc(T)))))
throw(LoadError("Attempted to match on a pattern that is not a struct",
throw(LoadError("Attempted to match on a pattern that is not a struct at $(file)",
@__LINE__,
AssertionError("Incorrect match usage. Attempted to match on a pattern that is not a struct")))
end
Expand Down

0 comments on commit 2e59272

Please sign in to comment.