haskell/hie-bios

Ambiguous target error

pepeiborra opened this issue · 1 comments

This error arises when using the simple Cabal cradle and a module is listed in more than one targets, e.g. in a library and a test suite:

Failed to parse result of calling cabal
Failed command: cabal --builddir=/home/debian/.cache/hie-bios/dist-glean-b7f5bda3788e268251326113cb8bbe28 v2-repl --with-compiler /home/debian/.cache/hie-bios/wrapper-b54f81dea4c0e6d1626911c526bc4e36 --with-hc-pkg /home/debian/.cache/hie-bios/ghc-pkg-e79adc0e43a6aff15fd0b2054117e35c /home/debian/glean/glean/server/Glean/Server/Sharding.hs

Error: cabal: Ambiguous target
'/home/debian/glean/glean/server/Glean/Server/Sharding.hs'. It could be:
publish-shards:glean/server/Glean/Server/Sharding (file)
glean-server:glean/server/Glean/Server/Sharding (file)

Process Environment:
HIE_BIOS_GHC: /home/debian/.ghcup/ghc/8.10.7/lib/ghc-8.10.7/bin/ghc
HIE_BIOS_GHC_ARGS: -B/home/debian/.ghcup/ghc/8.10.7/lib/ghc-8.10.7

I think it would be always sound to just pick the first target in the list, rather than failing with an unrecoverable error

Relevant cabal prs: