[GHC] #11624: Cannot declare hs-boot declaration if there is already a value in scope

GHC ghc-devs at haskell.org
Mon Feb 22 00:23:31 UTC 2016


#11624: Cannot declare hs-boot declaration if there is already a value in scope
-------------------------------------+-------------------------------------
           Reporter:  ezyang         |             Owner:  ezyang
               Type:  bug            |            Status:  new
           Priority:  normal         |         Milestone:  8.0.1
          Component:  Compiler       |           Version:  8.0.1-rc2
  (Type checker)                     |
           Keywords:                 |  Operating System:  Unknown/Multiple
       Architecture:                 |   Type of failure:  GHC rejects
  Unknown/Multiple                   |  valid program
          Test Case:                 |        Blocked By:
           Blocking:                 |   Related Tickets:
Differential Rev(s):                 |         Wiki Page:
-------------------------------------+-------------------------------------
 This code no longer works:

 {{{
 -- A.hs-boot
 module A where
 concat :: Int -> Int -- overlaps with Prelude's concat

 -- B.hs
 module B where
 import Prelude ()
 import {-# SOURCE #-} A
 x = concat 3

 -- A.hs
 module A where
 import B
 concat n = n + 2
 }}}

 Building `ghc --make A`, this crashes with:

 {{{
 [1 of 3] Compiling A[boot]          ( A.hs-boot, A.o-boot )
 [2 of 3] Compiling B                ( B.hs, B.o )

 B.hs:4:5: error:
     • Can't find interface-file declaration for variable concat
         Probable cause: bug in .hi-boot file, or inconsistent .hi file
         Use -ddump-if-trace to get an idea of which file caused the error
     • In the expression: concat 3
       In an equation for ‘x’: x = concat 3
 }}}

 The trouble is that renaming has botched up the top-level declaration for
 boot:

 {{{
 ezyang at sabre:~$ ghc-8.0 -c A.hs-boot -ddump-rn -dppr-debug
 A.hs-boot:1:1:

     ==================== Renamer ====================
     {A.hs-boot:2:1-20}
     base-4.9.0.0:Data.Foldable.concat{v r2S} ::
       {A.hs-boot:2:11-20}
       ghc-prim-0.5.0.0:GHC.Types.Int{(w) tc 3J}
       -> ghc-prim-0.5.0.0:GHC.Types.Int{(w) tc 3J}
 }}}

 Is a regression from 7.10. The dodginess is proximal to renameSig but I
 haven't quite narrowed it down yet.

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/11624>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list