Skip to content

Commit c6ce6e8

Browse files
authored
functor Base.Splat (#80)
1 parent f72c06e commit c6ce6e8

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

src/base.jl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@
1010
@functor Base.Fix2
1111
@functor Base.Broadcast.BroadcastFunction
1212

13+
@static if VERSION >= v"1.9"
14+
@functor Base.Splat
15+
end
16+
1317
@static if VERSION >= v"1.7"
1418
@functor Base.Returns
1519
end

test/base.jl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,12 @@ VERSION >= v"1.7" && @testset "Returns" begin
5656
@test Functors.functor(ret)[2]((value = 1:3,)) === Returns(1:3)
5757
end
5858

59+
VERSION >= v"1.9" && @testset "Splat" begin
60+
ret = Base.splat(Returns([0, pi, 2pi]))
61+
@test Functors.functor(ret)[1].f.value == [0, pi, 2pi]
62+
@test Functors.functor(ret)[2]((f = sin,)) === Base.splat(sin)
63+
end
64+
5965
@testset "LinearAlgebra containers" begin
6066
@test fmapstructure(identity, [1,2,3]') == (parent = [1, 2, 3],)
6167
@test fmapstructure(identity, transpose([1,2,3])) == (parent = [1, 2, 3],)

0 commit comments

Comments
 (0)