Test suite using code generator fails to compile with `cabal v2-repl`
- Dominant language
- Haskell
- Stars
- 1.7k
- Forks
- 750
- Avg merge
- 4d 3h
- Merged PRs (30d)
- 28
Description
A test suite that depends on a code generator will successfully build with `cabal v2-build`, but not with `cabal v2-repl`.
**To Reproduce**
1. Clone https://github.com/RyanGlScott/code-generators-issue, which contains a minimal reproducer for the bug.
2. Run `cabal v2-build code-generators-issue-test` and observe that it succeeds:
```
$ cabal v2-build code-generators-issue-test
Build profile: -w ghc-9.2.4 -O1
In order, the following will be built (use -v for more details):
- code-generators-issue-0.1 (test:code-generators-issue-test) (additional components to build)
Preprocessing test suite 'code-generators-issue-test' for code-generators-issue-0.1..
Building test suite 'code-generators-issue-test' for code-generators-issue-0.1..
[1 of 2] Compiling GeneratedFile ( /home/rscott/Documents/Hacking/Haskell/code-generators-issue/dist-newstyle/build/x86_64-linux/ghc-9.2.4/code-generators-issue-0.1/t/code-generators-issue-test/build/code-generators-issue-test/code-generators-issue-test-gen/GeneratedFile.hs, /home/rscott/Documents/Hacking/Haskell/code-generators-issue/dist-newstyle/build/x86_64-linux/ghc-9.2.4/code-generators-issue-0.1/t/code-generators-issue-test/build/code-generators-issue-test/code-generators-issue-test-tmp/GeneratedFile.o )
Linking /home/rscott/Documents/Hacking/Haskell/code-generators-issue/dist-newstyle/build/x86_64-linux/ghc-9.2.4/code-generators-issue-0.1/t/code-generators-issue-test/build/code-generators-issue-test/code-generators-issue-test ...
```
3. Run `cabal v2-repl code-generators-issue-test` and observe that it fails:
```
$ cabal v2-repl code-generators-issue-test
Build profile: -w ghc-9.2.4 -O1
In order, the following will be built (use -v for more details):
- code-generators-issue-0.1 (test:code-generators-issue-test) (ephemeral targets)
Preprocessing test suite 'code-generators-issue-test' for code-generators-issue-0.1..
GHCi, version 9.2.4: https://www.haskell.org/ghc/ :? for help
Loaded GHCi configuration from /home/rscott/.ghci
[1 of 1] Compiling Main ( test/Test.hs, interpreted )
test/Test.hs:3:1: error:
Could not find module ‘GeneratedFile’
Use -v (or `:set -v` in ghci) to see a list of the files searched for.
|
3 | import GeneratedFile
| ^^^^^^^^^^^^^^^^^^^^
Failed, no modules loaded.
```
**Expected behavior**
I would expect both to succeed.
**System information**
- Ubuntu 20.04 (64-bit)
- ```
$ ghc --version
The Glorious Glasgow Haskell Compilation System, version 9.2.4
$ cabal --version
cabal-install version 3.8.1.0
compiled using version 3.8.1.0 of the Cabal library
```
Contributor guide
Research direction
Start by cloning the linked code-generators-issue reproducer and run the documented cabal v2-build and cabal v2-repl commands with GHC 9.2.4. Trace how v2-repl preprocesses the test suite and locates the generated GeneratedFile module; done means the test suite's GeneratedFile import loads successfully in the REPL as it does with v2-build.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- haskell
- Domain
- build-system, cli
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100