Hey! Tried using Swift Export in my project.. gett...
# swift-export
a
Hey! Tried using Swift Export in my project.. getting this
Copy code
Execution failed for task ':commonJasper:iosArm64DebugSwiftExport'.

> A failure occurred while executing org.jetbrains.kotlin.gradle.plugin.mpp.apple.swiftexport.internal.SwiftExportAction

   > Type org.jetbrains.kotlin.sir.SirFunctionalType@5cee6b54 can not be named
I’m assuming this is because Swift Export doesn’t support functional types?
a
I’m assuming this is because Swift Export doesn’t support functional types?
You are absolutely right! 🙂 with a small nuance - swift export supports incoming functional types. And your pulbic api probably has either 1. inheritance from functional type 2. extension on functional type
👍 3
a
Thanks for the precision, that’s right.
s
What is your case exactly, btw? Is it inheritance or extension? :)
a
Took a look around in our codebase after this.. and could not find any explicit use case of inheritance or extension of functional types 🤔. Maybe I’m not looking at the right thing. We do have sealed class hierarchies, function type aliases, composition and higher-order functions, though. Using Kotlin 2.2.20.
a
Actually, sorry, I'm not sure what have triggered the exception. I've tried the following snippet and that is not enough to crash swift export :
Copy code
typealias Demo = ()->Unit
fun Demo.foo(): Unit = TODO()

abstract class Demo2: Demo

class CLZ: Demo2() {
    override fun invoke() {
        TODO("Not yet implemented")
    }
}

fun bar(): Demo = TODO()

interface DemoI: ()->Unit {
    fun dummy() {}
}

fun Function1<Unit, Unit>.demo(): Unit = TODO()
There are typealias, inheritance, extension. None of this causes a crash in swift export. Is there a chance you could find an actual declaration that causes swift export to crash?
a
I’ll try, my codebase is so huge at this point it might be hard, and the stacktrace isn’t helping me much pointing out what’s causing it exactly 😓
a
Yeah, stack traces can be better, sorry about that, we are thinking about improving those. Thanks for your efforts anyway!
👌 1