Skip to content

.cabal file "flag used but not defined" error message has inaccurate source location. #10955

Open
@fendor

Description

@fendor

In a .cabal file like this:

cabal-version: 2.4
name:          hls-test-utils
version:       2.10.0.0
build-type:    Simple

library
  hs-source-dirs:   src
  build-depends:
    , base
  if flag(unix)
    build-depends: unix < 2.9

  default-language: GHC2021

I get the error message:

/home/hugin/Documents/haskell/hls/hls-test-utils/hls-test-utils.cabal:0:0: These flags are used without having been defined: unix

Cabal should report exactly where the flag is used but not defined.

This looks especially silly in HLS:

Image

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions