@@ -73,10 +73,6 @@ _maybe_projector(x) = x
7373_maybe_call (f:: ProjectTo , x) = f (x)
7474_maybe_call (f, x) = f
7575
76- # Used for elements of e.g. Array{Any}, trivial projector
77- _always_projector (x:: Union{AbstractArray, Number, Ref} ) = ProjectTo (x)
78- _always_projector (x) = ProjectTo ()
79-
8076"""
8177 ProjectTo(x)
8278
@@ -164,11 +160,11 @@ end
164160
165161# In other cases, store a projector per element:
166162function ProjectTo (xs:: AbstractArray )
167- elements = map (_always_projector , xs)
163+ elements = map (ProjectTo , xs)
168164 if elements isa AbstractArray{<: ProjectTo{<:AbstractZero} }
169165 return ProjectTo {NoTangent} () # short-circuit if all elements project to zero
170- elseif elements isa AbstractArray{<: ProjectTo{Any} }
171- return ProjectTo {AbstractArray} (; element= ProjectTo (), axes= axes (xs)) # ... or all identity projection
166+ # elseif elements isa AbstractArray{<:ProjectTo{Any}}
167+ # return ProjectTo{AbstractArray}(; element=ProjectTo(), axes=axes(xs)) # ... or all identity projection
172168 else
173169 # Arrays of arrays come here, and will apply projectors individually:
174170 return ProjectTo {AbstractArray} (; elements= elements, axes= axes (xs))
@@ -208,7 +204,7 @@ function (project::ProjectTo{AbstractArray})(dx::Number) # ... so we restore fro
208204end
209205
210206# Ref -- works like a zero-array, also allows restoration from a number:
211- ProjectTo (x:: Ref ) = ProjectTo {Ref} (; x = _always_projector (x[]))
207+ ProjectTo (x:: Ref ) = ProjectTo {Ref} (; x = ProjectTo (x[]))
212208(project:: ProjectTo{Ref} )(dx:: Ref ) = Ref (project. x (dx[]))
213209(project:: ProjectTo{Ref} )(dx:: Number ) = Ref (project. x (dx))
214210
0 commit comments