swiftlang / swiftlang/swift-java
Conforming to Equatable generates uncompilable Swift code
Nobody has claimed this yet.
- Dominant language
- Swift
- Stars
- 1.2k
- Forks
- 123
- Avg merge
- 1d 7h
- Merged PRs (30d)
- 16
Description
Reproduction
Conform to Equatable using:
extension MySwiftClass: Equatable {
public static func ==(lhs: MySwiftClass, rhs: MySwiftClass) -> Bool {
return false
}
}
in Samples/SwiftJavaExtractFFMSampleApp/Sources/MySwiftLibrary/MySwiftClass.swift and run ./gradlew :Samples:SwiftJavaExtractFFMSampleApp:jextract -i.
The Swift compilation currently fails with:
102 | public func swiftjava_MySwiftLibrary_MySwiftClass_==_lhs_rhs(_ lhs: UnsafeRawPointer, _ rhs: UnsafeRawPointer) -> Bool {
| `- error: expressions are not allowed at the top level
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 with Samples/SwiftJavaExtractFFMSampleApp/Sources/MySwiftLibrary/MySwiftClass.swift and run ./gradlew :Samples:SwiftJavaExtractFFMSampleApp:jextract -i. Inspect the generated Swift around swiftjava_MySwiftLibrary_MySwiftClass_==_lhs_rhs and determine why the Equatable operator produces invalid syntax. Done means the reproduction generates Swift that compiles successfully.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- swift
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100