Skip to content

Commit

Permalink
BUG: Invalid constructor for static multi(co)spans.
Browse files Browse the repository at this point in the history
  • Loading branch information
epatters committed Sep 23, 2020
1 parent ccbbc79 commit 599f9b0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/categorical_algebra/FreeDiagrams.jl
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ end
const SMultispan{N,Ob} = Multispan{Ob,<:StaticVector{N}}

SMultispan(legs...) = Multispan(SVector(legs...))
SMultispan{N}(legs::Vararg{T,N}) where {T,N} = Multispan(SVector(legs...))
SMultispan{N}(legs...) where N = Multispan(SVector{N}(legs...))
SMultispan{0}(apex) = Multispan(apex, SVector{0,Any}())

""" Span of morphims in a category.
Expand Down Expand Up @@ -110,7 +110,7 @@ end
const SMulticospan{N,Ob} = Multicospan{Ob,<:StaticVector{N}}

SMulticospan(legs...) = Multicospan(SVector(legs...))
SMulticospan{N}(legs::Vararg{T,N}) where {T,N} = Multicospan(SVector(legs...))
SMulticospan{N}(legs...) where N = Multicospan(SVector{N}(legs...))
SMulticospan{0}(base) = Multicospan(base, SVector{0,Any}())

""" Cospan of morphisms in a category.
Expand Down
6 changes: 6 additions & 0 deletions test/categorical_algebra/FreeDiagrams.jl
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ span = Span(f,g)
@test left(span) == f
@test right(span) == g

f = Hom(:f, A, A)
@test legs(Span(id(A), f)) == [id(A),f]

f = Hom(:f, A, B)
@test_throws ErrorException Span(f,g)

Expand All @@ -68,6 +71,9 @@ cospan = Cospan(f,g)
@test left(cospan) == f
@test right(cospan) == g

f = Hom(:f, A, A)
@test legs(Cospan(f, id(A))) == [f,id(A)]

f = Hom(:f, A ,B)
@test_throws ErrorException Cospan(f,g)

Expand Down

0 comments on commit 599f9b0

Please sign in to comment.