File tree Expand file tree Collapse file tree 3 files changed +13
-2
lines changed Expand file tree Collapse file tree 3 files changed +13
-2
lines changed Original file line number Diff line number Diff line change 1
1
name = " ParameterHandling"
2
2
uuid = " 2412ca09-6db7-441c-8e3a-88d5709968c5"
3
3
authors = [" Invenia Technical Computing Corporation" ]
4
- version = " 0.4.7 "
4
+ version = " 0.4.8 "
5
5
6
6
[deps ]
7
7
ChainRulesCore = " d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4"
Original file line number Diff line number Diff line change @@ -19,9 +19,15 @@ function flatten end
19
19
20
20
flatten (x) = flatten (Float64, x)
21
21
22
+ function flatten (:: Type{T} , :: Nothing ) where {T<: Real }
23
+ v = T[]
24
+ unflatten_to_Nothing (:: Vector{T} ) = nothing
25
+ return v, unflatten_to_Nothing
26
+ end
27
+
22
28
function flatten (:: Type{T} , x:: Integer ) where {T<: Real }
23
29
v = T[]
24
- unflatten_to_Integer (v :: Vector{T} ) = x
30
+ unflatten_to_Integer (:: Vector{T} ) = x
25
31
return v, unflatten_to_Integer
26
32
end
27
33
Original file line number Diff line number Diff line change 8
8
end
9
9
end
10
10
11
+ @testset " Nothing" begin
12
+ test_flatten_interface (nothing )
13
+ @test isempty (first (flatten (nothing )))
14
+ end
15
+
11
16
@testset " AbstractArrays" begin
12
17
test_flatten_interface (randn (10 ))
13
18
test_flatten_interface (randn (5 , 4 ))
You can’t perform that action at this time.
0 commit comments