-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Closed
Labels
macros@macros@macros
Description
I have the following MWE of my macro redefining hash on enums:
macro new_enum(T::Symbol, args...)
esc(quote
@enum $T $(args...)
function Base.hash(x::$T, h::UInt)
rand(UInt)
end
end)
end
However with the new world age semantics I get the following warning introduced in #57133:
julia> @new_enum Foo A B
WARNING: Detected access to binding `Main.Foo` in a world prior to its definition world.
Julia 1.12 has introduced more strict world age semantics for global bindings.
!!! This code may malfunction under Revise.
!!! This code will error in future versions of Julia.
Hint: Add an appropriate `invokelatest` around the access to this binding.
To make this warning an error, and hence obtain a stack trace, use `julia --depwarn=error`.
It seems it the x::$T
which causes the issue and I don't see how to use invokelatest
here?
Metadata
Metadata
Assignees
Labels
macros@macros@macros