Skip to content

Commit 28f86cb

Browse files
committed
Only promote type when needed
1 parent 79f8063 commit 28f86cb

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/Equation.jl

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -147,9 +147,11 @@ Apply binary operator `op` (enumerating over the order given) to `Node`s `l` and
147147
"""
148148
function Node(op::Int, l::Node{T1}, r::Node{T2}) where {T1,T2}
149149
# Get highest type:
150-
T = promote_type(T1, T2)
151-
l = convert(Node{T}, l)
152-
r = convert(Node{T}, r)
150+
if T1 != T2
151+
T = promote_type(T1, T2)
152+
l = convert(Node{T}, l)
153+
r = convert(Node{T}, r)
154+
end
153155
return Node(2, false, nothing, 0, op, l, r)
154156
end
155157

0 commit comments

Comments
 (0)