-
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
Add static and class subscripts #23358
Add static and class subscripts #23358
Conversation
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
1 similar comment
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
099b736
to
6ca894c
Compare
6ca894c
to
977ac2e
Compare
Rolled back work on metatype key paths, which are now out of scope. That work is parked in #23623. |
This comment has been minimized.
This comment has been minimized.
1 similar comment
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
1 similar comment
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
1 similar comment
This comment has been minimized.
This comment has been minimized.
@swift-ci please test source compatibility |
@swift-ci please test compiler performance |
1 similar comment
@swift-ci please test compiler performance |
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.
Nice work! Only small comments from me.
dd635bb
to
7588d38
Compare
@swift-ci please smoke test |
@swift-ci please smoke test macOS platform |
In this commit, MyStruct.self[0] parses and typechecks but the solution doesn’t apply correctly. MyStruct[0] gets diagnosed as an error.
Obj-C subscripts don’t work on class objects, but you can declare class methods with the appropriate names. We don’t want to half-support this. Emit an error if you try to write “@objc class subscript” and test that we don’t import the methods as subscripts.
This commit modifies various subscript-related test files to add static subscript equivalents of existing tests.
8a463e5
to
7ae331d
Compare
@swift-ci please smoke test |
1 similar comment
@swift-ci please smoke test |
…ts-instances Add static and class subscripts
@brentdax are you going to make a SourceKit change to go with this, to make static and instance subscripts look different? |
@johnfairh Not me personally, but the SourceKit team is scheduled to work on it. |
Great, thanks. |
This PR lets you declare
static subscript
s or, in classes,class subscript
s, removing an unnecessary asymmetry between different kinds of members.This is just a quick Saturday prototype right now—it's nowhere near fully tested and I'm sure there are plenty of buried bodies I haven't discovered yet.