Hi! Is there any way to track the causes of `SirUn...
# swift-export
g
Hi! Is there any way to track the causes of
SirUnsupportedType
appearing which later cause
java.lang.IllegalStateException: Attempt to bridge unbridgeable type: SirUnsupportedType.
? I'm experimenting with Swift export in our project, and trying to export almost any module (trying to at least export dependencies before exporting our own modules) produces this exception. I've succeeded only with exporting single
kotlin-stdlib
, while having this exception with, for example,
kotlinx-datetime
,
ktor-http
,
ktor-client-core
or
coroutines-core
. Maybe there is some list of supported/unsupported types, or I'm just setting up something wrong?
s
Hi! This sounds like a bug -- normally the bridge generator should handle
SirUnsupportedType
properly. See e.g. https://github.com/JetBrains/kotlin/blob/9b117ee9e6dae8ad5abfc3df91a0644acc1e7492/[…]/kotlin/swiftexport/standalone/builders/buildFunctionBridges.kt. So, there is no other way than to debug the Swift Export implementation.
g
Hi! Seems like
patchCallableBodyAndGenerateRequest
doesn't check extension receiver parameters: while trying to bridge function
Instant::offsetIn
typesUsed
contains 2 elements (return type and timeZone parameter), but this function also has receiver parameter which is
SirUnsupportedType
, that's the reason of exception. Also, just curious, why is
kotlinx.datetime.Instant
unsupported type? We will really need it to export our modules :)
s
Hi! Seems like
patchCallableBodyAndGenerateRequest
doesn't check extension receiver parameters: while trying to bridge function
Instant::offsetIn
typesUsed
contains 2 elements (return type and timeZone parameter), but this function also has receiver parameter which is
SirUnsupportedType
, that's the reason of exception.
Nice catch! This was fixed some time ago, and I can't reproduce this locally. Which version are you on?
Also, just curious, why is
kotlinx.datetime.Instant
unsupported type? We will really need it to export our modules :)
Because it has a supertype
Comparable<Instant>
, which is a generic interface. Neither interfaces nor generics are supported at the moment.
g
Alright, thank you! I'm using Kotlin version 2.1.20
👍 1
s
Kotlin 2.2.0-Beta1 should already have the fix for the exception. This version should be released somewhere in the middle of April. But generally, with Swift Export, experimenting with dev builds also makes sense, because the project is in active development.
g
I see, thanks!