Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Swift enum cases out of order #1406

Open
thePsguy opened this issue Nov 5, 2024 · 1 comment
Open

Swift enum cases out of order #1406

thePsguy opened this issue Nov 5, 2024 · 1 comment
Labels

Comments

@thePsguy
Copy link

thePsguy commented Nov 5, 2024

When generating with the symbolgraph build tool, enum cases are listed out of order. The wrong order is consistently the same:
screenshot

The above is generated for something like:

/// The fields represent individual days of the week.
///
/// Matches NSDateComponents.weekday index.
/// Refer to https://developer.apple.com/documentation/foundation/nsdatecomponents/1410442-weekday
public enum DayOfWeek: UInt {

  case sunday = 1

  case monday = 2

  case tuesday = 3

  case wednesday = 4

  case thursday = 5

  case friday = 6

  case saturday = 7
}

The following command was used:
jazzy --clean --sdk "iphoneos" --module GooglePlacesSwift --output jazzy_gen --swift-build-tool symbolgraph --build-tool-arguments -I,GooglePlacesSwift.xcframework/ios-arm64,-target,arm64-apple-ios17.4

where the ios-arm64 directory in the xcframework contains a .a and a .swiftmodule

Any ideas where the problem might lie?
I'm open to investigating / creating a PR.

Thanks!

@johnfairh
Copy link
Collaborator

Symbolgraph sometimes does not give us source location info -- in that case jazzy has to fall back to some kind of default sort order. I've never really looked into what causes this but I can make it happen artificially by deleting the <mod>.swiftsourceinfo file that accompanies the .swiftmodule when you do a straight swiftc -emit-module.

If I paste your code into a file & do that basic thing to build it, I get source declaration order but if I delete the .swiftsourceinfo I get your version.

@johnfairh johnfairh added the help label Nov 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants