-
Notifications
You must be signed in to change notification settings - Fork 97
[swift2objc] fear: support operator overloading #2972
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
base: main
Are you sure you want to change the base?
[swift2objc] fear: support operator overloading #2972
Conversation
Sanitize illegal Objective-C identifiers and map Swift operators to valid names.
0b06e24 to
9d84eff
Compare
|
@liamappelbe Can you check this PR please? |
PR HealthLicense Headers ✔️
All source files should start with a license header. Unrelated files missing license headers
This check can be disabled by tagging the PR with API leaks ✔️The following packages contain symbols visible in the public API, but not exported by the library. Export these symbols or remove them from your publicly visible API.
This check can be disabled by tagging the PR with Breaking changes ✔️
This check can be disabled by tagging the PR with Changelog Entry ✔️
Changes to files need to be accounted for in their respective changelogs. This check can be disabled by tagging the PR with |
|
@Hassnaa9 You'll need to fix the analysis errors reported by the bot before the tests will run. Make sure to do |
Summary
This PR addresses the issue of the generator crashing when encountering Swift operator declarations (e.g.,
+,***,+=). It introduces a robust mechanism to sanitize illegal Objective-C identifiers and correctly parse operator symbols from the Swift SymbolGraph.Changes
Parser
swift.func.opinparse_declarations.dart.I verified through SymbolGraph JSON analysis (see attached evidence) that
swift.func.opsymbols share the same structure as regularswift.func.parseMethodDeclarationwithisStatic: truefor these symbols, which is safe and consistent with Swift's static operator implementation.UniqueNamer
_sanitizemethod to transform non-alphanumeric characters into valid Objective-C identifiers.+→plus,-→minus).opXX) for custom or unknown symbols to prevent naming collisions and illegal syntax.n).fixes: [swift2objc] Support operator overloading #2947