Opened 3 years ago

Last modified 3 years ago

#8956 new bug

Parser error shadowed by "module ‘main:Main’ is defined in multiple files" error

Reported by: hvr Owned by:
Priority: normal Milestone:
Component: Compiler Version: 7.8.1-rc2
Keywords: Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: Incorrect warning at compile-time Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:


Consider the following two (invalid) modules M1 and M2:

 # 1 "<built-in>" 1
module M1 where


 # 1 "<built-in>" 1
module M2 where

When those are compiled separately by GHC, they result in the following error:

$ ghc -c -Wall  M1.hs 

M1.hs:1:2: parse error on input ‘#’

ghc -c -Wall  M2.hs 

M2.hs:1:2: parse error on input ‘#’

However, when compiled simultaneously, the modules get seemingly parsed as Main-modules (which then conflict with each others):

ghc --make -Wall  M1.hs M2.hs 

<no location info>:
    module ‘main:Main’ is defined in multiple files: M1.hs M2.hs

Change History (2)

comment:1 Changed 3 years ago by hvr

Here's another example:

 f = ()
module M3 where
 f = ()
module M4 where

comment:2 Changed 3 years ago by hvr

Summary: Confusing error message due to ` #`-linesParser error shadowed by "module ‘main:Main’ is defined in multiple files" error
Note: See TracTickets for help on using tickets.