Skip to content

[CSSimplify] Delay binding metatype instance types if one side is type variable #20786

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

Merged
merged 1 commit into from
Nov 28, 2018

Conversation

xedin
Copy link
Contributor

@xedin xedin commented Nov 27, 2018

While matching two metatypes where one side is a class (which could have
supertypes) and another is a type variable use subtype constraint to
delay binding types together because there is a real possibility that
there exists a superclass associated with yet free type variable which
would be a better match when attempted.

Resolves: rdar://problem/44816848

@xedin xedin requested review from rudkx and DougGregor November 27, 2018 02:17
@xedin
Copy link
Contributor Author

xedin commented Nov 27, 2018

@swift-ci please test source compatibility

@xedin
Copy link
Contributor Author

xedin commented Nov 27, 2018

@swift-ci please test

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - 62d728c626a90de54d79263888ffc702eb3a75a6

@xedin
Copy link
Contributor Author

xedin commented Nov 27, 2018

Timeout :(

@xedin
Copy link
Contributor Author

xedin commented Nov 27, 2018

@swift-ci please test macOS platform

@rudkx
Copy link
Contributor

rudkx commented Nov 27, 2018

The metatype handling code here (prior to your change) seems pretty odd to me. Why do we default to a type equality check regardless of what the original type match kind was?

I wonder what breaks if we just make this immediately call back into matchTypes with the same kind, and the instance types?

@xedin
Copy link
Contributor Author

xedin commented Nov 27, 2018

@rudkx I think the reason is trying to maintain subtype property? I wonder if what we need to to do here is to resolve this constraint (e.g. call to matchTypes) only if both types are known, otherwise just form unresolved, because currently e.g. in case of ExistentialMetatype only one side is checked...

…e variable

While matching two metatypes where one side is a class (which could have
supertypes) and another is a type variable use `subtype` constraint to
delay binding types together because there is a real possibility that
there exists a superclass associated with yet free type variable which
would be a better match when attempted.

Resolves: rdar://problem/44816848
@xedin
Copy link
Contributor Author

xedin commented Nov 28, 2018

@swift-ci please test

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - 62d728c626a90de54d79263888ffc702eb3a75a6

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - 62d728c626a90de54d79263888ffc702eb3a75a6

Copy link
Contributor

@rudkx rudkx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change LGTM. Might be good to follow-up at some point with an assert about the incoming kind so that if we ever violate any assumptions being made here it will be flagged.

@xedin
Copy link
Contributor Author

xedin commented Nov 28, 2018

@swift-ci please test source compatibility

@xedin xedin merged commit 1c82d49 into swiftlang:master Nov 28, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants