Skip to content

Commit

Permalink
Use parameters in union
Browse files Browse the repository at this point in the history
  • Loading branch information
Tortar authored Sep 26, 2024
1 parent 189f19a commit 26e935c
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/HybridStructs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,12 @@ function _hybrid(expr)
end
end

union_struct = :(const $struct_name = Union{$struct_name_mut, $struct_name_immut})
if type_params == []
union_struct = :(const $struct_name = Union{$struct_name_immut, $struct_name_mut})
else
union_struct = :(const $struct_name = Union{$struct_name_immut{$(type_params...)}, $struct_name_mut{$(type_params...)}}
where {$(type_params...)})
end

return quote
if !(@isdefined $abstract_struct_name_mut) && $(namify(abstract_type)) != Any
Expand Down Expand Up @@ -97,4 +102,4 @@ end

include("precompile.jl")

end
end

0 comments on commit 26e935c

Please sign in to comment.