Skip to content

Commit 9ef732c

Browse files
authored
Fix code generation
1 parent 8c8bd25 commit 9ef732c

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/HybridStructs.jl

+7-2
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,13 @@ function _hybrid(expr)
4242
abstract_struct_name_mut = Symbol(abstract_struct_name, :_Mut)
4343
abstract_struct_name_immut = Symbol(abstract_struct_name, :_Immut)
4444

45-
abstract_struct_mut = abstract_type == :(Any) ? :(Any) : (:($abstract_struct_name_mut{$(abstract_type_params...)}))
46-
abstract_struct_immut = abstract_type == :(Any) ? :(Any) : (:($abstract_struct_name_immut{$(abstract_type_params...)}))
45+
if abstract_type_params == []
46+
abstract_struct_mut = abstract_type == :(Any) ? :(Any) : (:($abstract_struct_name_mut))
47+
abstract_struct_immut = abstract_type == :(Any) ? :(Any) : (:($abstract_struct_name_immut))
48+
else
49+
abstract_struct_mut = abstract_type == :(Any) ? :(Any) : (:($abstract_struct_name_mut{$(abstract_type_params...)}))
50+
abstract_struct_immut = abstract_type == :(Any) ? :(Any) : (:($abstract_struct_name_immut{$(abstract_type_params...)}))
51+
end
4752

4853
struct_mut = :(mutable struct $struct_name_mut{$(type_params...)} <: $abstract_struct_mut
4954
$(expr.args[3].args...)

0 commit comments

Comments
 (0)