yshrsmz / BuildKonfig

BuildConfig for Kotlin Multiplatform Project
Apache License 2.0
729 stars 33 forks source link

[Kotlin v2] CONST_VAL_WITHOUT_INITIALIZER warnings #148

Open AlexanderEggers opened 3 months ago

AlexanderEggers commented 3 months ago

Describe the bug When running a recent RC of the upcoming Kotlin v2 version (2.0.0-RC2), I'm running into a bunch of CONST_VAL_WITHOUT_INITIALIZER warnings:

This code uses error suppression for 'CONST_VAL_WITHOUT_INITIALIZER'. While it might compile and work, the compiler behavior is UNSPECIFIED and WON'T BE PRESERVED. Please report your use case to the Kotlin issue tracker instead: https://kotl.in/issue

This PR seems to be related to this issue: https://github.com/yshrsmz/BuildKonfig/pull/70.

To Reproduce Run a project using a recent Kotlin v2 RC. Add buildKonfig to the project, set a few props to const and observe the build throwing a lot of warnings during any build.

Expected behavior No warnings.

Desktop (please complete the following information):

Mina-1316 commented 2 months ago

Isn't expect val and actual const val isn't fit on this case? as the reference: https://youtrack.jetbrains.com/issue/KT-18856/Can-we-have-expect-actual-consts#focus=Comments-27-2335514.0-0

We need to investigate how the compiler handles it internally and what errors may occur when expect and multiple actuals are const mixed declarations, but it seems to be built well for now...