Skip to content

Commit

Permalink
Help type inference and reduce invalidation possibilities
Browse files Browse the repository at this point in the history
Duplicates improvement made to Base's Enums: JuliaLang/julia#37163
  • Loading branch information
jmert committed Sep 9, 2020
1 parent 5879cbd commit c9dbe16
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/BitFlags.jl
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ julia> instances(Items)
(apple::Items = 0x00000001, fork::Items = 0x00000002, napkin::Items = 0x00000004)
```
"""
macro bitflag(T, syms...)
macro bitflag(T::Union{Symbol,Expr}, syms...)
if isempty(syms)
throw(ArgumentError("no arguments given for BitFlag $T"))
end
Expand All @@ -141,7 +141,7 @@ macro bitflag(T, syms...)
elseif !isa(T, Symbol)
throw(ArgumentError("invalid type expression for bit flag $T"))
end
values = basetype[]
values = Vector{basetype}()
seen = Set{Symbol}()
namemap = Vector{Tuple{basetype,Symbol}}()
lo = hi = zero(basetype)
Expand Down

0 comments on commit c9dbe16

Please sign in to comment.