Repository navigation
Test closures with closure parameters in every bridging direction - #124
Draft
piercifani wants to merge 1 commit into
Draft
piercifani wants to merge 1 commit into
piercifani wants to merge 1 commit into
Conversation
Add samples and tests for closures whose parameters are closures: - Kotlin-compat: the @mainactor onDeposit signature from #101 set from Kotlin and called from Swift, and Swift-provided closures called from Kotlin with Kotlin lambdas (including a returning and an optional one) - BridgeToSwift: a Kotlin-native closure var called from Swift with a Swift closure, then reassigned from Swift and called from Kotlin Requires skiptools/skipstone#305. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Requires skiptools/skipstone#305. CI will fail until a skipstone release contains it. This PR stays a draft until then, and will then bump the
skipdependency the same way #109 did.#109 covered a Swift-declared closure property set from Kotlin and called from Swift. This PR adds runtime coverage for the other bridging directions of closures whose parameters are closures, along with the exact signature from #101.
Kotlin-compat samples (Swift types bridged to Kotlin):
testCompatNestedClosureSetFromKotlin:onDeposit: @MainActor (@escaping @MainActor () -> Void) -> Void, set from Kotlin and called from Swift (the Complex closure crashes when being executed #101 case).testCompatNestedClosureCalledFromKotlin: Swift-provided closures called from Kotlin with Kotlin lambdas:onDeposit, one that returns a value ((Int, @escaping (Int) -> String) -> String), and an optional one.BridgeToSwift samples (Kotlin types bridged to Swift):
testNestedClosureVar: a Kotlin-nativekotlinNestedClosureVarcalled from Swift with a Swift closure, then reassigned from Swift and called from Kotlin with a Kotlin lambda.Testing
Run against a local build of skipstone#305, using
SKIPLOCALand a localskipcheckout:BridgeToKotlinCompatTests: 9/9 JUnit tests passBridgeToSwiftTests: 71/71 JUnit tests passAgainst skipstone 1.9.16,
testCompatNestedClosureCalledFromKotlincrashes withFatal error: Unable to bridge Kotlin/Java instance.Closes #101
🤖 Generated with Claude Code