Skip to content

Bad cabal build error message with mangled top of file #883

@bos

Description

@bos

(Imported from Trac #893, reported by @rrnewton on 2011-10-02)

I accidentally executed an Emacs keystroke that switched tokens around and mangled the top of my file:

{-# Language BangPatterns?, CPP #-} # OPTIONS_GHC
{--fno-warn-name-shadowing -fwarn-unused-imports #-}

When GHC is run directly on this file it gives a sensible error message

Control/Monad/Par/Stream.hs:1:36: parse error on input `#'

But when building through cabal build it looks like there is a module-name-finding heuristic that is failing (and defaulting to Main), resulting in this weird error message:

Building monad-par-0.1.0.2... Control/Monad/Par/Stream.hs:1:1:
File name does not match module name: Saw: `Main' Expected: `Control.Monad.Par.Stream'
Which really caused me to scratch my head when I saw it ;-). ("No where does it say Main!!") I was afraid I had messed up paths and was loading a different version of the file from another directory or something...

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions