Skip to content

Commit

Permalink
Avoid having to deal with macro name collisions
Browse files Browse the repository at this point in the history
  • Loading branch information
omus committed Aug 28, 2024
1 parent bb3654a commit cbe803c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/schemas.jl
Original file line number Diff line number Diff line change
Expand Up @@ -787,6 +787,8 @@ macro version(record_type, declared_fields_block=nothing)
if f isa LineNumberNode
continue
elseif f isa Expr && f.head === :macrocall && f.args[1] === Symbol("@check")
# Avoids having to import `@check`
f.args[1] = Expr(:., :Legolas, QuoteNode(f.args[1]))
# Expand `@check` macro here so that we can reliably see the location of
# the user define `@check` when it fails. Ideally `Meta.replace_sourceloc!`
# would do this for us.
Expand Down
2 changes: 1 addition & 1 deletion test/runtests.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using Compat: current_exceptions
using Legolas, Test, DataFrames, Arrow, UUIDs
using Legolas: @schema, @version, @check, SchemaVersion, SchemaVersionDeclarationError,
using Legolas: @schema, @version, SchemaVersion, SchemaVersionDeclarationError,
DeclaredFieldInfo
using Accessors
using Aqua
Expand Down

0 comments on commit cbe803c

Please sign in to comment.