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

[SR-15556] Duplicate conformance sections generated from synthesized conformance in Docc #201

Open
heckj opened this issue Dec 4, 2021 · 1 comment
Labels
bug Something isn't working

Comments

@heckj
Copy link
Contributor

heckj commented Dec 4, 2021

Previous ID SR-15556
Radar rdar://problem/86089651
Original Reporter @heckj
Type Bug

Attachment: Download

Environment

Happens with both Xcode 13.1 and Version 13.2 beta 2 (13C5081f)

Additional Detail from JIRA
Votes 0
Component/s Swift-DocC, Swift-DocC-Render
Labels Bug
Assignee None
Priority Medium

md5: deb5998f8c142585ed2da631bc6fe8b3

Issue Description:

I'm not certain where the duplication comes from - but when I'm working on documenting a struct that has synthesized conformances, I'm seeing some replicated "Default Implementations" sections with the various operators.

The specific case that illustrates this is a struct that has an extenion where it conforms to Comparable. For detail, an example struct:

```
public struct ObjectId: Equatable, Hashable, Codable, ExpressibleByStringLiteral, ExpressibleByStringInterpolation {

init(_ objectId: String = UUID().uuidString)

{ self.objectId = objectId }

let objectId: String

public init(from decoder: Decoder) throws

{ let container = try decoder.singleValueContainer() self.objectId = try container.decode(String.self) }

public func encode(to encoder: Encoder) throws

{ var container = encoder.singleValueContainer() try container.encode(objectId) }

static let root: ObjectId = "_root"
static let head: ObjectId = "_head"

public init(stringLiteral value: StringLiteralType)

{ self.objectId = value }

func parseOpId() -> (counter: Int, actorId: String)? {
guard objectId.contains("@") else

{ return nil }

let splitted = objectId.split(separator: "@")
return (counter: Int(String(splitted[0]))!, actorId: String(splitted[1]))
}
}

extension ObjectId: Comparable {
public static func < (lhs: ObjectId, rhs: ObjectId) -> Bool

{ return lhs.objectId < rhs.objectId }

}
```

The resulting documentation exposed (through Xcode, or `docc-preview` on the CLI) shows the attached screenshot. Within each of the sections listed as 'Implementations' with nothing preceding it, are the same operators- screenshot of those attached as well. They're all from Comparable:
```
static func ... (Self) -> PartialRangeThrough<Self>
static func ... (Self) -> PartialRangeFrom<Self>
static func ... (Self, Self) -> ClosedRange<Self>
static func ..< (Self) -> PartialRangeUpTo<Self>
static func ..< (Self, Self) -> Range<Self>
```

@franklinsch
Copy link
Member

@swift-ci create

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@shahmishal shahmishal transferred this issue from apple/swift May 3, 2022
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

3 participants