-
Notifications
You must be signed in to change notification settings - Fork 707
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
Fix to Objective-C header parsing has broken certain method calls #2647
Comments
mmm... I checked out to 2df02c2 which is the parent of 97e29b4 and the emitted code is still pub trait IMyEvent: Sized + std::ops::Deref {
unsafe fn type_(&self) -> id
where
<Self as std::ops::Deref>::Target: objc::Message + Sized,
{
msg_send!(*self, r#type)
}
unsafe fn setType_(&self, type_: id)
where
<Self as std::ops::Deref>::Target: objc::Message + Sized,
{
msg_send ! (* self , setType : type_)
}
} so the culprit must be before that specific change. Edit: after some bisecting, the culprit is 6e5a666 |
I added a fix in #2648, @csmulhern could you let me know if this fixes your issue? |
Ahh, sorry for the misleading attribution. #2648 does fix it! Thanks for the quick fix! |
@csmulhern glad to hear! I haven't written any objective-C in the past so it is a bit hard for me to know what's right and what isn't 😅 I think it would make sense to add a small integration test for this to avoid future breakage so I'll try to do that on the same PR or at least open an issue so we don't forget about it. |
I opened #2652 to track the integration tests for objective-c |
Input C/C++ Header
Bindgen Invocation
Actual Results
Expected Results
type_ should be implemented as:
I believe this was caused by the changes in 97e29b4. While the fix in that commit fixes usage of
format_method_call
in parsing,format_method_call
is also used in codegen, see:rust-bindgen/bindgen/codegen/mod.rs
Line 4210 in 046d6f9
This change causes reserved words to escaped in the generated msg_send calls, which causes unrecognized selector errors at runtime (i.e.
-[MyEvent r#type]
is called instead of-[MyEvent type]
).@pvdrz, do you have any additional context here?
The text was updated successfully, but these errors were encountered: