-
-
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
f(::Type{Union{Missing, T}}) where {T} = T
throws MethodError when T isa UnionAll
#26135
Comments
Example failure: julia> f(Union{Missing, Tuple{Integer}})
ERROR: UndefVarError: T not defined
Stacktrace:
[1] f(::Type{Union{Missing, Tuple{X} where X<:Integer}}) at ./REPL[17]:1
[2] top-level scope |
I'm tempted to say we should make this always an UndefVarError |
I'm not particularly attached to this specific behaviour but we do need a way to get I do think |
I'm getting julia> f(Union{Missing, Tuple{Integer}})
Tuple{Integer}
julia> f(Union{Missing,Array{Int,1}})
Array{Int64,1} but julia> f(Union{Missing,Array})
ERROR: MethodError: no method matching f(::Type{Union{Missing, Array}})
Closest candidates are:
f(::Type{Union{Missing, T}}) where T at REPL[5]:1 which is consistent with julia> Union{Missing,Array{Int,1}} isa (Type{Union{Missing, T}} where T)
true
julia> Union{Missing,Array} isa (Type{Union{Missing, T}} where T)
false where I do not, however, understand why the latter is false. And why should it be an |
That looks like #26129. |
I think we should be able to get the expected behavior by doing the type computation manually inside a |
I implement some of that computation in inference, called "typesubtract". But it's not marked pure since I don't believe that function is pure. |
JuliaData/Missings.jl#82 changes |
Looks like a duplicate of #24333. |
Would it be reasonable for a call of I realize that this isn't a |
This, as far as I can tell, needs to not throw and actually run to implement
Missings.T
(which is the functionf
above). See JuliaData/Missings.jl#80 . This issue presented differently on 0.6.The text was updated successfully, but these errors were encountered: