Would it be worth a bug report to make `SirUnsuppo...
# swift-export
z
Would it be worth a bug report to make
SirUnsupportedType
errors report more information? It's currently pretty opaque and inactionable
βœ… 1
Some other noise higher up in the logs too
r
Do you have an example of some Kotlin code? Or what you would expect in Swift?
(working on something closely related)
z
tbh I don't really know where to look to start. Here's a branch in circuit: https://github.com/slackhq/circuit/tree/z/test24dev
kodee intensifies 1
sample I was testing is samplescounter
r
Ah got it. I thought you had some specific Kotlin code that resulted in a
SirUnsupportedType
z
I appear to!
I just don't know which kotlin code πŸ˜…
πŸ˜… 1
r
Ah w8 I see the exception now. Yeah an issue would be great. Should definitely investigate. AFAIK it's not supposed to crash like this πŸ˜‡
z
I'll file one later!
kodee excited 2
KT-85624 SirUnsupportedType error is vague/inactionable
thank you color 2
a
Hello there, thanks for the report πŸ™‚ > Some other noise higher up in the logs too That's a known problem, please follow https://youtrack.jetbrains.com/issue/KT-84410 . TLDR: we are aiming to fix this with 2.4.20. Hopefully...
πŸ™‡ 1
As for the actual report - I've encountered this error only once in my testing in the last month - please see https://youtrack.jetbrains.com/issue/KT-85380 The first build containing the fix is 8547. Do you mind trying it out?
πŸ‘€ 1
z
nice, it does appear to get past that error now, though not able to meaningfully proceed with the build yet due to other issues. Namely it doesn't propagate opt-ins for experimental APIs (so generated swift export files referencing experimental APIs fail to compile) and this error that I can't quite figure out
Copy code
Showing Recent Issues
/Users/zacsweers/dev/kotlin/contributing/circuit/samples/counter/apps/iosApp/  /Users/zacsweers/dev/kotlin/contributing/circuit/samples/counter/build/SPMPackage/iosSimulatorArm64/Debug/Sources/OrgJetbrainsComposeUiUiGraphics/OrgJetbrainsComposeUiUiGraphics.swift:2364:21: type member must not be named 'Type', since it would conflict with the 'foo.Type' expression

          public enum Type: KotlinRuntimeSupport._KotlinBridgeable, Swift.CaseIterable, Swift.LosslessStringConvertible, Swift.RawRepresentable {

                      ^~~~

                      `Type`
It's not a type I own, but appears to imply that any library that has a class called
Type
is wholly incompatible with swift export then? In this case this API coming from compose UI
a
it doesn't propagate opt-ins for experimental APIs
Yes, support for that was merged on the last week - https://github.com/JetBrains/kotlin/pull/5813 This will be included in 2.4.20 release πŸ™‚ First dev build is dev-371
type member must not be named 'Type', since it would conflict with the 'foo.Type' expression
Oh, that's a fun bug. I will file a bug for that. On that note - Why do you export ComposeUI? I always assumed that this is not a library that would be useful on the side of iOS. But I'm curious about your usecase.
I assume it's this Type
z
Why do you export ComposeUI?
I don't! At least not as far as I know? This is all there is in the swift export block. The closest guess I have for this is that it's an
api
dependency in commonMain, which does make sense for this library
doesn't look lke KT-85660 is public
a
Oh, sorry about that, published πŸ™‚
πŸ‘ 1
At least not as far as I know?
Yeah, that can happen, as we do transitive export - if a part of your public API requires some part of another libraries public API - this part will also be exported. And everything that is needed by that part. As an example
Copy code
// module foo

class Foo // will be exported

class Bar { // will be exported
  fun foo(): Foo = TODO() // forces export of Foo
}

class Zar // will not be exported

// module shared // exported by swift export

fun bar(): Bar = TODO() // forces export of Bar
If my assumption about what Type is exported in your case - you either have a
PathSegment
as a part of your public API, or some other class from ui-graphics is a part of your public API and that class transitively exports PathSegment. in future versions of swift export we plan to release an exclusion from this algorithm for a particular module, but I don't have any public timelines for that 😞 I think that in your case it's the following: 1.
Remove
is a public value of type ImageVector - link 2. ImageVector can be found here 3. ImageVector starts pulling ui-graphics to the public api surface uncontrollably and leads to this error. At least at first glance it's the only usage of this library in a public api in your sample, but maybe I don't see everything
z
gotcha, yeah I'm not sure offhand what to do about that. The API I need to expose to swift is limited but the API to other consumers can be broader. Would the recommendation be to explicitly define dependency as implementation in the iOS sourceset and api in all the others?
a
The API I need to expose to swift is limited but the API to other consumers can be broader
For that there is a HiddenFromObjC annotation, that is also supported by Swift Export πŸ™‚
z
ah no I meant the underlying dependency at the build level
a
plicitly define dependency as implementation in
Nope, that has zero effect in the export config.
ah no I meant the underlying dependency at the build level
And again - we will provide an API for such cases, but we do not have a public timeline for that 😞
πŸ‘ 1
z
is there an issue I could follow?
a
Let me create a public one πŸ™‚
πŸ™‡ 1
It's not much but it's an honest work kodee intensifies
z
appreciated!
kodee happy 2