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

Fails when a file uses the PackageImports extension #40

Closed
ilyakooo0 opened this issue May 18, 2020 · 9 comments · Fixed by #45
Closed

Fails when a file uses the PackageImports extension #40

ilyakooo0 opened this issue May 18, 2020 · 9 comments · Fixed by #45

Comments

@ilyakooo0
Copy link

originally posted: https://github.com/digital-asset/ghcide/issues/569

I am fairly certain that the following error is related to the use of the PackageImports extension in the currently open file.

ghcide: very bad
CallStack (from HasCallStack):
  error, called at src/Development/IDE/Import/FindImports.hs:78:23 in ghcide-0.1.0-B7KZ16czJifIz5r3YZOrKr:Development.IDE.Import.FindImports
@mpickering
Copy link
Owner

How do I reproduce this?

@ilyakooo0
Copy link
Author

It seems to be reproducible by opening the following file in a project:

{-# LANGUAGE PackageImports #-}

module Foo
  (
  ) where

import "aeson" Data.Aeson

@mpickering
Copy link
Owner

@ilyakooo0 Can you try building from master again? I added a slightly better diagnostic which may help us see what's going on.

@ilyakooo0
Copy link
Author

By master you mean hls, right?

@mpickering
Copy link
Owner

Yes, sorry about that confusion.

@ilyakooo0
Copy link
Author

ghcide: mkImportDirs: main
CallStack (from HasCallStack):
  error, called at src/Development/IDE/Import/FindImports.hs:86:23 in ghcide-0.1.0-1cZQndkFIIrCG5hVUVKcRi:Development.IDE.Import.FindImports

@mpickering
Copy link
Owner

Thanks, that's very useful. Hopefully will get around to fixing it this week. It is probably safe to not error in this case if you want to make progress.

mpickering added a commit that referenced this issue May 20, 2020
In particular, be more careful about only returning import paths which
could actually be imported into the current module which means excluding
'main' modules.

Fixes #40
@mpickering
Copy link
Owner

Can you try this patch?

#45

@ilyakooo0
Copy link
Author

I can confirm that the issue is not present in the wip/refine-package-imports branch.

mpickering added a commit that referenced this issue May 22, 2020
In particular, be more careful about only returning import paths which
could actually be imported into the current module which means excluding
'main' modules.

Fixes #40
mpickering added a commit that referenced this issue May 22, 2020
In particular, be more careful about only returning import paths which
could actually be imported into the current module which means excluding
'main' modules.

Fixes #40
mpickering added a commit that referenced this issue May 23, 2020
In particular, be more careful about only returning import paths which
could actually be imported into the current module which means excluding
'main' modules.

Fixes #40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants