How to nest the 2 macros? If I have both AutoHashEquals.@auto_hash_equals
& Parameters.@with_kw
applied onto a type definition. Either @auto_hash_equals @with_kw
or @with_kw @auto_hash_equals
is not working:
julia> @auto_hash_equals(@with_kw struct AAA
a::String
b
c = [1, 1, 1]
end)
ERROR: LoadError: AssertionError: typ.head == :type || typ.head == :struct
Stacktrace:
[1] @auto_hash_equals(::LineNumberNode, ::Module, ::Any) at /Users/xxx/.julia/packages/AutoHashEquals/tDuUH/src/AutoHashEquals.jl:67
in expression starting at REPL[3]:1
julia> @with_kw(@auto_hash_equals struct AAA
a::String
b
c = [1, 1, 1]
end)
ERROR: LoadError: Only works on type-defs or named tuples.
Make sure to have a space after `@with_kw`, e.g. `@with_kw (a=1,)
Also, make sure to use a trailing comma for single-field NamedTuples.
Stacktrace:
[1] error(::String) at ./error.jl:33
[2] with_kw(::Expr, ::Module, ::Bool) at /Users/xxx/.julia/packages/Parameters/l76EM/src/Parameters.jl:307
[3] @with_kw(::LineNumberNode, ::Module, ::Any) at /Users/xxx/.julia/packages/Parameters/l76EM/src/Parameters.jl:631
in expression starting at REPL[4]:100