Hi all, maybe is a known issue, but if I declare a...
# compose-ios
s
Hi all, maybe is a known issue, but if I declare a package variable in kotlin ios compilation fails: So something like:
Copy code
package myPackage

//imports

val SMALL = 8.dp
val LARGE = 16.dp
I have the following error:
Copy code
e: Compilation failed: IrPropertyPublicSymbolImpl for news/SMALL|649714184259855934[0] is already bound: PROPERTY name:SMALL visibility:public modality:FINAL [val]
The only solution I found is having them in an Object. Not sure if it's the right approach and I personally don't like it. For this kind of data could make sense, but if we have for example
compositionLocalOf
will be different from how is used in the rest of the framework
i
Found mention of
IrPropertyPublicSymbolImpl
here: https://github.com/JetBrains/compose-multiplatform/issues/3155 But as I see there is no repro there. If you have complete repro to share - it will be great. cc @Oleksandr Karpovich [JB]
s
Yes, I've a simple github project, I can create a branch with the error and share
o
interesting. we have global val(s) for composition locals in compose source set and they compile fine. your project will be helpful to reproduce. Do you use compose multiplatform compiler plugin? Or maybe androidx.compose.compiler? What kotlin version? Feel free to file an issue with these details
s
left a comment in the issue
thank you color 1
I've the problem during iosCompilation, (linking stage)
could be that my setup is wrong, it's my first project in compose multiplatform
I add a comment in github too, but if I remove the commonTest "module" compilation pass, looks like is linking 2 times the commonMain module with commonTest present.
🤔 1
Found the problem, and I think is my misconfiguration: was:
Copy code
val commonTest by getting {
            dependencies {
                dependsOn(commonMain)
                implementation(kotlin("test"))
                implementation(kotlin("test-common"))
                implementation(kotlin("test-junit"))
            }
        }
changed in:
Copy code
val commonTest by getting {
            dependencies {
                implementation(kotlin("test"))
                implementation(kotlin("test-common"))
                implementation(kotlin("test-junit"))
@@ -72,15 +71,7 @@ kotlin {
            }
        }
works fine. See this PR: https://github.com/sciack/news_kmp/pull/31/files
I also removed some noise from Gradle but that should not be relevant.
o
So did it fail only for tests compilation? right, commonMain is added everywhere by default. But it's a bit surprising that adding it more than once leads to such an error. Probably it's reproducible without Compose too.
s
Yes, I was thinking at most is redundant. No problem for android and desktop, but create problem in iOS (and maybe JS from the bug). Could be a problem of the KMP compiler. The step in error is the test linking one:
Task sharedlinkDebugTestIosSimulatorArm64
But I'm happy that I found the solution for my problem in an easy and clean way.
🙌 1
Just as suggestion, maybe add the test configuration (with a sample test one) in the multiplatform template, will simplify a lot the life to newbie like me.
âž• 1
thank you color 1