File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -36,7 +36,9 @@ Iterators.flatten(c::Const) = c
3636
3737Base. eltype (:: Type{<:Const} ) = Any
3838
39- Base. convert (:: Type{Const{T}} , x:: Const ) where {T} = Const (Base. convert (T, x. value))
39+ Base. convert (:: Type{Const{T}} , x:: Const{T} ) where {T} = x
40+ Base. convert (:: Type{Const{T}} , x:: Const ) where {T} = Const {T} (convert (T, x. value))
41+
4042# Const is covariate
4143# promote_rule only works on concrete types, more general checks Type{<:Const} may overwrite
4244# unintentionally more specific promote_rule types
Original file line number Diff line number Diff line change @@ -38,7 +38,9 @@ Base.foreach(f, a::Identity) = begin f(a.value); nothing; end
3838Base. map (f, a:: Identity ) = Identity (f (a. value))
3939Base. Iterators. flatten (a:: Identity ) = convert (Identity, a. value)
4040
41- Base. convert (:: Type{Identity{T}} , x:: Identity ) where {T} = Identity (Base. convert (T, x. value))
41+ Base. convert (:: Type{Identity{T}} , x:: Identity{T} ) where {T} = x
42+ Base. convert (:: Type{Identity{T}} , x:: Identity ) where {T} = Identity {T} (convert (T, x. value))
43+
4244# Identity is covariate
4345# promote_rule only works on concrete types, more general checks Type{<:Const} may overwrite
4446# unintentionally more specific promote_rule types
You can’t perform that action at this time.
0 commit comments