Tuple (`[A, B, C]`) doesn't work in Swift
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 1.9k
- Forks
- 117
- Avg merge
- 1d 8h
- Merged PRs (30d)
- 44
Description
When creating a tuple, the Swift code gets generated but it won't compile.
Tuple:
interface MyHybrid extends HybridObject<{ ios: 'swift' }> {
someFunc(value: [number, number, number])
}
Generated Swift:
class MyHybrid implements MyHybridSpec {
func someFunc(value: (Double, Double, Double)) {
// do nothing
}
}
Looks good, but unfortunately it will fail to compile because the Swift compiler inserted an additional < and > around the C++ type (std::tuple<<...>> instead of std::tuple<..>) in the generated -Swift.h header:
- SWIFT_INLINE_THUNK std::__1::tuple<<double, double, std::string>> MyHybridSpecCxx::getSomeTuple() {
I already reported this bug in the Swift compiler repo: https://github.com/swiftlang/swift/issues/75865
Until that's fixed, tuples are currently not supported in Nitrogen.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the tuple case from the issue and inspecting the generated -Swift.h declaration. Read the linked Swift compiler issue #75865 to determine whether a project-side path remains available. Done means tuple support no longer produces the malformed nested std::tuple angle brackets and the generated Swift interface compiles.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, swift, typescript
- Domain
- compilers, mobile-dev
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100