From cbe803c66b2a39f43631f843c31e03864a6ccdf7 Mon Sep 17 00:00:00 2001 From: Curtis Vogt Date: Wed, 28 Aug 2024 14:15:17 -0500 Subject: [PATCH] Avoid having to deal with macro name collisions --- src/schemas.jl | 2 ++ test/runtests.jl | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/schemas.jl b/src/schemas.jl index cecf2f7..a77b8b3 100644 --- a/src/schemas.jl +++ b/src/schemas.jl @@ -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. diff --git a/test/runtests.jl b/test/runtests.jl index efb959b..f969428 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -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