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-529] Support for searchable diagnostic documentation #43146

Closed
ddunbar opened this issue Jan 12, 2016 · 6 comments
Closed

[SR-529] Support for searchable diagnostic documentation #43146

ddunbar opened this issue Jan 12, 2016 · 6 comments
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself diagnostics QoI Bug: Diagnostics Quality of Implementation

Comments

@ddunbar
Copy link
Member

ddunbar commented Jan 12, 2016

Previous ID SR-529
Radar None
Original Reporter @ddunbar
Type Bug
Status Resolved
Resolution Done
Additional Detail from JIRA
Votes 2
Component/s Compiler
Labels Bug, DiagnosticsQoI
Assignee owenvoorhees (JIRA)
Priority Medium

md5: 20f69e146e56d7a09c658b22f8a8b62a

Issue Description:

Some of Swift's diagnostics are very terse, especially diagnostics related to type system limitations.

It would be very nice of Swift provided with each diagnostic a unique identifier which could be used to find additional documentation on the diagnostic. For example, for "Protocol ... can only be used as a generic constraint" could lead people to a page explaining exactly what the diagnostic means, why it is present/required, and what are common solutions to the problems people are trying to solve when they encounter such things.

@milseman
Copy link
Mannequin

milseman mannequin commented Jan 12, 2016

I think this is very interesting, and in line with other work I'm doing on warning suppression. If anybody else is interested, by all means step up, otherwise I don't mind holding onto this one. I won't be able to tackle it for a couple weeks at the very least, though.

@belkadan
Copy link
Contributor

There are several directions we can go here. @jckarter has pointed to some of the awesome things Elm does.

@milseman
Copy link
Mannequin

milseman mannequin commented Jan 12, 2016

Much of that link seems to talk about what we already have, such as hints, reproducing and underlining the offending code, and colors. But they do show more details on failure, which could be an interesting direction to go further in, and they do show more type inference steps.

Better type-checking diagnostics is definitely a hugely valuable request, though I think Daniel was more so asking for a unique identifier for every warning, such that warnings are searchable/googlable. Then, we could have a lookup (online, or offline) on that identifier. Perhaps if we had a long-form description of each warning, mapped to the unique identifier, we could generate documentation (either on website or in error message themselves via some kind of --verbose-warnings) from them. Having a unique name/identifier would also be useful for finding relevant blog posts online, etc.

@ddunbar
Copy link
Member Author

ddunbar commented Jan 12, 2016

That is true, I would of course also love to see that documentation integrated better with the compiler. Having the facility for presenting the advanced documentation inline, or doing more sophisticated diagnostics UI (like pretty printing with syntax coloring the code in question with additional "advanced" explanation type stuff) would be awesome.

@swift-ci
Copy link
Collaborator

Comment by Owen Voorhees (JIRA)

Opened a PR here for stable diagnostic IDs to address the first half of this: #27299

@swift-ci
Copy link
Collaborator

Comment by Owen Voorhees (JIRA)

Educational notes are now available on master to address the compiler-integrated documentation aspect of this. So far we haven't introduced unique identifiers for diagnostics, but I think it makes sense to track that separately if we decide they would still be nice to have for stack overflow, google, etc. I'm going to mark this as resolved, but feel free to reopen if you disagree.

I'm tracking documentation coverage in https://bugs.swift.org/browse/SR-12509

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself diagnostics QoI Bug: Diagnostics Quality of Implementation
Projects
None yet
Development

No branches or pull requests

3 participants