touchlab / SKIE

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

Build Error When Enum Name Conflicts with KMP Library Name #114

Open sobaya-0141 opened 1 month ago

sobaya-0141 commented 1 month ago

The following template contains guiding questions that should help you provide as much helpful information as possible.

You don't have to follow the template, you can just write the bug report and check this template to see if the bug report answers all the relevant questions. Don't worry if you don't know some answers; we will help you find them if needed.

Questions:

What is the problem?

Build Error

When does the problem occur?

How do we reproduce the issue?

What is your SKIE Gradle configuration?

A build error occurs when the KMP library name and an enum constant name are the same.

Example:

kotlin {
    val xcfName = "hoge"  // This conflicts
    val xcf = XCFramework(xcfName)
    sourceSets.forEach {
        it.binaries.framework {
            baseName = xcfName
        }
    }
}
enum class Fuga {
    HOGE,  // This causes the build error
    SOBA,
}

What versions of SKIE, Kotlin, and Gradle do you use?

SKIE:0.8.4

ykws commented 1 month ago

Additional Information: We encountered the following error:

error: enum case 'hoge' cannot be used as an instance member
        case .hoge: return hoge.__Fuga.hoge as hoge.__Fuga
                            ^~~~~~
                            Fuga.

We still have an error, even when using @ObjCName(swiftName = "hoge2") with sight changes.

error: static member 'hoge' cannot be used on instance of type '__Fuga'
        return hoge.Fuga._unconditionallyBridgeFromObjectiveC(self)
               ^~~~~~
               __Fuga.