jextract: support Swift custom operators#829
Draft
AbdAlRahmanGad wants to merge 12 commits into
Draft
Conversation
ktoso
reviewed
Jul 13, 2026
ktoso
reviewed
Jul 13, 2026
ktoso
reviewed
Jul 13, 2026
| } | ||
| private var deferredConstrainedExtensions: [DeferredConstrainedExtension] = [] | ||
|
|
||
| private static func isOperatorFunction(_ node: FunctionDeclSyntax) -> Bool { |
Collaborator
There was a problem hiding this comment.
This may be worth changing into operatorKind: SwiftOperatorKind?`
and make a new SwiftOperatorKind that is enum SwiftOperatorKind { case prefixOperator; case binaryOperator; case postfixOperator }
Member
Author
There was a problem hiding this comment.
I ended up not adding the new enum beacause it didn't really fit in and didn't simplify the code
ktoso
reviewed
Jul 16, 2026
ktoso
reviewed
Jul 16, 2026
ktoso
reviewed
Jul 16, 2026
ktoso
reviewed
Jul 16, 2026
ktoso
reviewed
Jul 16, 2026
ktoso
reviewed
Jul 16, 2026
| public func Java_com_example_swift_Number__00024plus__JJ(environment: UnsafeMutablePointer<JNIEnv?>!, thisClass: jclass, left: jlong, right: jlong) -> jlong { | ||
| ... | ||
| let result$ = UnsafeMutablePointer<Number>.allocate(capacity: 1) | ||
| result$.initialize(to: ( ((left$.pointee) + (right$.pointee))) |
Collaborator
There was a problem hiding this comment.
Suggested change
| result$.initialize(to: ( ((left$.pointee) + (right$.pointee))) | |
| result$.initialize(to: ((left$.pointee) + (right$.pointee))) |
do we have an unbalanced () here? Is the sourcegen wrong or the test wrongly asserted that
Member
Author
There was a problem hiding this comment.
ah, so it turns out I added it in the codegen step code but now it's balanced!
ktoso
reviewed
Jul 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
#817