Skip to content

Commit 71330a9

Browse files
authored
Use parameters in union (#3)
1 parent 189f19a commit 71330a9

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/HybridStructs.jl

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,11 @@ function _hybrid(expr)
6969
end
7070
end
7171

72-
union_struct = :(const $struct_name = Union{$struct_name_mut, $struct_name_immut})
72+
if type_params == []
73+
union_struct = :(const $struct_name = Union{$struct_name_immut, $struct_name_mut})
74+
else
75+
union_struct = :(const $struct_name = Union{$struct_name_immut{$(type_params...)}, $struct_name_mut{$(type_params...)}} where {$(type_params...)})
76+
end
7377

7478
return quote
7579
if !(@isdefined $abstract_struct_name_mut) && $(namify(abstract_type)) != Any
@@ -97,4 +101,4 @@ end
97101

98102
include("precompile.jl")
99103

100-
end
104+
end

0 commit comments

Comments
 (0)