Skip to content

Commit 104ee17

Browse files
committed
Make JET happy
1 parent 0ab15a5 commit 104ee17

File tree

1 file changed

+18
-13
lines changed

1 file changed

+18
-13
lines changed

src/product.jl

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Deligne tensor product of different sectors: ⊠
22
#------------------------------------------------------------------------------#
3-
const SectorTuple = Tuple{Vararg{Sector}}
3+
const SectorTuple = Tuple{Sector, Vararg{Sector}}
44
const SectorNamedTuple = NamedTuple{<:Any, <:SectorTuple}
55
const AnySectorTuple = Union{SectorTuple, SectorNamedTuple}
66

@@ -35,17 +35,22 @@ ProductSector{NamedTuple{K, V}}(x::Tuple) where {K, V} = ProductSector{NamedTupl
3535
const TupleProductSector{T <: SectorTuple} = ProductSector{T}
3636
const NamedProductSector{T <: SectorTuple} = ProductSector{<:NamedTuple{<:Any, T}}
3737

38-
TupleProductSector(s::NamedProductSector) = ProductSector(values(s.sectors))
38+
TupleProductSector(s::NamedProductSector) = ProductSector(values(Tuple(s)))
3939

4040
Base.Tuple(a::ProductSector) = Tuple(a.sectors)
4141

42-
Base.getindex(s::ProductSector, i::Int) = getindex(s.sectors, i)
43-
Base.length(s::ProductSector) = length(s.sectors)
44-
Base.iterate(s::ProductSector, args...) = iterate(s.sectors, args...)
42+
Base.getindex(s::ProductSector, i::Int) = getindex(Tuple(s), i)
43+
Base.length(s::ProductSector) = length(Tuple(s))
44+
Base.iterate(s::ProductSector, args...) = iterate(Tuple(s), args...)
4545
Base.indexed_iterate(s::ProductSector, args...) = Base.indexed_iterate(s.sectors, args...)
4646

47-
Base.@constprop :aggressive function Base.getproperty(s::NamedProductSector, f::Symbol)
48-
return f === :sectors ? getfield(s, f) : getproperty(s.sectors, f)
47+
Base.@constprop :aggressive function Base.getproperty(s::ProductSector{<:NamedTuple}, f::Symbol)
48+
sectors = getfield(s, :sectors)
49+
if f === :sectors
50+
return sectors
51+
else
52+
return getproperty(sectors, f)
53+
end
4954
end
5055
Base.propertynames(s::NamedProductSector) = (:sectors, propertynames(fieldtype(typeof(s), :sectors))...)
5156

@@ -111,8 +116,8 @@ function Nsymbol(a::P, b::P, c::P) where {P <: ProductSector}
111116
return prod(map(Nsymbol, a.sectors, b.sectors, c.sectors))
112117
end
113118

114-
_firstsector(x::ProductSector) = x.sectors[1]
115-
_tailsector(x::ProductSector) = ProductSector(Base.tail(Tuple(x.sectors)))
119+
_firstsector(x::ProductSector) = Base.first(Tuple(x))
120+
_tailsector(x::ProductSector) = ProductSector(Base.tail(Tuple(x)))
116121

117122
function Fsymbol(a::P, b::P, c::P, d::P, e::P, f::P) where {P <: ProductSector}
118123
heads = map(_firstsector, (a, b, c, d, e, f))
@@ -210,8 +215,8 @@ function Asymbol(a::P, b::P, c::P) where {P <: ProductSector}
210215
end
211216
end
212217

213-
frobenius_schur_phase(p::ProductSector) = prod(frobenius_schur_phase, p.sectors)
214-
frobenius_schur_indicator(p::ProductSector) = prod(frobenius_schur_indicator, p.sectors)
218+
frobenius_schur_phase(p::ProductSector) = prod(frobenius_schur_phase, Tuple(p))
219+
frobenius_schur_indicator(p::ProductSector) = prod(frobenius_schur_indicator, Tuple(p))
215220

216221
function fusiontensor(a::P, b::P, c::P) where {P <: ProductSector}
217222
heads = map(_firstsector, (a, b, c))
@@ -305,7 +310,7 @@ Base.@assume_effects :foldable function _deligneproduct_impl(
305310
end
306311

307312
function Base.show(io::IO, P::TupleProductSector)
308-
sectors = P.sectors
313+
sectors = Tuple(P)
309314
compact = get(io, :typeinfo, nothing) === typeof(P)
310315
sep = compact ? ", " : ""
311316
print(io, "(")
@@ -396,7 +401,7 @@ See Julia issues #29988, #29428, #22363, #28983.
396401
Base.show(io::IO, P::Type{<:ProductSector}) = print(io, type_repr(P))
397402
==============================================================================#
398403
function Base.show(io::IO, P::ProductSector{T}) where {T <: Tuple{Vararg{AbstractIrrep}}}
399-
sectors = P.sectors
404+
sectors = Tuple(P)
400405
get(io, :typeinfo, nothing) === typeof(P) || print(io, type_repr(typeof(P)))
401406
print(io, "(")
402407
for i in 1:length(sectors)

0 commit comments

Comments
 (0)