You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
original = :(($(_originaltype(type)))($(_fieldnames(type)...)))
44
+
original = :(($(_originaltype_parameterized(type)))($(_fieldnames(type)...)))
45
+
#:($variant => begin $(Expr(:call, call, preargs..., original, postargs...)); nothing end) # useful when you are searching for type instabilities due to inconsistent output types for a method (usually also pointing to a method not following the conventions of the API)
return :( CompactifiedGate(g::$(_header(type))) = CompactifiedGate'.$(_symbol(type))($([:(g.$n) for n in_fieldnames(type)]...)) )
96
100
else
97
-
#return :( CompactifiedGate(g::$(_header(type))) = (@warn "The operation is of a type that can not be unified, defaulting to slower runtime dispatch" typeof(g); return g) )
98
-
return :()
101
+
return :() # this is taken care of by a default constructor that also warns about the failure to compactify
99
102
end
100
103
end
101
104
@@ -135,15 +138,21 @@ function make_all_sumtype_infrastructure_expr(t::DataType, callsigs)
135
138
push!(concrete_types, ut) # fallback
136
139
end
137
140
sumtype =make_sumtype(concrete_types)
141
+
@debug"compiling a total of $(length(concrete_types)) concrete types"
methods = [make_sumtype_method(concrete_types, call, preargs, postargs) for (call, preargs, postargs) in callsigs]
144
+
modulename =gensym(:CompactifiedGate)
140
145
returnquote
146
+
#module $(modulename)
147
+
#using QuantumClifford
148
+
#import QuantumClifford: CompactifiedGate, # todo
141
149
$(concretifier_workarounds_types...)
142
150
$(sumtype.args...) # defining the sum type
143
151
$(constructors...) # creating constructors for the sumtype which turn our concrete types into instance of the sum type
144
152
$(concretifier_additional_constructors...) # creating constructors for the newly generated "workaround" concrete types
145
-
:(CompactifiedGate(g::AbstractOperation) = (@warn"The operation is of a type that can not be unified, defaulting to slower runtime dispatch"typeof(g); return g) )
153
+
:(CompactifiedGate(g::AbstractOperation) = (@warn"The operation is of a type that can not be unified, defaulting to slower runtime dispatch"typeof(g); return g) )
0 commit comments