Get rid of shallow_repr and print full terms #1676
Merged
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.
For a long time, we've used
shallow_repr()
as a light pretty printer for terms in error messages. The issue is that this printer is very uninformative: anything past constant is printer as{ ... }
or[ ... ]
. It dates back to times where we didn't have a proper pretty printer, but now we have (and we can cap the output if we don't want the message to be too long).This PR get rid of
shallow_repr
and use theDisplay
instance forRichTerm
instead. It has the drawbacks of sometimes exposing generated variables (and, very soon, will be closure addresses) - we might want, in the future, to substitute some of the environment variables to get a better output. Still, even with generated variables, we have much more information about the structure of a term in an error message (field names, array length, etc.). Most of the error messages use codespan to print those terms, and codespan is handling long input on its own (only showing the beginning of the snippet and the end). Elsewhere, we usedpretty_print_cap
.