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

DocC cannot generate documentation for tuple containing multiple parameter packs. #999

Open
2 tasks done
JessyCatterwaul opened this issue Jul 26, 2024 · 1 comment
Open
2 tasks done
Labels
bug Something isn't working

Comments

@JessyCatterwaul
Copy link

JessyCatterwaul commented Jul 26, 2024

Description

Here is the simplest example I've been able to come up with:

public func function<each Element0, each Element1>(
  _: (repeat (each Element0, each Element1))
) { }

You need that for the following kinds of stuff:

/// A tuple of pairs built out of two underlying tuples.
///
/// - Note: Unlike `zip` for sequences, these two tuples are required to have the same count.
@_documentation(visibility: private) // DocC can't cope with this signature.
@inlinable public func zip<each Element0, each Element1>(
  _ element0: (repeat each Element0),
  _ element1: (repeat each Element1)
) -> (repeat (each Element0, each Element1)) {
  (repeat (each element0, each element1))
}
/// Equate tuples of tuples.
///
/// Tuples can't be considered `Equatable`,
/// so just using a version of `==` that compares parameters packs of `Equatables` is not adequate.
@_documentation(visibility: private) // DocC can't cope with this signature.
@inlinable public func == <each Element0: Equatable, each Element1: Equatable>(
  _ element0: (repeat (each Element0, each Element1)),
  _ element1: (repeat (each Element0, each Element1))
) -> Bool {
  for elements in repeat (each element0, each element1) {
    guard elements.0 == elements.1 else { return false }
  }
  return true
}

Checklist

  • If possible, I've reproduced the issue using the main branch of this package.
  • This issue hasn't been addressed in an existing GitHub issue.

Expected Behavior

I don't have to add @_documentation(visibility: private) to such code, and can document it! 📜

Actual behavior

Error: dataCorrupted(Swift.DecodingError.Context(codingPath: [CodingKeys(stringValue: "symbols", intValue: nil), _JSONKey(stringValue: "Index 0", intValue: 0), CodingKeys(stringValue: "swiftGenerics", intValue: nil), CodingKeys(stringValue: "constraints", intValue: nil), _JSONKey(stringValue: "Index 0", intValue: 0), CodingKeys(stringValue: "kind", intValue: nil)], debugDescription: "Cannot initialize Kind from invalid String value sameShape", underlyingError: nil))
Command CompileDocumentation failed with a nonzero exit code

Steps To Reproduce

No response

Swift-DocC Version Information

Tip of main: 081ad56

Swift Compiler Version Information

swift-driver version: 1.112.3 Apple Swift version 6.0 (swiftlang-6.0.0.6.8 clang-1600.0.23.1)
@JessyCatterwaul JessyCatterwaul added the bug Something isn't working label Jul 26, 2024
@aim2120
Copy link

aim2120 commented Dec 3, 2024

Experiencing the same problem in my project.

Triggering code:

public func MapPack<each V, each V2>(_ value: repeat each V, transform: repeat (each V) -> (each V2)) -> (repeat each V2) {
    (repeat (each transform)(each value))
}

Error:

Error: dataCorrupted(Swift.DecodingError.Context(codingPath: [CodingKeys(stringValue: "symbols", intValue: nil), _JSONKey(stringValue: "Index 1", intValue: 1), CodingKeys(stringValue: "swiftGenerics", intValue: nil), CodingKeys(stringValue: "constraints", intValue: nil), _JSONKey(stringValue: "Index 0", intValue: 0), CodingKeys(stringValue: "kind", intValue: nil)], debugDescription: "Cannot initialize Kind from invalid String value sameShape", underlyingError: nil))
Command CompileDocumentation failed with a nonzero exit code

Swift:

swift-driver version: 1.115 Apple Swift version 6.0.2 (swiftlang-6.0.2.1.2 clang-1600.0.26.4)
Target: arm64-apple-macosx14.0

Xcode:

Xcode 16.1
Build version 16B40

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants