Skip to content

Commit 8e37323

Browse files
committed
fix FixedSizeArrays tests on v0.7
1 parent 77d051f commit 8e37323

File tree

5 files changed

+16
-8
lines changed

5 files changed

+16
-8
lines changed

src/FixedSizeArrays.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -111,20 +111,20 @@ macro fixed_vector(name, parent)
111111
# Array constructor
112112
@inline function (::Type{$(name){S}})(x::AbstractVector{T}) where {S, T}
113113
@assert S <= length(x)
114-
$(name){S, T}(ntuple(i-> x[i], Val{S}))
114+
$(name){S, T}(ntuple(i-> x[i], Val{S}()))
115115
end
116116
@inline function (::Type{$(name){S, T1}})(x::AbstractVector{T2}) where {S, T1, T2}
117117
@assert S <= length(x)
118-
$(name){S, T1}(ntuple(i-> T1(x[i]), Val{S}))
118+
$(name){S, T1}(ntuple(i-> T1(x[i]), Val{S}()))
119119
end
120120

121121
@inline function (::Type{$(name){S, T}})(x) where {S, T}
122-
$(name){S, T}(ntuple(i-> T(x), Val{S}))
122+
$(name){S, T}(ntuple(i-> T(x), Val{S}()))
123123
end
124124

125125

126126
@inline function (::Type{$(name){S}})(x::T) where {S, T}
127-
$(name){S, T}(ntuple(i-> x, Val{S}))
127+
$(name){S, T}(ntuple(i-> x, Val{S}()))
128128
end
129129
@inline function (::Type{$(name){1, T}})(x::T) where T
130130
$(name){1, T}((x,))

src/arraymath.jl

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,14 @@ end
3838

3939
# Also consider randcycle, randperm? Also faster rand!(staticarray, collection)
4040

41-
@inline rand(rng::AbstractRNG, ::Type{SA}) where {SA <: StaticArray} = _rand(rng, Size(SA), SA)
41+
@static if VERSION >= v"0.7.0-DEV.3406"
42+
using Random: SamplerType
43+
@inline rand(rng::AbstractRNG, ::Type{SA}, dims::Dims) where {SA <: StaticArray} = rand!(rng, Array{SA}(undef, dims), SA)
44+
@inline rand(rng::AbstractRNG, ::SamplerType{SA}) where {SA <: StaticArray} = _rand(rng, Size(SA), SA)
45+
else
46+
@inline rand(rng::AbstractRNG, ::Type{SA}) where {SA <: StaticArray} = _rand(rng, Size(SA), SA)
47+
end
48+
4249
@generated function _rand(rng::AbstractRNG, ::Size{s}, ::Type{SA}) where {s, SA <: StaticArray}
4350
T = eltype(SA)
4451
if T == Any

test/REQUIRE

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
SpecialFunctions

test/fixed_size_arrays.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -385,8 +385,8 @@ const unaryOps = (
385385

386386
trunc, round, ceil, floor,
387387
significand, lgamma,
388-
gamma, lfact, frexp, modf, airy, airyai,
389-
airyprime, airyaiprime, airybi, airybiprime,
388+
gamma, lfact, frexp, modf, airyai,
389+
airyaiprime, airybi, airybiprime,
390390
besselj0, besselj1, bessely0, bessely1,
391391
eta, zeta, digamma, real, imag
392392
)

test/runtests.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using StaticArrays, Compat, Compat.Test, Compat.Random, Compat.LinearAlgebra
1+
using StaticArrays, Compat, Compat.Test, Compat.Random, Compat.LinearAlgebra, SpecialFunctions
22
if VERSION > v"0.7-"
33
using InteractiveUtils
44
else

0 commit comments

Comments
 (0)