Skip to content
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
UnkindPartition opened this issue Feb 18, 2016 · 5 comments
Closed

stack ghci attempts to load a removed module #1805

UnkindPartition opened this issue Feb 18, 2016 · 5 comments

Comments

@UnkindPartition
Copy link
Contributor

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
Copy link
Contributor

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 this to the P2: Should milestone Feb 18, 2016
@borsboom borsboom self-assigned this Feb 18, 2016
@mgsloan
Copy link
Contributor

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

@UnkindPartition
Copy link
Contributor Author

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
Copy link
Contributor

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
+ Fully resolves #921, where unlisted module warnings were being emitted
for deleted modules
@mgsloan
Copy link
Contributor

mgsloan commented Feb 21, 2016

Fixed!

@mgsloan mgsloan closed this as completed Feb 21, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants