-
Notifications
You must be signed in to change notification settings - Fork 67
[JExtract/FFM] Translate 'some DataProtocol' parameters to 'Data' #303
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
* 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.
| try (var arena = AllocatingSwiftArena.ofConfined()) { | ||
| var bytes = arena.allocateFrom("hello"); | ||
| var dat = Data.init(bytes, bytes.byteSize(), arena); | ||
| MySwiftLibrary.globalReceiveSomeDataProtocol(dat); |
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.
@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?
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.
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 :)
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.
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 :)
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.
Done!
| let concreteTy = knownTypes.representativeType(of: knownProtocol) | ||
| { | ||
| return try lowerParameter(concreteTy, convention: convention, parameterName: parameterName) | ||
| } |
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.
👍
ktoso
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.
Very nice!
Also, run Samples:SwiftKitSampleApp:test in CI
SwiftType.opaque(SwiftType)and.existential(SwiftType)to representsomeandanytypes respectively.SwiftKnownTypes.representativeType(of:)to the hardcodedDataProtocol->Datatranslation mapping.