-
Notifications
You must be signed in to change notification settings - Fork 10.5k
AST: Fix Type::join() to do the right thing with class metatypes [3.1] #7100
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
AST: Fix Type::join() to do the right thing with class metatypes [3.1] #7100
Conversation
@DougGregor Is this what you had in mind? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should narrow this so that it does not produce joins where there isn't actually a subtyping relationship.
metatype2->getInstanceType()); | ||
if (!result) | ||
return result; | ||
return MetatypeType::get(result); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not always true that if T < U
, thenT.Type < U.Type
in our type system. Let's whitelist the cases where it's true:
- Both instance types
mayHaveSuperclass()
, or - Both are existential metatypes
and not compute a join in the other cases.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's a counter-example? (Non-existential) protocol metatypes?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Int.Type
isn't a subtype of Int?.Type
Your revised master PR LGTM! |
Fixes <rdar://problem/30233451>.
e29544b
to
4d61f48
Compare
@swift-ci Please test |
Build failed |
Build failed |
@swift-ci Please test |
Fixes rdar://problem/30233451.