[GHC] #4042: Order of declarations affects the correctness of reported error.

GHC cvs-ghc at haskell.org
Tue May 4 10:49:39 EDT 2010


#4042: Order of  declarations affects the correctness of reported error.
----------------------------------+-----------------------------------------
    Reporter:  ChrisN             |        Owner:                                   
        Type:  bug                |       Status:  new                              
    Priority:  normal             |    Milestone:                                   
   Component:  Compiler (Parser)  |      Version:  6.12.2                           
    Keywords:                     |   Difficulty:                                   
          Os:  Linux              |     Testcase:                                   
Architecture:  Unknown/Multiple   |      Failure:  Incorrect warning at compile-time
----------------------------------+-----------------------------------------

Comment(by simonmar):

 There does indeed seem to be something strange going on here.  An
 expression on its own at the top level is an implicit Template Haskell
 splice nowadays (since 6.12.1), which accounts for some of the apparent
 oddness, but I don't understand this:

 {{{
 $ ghc -c -ddump-parsed 4042.hs

 ==================== Parser ====================
 f :: A -> A
 $(f)
 data A = A



 4042.hs:1:1:
     The type signature for `f' lacks an accompanying binding

 4042.hs:1:6: Not in scope: type constructor or class `A'

 4042.hs:1:11: Not in scope: type constructor or class `A'
 }}}

 moving the `data` declaration makes the "Not in scope" errors disappear:

 {{{
 $ ghc -c -ddump-parsed 4042.hs

 ==================== Parser ====================
 f :: A -> A
 data A = A
 $(f)



 4042.hs:1:1:
     The type signature for `f' lacks an accompanying binding
 }}}

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/4042#comment:1>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the Glasgow-haskell-bugs mailing list