Skip to content

Commit b0a2365

Browse files
committed
update DocumentationInheritance test expectations
1 parent 199c4e5 commit b0a2365

10 files changed

+53
-26
lines changed

Sources/SymbolGraphPartTests/DocumentationInheritance.swift

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -132,36 +132,42 @@ struct DocumentationInheritance
132132
.intrinsicWitness(.init(
133133
_ : "s24DocumentationInheritance15OtherRefinementPAAE8protocolytvp",
134134
of: "s24DocumentationInheritance8ProtocolP8protocolytvp",
135-
origin: .init("s24DocumentationInheritance8ProtocolP8protocolytvp"))),
135+
origin: "s24DocumentationInheritance8ProtocolP8protocolytvp")),
136+
137+
.requirement(.init(
138+
_ : "s24DocumentationInheritance10RefinementP8protocolytvp",
139+
of: "s24DocumentationInheritance10RefinementP",
140+
origin: "s24DocumentationInheritance8ProtocolP8protocolytvp")),
141+
142+
.override(.init(
143+
_ : "s24DocumentationInheritance10RefinementP8protocolytvp",
144+
of: "s24DocumentationInheritance8ProtocolP8protocolytvp",
145+
origin: "s24DocumentationInheritance8ProtocolP8protocolytvp")),
136146

137147
.member(.init(
138148
_ : "s24DocumentationInheritance9ConformerV7nowhereytvp",
139149
in: .scalar("s24DocumentationInheritance9ConformerV"),
140-
origin: .init("s24DocumentationInheritance10RefinementP7nowhereytvp"))),
150+
origin: "s24DocumentationInheritance10RefinementP7nowhereytvp")),
141151

142152
.member(.init(
143153
_ : "s24DocumentationInheritance9ConformerV10refinementytvp",
144154
in: .scalar(.init("s:24DocumentationInheritance9ConformerV")!),
145-
origin: .init(.init(
146-
"s:24DocumentationInheritance10RefinementP10refinementytvp")!))),
155+
origin: "s24DocumentationInheritance10RefinementP10refinementytvp")),
147156

148157
.member(.init(
149158
_ : "s24DocumentationInheritance9ConformerV9conformerytvp",
150159
in: .scalar("s24DocumentationInheritance9ConformerV"),
151-
origin: .init(
152-
"s24DocumentationInheritance10RefinementP9conformerytvp"))),
160+
origin: "s24DocumentationInheritance10RefinementP9conformerytvp")),
153161

154162
.member(.init(
155163
_ : "s24DocumentationInheritance9ConformerV10everywhereytvp",
156164
in: .scalar("s24DocumentationInheritance9ConformerV"),
157-
origin: .init(
158-
"s24DocumentationInheritance10RefinementP10everywhereytvp"))),
165+
origin: "s24DocumentationInheritance10RefinementP10everywhereytvp")),
159166

160167
.member(.init(
161168
_ : "s24DocumentationInheritance9ConformerV8protocolytvp",
162169
in: .scalar("s24DocumentationInheritance9ConformerV"),
163-
origin: .init(
164-
"s24DocumentationInheritance8ProtocolP8protocolytvp"))),
170+
origin: "s24DocumentationInheritance8ProtocolP8protocolytvp")),
165171
])
166172
}
167173
}

Sources/SymbolGraphParts/Relationships/Symbol.AnyRelationship.swift

Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,21 +16,39 @@ extension Symbol
1616
case requirement (RequirementRelationship)
1717
}
1818
}
19+
extension Symbol.AnyRelationship:CustomStringConvertible
20+
{
21+
public
22+
var description:String
23+
{
24+
switch self
25+
{
26+
case .conformance (let self): self.description
27+
case .intrinsicWitness (let self): self.description
28+
case .extension (let self): self.description
29+
case .inheritance (let self): self.description
30+
case .feature (let self): self.description
31+
case .member (let self): self.description
32+
case .override (let self): self.description
33+
case .requirement (let self): self.description
34+
}
35+
}
36+
}
1937
extension Symbol.AnyRelationship
2038
{
2139
@inlinable public
2240
var existential:any SymbolRelationship
2341
{
2442
switch self
2543
{
26-
case .conformance (let relationship): relationship
27-
case .intrinsicWitness (let relationship): relationship
28-
case .extension (let relationship): relationship
29-
case .inheritance (let relationship): relationship
30-
case .feature (let relationship): relationship
31-
case .member (let relationship): relationship
32-
case .override (let relationship): relationship
33-
case .requirement (let relationship): relationship
44+
case .conformance (let self): self
45+
case .intrinsicWitness (let self): self
46+
case .extension (let self): self
47+
case .inheritance (let self): self
48+
case .feature (let self): self
49+
case .member (let self): self
50+
case .override (let self): self
51+
case .requirement (let self): self
3452
}
3553
}
3654

Sources/SymbolGraphParts/Relationships/Symbol.ConformanceRelationship.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ extension Symbol.ConformanceRelationship:CustomStringConvertible
3434
var description:String
3535
{
3636
"""
37-
(conformance: \(self.source), to: \(self.target))
37+
/\(self.source) CONFORMS TO \(self.target) \
38+
(\(self.conditions.count) condition(s), \(self.origin == nil ? 0 : 1) origin(s))/
3839
"""
3940
}
4041
}

Sources/SymbolGraphParts/Relationships/Symbol.ExtensionRelationship.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ extension Symbol.ExtensionRelationship:CustomStringConvertible
2929
var description:String
3030
{
3131
"""
32-
(extension: \(self.source), of: \(self.target))
32+
/\(self.source) EXTENDS \(self.target)/
3333
"""
3434
}
3535
}

Sources/SymbolGraphParts/Relationships/Symbol.FeatureRelationship.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ extension Symbol.FeatureRelationship:CustomStringConvertible
2929
var description:String
3030
{
3131
"""
32-
(feature: \(self.source), of: \(self.target))
32+
/\(self.source) INHERITED BY \(self.target) (\(self.origin == nil ? 0 : 1) origin(s))/
3333
"""
3434
}
3535
}

Sources/SymbolGraphParts/Relationships/Symbol.InheritanceRelationship.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ extension Symbol.InheritanceRelationship:CustomStringConvertible
5555
var description:String
5656
{
5757
"""
58-
(inheritance by: \(self.source), of: \(self.target))
58+
/\(self.source) INHERITS FROM \(self.target) (\(self.origin == nil ? 0 : 1) origin(s))/
5959
"""
6060
}
6161
}

Sources/SymbolGraphParts/Relationships/Symbol.IntrinsicWitnessRelationship.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ extension Symbol.IntrinsicWitnessRelationship:CustomStringConvertible
5757
var description:String
5858
{
5959
"""
60-
(default implementation: \(self.source), of: \(self.target))
60+
/\(self.source) IMPLEMENTS \(self.target) (\(self.origin == nil ? 0 : 1) origin(s))/
6161
"""
6262
}
6363
}

Sources/SymbolGraphParts/Relationships/Symbol.MemberRelationship.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ extension Symbol.MemberRelationship:CustomStringConvertible
5757
var description:String
5858
{
5959
"""
60-
(member: \(self.source), of: \(self.target))
60+
/\(self.source) MEMBER OF \(self.target) (\(self.origin == nil ? 0 : 1) origin(s))/
6161
"""
6262
}
6363
}

Sources/SymbolGraphParts/Relationships/Symbol.OverrideRelationship.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ extension Symbol.OverrideRelationship:CustomStringConvertible
5858
var description:String
5959
{
6060
"""
61-
(override: \(self.source), of: \(self.target))
61+
/\(self.source) OVERRIDES \(self.target) (\(self.origin == nil ? 0 : 1) origin(s))/
6262
"""
6363
}
6464
}

Sources/SymbolGraphParts/Relationships/Symbol.RequirementRelationship.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ extension Symbol
1414
public
1515
let optional:Bool
1616

17+
@inlinable public
1718
init(_ source:Symbol.Decl,
1819
of target:Symbol.Decl,
1920
origin:Symbol.Decl? = nil,
@@ -65,7 +66,8 @@ extension Symbol.RequirementRelationship:CustomStringConvertible
6566
var description:String
6667
{
6768
"""
68-
(\(self.optional ? "optional " : "")requirement: \(self.source), of: \(self.target))
69+
/\(self.source) REQUIRED BY \(self.target) \
70+
(\(self.origin == nil ? 0 : 1) origin(s), optional: \(self.optional))/
6971
"""
7072
}
7173
}

0 commit comments

Comments
 (0)