Bridge closures with closure parameters in the remaining directions #305
All Vouch review confidence checks passed
Residual risk 0.17 = Change Risk (0.43) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.43 · 356 lines diff across 4 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.352
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #305"
general
weight: 0.35
marcprux
#249 made it possible for Swift to call a Kotlin closure that takes closure parameters, through the
@_cdeclpath (skiptools/skip-bridge#109). Three other cases still sent the nested closure arguments throughAnyBridging, which cannot convert between Swift closures and Kotlin functions:| Bridged type | Closure provided by | Called from | Generated by | Previous result |
|---|---|---|---|---|
| Swift type bridged to Kotlin | Swift | Kotlin, with a Kotlin lambda |
convertToCDecl|Unable to bridge Kotlin/Java instance|| Kotlin type bridged to Swift | Swift (assigned to the property) | Kotlin, with a Kotlin lambda |
convertToJava| same || Kotlin type bridged to Swift | Kotlin | Swift, with a Swift closure |
convertClosureFromJava|Unable to bridge Swift instance (Function)|For example, Kotlin calling
public var onDeposit: @MainActor (@escaping @MainActor () -> Void) -> Voidon a bridged Swift class crashed. This is the reverse of skiptools/skip-bridge#101.Change
convertClosureToJavawraps a Swift closure whose parameters include closures. Those parameters arrive asJavaObjectPointer?and are converted withconvertClosureFromCDeclusing their static types. It is used by bothconvertToCDeclandconvertToJava:The capture list keeps the closure value from the time it is bridged, as before. Optional closures go through
.map.throwsand@MainActorare preserved.convertClosureFromJavaconverts closure arguments withconvertClosureToJavabefore callingJavaBackedClosure.invoke.@_cdeclconversion has moved intoconvertClosureFromCDecl, and it now also usesconvertClosureToJavafor its nested arguments, so deeper nesting goes through the same code. The two existing nested-closure tests therefore now expect!after the innerjavaObject(...)call; it cannot fail for a non-optional closure.As with #249,
asyncclosures and closures with more than 5 parameters are still not handled.Testing
BridgeToKotlinTests.testNestedClosureVar,testOptionalNestedClosureVarandBridgeToSwiftTests.testNestedClosureVar. All 253BridgeTo*tests pass.Unable to bridge Kotlin/Java instance.🤖 Generated with Claude Code