#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> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler