haskell/cabal

Removal of sub-component targets breaks HLS/hie-bios: we need regression test

Open

#9,688 opened on Feb 2, 2024

View on GitHub
 (7 comments) (1 reaction) (0 assignees)Haskell (1,731 stars) (732 forks)batch import
cabal-testsuitegood first issuenewcomertype: enhancement

Description

UPDATE: the change was reverted but let's leave the ticket open until we have a regression test.

Describe the bug

https://github.com/haskell/cabal/pull/8966 removes cabal-install's support for sub-module targets.

But this (mis-)feature is used by HLS via hie-bios to determine the flags for a component.

In particular it makes a call to cabal v2-repl <path to a .hs in the component>

To Reproduce Steps to reproduce the behavior:

Have a prerelease of cabal-install on your PATH

$ cabal repl <path to a .hs file>
Warning: this is a debug build of cabal-install with assertions enabled.
Error: [Cabal-7121]
Failed extracting script block: `{- cabal:` start marker not found

or

$ haskell-language-server <path to .hs file or a component target>
...
Loading the module 'so-and-so.hs' failed.

  It may not be listed in your .cabal file!
  Perhaps you need to add `so-and-so` to other-modules or exposed-modules.

Expected behavior HLS should at least work. Perhaps some work needs to be done to migrate HLS/hie-bios off this feature. Alternatively the MR could be reverted.

System information tested using cabal-head

Contributor guide