Pearce Keesling
04/22/2026, 8:27 PMArtem Olkov
04/23/2026, 8:36 AMPearce Keesling
04/23/2026, 2:31 PMArtem Olkov
04/23/2026, 2:39 PMSam Rayner
04/23/2026, 6:15 PMPearce Keesling
04/23/2026, 8:04 PMโข When exported to Swift, Kotlin generic type parameters are type-erased to their upper bounds.What's interesting is it might just be nested generics, but I need to dig a little deeper through the generated kotlin code
Pearce Keesling
04/23/2026, 8:17 PM// Kotlin code
data class ManualAccountFormBinding(
val name: FormBinding<String>,
val typeId: FormBinding<String>,
val openingBalance: FormBinding<Double>,
val statementDate: FormBinding<String>,
)
//Generated kotlin code
@ExportedBridge("com_quicken_accountDiscovery_ManualAccountFormBinding_init_initialize__TypesOfArguments__Swift_UnsafeMutableRawPointer_ExportedKotlinPackages_com_quicken_form_FormBinding_ExportedKotlinPackages_com_quicken_form_FormBinding_ExportedKotlinPackages_com_quicken_form_FormBinding_ExportedKotlinPackages_com_quicken_form_FormBinding__")
public fun com_quicken_accountDiscovery_ManualAccountFormBinding_init_initialize__TypesOfArguments__Swift_UnsafeMutableRawPointer_ExportedKotlinPackages_com_quicken_form_FormBinding_ExportedKotlinPackages_com_quicken_form_FormBinding_ExportedKotlinPackages_com_quicken_form_FormBinding_ExportedKotlinPackages_com_quicken_form_FormBinding__(__kt: kotlin.native.internal.NativePtr, name: kotlin.native.internal.NativePtr, typeId: kotlin.native.internal.NativePtr, openingBalance: kotlin.native.internal.NativePtr, statementDate: kotlin.native.internal.NativePtr): Boolean {
val ____kt = kotlin.native.internal.ref.dereferenceExternalRCRef(__kt)!!
val __name = kotlin.native.internal.ref.dereferenceExternalRCRef(name) as com.quicken.form.FormBinding<kotlin.Any>
val __typeId = kotlin.native.internal.ref.dereferenceExternalRCRef(typeId) as com.quicken.form.FormBinding<kotlin.Any>
val __openingBalance = kotlin.native.internal.ref.dereferenceExternalRCRef(openingBalance) as com.quicken.form.FormBinding<kotlin.Any>
val __statementDate = kotlin.native.internal.ref.dereferenceExternalRCRef(statementDate) as com.quicken.form.FormBinding<kotlin.Any>
val _result = run { kotlin.native.internal.initInstance(____kt, com.quicken.accountDiscovery.ManualAccountFormBinding(__name, __typeId, __openingBalance, __statementDate)) }
return run { _result; true }
}
and then it fails with an error because it is trying to pass FormBinding<Any> into FormBinding<String>
Showing Recent Messages
e: file:///[...]/build/SwiftExport/iosSimulatorArm64/Debug/files/ComQuickenSharedAccountDiscoveryApi/ComQuickenSharedAccountDiscoveryApi.kt:2924:123 Argument type mismatch: actual type is 'FormBinding<Any>', but 'FormBinding<String>' was expected.Pearce Keesling
04/23/2026, 11:00 PMShowing Recent Messages
org.jetbrains.kotlin.backend.common.CompilationException: Back-end: Please report this problem <https://kotl.in/issue>
/Users/pkeesling/Documents/GitHub/app-components/packages/mobile/sharedKt/swiftUmbrella/build/SwiftExport/iosSimulatorArm64/Debug/KotlinCoroutineSupport/KotlinCoroutineSupport/KotlinCoroutineSupport.kt:-1:-1
Details: Internal error in file lowering: java.lang.IllegalStateException: Internal compiler error: doesn't correspond to any C type: kotlin.native.internal.NativePtr
at /Users/pkeesling/Documents/GitHub/app-components/packages/mobile/sharedKt/swiftUmbrella/build/SwiftExport/iosSimulatorArm64/Debug/KotlinCoroutineSupport/KotlinCoroutineSupport/KotlinCoroutineSupport.kt (240:115)
GET_VAR 'continuation: kotlin.native.internal.NativePtr declared in <root>.SwiftFlowIterator_next' type=kotlin.native.internal.NativePtr origin=nullArtem Olkov
04/24/2026, 8:45 AMAre there currently known limitations with generics in swift-export?Yes, generics currently are type erased to the upper bound ๐ The full support for the generics are currently in development, we are not sure how much time it will take, but we are working on it.
but now I think I'm stuck on a coroutines issue:Well, that's new. Do you have a reproducer for that to share? What versions of kotlin, kotlinx-coroutines and swift are you using? I feel like I've seen something like that couple moth ago, but it should be already fixed in 2.4.0-Beta2.
and then it fails with an error because it is trying to passReproduced withintoFormBinding<Any>FormBinding<String>
class FormBinding<T>(val bind: T)
data class ManualAccountFormBinding(
val name: FormBinding<String>
)
Thanks for the report, we will try and fix that (sadly not in 2.4.0) ๐
KT-85981 [Swift Export] generic property with specified type generates uncompilable bridgesPearce Keesling
04/24/2026, 2:44 PMArtem Olkov
04/24/2026, 3:18 PMPearce Keesling
04/24/2026, 3:22 PM1.11.0-rc01 so that might be a part of it