realm / jazzy

Soulful docs for Swift & Objective-C
https://realm.io
MIT License
7.35k stars 413 forks source link

Swift enum cases out of order #1406

Open thePsguy opened 2 weeks ago

thePsguy commented 2 weeks ago

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 commented 2 weeks ago

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.