|
39 | 39 | @pure tuple_minimum(T::Tuple) = minimum(T)
|
40 | 40 |
|
41 | 41 | # Something doesn't match up type wise
|
42 |
| -@generated function check_array_parameters(Size, T, N, L) |
43 |
| - (!isa(Size, DataType) || (Size.name !== Tuple.name)) && return :(throw(ArgumentError("Static Array parameter Size must be a Tuple type, got $Size"))) |
44 |
| - !isa(T, Type) && return :(throw(ArgumentError("Static Array parameter T must be a type, got $T"))) |
45 |
| - !isa(N.parameters[1], Int) && return :(throw(ArgumenError("Static Array parameter N must be an integer, got $(N.parameters[1])"))) |
46 |
| - !isa(L.parameters[1], Int) && return :(throw(ArgumentError("Static Array parameter L must be an integer, got $(L.parameters[1])"))) |
| 42 | +function check_array_parameters(Size, T, N, L) |
| 43 | + (!isa(Size, DataType) || (Size.name !== Tuple.name)) && return throw(ArgumentError("Static Array parameter Size must be a Tuple type, got $Size")) |
| 44 | + !isa(T, Type) && return throw(ArgumentError("Static Array parameter T must be a type, got $T")) |
| 45 | + !isa(N.parameters[1], Int) && return throw(ArgumenError("Static Array parameter N must be an integer, got $(N.parameters[1])")) |
| 46 | + !isa(L.parameters[1], Int) && return throw(ArgumentError("Static Array parameter L must be an integer, got $(L.parameters[1])")) |
47 | 47 | # shouldn't reach here. Anything else should have made it to the function below
|
48 |
| - return :(error("Internal error. Please file a bug")) |
| 48 | + return error("Internal error. Please file a bug") |
49 | 49 | end
|
50 | 50 |
|
51 |
| -@generated function check_array_parameters{Size,T,N,L}(::Type{Size}, ::Type{T}, ::Type{Val{N}}, ::Type{Val{L}}) |
| 51 | +function check_array_parameters{Size,T,N,L}(::Type{Size}, ::Type{T}, ::Type{Val{N}}, ::Type{Val{L}}) |
52 | 52 | if !all(x->isa(x, Int), Size.parameters)
|
53 |
| - return :(throw(ArgumentError("Static Array parameter Size must be a tuple of Ints (e.g. `SArray{Tuple{3,3}}` or `SMatrix{3,3}`)."))) |
| 53 | + return throw(ArgumentError("Static Array parameter Size must be a tuple of Ints (e.g. `SArray{Tuple{3,3}}` or `SMatrix{3,3}`).")) |
54 | 54 | end
|
55 |
| - |
56 | 55 | if L != tuple_prod(Size) || L < 0 || tuple_minimum(Size) < 0 || tuple_length(Size) != N
|
57 |
| - return :(throw(ArgumentError("Size mismatch in Static Array parameters. Got size $Size, dimension $N and length $L."))) |
| 56 | + return throw(ArgumentError("Size mismatch in Static Array parameters. Got size $Size, dimension $N and length $L.")) |
58 | 57 | end
|
59 |
| - |
60 | 58 | return nothing
|
61 | 59 | end
|
0 commit comments