@@ -147,17 +147,15 @@ function to_parent_dims(::Type{T}, ::StaticInt{dim}) where {T,dim}
147147 end
148148end
149149
150- _nunderscore (:: Val{N} ) where {N} = ntuple (Compat. Returns (:_ ), Val (N))
151-
152150"""
153151 has_dimnames(::Type{T}) -> StaticBool
154152
155153Returns `static(true)` if `x` has on or more named dimensions. If all dimensions correspond
156154to `static(:_)`, then `static(false)` is returned.
157155"""
158- Compat . @constprop :aggressive has_dimnames (x) = static ( _is_named ( known_dimnames (x)) )
159- _is_named (x :: NTuple{N,Symbol} ) where {N} = x != = _nunderscore ( Val (N ))
160- _is_named ( :: Any ) = true
156+ @inline function has_dimnames (x)
157+ static ( known_dimnames (x) != = ntuple (Compat . Returns ( :_ ), Val (ndims (x)) ))
158+ end
161159
162160"""
163161 known_dimnames(::Type{T}) -> Tuple{Vararg{Union{Symbol,Nothing}}}
@@ -170,7 +168,7 @@ have a name.
170168known_dimnames (x) = known_dimnames (typeof (x))
171169known_dimnames (:: Type{T} ) where {T} = _known_dimnames (T, parent_type (T))
172170_known_dimnames (:: Type{T} , :: Type{T} ) where {T} = _unknown_dimnames (Base. IteratorSize (T))
173- _unknown_dimnames (:: Base.HasShape{N} ) where {N} = _nunderscore ( Val (N))
171+ _unknown_dimnames (:: Base.HasShape{N} ) where {N} = ntuple (Compat . Returns ( :_ ), Val (N))
174172_unknown_dimnames (:: Any ) = (:_ ,)
175173function _known_dimnames (:: Type{C} , :: Type{P} ) where {C,P}
176174 eachop (_inbounds_known_dimname, to_parent_dims (C), known_dimnames (P))
0 commit comments