Expected identifier; 'nullptr' is a keyword in Objective-C++
- Dominant language
- Kotlin
- Stars
- 3k
- Forks
- 148
- Avg merge
- 13h 44m
- Merged PRs (30d)
- 1
Description
I use `com.soywiz.korge:korge-core` v6.0.0 in KMP project and I get error `Expected identifier; 'nullptr' is a keyword in Objective-C++` in generated header in Objective C++/Swift project for methods:
```
- (double)maxOrElseNil:(double)nil __attribute__((swift_name("maxOrElse(nil:)")));
- (double)minOrElseNil:(double)nil __attribute__((swift_name("minOrElse(nil:)")));
```
References:
https://github.com/korlibs/korlibs-math/blob/ace56000cd8a040245f7132260c167122c2a8a2d/korlibs-math/src/korlibs/math/ArrayExt.kt#L13
https://dokka.korge.org/korge-foundation/korlibs.math/max-or-else.html
Possible solution:
rename declarations
https://kotlinlang.org/docs/native-objc-interop.html#change-declaration-names
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with korlibs-math/src/korlibs/math/ArrayExt.kt at the referenced declaration and compare the generated Objective-C header methods maxOrElseNil and minOrElseNil. Rename the declarations using Kotlin/Native Objective-C interop guidance, then verify that the generated header no longer treats nil or nullptr as an identifier in the reported Objective-C++/Swift project.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- kotlin, objective-c, swift
- Domain
- mobile-dev
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100