haskell / haskell/cabal

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

Open
#9,688 7 comments 1 reaction 0 assignees View on GitHub
cabal-testsuite good first issue newcomer type: enhancement
Dominant language
Haskell
Stars
1.7k
Forks
750
Avg merge
4d 3h
Merged PRs (30d)
28

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 `

**To Reproduce**
Steps to reproduce the behavior:

Have a prerelease of cabal-install on your PATH
```
$ cabal repl
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
...
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

Open the contributing guide

Research direction

Start by reproducing the `cabal v2-repl` call with a path to a `.hs` file, then inspect the cabal-install handling of sub-module targets and the HLS/hie-bios integration described here. Add a regression test covering a component target or source-file path and verify that HLS can determine the component flags without the reported failure.

Written by the indexing model from the issue text.

Assessment

Tech stack
haskell
Domain
cli, testing-qa
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.