Skip to content

Commit 77b9ecf

Browse files
committed
undo #17318 workaround, add more constant-folding tests
1 parent 319a01a commit 77b9ecf

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

test/broadcast.jl

+4-2
Original file line numberDiff line numberDiff line change
@@ -170,10 +170,10 @@ rt = Base.return_types(broadcast!, Tuple{Function, Array{Float64, 3}, Array{Floa
170170
@test length(rt) == 1 && rt[1] == Array{Float64, 3}
171171

172172
# f.(args...) syntax (#15032)
173-
let x = [1,3.2,4.7], y = [3.5, pi, 1e-4], α = 0.2342, n = 3
173+
let x = [1,3.2,4.7], y = [3.5, pi, 1e-4], α = 0.2342
174174
@test sin.(x) == broadcast(sin, x)
175175
@test sin.(α) == broadcast(sin, α)
176-
@test factorial.(n) == broadcast(factorial, n)
176+
@test factorial.(3) == broadcast(factorial, 3)
177177
@test atan2.(x, y) == broadcast(atan2, x, y)
178178
@test atan2.(x, y') == broadcast(atan2, x, y')
179179
@test atan2.(x, α) == broadcast(atan2, x, α)
@@ -220,6 +220,7 @@ end
220220
let x = sin.(1:10)
221221
@test atan2.((x->x+1).(x), (x->x+2).(x)) == atan2(x+1, x+2) == atan2(x.+1, x.+2)
222222
@test sin.(atan2.([x+1,x+2]...)) == sin.(atan2.(x+1,x+2))
223+
@test sin.(atan2.(x, 3.7)) == broadcast(x -> sin(atan2(x,3.7)), x)
223224
@test atan2.(x, 3.7) == broadcast(x -> atan2(x,3.7), x) == broadcast(atan2, x, 3.7)
224225
end
225226
# Use side effects to check for loop fusion. Note that, due to #17314,
@@ -236,6 +237,7 @@ let x = sin.(1:10), a = [x]
236237
@test atan2.(x, cos.(x)) == atan2.(a..., cos.(x)) == atan2(x, cos.(a...)) == atan2(a..., cos.(a...))
237238
@test ((args...)->cos(args[1])).(x) == cos.(x) == ((y,args...)->cos(y)).(x)
238239
end
240+
@test atan2.(3,4) == atan2(3,4) == (() -> atan2(3,4)).()
239241

240242
# PR 16988
241243
@test Base.promote_op(+, Bool) === Int

0 commit comments

Comments
 (0)