Skip to content

Commit

Permalink
Defining size on UnionAll types associated with MultiValues
Browse files Browse the repository at this point in the history
  • Loading branch information
fverdugo committed Jun 16, 2019
1 parent 78d4982 commit 188adca
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/TensorValues.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module TensorValues

using StaticArrays
using Base: @propagate_inbounds
using Base: @propagate_inbounds, @pure

export MultiValue
export TensorValue
Expand Down
6 changes: 6 additions & 0 deletions src/Types.jl
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,12 @@ function size(::Type{MultiValue{S,T,N,L}}) where {S,T,N,L}
size(A)
end

function size(::Type{<:MultiValue{S}}) where S
_s(Size(S))
end

@pure _s(s::Size{T}) where T = T

# Custom type printing

function show(io::IO,v::MultiValue)
Expand Down
1 change: 1 addition & 0 deletions test/TypesTests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ V = VectorValue{3,Int}

V = VectorValue{3}
@test length(V) == 3
@test size(V) == (3,)

# Custom type printing

Expand Down

0 comments on commit 188adca

Please sign in to comment.