-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Do not import objc_direct constructors #40234
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
@rjmccall @CodaFi @slavapestov Could someone take a look? We ran into the unhandled case when Swift tries to call an ObjC constuctor marked as |
@beccadax not sure if you are the correct reviewer, but I thought you would know better than me. |
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.
I have some small requests, but this is basically sound.
Incidentally, I recently extracted some nearby code from importAttributes()
into a new importSwiftAttrAttributes()
method. Your change should still be in importAttributes()
, not the new method.
Unlike normal Objective-C functions, Swift does not directly call Objective-C constructors because it creates a thunk to allocate the object and call then constructor dynamically. This can be fixed, but for now emit a compile-time error rather than a runtime error.
ping @beccadax could you take another quick look? I believe I've made the changes you suggested |
@swift-ci please test |
This LGTM if nobody else has any concerns! |
@ellishg I've sketched lifting this restriction, and also moving |
@CodaFi Hey will you have time to upload the patch for review? Or it still needs some more work? Thanks! |
Unlike normal Objective-C functions, Swift does not directly call
Objective-C constructors because it creates a thunk to allocate the
object and call then constructor dynamically. This can be fixed, but for
now emit a compile-time error rather than a runtime error.