-
Notifications
You must be signed in to change notification settings - Fork 10.4k
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
[Sema] Allow extending specialized types #39307
Conversation
@swift-ci please test |
Build failed |
@swift-ci clean test Linux |
Looks like |
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.
Brilliant 👍
Does this need to go through evolution?
🎉
Speaking of which, I remember some people were sceptic about this because it wasn't obvious to them whether |
Build failed |
Build failed |
remove hacks for typealiases remove isPassThroughTypealias
418af51
to
db2f077
Compare
@swift-ci please test |
Build failed |
@swift-ci clean test Linux |
A scoped-down version of swiftlang#39307. Implement extension of bound generic types. The important bit here is in TypeCheckGeneric where we now use the underlying type of a typealias and its associated nominal type decl when we're generating substitutions for the extended type. Put this behind a new experimental flag -enable-experimental-bound-generic-extensions Resolves SR-4875 Resolves rdar://17434633
While we patiently wait for parameterized extensions, I figured this feature can be split off and proposed separately so that people can use some much needed sugar for extensions. This allows for the following:
This means that users can now finally use type sugar for their extended types like the following:
In the process of doing this, I stumbled upon https://bugs.swift.org/browse/SR-4875 , and removing the constrained extension diagnostic means that this bug should probably just be fixed, so it is now.
Resolves: https://bugs.swift.org/browse/SR-4875