-
Notifications
You must be signed in to change notification settings - Fork 10.5k
SR-2747: Recommend type(of:) instead of .dynamicType #4974
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
Conversation
Thanks for catching this and thanks for the patch! I think I'd mildly prefer just naming this operation like a Swift function: |
|
Agreed on the |
Found where it comes from. If it’s better that they’re consistent I’m happy to change the other instance(s) of |
_ = NSObject.`class`() // expected-error {{'class()' is unavailable in Swift: use 'self' instead}} | ||
_ = obj.`class`!() // expected-error {{'class()' is unavailable in Swift: use 'dynamicType' instead}} | ||
_ = obj.`class`!() // expected-error {{'class()' is unavailable in Swift: use 'type(of:' instead}} |
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.
Missing paren
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.
Whoops, fixed!
@swift-ci please smoke test |
Any more thoughts on this? |
LGTM! |
Thanks, Jeff! |
When trying to use
.class()
from Objective-C, the compiler recommended using.dynamicType
instead, which has been deprecated in favor oftype(of:)
.Resolves SR-2747.