@@ -147,17 +147,15 @@ function to_parent_dims(::Type{T}, ::StaticInt{dim}) where {T,dim}
147
147
end
148
148
end
149
149
150
- _nunderscore (:: Val{N} ) where {N} = ntuple (Compat. Returns (:_ ), Val (N))
151
-
152
150
"""
153
151
has_dimnames(::Type{T}) -> StaticBool
154
152
155
153
Returns `static(true)` if `x` has on or more named dimensions. If all dimensions correspond
156
154
to `static(:_)`, then `static(false)` is returned.
157
155
"""
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
161
159
162
160
"""
163
161
known_dimnames(::Type{T}) -> Tuple{Vararg{Union{Symbol,Nothing}}}
@@ -170,7 +168,7 @@ have a name.
170
168
known_dimnames (x) = known_dimnames (typeof (x))
171
169
known_dimnames (:: Type{T} ) where {T} = _known_dimnames (T, parent_type (T))
172
170
_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))
174
172
_unknown_dimnames (:: Any ) = (:_ ,)
175
173
function _known_dimnames (:: Type{C} , :: Type{P} ) where {C,P}
176
174
eachop (_inbounds_known_dimname, to_parent_dims (C), known_dimnames (P))
0 commit comments