-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Vector eltype depends on code executed before - only 1.9rc #48961
Comments
|
Looks like a dispatch failure julia> @which promote_rule(Union{Missing, Int}, Int)
promote_rule(T::Type{>:Missing}, S::Type)
@ Base missing.jl:59
julia> [1, missing, nothing, 2]
4-element Vector{Union{Missing, Nothing, Int64}}:
1
missing
nothing
2
julia> @which promote_rule(Union{Missing, Int}, Int)
promote_rule(T::Type{>:Union{Missing, Nothing}}, S::Type)
@ Base missing.jl:49 But the subtyping is correct julia> S = ans.sig
Tuple{typeof(promote_rule), Type{>:Union{Missing, Nothing}}, Type}
julia> T = Tuple{typeof(promote_rule), Type{Union{Missing, Int}}, Type{Int}}
Tuple{typeof(promote_rule), Type{Union{Missing, Int64}}, Type{Int64}}
julia> T <: S
false |
Also reproduces on 596ce65, but not on latest master. Bisected the fix:
|
Should add a test for this (and backport it). |
Ok, get the subtyping bug. S = Type{Union{Missing, Int}}
T = Type{Union{Missing, Nothing, Int}}
S<:T # 1.9rc: true; 1.8.5/master: false; I guess the localized reversed subtyping in |
I’ll take a look tomorrow. |
We should perhaps revert Jeff's commit instead so we can get the release out without adding more uncertainty |
Yeah, maybe that is a better idea. |
I pushed the revert. |
OK, the example above was caused by a mess on #48441 fixes such risk as |
I would rather backport the new fix #48441 as well; some people (Catlab) are depending on this being fixed and they will be sad. |
Well, then I need help with the backport(s). |
prints
typeof([1, missing, 2]) = Vector{Union{Missing, Int64}}
as expected.But add a totally irrelevant line, and eltype changes:
prints
typeof([1, missing, 2]) = Vector{Any}
.Only happens on 1.9rc, not 1.8 nor 1.9 betas.
The text was updated successfully, but these errors were encountered: