Commit a7c5e25
authored
Fix regression with duplicated generated implementation sections (#321)
With the recent fix for supporting generated implementation sections for
symbols that include periods (like `Comparable...<`), we introduced a
regression where it's possible to end up with a duplicate default
implementation section.
This can happen when a protocol has a mix of documentation coverage. For example
```swift
public protocol Foo {
/// This is my great doc.
func fooMemberWithDocComment()
func fooMemberWithoutDocComment()
}
public extension Foo {
func fooMemberWithDocComment() { }
func fooMemberWithoutDocComment() { }
}
public struct Bar: Foo {}
```
Here `Bar` would end up with two "Foo Implementations" sections.
This is because we're able to access the original parent symbol for
`fooMemberWithDocComment()` but not for `fooMemberWithoutDocComment` so
these relationships end up with a different unique identifier but the same
collection name: "Foo Implementations".
The fix is to not rely on the parent relationship being there and instead
look at the origin symbol's parent path components. We can rely on the origin
symbol always being there for protocols defined in the current module.
This also resolves an issue where conforming to compmlicated protocols in a
different module would produce a misnamed collection. For example:
```swift
// FirstTarget
infix operator .<.. : RangeFormationPrecedence
public protocol OtherFancyProtocol {
static func .<.. (lhs: OtherFancyProtocol, rhs: OtherFancyProtocol)
}
public extension OtherFancyProtocol {
static func .<.. (lhs: OtherFancyProtocol, rhs: OtherFancyProtocol) {}
}
```
```swift
// SecondTarget
import FirstTarget
public struct OtherFancyProtocolConformer: OtherFancyProtocol {}
```
Here we would end up with a default collection named "< Implementations"
instead of "OtherFancyProtocol Implementations". The solution is to figure
out the actual name of the symbol based on the source symbol which is always
guaranteed to be there. We can use this to split out the parent symbol's name
from the source origin display name.
Resolves rdar://958089501 parent eb8e694 commit a7c5e25
File tree
6 files changed
+8310
-14
lines changed- Sources/SwiftDocC/Infrastructure
- Symbol Graph
- Tests/SwiftDocCTests
- Rendering
- Test Resources
6 files changed
+8310
-14
lines changedLines changed: 0 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1264 | 1264 | | |
1265 | 1265 | | |
1266 | 1266 | | |
1267 | | - | |
1268 | 1267 | | |
1269 | 1268 | | |
1270 | 1269 | | |
| |||
Lines changed: 33 additions & 13 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
43 | | - | |
| 43 | + | |
44 | 44 | | |
45 | 45 | | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
50 | 68 | | |
51 | | - | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
52 | 72 | | |
53 | 73 | | |
54 | 74 | | |
| |||
209 | 229 | | |
210 | 230 | | |
211 | 231 | | |
212 | | - | |
| 232 | + | |
213 | 233 | | |
214 | 234 | | |
215 | 235 | | |
| |||
223 | 243 | | |
224 | 244 | | |
225 | 245 | | |
| 246 | + | |
| 247 | + | |
226 | 248 | | |
227 | | - | |
228 | | - | |
229 | | - | |
230 | | - | |
231 | | - | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
232 | 252 | | |
233 | | - | |
| 253 | + | |
234 | 254 | | |
235 | 255 | | |
236 | 256 | | |
| |||
Lines changed: 115 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| 14 | + | |
14 | 15 | | |
15 | 16 | | |
16 | 17 | | |
| |||
650 | 651 | | |
651 | 652 | | |
652 | 653 | | |
| 654 | + | |
| 655 | + | |
| 656 | + | |
| 657 | + | |
| 658 | + | |
| 659 | + | |
| 660 | + | |
| 661 | + | |
| 662 | + | |
| 663 | + | |
| 664 | + | |
| 665 | + | |
| 666 | + | |
| 667 | + | |
| 668 | + | |
| 669 | + | |
| 670 | + | |
| 671 | + | |
| 672 | + | |
| 673 | + | |
| 674 | + | |
| 675 | + | |
| 676 | + | |
| 677 | + | |
| 678 | + | |
| 679 | + | |
| 680 | + | |
| 681 | + | |
| 682 | + | |
| 683 | + | |
| 684 | + | |
| 685 | + | |
| 686 | + | |
| 687 | + | |
| 688 | + | |
| 689 | + | |
| 690 | + | |
| 691 | + | |
| 692 | + | |
| 693 | + | |
| 694 | + | |
| 695 | + | |
| 696 | + | |
| 697 | + | |
| 698 | + | |
| 699 | + | |
| 700 | + | |
| 701 | + | |
| 702 | + | |
| 703 | + | |
| 704 | + | |
| 705 | + | |
| 706 | + | |
| 707 | + | |
| 708 | + | |
| 709 | + | |
| 710 | + | |
| 711 | + | |
| 712 | + | |
| 713 | + | |
| 714 | + | |
| 715 | + | |
| 716 | + | |
| 717 | + | |
| 718 | + | |
| 719 | + | |
| 720 | + | |
| 721 | + | |
| 722 | + | |
| 723 | + | |
| 724 | + | |
| 725 | + | |
| 726 | + | |
| 727 | + | |
| 728 | + | |
| 729 | + | |
| 730 | + | |
| 731 | + | |
| 732 | + | |
| 733 | + | |
| 734 | + | |
| 735 | + | |
| 736 | + | |
| 737 | + | |
| 738 | + | |
| 739 | + | |
| 740 | + | |
| 741 | + | |
| 742 | + | |
| 743 | + | |
| 744 | + | |
| 745 | + | |
| 746 | + | |
| 747 | + | |
| 748 | + | |
| 749 | + | |
| 750 | + | |
| 751 | + | |
| 752 | + | |
| 753 | + | |
| 754 | + | |
| 755 | + | |
| 756 | + | |
| 757 | + | |
| 758 | + | |
| 759 | + | |
| 760 | + | |
| 761 | + | |
| 762 | + | |
| 763 | + | |
| 764 | + | |
| 765 | + | |
| 766 | + | |
| 767 | + | |
653 | 768 | | |
654 | 769 | | |
655 | 770 | | |
| |||
0 commit comments