-
Notifications
You must be signed in to change notification settings - Fork 1.7k
[Functions] Address more Swift 6 warnings #14772
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
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist is currently in preview and may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments to provide feedback. |
paulb777
left a comment
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.
Thanks for the step-by-step thorough explanation!
morganchen12
left a comment
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.
LGTM
I wonder if we could make HTTPCallableResult a generic instead of Any and then add Sendable conformance for parameterized types that are Sendable.
Yes, I like that approach. It would be breaking to add the generic and I am curious how the ObjC API would be affected. |
|
It looks like this might have broken the Objective-C API. See the nightly failure in https://github.com/firebase/firebase-ios-sdk/actions/runs/14679321280/job/41206125399. @ncooke3 PTAL |

Note: module is not yet 100% Swift 6 compliant.
I added
@MainActorso the compiler enforces that the completion handler can only be called on the main actor. This address the error in step 1.The new
@MainActorattribute needed to bubble up to signature of a function that called the first one.HTTPSCallableResultwhich is not Sendable, so sending it could cause data races.HTTPSCallableResultas Sendable (it would have to be unchecked) because it retains anAny. While our SDK could be audited to verify that it doesn't access theAnyreference, there'd be no way to enforce that it isn't accessed unsafely in SDK or client code.HTTPSCallableResultissendingwhich indicates that it isn't accessed after being returned to the calling context.Task or actor isolated value cannot be senterror in the above screenshot is tricky. The following fixes appear to address it. I think the issue is that we need to indicate that theAnyvalue is only owned in the current context. To do that, we markresponseDataJSONto return asending Any. MarkingFunctionsSerializerasSendableis the final piece. I'm less sure why it resolves it though? Previously, I addedsendingtoFunctionsSerializer'sdecodeAPI but that led to errors down a rabbit hole that I ultimately couldn't solve simply.#no-changelog