yshrsmz/BuildKonfig

[Kotlin v2] CONST_VAL_WITHOUT_INITIALIZER warnings

Opened this issue · 1 comments

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: #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):

  • OS: Mac OS 14.4.1
  • BuildKonfig Version: v0.15.1
  • Kotlin Version: 2.0.0-RC2
  • Gradle Version: 8.6

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...