-
Notifications
You must be signed in to change notification settings - Fork 166
More symbol info about collisions in error message when a link is ambiguous #398
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
More symbol info about collisions in error message when a link is ambiguous #398
Conversation
|
@swift-ci please test |
|
|
||
| case .lookupCollision(let partialResult, let collisions): | ||
| let collisionDescription = collisions.map { "Add \($0.disambiguation.singleQuoted) to refer to \($0.node.fullNameOfValue(context: context).singleQuoted)"}.sorted() | ||
| let collisionDescription = collisions.map { "Append '-\($0.disambiguation)' to refer to \($0.node.fullNameOfValue(context: context).singleQuoted)"}.sorted() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we also delete the following "singleQuoted" call?
| let collisionDescription = collisions.map { "Append '-\($0.disambiguation)' to refer to \($0.node.fullNameOfValue(context: context).singleQuoted)"}.sorted() | |
| let collisionDescription = collisions.map { "Append '-\($0.disambiguation)' to refer to \($0.node.fullNameOfValue(context: context))"}.sorted() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think so. I feel the the quotation marks makes it easier to follow where each declaration starts and ends in the error message.
I surrounded the disambiguation interpolation with quotation marks because I also needed to prefix it with a dash and I felt that '-\($0.disambiguation)' was more readable than \(("-" + $0.disambiguation).singleQuoted). In the rest of the code I think that we're mostly using .singleQuoted.
Sources/SwiftDocC/Infrastructure/Link Resolution/PathHierarchy.swift
Outdated
Show resolved
Hide resolved
|
@swift-ci please test |
| try assertFindsPath("/MixedFramework/MyObjectiveCCompatibleProtocol/myProtocolMethod", in: tree, asSymbolID: "c:@M@MixedFramework@objc(pl)MyObjectiveCCompatibleProtocol(im)myProtocolMethod") | ||
| try assertFindsPath("/MixedFramework/MyObjectiveCCompatibleProtocol/myProtocolMethod()", in: tree, asSymbolID: "c:@M@MixedFramework@objc(pl)MyObjectiveCCompatibleProtocol(im)myProtocolMethod") | ||
| try assertFindsPath("/MixedFramework/MyObjectiveCCompatibleProtocol/myProtocolProperty", in: tree, asSymbolID: "c:@M@MixedFramework@objc(pl)MyObjectiveCCompatibleProtocol(py)myProtocolProperty") | ||
| // Objective-C class properties have a "property" kind instead of a "type.property" kind (rdar://92927788) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems unrelated, might be worth splitting this into a separate commit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is a separate commit in the PR. Did you mean open a separate PR for this change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, my bad I got confused, when reading the commit logs.
|
@swift-ci please test |
Bug/issue #, if applicable: #397 rdar://100436859
Summary
This shows the full symbol declarations in the error message for a symbol link that's ambiguous to help developers distinguish between the colliding symbols.
This also fixes a minor issue where the descriptions of unresolved references contained percent encoding, resulting in hard to read diagnostics.
These changes together refines this error message
into this error message
Dependencies
n/a
Testing
With
DOCC_USE_HIERARCHY_BASED_LINK_RESOLVER=YESwrite an ambiguous link, for example by adding this codeand linking to
CollisionsWithDifferentFunctionArguments/something(argument:)In the resulting error message it should be possible to distinguish the collisions.
Checklist
Make sure you check off the following items. If they cannot be completed, provide a reason.
./bin/testscript and it succeededUpdated documentation if necessary