-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Closed
Labels
types and dispatchTypes, subtyping and method dispatchTypes, subtyping and method dispatch
Description
@andreasnoack mentioned this on Slack:
julia> (Complex{T} where T) <: Complex
false
The annoying part is that in Complex, the upper bound for the TypVar is Real, but in Complex{T} where T, the upper bound is simply Any. But since it's not possible to instantiate e.g. Complex{String}:
julia> Complex{String}
ERROR: TypeError: in Complex, in T, expected T<:Real, got Type{String}
Stacktrace:
[1] top-level scope at REPL[17]:1
Then the extent of the two types Complex{T} where {T <: Any} is the same as Complex{T} where {T <: Real}. So Julia might as well normalise it to Complex{T} where {T <: Real}. Similarly for e.g. Complex{<:Number}.
bramtayl
Metadata
Metadata
Assignees
Labels
types and dispatchTypes, subtyping and method dispatchTypes, subtyping and method dispatch