Repository navigation
A dotted name an imported file resolved once is not resolved again - #1785
HamedShams wants to merge 1 commit into
Conversation
parse_var turns a dotted name into its key (lib:Cell.At) and returns a
Ref holding it. The <..> family head, the \{..} arm names and the
(.. : T) operator namespace passed that key to parse_reso a second
time; for a datatype declared later in an imported file, parse_qual
then prefixed the namespace again and the term kept lib:lib:Cell.At, a
key no file declares. A module that checked on its own failed the
moment it was imported.
A source name never contains ":", so parse_reso returns a key that has
one unchanged. Guard and tests from @viridale's analysis in the issue.
Closes bendlang#1514.
|
@nicolas-abril a gentle ping on this one now that the queue has moved. I re-checked it today against main |
|
Thanks for picking this up, and to @viridale for the analysis in #1514. I'm closing this one. The guard fixes the symptom, not the cause. The |
Closes #1514.
parse_varresolves a dotted name once and returns aRefholding the key (lib:Cell.At). Three sites then pass that key toparse_resoagain: the<..>family head, the\{..}arm names and the(.. : T)operator namespace. When the name is already in the book,parse_resoreturns the key unchanged; for a datatype declared later in an imported file,parse_qualadds the namespace a second time and the term keepslib:lib:Cell.At, a key no file declares. So a file that checks on its own fails as soon as it is imported.A source name never contains
:(char_is_nameallows letters, digits,_and.), so a key that has one is already resolved, andparse_resonow returns it as is. That covers all three sites in one place.The guard and the two tests are @viridale's from the issue thread; I'm sending them as a PR since they'd been sitting there. Tests, in
tests/import/: a module whose def names a dotted datatype and constructor declared below it, and an entry that imports it. Onmainthe entry fails withunknown: forward_dotted_lib.forward_dotted_lib:Cell.At; here it prints 5, and the module alone still prints 7.What I ran: every file under
tests/throughbend <file>onmain(34003e6) and on this branch, 1,688 shared outputs identical, the two new tests the only additions;bun gates/repo.ts54/54. Not run: the cluster gates.