You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Given a Nullable and something completely unrelated, you get two Nullable{Any}s. I don't think two types should have a non-identity promotion just because one is Nullable. This was not obvious at the time.
I propose this definition instead:
function promote_rule{S,T}(::Type{Nullable{S}}, ::Type{T})
R = promote_type(S, T)
if R <: S || R <: T
else
if S <: R || T <: R
return R
end
end
return Nullable{R}
end
This says to leave the values alone if the promoted type (R) is a strict supertype of T or S, and otherwise promote as before. For example
Moved from JuliaLang/julia#19748
e79e84654a40e8189e5dfbd55df232ae6c82a213 added the following definition:
This might have unintended consequences. For example, we have:
Given a
Nullable
and something completely unrelated, you get twoNullable{Any}
s. I don't think two types should have a non-identity promotion just because one is Nullable. This was not obvious at the time.I propose this definition instead:
This says to leave the values alone if the promoted type (R) is a strict supertype of T or S, and otherwise promote as before. For example
This definition can still be type-inferred (since we can now handle constant conditions well).
The text was updated successfully, but these errors were encountered: