-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix "module defined in multiple files" with eval commands (#214)
Our favorite bug is back! We have a situation where `ghciwatch` loads all the modules at the start of the session, so they're all loaded: ``` ghci> :show targets Foo Bar Baz ``` Then, an eval command in (for example) module `Foo` is executed. To start with, the module is added and explicitly interpreted: ``` ghci> :add *src/Foo.hs ``` Unfortunately, this always uses the module path (see [#171](#171)), so if `ghciwatch` wasn't the one to load the module (e.g. it was loaded at the start of the session), the module path and module name will conflict and lead tot he dreaded "module is defined in multiple files". See: [https://gitlab.haskell.org/ghc/ghc/-/issues/13254#note_525037](https://gitlab.haskell.org/ghc/ghc/-/issues/13254#note_525037) # Solution I think we can fix this by keeping track of how each module is added to the session — as a path or as a module name — and then only using that form going forward.
- Loading branch information
Showing
9 changed files
with
125 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
/// Entries in `:show targets` can be one of two types: module paths or module names (with `.` in | ||
/// place of path separators). Due to a `ghci` bug, the module can only be referred to as whichever | ||
/// form it was originally added as (see below), so we use this to track how we refer to modules. | ||
/// | ||
/// See: <https://gitlab.haskell.org/ghc/ghc/-/issues/13254#note_525037> | ||
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)] | ||
pub enum TargetKind { | ||
/// A target named by its source path. | ||
Path, | ||
/// A target named by its module name. | ||
Module, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters