Skip to content

False positive on package-qualified import #4826

@Aster89

Description

@Aster89

I've searched for is:issue state:closed "PackageImports", and the most recent issue was created on 2022, while the most recently updated one was updated in 2024. That both seems quite some time ago. Plus the titles don't suggest they're about what I'm observing. I haven't gone through more than a few issue without finding much.

Your environment

Which OS do you use?
up-to-date ArchLinux
Which version of GHC do you use and how did you install it?
GHC 9.14.1 from GHCup
How is your project built (alternative: link to the project)?
https://github.com/sellout/pathway

Which LSP client (editor/plugin) do you use?
(terminal) Vim + YCM
Which version of HLS do you use and how did you install it?
HLS 2.13.0.0 from GHCup
Have you configured HLS in any way (especially: a hie.yaml file)?
Nope

Steps to reproduce

  1. Clone the repo and build it, then open pathway/src/Data/Path/Type.hs:

    git clone https://github.com/sellout/pathway.git
    # at the time of writing, origin/main ≡ 336a358
    cd pathway
    cabal build all
    vim pathway/src/Data/Path/Type.hs # or whatever IDE you use
  2. Hover with the mouse (or whatever you do in your IDE) to query the type of, say, Any, just to make sure HLS is working. You should see no red squiggles so far.

  3. Tell HLS to go to the definition of Any, thus ending up into internal/src/Data/Path/Internal/Type.hs. All seems fine here too.

  4. Head back to the previously opened file, pathway/src/Data/Path/Type.hs.

Expected behaviour

No error diagnostics.

Actual behaviour

Error diagnostic on the text Data.Path.Internal.Type, saying

Could not find module ‘Data.Path.Internal.Type’.
Perhaps you meant
  Data.Path.Internal.Type (needs flag -package-id pathway-internal-0.0.1.0)
  Data.Path.Internal (needs flag -package-id pathway-internal-0.0.1.0)

Debug information

If I change

import "pathway-internal" Data.Path.Internal.Type as Type

to

import Data.Path.Internal.Type as Type

in pathway/src/Data/Path/Type.hs, i.e. if I remove the package-qualified import, the error disappears, so I believe the issue is precisely with the PackageImports extension.

Metadata

Metadata

Assignees

No one assigned

    Labels

    status: needs triagetype: bugSomething isn't right: doesn't work as intended, documentation is missing/outdated, etc..

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions