Kamel-Media / Kamel

Kotlin asynchronous media loading and caching library for Compose.
Apache License 2.0
621 stars 25 forks source link

iOS-only: `IrCallImpl: 1` compilation error when passing a Kamel `File` to `asyncPainterResource` with Kotlin 2.0.0 #108

Open yuroyami opened 2 months ago

yuroyami commented 2 months ago

I use expect/actual to instantiate a Kamel File :

//commonMain
expect fun String.toKamelFile(): File

KamelImage(
      resource = asyncPainterResource(someImageFilePath.toKamelFile())
      ...
)

//androidMain
actual fun String.toKamelFile() = java.File(this) <-- works fine

//iosMain
actual fun String.toKamelFile(): File { return File(path = this) } <--- Causes compilation error 

Kotlin: 2.0.0 Compose multiplatform: 1.7.0-alpha01

luca992 commented 2 months ago

This on the latest beta release?

yuroyami commented 2 months ago

Issue confirmed in v0.9.5 and v1.0.0-beta.6. Can't check beta7 as i am out of town for the moment

luca992 commented 2 months ago

are you using kotlin.incremental.native=true by chance? I was getting some weird errors when using that just now. I'm able to load images with File on ios in the sample, so not really sure how to reproduce it.

yuroyami commented 2 months ago

Here's my gradle.properties:

#Gradle
org.gradle.jvmargs=-Xmx2g -Dfile.encoding=UTF-8 -Dkotlin.daemon.jvm.options\="-Xmx2g"

#Kotlin
kotlin.code.style=official

#Android
android.useAndroidX=true
android.enableJetifier=true
android.compileSdk=34
android.targetSdk=34
android.minSdk=24
android.nonTransitiveRClass=true

#MPP
kotlin.mpp.enableCInteropCommonization=true
kotlin.mpp.stability.nowarn=true #
kotlin.mpp.androidSourceSetLayoutVersion=2 #
kotlin.native.disableCompilerDaemon=true

kotlin.mpp.androidGradlePluginCompatibility.nowarn=true
kotlin.apple.xcodeCompatibility.nowarn=true

#Compose
org.jetbrains.compose.experimental.uikit.enabled=true

#Room-related
room.generateKotlin=true
#ksp.useKSP2 = true

Could it be due to kotlin.native.disableCompilerDaemon=true ?

AlexWink commented 1 month ago

Hi, I encountered the same issue as @yuroyami and I couldn't figure out what was the difference between my implementation and the sample's one that works fine. I created a mini project that reproduces the issue if it can help finding what causes the problem. https://github.com/AlexWink/KamelIOSCompileError

luca992 commented 1 month ago

Hi, I encountered the same issue as @yuroyami and I couldn't figure out what was the difference between my implementation and the sample's one that works fine. I created a mini project that reproduces the issue if it can help finding what causes the problem. https://github.com/AlexWink/KamelIOSCompileError

Sweet. Thanks for making that. I can take a look soon.