[GHC] #13622: Regression: can't export constructor when conflicting, qualified constructor is also in scope
#13622: Regression: can't export constructor when conflicting, qualified constructor is also in scope -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: (none) Type: bug | Status: new Priority: high | Milestone: 8.2.1 Component: Compiler | Version: 8.2.1-rc2 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: -------------------------------------+------------------------------------- I ran into this regression when trying to compile the `ersatz` library with GHC 8.2.1-rc1. Here is a minimized example: {{{#!hs module Bug (Bits(Bits)) where import qualified Data.Bits as Bits newtype Bits = Bits Int }}} Compiling this with GHC 8.0.2 works fine, but with 8.2.1-rc1, you get this error: {{{ l$ /opt/ghc/8.2.1/bin/ghci Bug.hs GHCi, version 8.2.0.20170422: http://www.haskell.org/ghc/ :? for help Loaded GHCi configuration from /home/rgscott/.ghci [1 of 1] Compiling Bug ( Bug.hs, interpreted ) Bug.hs:1:13: error: • Ambiguous occurrence ‘Bits’ It could refer to either ‘Bits.Bits’, imported qualified from ‘Data.Bits’ at Bug.hs:3:1-34 or ‘Bits’, defined at Bug.hs:5:1 • In the export: Bits(Bits) | 1 | module Bug (Bits(Bits)) where | ^^^^^^^^^^ }}} Despite the fact that `Bits` isn't actually ambiguous, since the `Bits` from `Data.Bits` is qualified. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13622> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#13622: Regression: can't export constructor when conflicting, qualified constructor is also in scope -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: (none) Type: bug | Status: new Priority: high | Milestone: 8.2.1 Component: Compiler | Version: 8.2.1-rc2 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 Iceland_jack): That example could be featured in a children's book -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13622#comment:1> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#13622: Regression: can't export constructor when conflicting, qualified constructor is also in scope -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: (none) Type: bug | Status: new Priority: high | Milestone: 8.2.1 Component: Compiler | Version: 8.2.1-rc2 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 mpickering): Does it work with HEAD? I think I fixed this in #13528 -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13622#comment:2> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#13622: Regression: can't export constructor when conflicting, qualified constructor is also in scope -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: (none) Type: bug | Status: new Priority: high | Milestone: 8.2.1 Component: Compiler | Version: 8.2.1-rc2 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 RyanGlScott): I experience the same bug with GHC HEAD. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13622#comment:3> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#13622: Regression: can't export constructor when conflicting, qualified constructor is also in scope -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: (none) Type: bug | Status: new Priority: high | Milestone: 8.2.1 Component: Compiler | Version: 8.2.1-rc2 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 Lemming): * cc: Lemming (added) -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13622#comment:4> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#13622: Regression: can't export constructor when conflicting, qualified constructor is also in scope -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: (none) Type: bug | Status: new Priority: high | Milestone: 8.2.1 Component: Compiler | Version: 8.2.1-rc2 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 mpickering): The problem is that name clash errors are reported too eagerly. Solution. 1. Extend `ChildLookupResult` to have a case for an ambiguous lookup 2. Prefer other options to ambiguous lookup in the monoid instance. 3. Use `addNameClashErr` when handling `ChildLookupResult` for the ambiguous case. I need to look carefully at whether all the uses of ambiguous names are recoverable or whether they should all be deferred to later. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13622#comment:5> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#13622: Regression: can't export constructor when conflicting, qualified constructor is also in scope -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: mpickering Type: bug | Status: new Priority: high | Milestone: 8.2.1 Component: Compiler | Version: 8.2.1-rc2 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 mpickering): * owner: (none) => mpickering -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13622#comment:6> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#13622: Regression: can't export constructor when conflicting, qualified constructor is also in scope -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: mpickering Type: bug | Status: patch Priority: highest | Milestone: 8.2.1 Component: Compiler | Version: 8.2.1-rc2 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:D3515 Wiki Page: | -------------------------------------+------------------------------------- Changes (by mpickering): * status: new => patch * priority: high => highest * differential: => Phab:D3515 -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13622#comment:7> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#13622: Regression: can't export constructor when conflicting, qualified constructor is also in scope -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: mpickering Type: bug | Status: patch Priority: highest | Milestone: 8.2.1 Component: Compiler | Version: 8.2.1-rc2 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:D3515 Wiki Page: | -------------------------------------+------------------------------------- Comment (by rwbarton):
The problem is that name clash errors are reported too eagerly.
I guess you must know what you are talking about, but this sounds weird to me since I can't see what name clash there is in the original program. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13622#comment:8> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#13622: Regression: can't export constructor when conflicting, qualified constructor is also in scope -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: mpickering Type: bug | Status: patch Priority: highest | Milestone: 8.2.1 Component: Compiler | Version: 8.2.1-rc2 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:D3515 Wiki Page: | -------------------------------------+------------------------------------- Comment (by Ben Gamari <ben@…>): In [changeset:"1829d265662ca8d052df3e5df1aa1137b19e39ce/ghc" 1829d26/ghc]: {{{ #!CommitTicketReference repository="ghc" revision="1829d265662ca8d052df3e5df1aa1137b19e39ce" Implement sequential name lookup properly Previously we would run all the monadic actions and then combine their results. This caused problems if later actions raised errors but earlier lookups suceeded. We only want to run later lookups if the earlier ones fail. Fixes #13622 Reviewers: RyanGlScott, austin, bgamari, simonpj Reviewed By: simonpj Subscribers: simonpj, rwbarton, thomie GHC Trac Issues: #13622 Differential Revision: https://phabricator.haskell.org/D3515 }}} -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13622#comment:9> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#13622: Regression: can't export constructor when conflicting, qualified constructor is also in scope -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: mpickering Type: bug | Status: merge Priority: highest | Milestone: 8.2.1 Component: Compiler | Version: 8.2.1-rc2 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:D3515 Wiki Page: | -------------------------------------+------------------------------------- Changes (by bgamari): * status: patch => merge -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13622#comment:10> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#13622: Regression: can't export constructor when conflicting, qualified constructor is also in scope -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: mpickering Type: bug | Status: closed Priority: highest | Milestone: 8.2.1 Component: Compiler | Version: 8.2.1-rc2 Resolution: fixed | 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:D3515 Wiki Page: | -------------------------------------+------------------------------------- Changes (by bgamari): * status: merge => closed * resolution: => fixed Comment: Merged with 0c845697e054b5e30e76a801c7ebc78238c8268a. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13622#comment:11> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#13622: Regression: can't export constructor when conflicting, qualified constructor is also in scope -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: mpickering Type: bug | Status: closed Priority: highest | Milestone: 8.2.1 Component: Compiler | Version: 8.2.1-rc2 Resolution: fixed | 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:D3515 Wiki Page: | -------------------------------------+------------------------------------- Comment (by Lemming): Using `ghc-8.2.0.20170505` my problems are gone. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13622#comment:12> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
participants (1)
-
GHC