[GHC] #13568: Name is reported as ambiguous and not in scope

GHC ghc-devs at haskell.org
Thu May 11 21:33:23 UTC 2017


#13568: Name is reported as ambiguous and not in scope
-------------------------------------+-------------------------------------
        Reporter:  mpickering        |                Owner:  mpickering
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  8.0.1
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):  Phab:D3547
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by Ben Gamari <ben@…>):

 In [changeset:"1381c142cd8d030f9997cdc206dcad006c028bbb/ghc"
 1381c142/ghc]:
 {{{
 #!CommitTicketReference repository="ghc"
 revision="1381c142cd8d030f9997cdc206dcad006c028bbb"
 Fix incorrect ambiguity error on identically-named data constructors

 Given multiple in-scope constructors with the same name, say `A`, and a
 function of type `A -> Int`, say, the compiler reports both a "type `A`
 is not in scope" and (incorrectly) an ambiguity error. The latter
 shouldn't be there if `DataKinds` isn't enabled.

 This issue was recommended to me by @mpickering as a suitable first
 task, and the fix was also outlined in the original Trac ticket. It
 involved a simple reordering of the steps taken in `lookup_demoted` in
 `RnEnv.hs`. The fix is to make the `DataKinds` check happen earlier,
 ensuring that the ambiguity check doesn't happen at all if we know the
 constructors couldn't have been promoted.

 Signed-off-by: Soham Chowdhury <chow.soham at gmail.com>

 Reviewers: mpickering, austin, bgamari

 Reviewed By: mpickering, bgamari

 Subscribers: rwbarton, thomie

 GHC Trac Issues: #13568

 Differential Revision: https://phabricator.haskell.org/D3547
 }}}

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


More information about the ghc-tickets mailing list