Skip to content

Commit

Permalink
Fix wrong argument checking in @constfield macro
Browse files Browse the repository at this point in the history
  • Loading branch information
Seelengrab committed Jul 15, 2023
1 parent a52b59b commit 8272656
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/util.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ A macro providing compatibility for `const` fields in mutable structs.
Gives a `const` `Expr` if supported, otherwise is a noop and just returns the field.
"""
macro constfield(ex::Expr)
ex.head != :(::) || length(ex.args) != 2 || throw(ArgumentError("`@constfield` only supports expressions of the form `field::Type`!"))
(ex.head == Symbol("::") && length(ex.args) == 2) || throw(ArgumentError("`@constfield` only supports expressions of the form `field::Type`!"))
ex = esc(ex)
if VERSION < v"1.8"
ex
Expand Down

0 comments on commit 8272656

Please sign in to comment.