kotlin icon indicating copy to clipboard operation
kotlin copied to clipboard

[KT-48068] Add opt-in support for NSEnum for Kotlin Native iOS via an annotation

Open stefanhaustein opened this issue 1 month ago • 5 comments

Basically implementing the feature suggested here: https://youtrack.jetbrains.com/issue/KT-48068

stefanhaustein avatar Oct 29 '25 18:10 stefanhaustein

/test-private

SvyatoslavScherbina avatar Oct 30 '25 17:10 SvyatoslavScherbina

Failed to process command due to an unexpected exception.

kotlin-safe-merge[bot] avatar Oct 30 '25 17:10 kotlin-safe-merge[bot]

The K2 (Analysis API, aka AA) implementation is missing, which makes the new test fail in this mode. Run

./gradlew :native:objcexport-header-generator:testAnalysisApi --tests "org.jetbrains.kotlin.backend.konan.tests.ObjCExportHeaderGeneratorTest"

to reproduce.

Related code: https://github.com/JetBrains/kotlin/blob/f90cbf3d9a9437ca98360347a18dd9d9193ea76f/native/objcexport-header-generator/impl/analysis-api/src/org/jetbrains/kotlin/objcexport/translateToObjCClass.kt#L54

SvyatoslavScherbina avatar Oct 31 '25 12:10 SvyatoslavScherbina

Another thing to fix: adding a declaration to stdlib requires updating the ABI dump. Run the following command to do that:

./gradlew :tools:binary-compatibility-validator:cleanTest :tools:binary-compatibility-validator:test --tests "*" -Poverwrite.output=true

SvyatoslavScherbina avatar Oct 31 '25 12:10 SvyatoslavScherbina

The K2 (Analysis API, aka AA) implementation is missing, which makes the new test fail in this mode. Run

I have added this, but AA emits the a comment about the annotation whereas K1 does not... Any suggestions how to resolve this? Current state is the AA output

stefanhaustein avatar Nov 04 '25 13:11 stefanhaustein

Ok, I think the implementation is good now. But there are a few more things to be done to actually get it merged:

  1. Rebase it to master, squash the commits and write a commit message as recommended here.

I think I have rebased the fork successfully but would like to confirm that I won't screw up the branch with the wrong git command.... (I mainly use perforce for work... O:)

Can you confirm that a valid option to squash is to run git rebase -i HEAD~29 in the fork and then replace /every/ "pick" there with "squash" -- including commits from previous times I synced the fork to head? Would you recommend something else?

stefanhaustein avatar Dec 02 '25 14:12 stefanhaustein

I think I have rebased the fork successfully but would like to confirm that I won't screw up the branch with the wrong git command.... (I mainly use perforce for work... O:)

It seems that you actually merged the master branch, not rebased to master.

Can you confirm that a valid option to squash is to run git rebase -i HEAD~29 in the fork and then replace /every/ "pick" there with "squash" -- including commits from previous times I synced the fork to head? Would you recommend something else?

That won't work because of the merge. First, you need to get rid of the merge commits. Luckily, git rebase helps:

git rebase -i 5952e77c40174e23afb9b2606d3ee3dded3b4b9f

And then you can replace "pick" with "squash" (or "fixup").

SvyatoslavScherbina avatar Dec 03 '25 15:12 SvyatoslavScherbina

Thank you! Merged manually as 48a6704c2ba38ddcf9e29ab880755ec1e373e0ef.

SvyatoslavScherbina avatar Dec 09 '25 11:12 SvyatoslavScherbina