[GHC] #11624: Cannot declare hs-boot declaration if there is already a value in scope
#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@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
#11624: Cannot declare hs-boot declaration if there is already a value in scope -------------------------------------+------------------------------------- Reporter: ezyang | Owner: ezyang Type: bug | Status: new Priority: highest | Milestone: 8.0.1 Component: Compiler (Type | Version: 8.0.1-rc2 checker) | Resolution: | 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: | -------------------------------------+------------------------------------- Changes (by hvr): * priority: normal => highest Comment: This seems to be the same problem that causes regression in hackage:enumerator-0.4.20 with GHC HEAD/8.0: {{{ [ 4 of 10] Compiling Data.Enumerator.Compatibility ( lib/Data/Enumerator/Compatibility.hs, /tmp/enumerator-0.4.20/dist- newstyle/build/enumerator-0.4.20/build/Data/Enumerator/Compatibility.o ) lib/Data/Enumerator/Compatibility.hs:55:8: error: • Can't find interface-file declaration for variable EL.head 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: EL.head In an equation for ‘head’: head = EL.head ...and several more... }}} I'm increasing priority as this is a regression relative to 7.10 and there's at least on package on Hackage suffering from it. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/11624#comment:1> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#11624: Cannot declare hs-boot declaration if there is already a value in scope -------------------------------------+------------------------------------- Reporter: ezyang | Owner: ezyang Type: bug | Status: new Priority: highest | Milestone: 8.0.1 Component: Compiler (Type | Version: 8.0.1-rc2 checker) | Resolution: | 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: | -------------------------------------+------------------------------------- Changes (by RyanGlScott): * cc: RyanGlScott (added) -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/11624#comment:2> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#11624: Cannot declare hs-boot declaration if there is already a value in scope -------------------------------------+------------------------------------- Reporter: ezyang | Owner: ezyang Type: bug | Status: new Priority: highest | Milestone: 8.0.1 Component: Compiler (Type | Version: 8.0.1-rc2 checker) | Resolution: | 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: | -------------------------------------+------------------------------------- Comment (by ezyang): BTW, it's pretty easy to work around this problem: do an explicit import of Prelude bringing into scope only the identifiers you need. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/11624#comment:3> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#11624: Cannot declare hs-boot declaration if there is already a value in scope -------------------------------------+------------------------------------- Reporter: ezyang | Owner: ezyang Type: bug | Status: new Priority: highest | Milestone: 8.0.1 Component: Compiler (Type | Version: 8.0.1-rc2 checker) | Resolution: | 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: | -------------------------------------+------------------------------------- Comment (by ezyang): Just a hunch but I think it is highly likely this commit is the culprit: {{{ Commit 6ab5da9913e4f8a8dcc8bda3c77d4e896fd67352 Author: Richard Eisenberg <eir@cis.upenn.edu> Fri Apr 10 14:25:29 2015 Committer: Richard Eisenberg <eir@cis.upenn.edu> Fri Apr 24 13:53:02 2015 Rename role annotations w.r.t only local decls. Fix #10263. }}} -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/11624#comment:4> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#11624: Cannot declare hs-boot declaration if there is already a value in scope -------------------------------------+------------------------------------- Reporter: ezyang | Owner: ezyang Type: bug | Status: patch Priority: highest | Milestone: 8.0.1 Component: Compiler (Type | Version: 8.0.1-rc2 checker) | Resolution: | 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): Phab:D1963 Wiki Page: | -------------------------------------+------------------------------------- Changes (by ezyang): * status: new => patch * differential: => Phab:D1963 -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/11624#comment:5> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#11624: Cannot declare hs-boot declaration if there is already a value in scope -------------------------------------+------------------------------------- Reporter: ezyang | Owner: ezyang Type: bug | Status: patch Priority: highest | Milestone: 8.0.1 Component: Compiler (Type | Version: 8.0.1-rc2 checker) | Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: GHC rejects | Unknown/Multiple valid program | Test Case: Blocked By: | Blocking: Related Tickets: #10472 | Differential Rev(s): Phab:D1963 Wiki Page: | -------------------------------------+------------------------------------- Changes (by ezyang): * related: => #10472 -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/11624#comment:6> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#11624: Cannot declare hs-boot declaration if there is already a value in scope -------------------------------------+------------------------------------- Reporter: ezyang | Owner: ezyang Type: bug | Status: patch Priority: highest | Milestone: 8.0.1 Component: Compiler (Type | Version: 8.0.1-rc2 checker) | Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: GHC rejects | Unknown/Multiple valid program | Test Case: Blocked By: | Blocking: Related Tickets: #10472 | Differential Rev(s): Phab:D1963 Wiki Page: | -------------------------------------+------------------------------------- Comment (by Ben Gamari <ben@…>): In [changeset:"fc16690a536b74e7af72e963599471474e3df603/ghc" fc16690/ghc]: {{{ #!CommitTicketReference repository="ghc" revision="fc16690a536b74e7af72e963599471474e3df603" Fix #11624, cannot declare hs-boot if already one in scope. I'm not sure if this fix is the "right way" to do it, but it solves the proximal problem, which is that lookupBindGroupOcc was picking out the wrong renaming for hs-boot signatures, which then lead to an interface file error. Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu> Test Plan: validate Reviewers: simonpj, hvr, austin, bgamari Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D1963 GHC Trac Issues: #11624 }}} -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/11624#comment:7> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#11624: Cannot declare hs-boot declaration if there is already a value in scope -------------------------------------+------------------------------------- Reporter: ezyang | Owner: ezyang Type: bug | Status: merge Priority: highest | Milestone: 8.0.1 Component: Compiler (Type | Version: 8.0.1-rc2 checker) | Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: GHC rejects | Unknown/Multiple valid program | Test Case: Blocked By: | Blocking: Related Tickets: #10472 | Differential Rev(s): Phab:D1963 Wiki Page: | -------------------------------------+------------------------------------- Changes (by bgamari): * status: patch => merge -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/11624#comment:8> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#11624: Cannot declare hs-boot declaration if there is already a value in scope -------------------------------------+------------------------------------- Reporter: ezyang | Owner: ezyang Type: bug | Status: closed Priority: highest | Milestone: 8.0.1 Component: Compiler (Type | Version: 8.0.1-rc2 checker) | Resolution: fixed | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: GHC rejects | Unknown/Multiple valid program | Test Case: Blocked By: | Blocking: Related Tickets: #10472 | Differential Rev(s): Phab:D1963 Wiki Page: | -------------------------------------+------------------------------------- Changes (by bgamari): * status: merge => closed * resolution: => fixed @@ -3,1 +3,1 @@ - {{{ + {{{#!hs @@ -49,1 +49,1 @@ - Is a regression from 7.10. The dodginess is proximal to renameSig but I + Is a regression from 7.10. The dodginess is proximal to `renameSig` but I New description: This code no longer works: {{{#!hs -- 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@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. -- Comment: Merged to `ghc-8.0` as 88a86f126f0fb2439b832927d51fd6d6445135b7. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/11624#comment:9> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
participants (1)
-
GHC