-
-
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
Make Union{} <: T always return false (except when T is Union{}) #40301
Comments
This is the defining property of the bottom type, so changing this would pretty much break all the internals related to the type system. What has come up before though is being able to dispatch on |
See, I knew I was missing at least some minor aspect of this ;) I think what is still true, though, is that in pretty much every instance where I have used the Don't really know whether I have a real suggestion here, other than a) it would be nice if there was a name for the relationship I'm interested in and b) if there was some function or operator in Julia that I could use instead of |
Possible duplicate of #33780 ? |
I have to admit that I don't understand the formal properties of the type system well enough to tell whether this could cause trouble, and also not clear whether this could be done in a 1.x release at all. With those caveats:
The current behavior, that any subtype check with
Union{}
on the left hand side will returntrue
(no matter what) was surprising to me and makes it kind of cumbersome to write code that really does what at least I want it to do when I'm checking for a subtype relationship. I've always assumed that if I write sayT <: AbstractString
, that I really only can get atrue
ifT
is some sort of string, but it turns out that if I want that behavior I need to writeT <: AbstractString && T !== Union{}
.This came up in queryverse/TableTraits.jl#21.
The text was updated successfully, but these errors were encountered: