touchlab / SKIE

SKIE - Swift Kotlin Interface Enhancer
https://skie.touchlab.co/
Apache License 2.0
768 stars 8 forks source link

Incorrect generation for private set properties #57

Closed mksmdvdff closed 8 months ago

mksmdvdff commented 9 months ago

What is the problem?

Skie generates incorrect implementation for global property, and fails to build for iOS. My 'linkPodDebugFrameworkIosSimulatorArm64' fails with: build/skie/binaries/podDebugFramework/DEBUG/iosSimulatorArm64/swift/generated/Runtime/Runtime.LiveLiteralKt.swift:8:32: error: cannot assign to property: 'isLiveLiteralsEnabled' is a get-only property

Here is implementation from this file

public var isLiveLiteralsEnabled: Swift.Bool { get { return myApp.LiveLiteralKt.isLiveLiteralsEnabled } set(value) { myApp.LiveLiteralKt.isLiveLiteralsEnabled = value } }

While LiveLiteral.kt (from Jetbrains Compose) looks like

@InternalComposeApi @ComposeCompilerApi var isLiveLiteralsEnabled: Boolean = false private set

Kotlin version: 1.9.22 SKIE version: 0.6.1

FilipDolnik commented 9 months ago

Hi! I was able to reproduce this error, and it will likely be fixed in the next bug-fix release.

In the meantime, you can work around this problem by disabling the global wrapper for this property using the Gradle configuration:

skie {
    features {
        // Not sure if this is the right package name
        group("androidx.compose.runtime.internal.isLiveLiteralsEnabled") {
            FunctionInterop.FileScopeConversion.Enabled(false)
        }
    }
}
mksmdvdff commented 9 months ago

It works, but it must be "false" in last line. But anyway - thank you for so fast answer and help! Do I need to close this issue?

FilipDolnik commented 9 months ago

Oh, yeah, it should be "false". I was testing if it works and forgot to change it back :D I corrected the code in the previous comment.

No need to close this issue, I will close it after we have a proper fix.

FilipDolnik commented 8 months ago

Fixed in 0.6.2.