New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

stack ghci attempts to load a removed module #1805

Closed
feuerbach opened this Issue Feb 18, 2016 · 5 comments

Comments

Projects
None yet
3 participants
@feuerbach
Contributor

feuerbach commented Feb 18, 2016

If you remove a module from a project and erase all mentions of it from the cabal file and other source files, stack ghci may still attempt to load it (and fail).

This happens because Stack.Package.getDependencies will resurrect the dead module name from a stale interface file.

I don't really know what to do about this, but it sure was annoying and took me quite some time to figure out.

% stack --version
Version 1.0.3, Git revision 3f7b50fe598ec83eda5d393fe5b08a99ce5ac1e9 (dirty) (3212 commits) x86_64
@borsboom

This comment has been minimized.

Contributor

borsboom commented Feb 18, 2016

That definitely sounds like a bug. I think at one point it was the other way around (where modules left out of the .cabal file but referenced by source files wouldn't get loaded), but this is going a bit too far :)

Does running stack build and then stack ghci again help? In theory, the stack build should refresh the interface files and remove mentions of the removed module. Although stack ghci should be running the build first anyway, unless you're passing in --no-build.

@borsboom borsboom added the type: bug label Feb 18, 2016

@borsboom borsboom added this to the P2: Should milestone Feb 18, 2016

@borsboom borsboom self-assigned this Feb 18, 2016

@mgsloan

This comment has been minimized.

Collaborator

mgsloan commented Feb 19, 2016

I cannot reproduce the issue: https://gist.github.com/mgsloan/1b30acd0de8b57f1d014 . Does the thing I tried work for you? What's different about your setup?

Like @borsboom mentioned, are you passing in --no-build? Issues like this are why building is done by default. It'll be necessary until #1364

@feuerbach

This comment has been minimized.

Contributor

feuerbach commented Feb 19, 2016

In my case, the code wasn't buildable. It contained some errors that I was going to fix with the help of ghci. So, I guess stack did try to build it but failed.

@borsboom

This comment has been minimized.

Contributor

borsboom commented Feb 19, 2016

Yup, that explains it! Perhaps for the GHCI case we could have it skip any unlisted module which can't be found on the file system. In any case, we could make the warning in case of failed pre-GHCi build more clear that there can be inconsistent results.

mgsloan added a commit that referenced this issue Feb 21, 2016

Now ghci only loads present modules #1805
+ Fully resolves #921, where unlisted module warnings were being emitted
for deleted modules
@mgsloan

This comment has been minimized.

Collaborator

mgsloan commented Feb 21, 2016

Fixed!

@mgsloan mgsloan closed this Feb 21, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment