-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Better protocol conformance and substitution map printing #16622
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
Merged
huonw
merged 7 commits into
swiftlang:master
from
huonw:better-protocol-conformance-printing
May 15, 2018
Merged
Better protocol conformance and substitution map printing #16622
huonw
merged 7 commits into
swiftlang:master
from
huonw:better-protocol-conformance-printing
May 15, 2018
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@swift-ci please smoke test |
04e1cb1
to
41bdc91
Compare
@swift-ci please smoke test |
@swift-ci please smoke test macOS |
…en filled out. If they're printed before being checked, they have little useful content: just (normal_conformance type=Basic protocol=P1), with no details about their contents at all.
A recursive conformance would previously recur infinitely, but now prints just the header plus "(details printed above)". Fixes (most of) rdar://problem/40074968
This is much easier to read when part of a larger dump, where it now occurs in expressions and specialized conformances. Part of rdar://problem/40074968.
…ions. Within a dump of a DeclRef (or, more likely, a larger entity that includes one), the full multiline details of a substitution map are likely to not be hugely relevant, and just get in the way of understanding the interesting parts of the dump. Thus, this is a variant that is a single line and just includes the substitutions; the conformances (or, at least, the protocols involved) can be inferred from the generic signature combined with those substitutions. The style is controlled via a enum rather than a boolean, to avoid problems with trying to pass an indent like `map->dump(out, indent)`, where the integer indent coerces to a bool, rather than error. Fixes rdar://problem/40074968.
…t of a larger dump.
41bdc91
to
835c2c9
Compare
@swift-ci please smoke test |
Otherwise, since typealiases are used so often, one ends up with dumps that say nothing new/useful: (normal_conformance type=X protocol=P (assoc_type req=A type=X.A))
@swift-ci please smoke test |
Excellent! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This stops recursive conformances from printing forever, and replaces them with something like:
(Also, notice that the above says
(assoc_type req=A type=X)
with thetype
desugared toX
, whereas previously it would print the sugared versionX.A
because of thetypealias
.)This also makes substitution map printed lisp-style and indent-awarely... nice for specialised conformances:
And, lastly, minimises the size of substitution maps inside expressions (which occur on decl refs pointing to something generic):
Fixes rdar://problem/40074968.