haskell / haskell/haskell-language-server
For `haskell/test-framework`, HLS has mysterious errors showing up in VSCode
- Dominant language
- Haskell
- Stars
- 3k
- Forks
- 455
- Avg merge
- 2d 19h
- Merged PRs (30d)
- 11
Description
To reproduce:
```
gh repo clone haskell/test-framework
cd test-framework
gh pr checkout 75
haskell-language-server-9.10.1
```
This fails, while e.g. `cabal build all -w ghc-9.10.1` succeeds without error.
The `cabal.project` here has:
```
packages: ./core
./hunit
./quickcheck2
./example
```
However, there is also a directory `./quickcheck` containing legacy code for the deprecated package `test-framework-quickcheck`. This code is not functioning and should be ignored by a build process.
The first error by HLS is:
```
2025-02-24T21:53:32.808035Z | Info | Making new HscEnv. In-place unit ids: [ test-framework-0.8.2.1-inplace
, test-framework-0.8.2.1-inplace-test-framework-tests
, test-framework-example-0.2.1-inplace-test-framework-example
, test-framework-hunit-0.3.0.2-inplace
, test-framework-quickcheck2-0.3.0.6-inplace ]
2025-02-24T21:53:32.901458Z | Info | Cradle path: quickcheck/Test/Framework/Providers/QuickCheck.hs
2025-02-24T21:53:32.901530Z | Warning | No [cradle](https://github.com/mpickering/hie-bios#hie-bios) found for quickcheck/Test/Framework/Providers/QuickCheck.hs.
Proceeding with [implicit cradle](https://hackage.haskell.org/package/implicit-hie).
You should ignore this message, unless you see a 'Multi Cradle: No prefixes matched' error.
2025-02-24T21:53:32.902256Z | Info | invoking build tool to determine build flags (this may take some time depending on the cache)
2025-02-24T21:53:33.381584Z | Info | Load cabal cradle using single file
2025-02-24T21:53:33.768656Z | Info | cabal --builddir=/Users/abela/.cache/hie-bios/dist-test-framework-3a7e3fed834d796685ee68f42b350f7b v2-repl --with-compiler /Users/abela/.cache/hie-bios/wrapper-b54f81dea4c0e6d1626911c526bc4e36 --with-hc-pkg /Users/abela/.cache/hie-bios/ghc-pkg-b5af9e5b00fb1eb99fb148381418ddd7 /Users/abel/bin/src/test-framework/quickcheck/Test/Framework/Providers/QuickCheck.hs
Environment Variables
HIE_BIOS_OUTPUT: /private/var/folders/19/d9jtc4c5365g3c_5jjk7m_980000gn/T/HIE_BIOS_OUTPUT46741-6
HIE_BIOS_GHC: /Users/abela/.ghcup/ghc/9.10.1/lib/ghc-9.10.1/bin/ghc-9.10.1
HIE_BIOS_GHC_ARGS: -B/Users/abela/.ghcup/ghc/9.10.1/lib/ghc-9.10.1/lib
2025-02-24T21:53:33.797389Z | Info | updateFileDiagnostics published different from new diagnostics - file diagnostics: File: /Users/abel/bin/src/test-framework/quickcheck/Test/Framework/Providers/QuickCheck.hs
Hidden: no
Range: 1:1-2:1
Source: cradle
Severity: DiagnosticSeverity_Error
Message:
Loading the module
'/Users/abel/bin/src/test-framework/quickcheck/Test/Framework/Providers/QuickCheck.hs' failed.
It may not be listed in your .cabal file!
Perhaps you need to add `QuickCheck` to other-modules or exposed-modules.
For more information, visit:
https://cabal.readthedocs.io/en/3.4/developing-packages.html#modules-included-in-the-package
```
HLS seems to leave the path to salvation here, by getting seduced to look into the broken package:
> No [cradle](https://github.com/mpickering/hie-bios#hie-bios) found for quickcheck/Test/Framework/Providers/QuickCheck.hs.
> Proceeding with [implicit cradle](https://hackage.haskell.org/package/implicit-hie).
From there the road to hell is paved:
> Loading the module
> '/Users/abel/bin/src/test-framework/quickcheck/Test/Framework/Providers/QuickCheck.hs' failed.
> It may not be listed in your .cabal file!
One wants to happily ignore this error, but it seems to derail HLS because we later see:
> Severity: DiagnosticSeverity_Error
> Message:
> attempting to use module ‘test-framework-0.8.2.1:Test.Framework.Utilities’
> (/Users/abel/bin/src/test-framework/core/src/Test/Framework/Utilities.hs) which is not loaded
This then causes a real type error:
> Severity: DiagnosticSeverity_Error
> Message: Variable not in scope: microsecondsToPicoseconds :: t0 -> Integer
Maybe HLS should not poke its nose into packages not listed in `cabal.project` or `stack.yaml`...
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.