fix: treat pretty-printed names as strings #2652
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.
I initially expected
Name
s to always faithfully represent internal data, in particular that a name with macro scopes would have a form such as`foo._@.Module._hyg.1
, and that tombstones would only appear in types that represent pretty-printed output such as asString
orFormat
. However, that is not what happens. We havesanitizeNames
which rewrites theuserName
field of local hypotheses to beName.str .anonymous "blah✝"
.Then in the server code, we put these into
names : Array Name
. This works fine for displaying in the infoview, but if we try to deserialize anInteractiveHypothesisBundle
inside an RPC method for widget purposes, theFromJson Name
instance blows up inString.toName
.I think my preferred solution is to, rather than 'fix'
String.toName
to accept these names with tombstones, stop pretending that they are actualName
s and re-typeInteractiveHypothesisBundle.names : Array String
. This should be a backwards-compatible change w.r.t. infoview code as the JSON representation is a string in either case. It is not backwards compatible w.r.t. meta code that uses this field.See also Zulip discussion.