Always print redefined value names and typenames in the REPL. #805
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.
Prior to this patch, defining two functions with the same name would
only cause the former to be printed by the REPL, e.g.
With this patch the REPL will also print the latter entry.
The previous implementation would simply diff the previous compiler
context and the current compiler context to determine which names were
new. However, this is not sufficient to tell whether a name has been
redefined as long as the internal names are not hygienic.
This patch refines the diffing approach:
For values the REPL computes the set of new IR vars -- which are
globally unique -- and uses those to determine whether a name has
been redefined, and thus should be printed.
As for typenames, the REPL makes use of a slight hack. Typenames are
represented as plain strings, so in order to check whether a
typename has been redefined this implementation performs a reference
equality check on the object that the typename is bound to. If that
check returns false, then the name has been redefined.
This situation will improve once I manage to land the hygienic names patch.