Skip to content

Commit d324782

Browse files
authored
Shorten explination
1 parent 50a1156 commit d324782

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

src/projection.jl

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -146,14 +146,11 @@ ProjectTo(x::Complex{<:Integer}) = ProjectTo(float(x))
146146
(::ProjectTo{T})(dx::AbstractFloat) where T<:AbstractFloat = convert(T, dx)
147147
(::ProjectTo{T})(dx::Integer) where T<:AbstractFloat = convert(T, dx) #needed to avoid ambiguity
148148

149-
# We asked for a number/real and they gave use one. We did ask for a particular concrete
150-
# type, but that is just for the preserving low precision floats, which is handled above.
151-
# Any Number/Real actually occupies the same subspace, so we can trust them.
152-
# In particular, this makes weirder Real subtypes that are not simply the values like
153-
# ForwardDiff.Dual and Symbolics.Sym work, because we stay out of their way.
149+
# Other numbers, including e.g. ForwardDiff.Dual and Symbolics.Sym, should pass through.
150+
# We assume (lacking evidence to the contrary) that
151+
# The (::ProjectTo{T})(::T) method doesn't work because we are allowing a different
152+
# Number type that might not be a subtype of the `project_type`.
154153
(::ProjectTo{<:Number})(dx::Number) = dx
155-
# If you remove the above julia sometimes can't find the (::ProjectTo{T})(::T) for complex T
156-
# Seems like it might be a julia bug?
157154

158155
(project::ProjectTo{<:Real})(dx::Complex) = project(real(dx))
159156

0 commit comments

Comments
 (0)