Skip to content

Commit e9bf29d

Browse files
committed
Update
1 parent 5497ee8 commit e9bf29d

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

src/FileFormats/NL/read.jl

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -250,10 +250,7 @@ function _try_scalar_affine_function(expr::Expr)
250250
if expr.args[1] == :+
251251
args = _try_scalar_affine_function.(expr.args[2:end])
252252
if !any(isnothing, args)
253-
if length(args) == 1
254-
return only(args)
255-
end
256-
return +(0.0, args...)
253+
return MOI.Utilities.operate(+, Float64, args...)
257254
end
258255
elseif expr.args[1] == :*
259256
args = _try_scalar_affine_function.(expr.args[2:end])
@@ -263,10 +260,7 @@ function _try_scalar_affine_function(expr::Expr)
263260
n_affine_terms += arg isa MOI.ScalarAffineFunction{Float64}
264261
end
265262
if n_affine_terms <= 1
266-
if length(args) == 1
267-
return only(args)
268-
end
269-
return *(args...)
263+
return MOI.Utilities.operate(*, Float64, args...)
270264
end
271265
end
272266
return nothing

0 commit comments

Comments
 (0)