Skip to content

"Refine imports" code lens suggests to import internal module in multi-component project #2851

Open
@konsumlamm

Description

@konsumlamm

Example

Project structure:

├── hls-issues.cabal
├── src
│   ├── Internal.hs
│   └── Lib.hs
└── test
    └── Test.hs

Internal.hs

module Internal (example) where

example :: Int
example = 5

hls-issues.cabal

cabal-version:      2.4
name:               hls-issues
version:            0.1.0.0

library
    exposed-modules:  Lib
    other-modules:
        Internal
    build-depends:    base ^>= 4.15, containers
    hs-source-dirs:   src
    default-language: Haskell2010

test-suite test
    hs-source-dirs:   test
    main-is:          Test.hs
    type:             exitcode-stdio-1.0
    build-depends:    base ^>= 4.15, hls-issues
    default-language: Haskell2010

Lib.hs

module Lib (example) where

import Internal

Test.hs

import Lib (example)

lol :: Int
lol = example

image

HLS suggests to refine the imports to import Internal, eventhough Internal is not exposed from the library component and thus can't be used in the test suite.

Metadata

Metadata

Assignees

No one assigned

    Labels

    component: imports pluginmulti-componentIssues relating to multi-component supporttype: 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