Re: #16385: Lousy error message for `instance forall c. c`

"GHC" <[email protected]> Wed, 06 Mar 2019 21:48:28 -0000
Newsgroups gmane.comp.lang.haskell.glasgow.bugs
Message-ID <[email protected]>
--===============8525591287799797738==
Content-Type: multipart/related;
 boundary="===============4354143881979068026=="

--===============4354143881979068026==
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit

#16385: Lousy error message for `instance forall c. c`
-------------------------------------+-------------------------------------
        Reporter:  RyanGlScott       |                Owner:  (none)
            Type:  bug               |               Status:  closed
        Priority:  normal            |            Milestone:  8.10.1
       Component:  Compiler          |              Version:  8.6.3
      Resolution:  fixed             |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  Poor/confusing    |            Test Case:
  error message                      |  rename/should_fail/T16385
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |  https://gitlab.haskell.org/ghc/ghc/merge_requests/483
-------------------------------------+-------------------------------------

Comment (by Marge Bot <ben+marge-bot@…>):

 In [changeset:"78dd04f9126dc5df966070b8db4b39a517a9d99f/ghc"
 78dd04f9/ghc]:
 {{{
 #!CommitTicketReference repository="ghc"
 revision="78dd04f9126dc5df966070b8db4b39a517a9d99f"
 Fix #16385 by appending _maybe to a use of lookupGlobalOcc

 `instance forall c. c` claimed that `c` was out of scope because the
 renamer was invoking `lookupGlobalOcc` on `c` (in
 `RnNames.getLocalNonValBinders`) without binding `c` first. To avoid
 this, this patch changes GHC to invoke `lookupGlobalOcc_maybe` on `c`
 instead, and if that returns `Nothing`, then bail out, resulting
 in a better error message.
 }}}

-- 
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/16385#comment:3>