Skip to content

Commit 8c8a5ca

Browse files
committed
remove return
1 parent 80342bf commit 8c8a5ca

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

src/util.jl

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -40,20 +40,22 @@ end
4040

4141
# Something doesn't match up type wise
4242
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])"))
43+
(!isa(Size, DataType) || (Size.name !== Tuple.name)) && throw(ArgumentError("Static Array parameter Size must be a Tuple type, got $Size"))
44+
!isa(T, Type) && throw(ArgumentError("Static Array parameter T must be a type, got $T"))
45+
!isa(N.parameters[1], Int) && throw(ArgumenError("Static Array parameter N must be an integer, got $(N.parameters[1])"))
46+
!isa(L.parameters[1], Int) && throw(ArgumentError("Static Array parameter L must be an integer, got $(L.parameters[1])"))
4747
# shouldn't reach here. Anything else should have made it to the function below
48-
return error("Internal error. Please file a bug")
48+
error("Internal error. Please file a bug")
4949
end
5050

51-
function check_array_parameters{Size,T,N,L}(::Type{Size}, ::Type{T}, ::Type{Val{N}}, ::Type{Val{L}})
51+
@generated function check_array_parameters{Size,T,N,L}(::Type{Size}, ::Type{T}, ::Type{Val{N}}, ::Type{Val{L}})
5252
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}`).")))
5454
end
55+
5556
if L != tuple_prod(Size) || L < 0 || tuple_minimum(Size) < 0 || tuple_length(Size) != N
56-
return throw(ArgumentError("Size mismatch in Static Array parameters. Got size $Size, dimension $N and length $L."))
57+
return :(throw(ArgumentError("Size mismatch in Static Array parameters. Got size $Size, dimension $N and length $L.")))
5758
end
59+
5860
return nothing
5961
end

0 commit comments

Comments
 (0)