Skip to content

Commit cc67894

Browse files
committed
Update Mul constructor
1 parent 94f7ef1 commit cc67894

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

src/types.jl

+6-8
Original file line numberDiff line numberDiff line change
@@ -320,20 +320,18 @@ function _Add(::Type{T}, coeff, dict; kwargs...) where {T}
320320
BasicSymbolic{T}(; impl, kwargs...)
321321
end
322322

323-
function Mul(T, a, b; metadata=NO_METADATA, kw...)
324-
isempty(b) && return a
325-
if _isone(a) && length(b) == 1
326-
pair = first(b)
323+
function _Mul(::Type{T}, coeff, dict; kwargs...) where {T}
324+
isempty(dict) && return coeff
325+
if _isone(coeff) && length(dict) == 1
326+
pair = first(dict)
327327
if _isone(last(pair)) # first value
328328
return first(pair)
329329
else
330330
return unstable_pow(first(pair), last(pair))
331331
end
332-
else
333-
coeff = a
334-
dict = b
335-
Mul{T}(; coeff, dict, hash=Ref(UInt(0)), metadata, arguments=[], issorted=RefValue(false), kw...)
336332
end
333+
impl = Mul(; coeff, dict)
334+
BasicSymbolic{T}(; impl, kwargs...)
337335
end
338336

339337
const Rat = Union{Rational, Integer}

0 commit comments

Comments
 (0)