Closed ceedubs closed 11 months ago
Good bug. I think this ought to be caught by the uniqueness
filter in calcImports
, but it's not being, because local bindings aren't being included in the PrintAnnotation.usages
tree of stats about names. I think the fix would be to add a LamsNamedOrDelay'
branch to suffixCounterTerm
(like the one in prettyBinding0
which actually does the pretty-printing of local bindings). And add tests in the FQN elision zone of the test suite. Note also the long explanatory comment here.
Am unlikely to get to this myself ☹️
@ChrisPenner Is there an easy fix in the pretty-printer or in PPE construction for this?
@aryairani There's no simple one-line change AFAICT, we'd need to keep track of all the in-scope locals while pretty-printing in order to do it, then would probably be easiest to just add an argument to the pretty printer of local vars.
Definitely fix-able, but not a super quick win.
Let's look at this in the next triage meeting maybe, if it's high enough priority I could take a look at it 😄
I think that this was fixed by #4213
The raw transcript is here.
pretty-printer doesn't consider local terms for unique suffix
It seems that the pretty-printer doesn't consider function-local terms when determining the minimal suffix to reference a term that is declared outside of the function.
Below we add
Foo.bar
and the localbar
. The watch statement shows that the result is3
, as would be expected.However, if you use
view
(oredit
), the pretty-printer showsbar + bar
, dropping theFoo
prefix from the first operand.