Fix "module defined in multiple files" AGAIN!!!! #237
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.
In #214, we had a situation where modules were loaded:
And then an eval comment in (e.g.)
Foo
causes the module to be added and explicitly interpreted by path:Then, we have
Foo
loaded by name (Foo
) and by path (src/Foo.hs
), which triggers the dreaded bug.At the time I proposed this fix, correctly:
I threaded some extra information to the
:show targets
parser to track if modules were listed as names or paths, but then at the end ofGhci::interpret_module
I would always insert the module into the target set as aTargetKind::Path
, meaning that the next time the comment was evaluated, the module would be loaded as a path, causing theerror.
ghciwatch/src/ghci/mod.rs
Lines 698 to 699 in dbba61b
This fixes the bug and adds an
assert!
to fail faster and more obviously if it happens again.Prior art