Skip to content

Commit 88e2e13

Browse files
committed
Fix typo and test
1 parent 9285d05 commit 88e2e13

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

src/code.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,12 +111,12 @@ const NaNMathFuns = (
111111
:log1p,
112112
:sqrt,
113113
)
114-
function function_to_expr(op, args, st)
115-
(op isa Function && (name = nameof(op)) in NaNMathFuns) && return nothing
114+
function function_to_expr(op, O, st)
115+
(op isa Function && (name = nameof(op)) in NaNMathFuns) || return nothing
116116
fun = GlobalRef(NaNMath, name)
117117
args = map(Base.Fix2(toexpr, st), arguments(O))
118118
expr = Expr(:call, fun)
119-
expr.args = args
119+
append!(expr.args, args)
120120
return expr
121121
end
122122

test/code.jl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,10 @@ test_repr(a, b) = @test repr(Base.remove_linenums!(a)) == repr(Base.remove_linen
189189
f = eval(toexpr(Func([a+b], [], a+b)))
190190
@test f(1) == 1
191191
@test f(2) == 2
192+
193+
f = eval(toexpr(Func([a, b], [], sqrt(a - b))))
194+
@test isnan(f(0, 10))
195+
@test f(10, 2) sqrt(8)
192196
end
193197

194198
let

0 commit comments

Comments
 (0)