Skip to content

jextract: Fix duplicate rawValue generation for enums#707

Merged
ktoso merged 1 commit intoswiftlang:mainfrom
sidepelican:fix_redecl
Apr 17, 2026
Merged

jextract: Fix duplicate rawValue generation for enums#707
ktoso merged 1 commit intoswiftlang:mainfrom
sidepelican:fix_redecl

Conversation

@sidepelican
Copy link
Copy Markdown
Contributor

Currently, providing an enum that explicitly defines rawValue causes the generator to produce duplicate rawValue implementations.

public enum DeliveryStage : Swift.String, Swift.Sendable & Swift.Codable {
  case schedule
  case delivered
  public init?(rawValue: Swift.String)
  public typealias RawValue = Swift.String
  public var rawValue: Swift.String {
    get
  }
}
error: invalid redeclaration of 'Java_com_example_swift_DeliveryStage__00024getRawValue__J(environment:thisClass:selfPointer:)'

There was a simple logic error in the generator.

@sidepelican sidepelican requested a review from ktoso as a code owner April 17, 2026 01:22
Copy link
Copy Markdown
Collaborator

@ktoso ktoso left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@ktoso ktoso merged commit e0127ae into swiftlang:main Apr 17, 2026
63 of 64 checks passed
@sidepelican sidepelican deleted the fix_redecl branch April 17, 2026 01:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants