[JExtract/FFM] Translate 'some DataProtocol' parameters to 'Data'#303
Merged
Conversation
* Introduce `SwiftType.opaque(SwiftType)` and `.existential(SwiftType)` to represent `some` and `any` types respectively. * Introduce `SwiftKnownTypes.representativeType(of:)` to the hardcoded `DataProtocol` -> `Data` translation mapping.
rintaro
commented
Jul 10, 2025
| try (var arena = AllocatingSwiftArena.ofConfined()) { | ||
| var bytes = arena.allocateFrom("hello"); | ||
| var dat = Data.init(bytes, bytes.byteSize(), arena); | ||
| MySwiftLibrary.globalReceiveSomeDataProtocol(dat); |
Member
Author
There was a problem hiding this comment.
@ktoso I'd be happy to make this and Data thing test cases, but where exactly I should write? Any PR testing runs Samples:SwiftKitSampleApp:test?
Collaborator
There was a problem hiding this comment.
So every example has a ci-validate.sh and you can add a ./gradle test in there in Samples/SwiftKitSampleApp/ci-validate.sh and add a test in Samples/SwiftKitSampleApp/src/test/java/com/example/swift :)
Collaborator
There was a problem hiding this comment.
Oh boy I just realized we have tests there but we've not been running them huh. so yeah please add a gradle test there :)
ktoso
reviewed
Jul 10, 2025
| let concreteTy = knownTypes.representativeType(of: knownProtocol) | ||
| { | ||
| return try lowerParameter(concreteTy, convention: convention, parameterName: parameterName) | ||
| } |
Also, run Samples:SwiftKitSampleApp:test in CI
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.
SwiftType.opaque(SwiftType)and.existential(SwiftType)to representsomeandanytypes respectively.SwiftKnownTypes.representativeType(of:)to the hardcodedDataProtocol->Datatranslation mapping.