[GHC] #11941: stage restriction mentioned when an identifier is out of scope
#11941: stage restriction mentioned when an identifier is out of scope -------------------------------------+------------------------------------- Reporter: aavogt | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.0.1-rc2 Keywords: | Operating System: Unknown/Multiple Architecture: | Type of failure: None/Unknown Unknown/Multiple | Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- {{{#!hs {-# LANGUAGE TemplateHaskell #-} import Data.Monoid const (return []) $ mempty { getFrst = Just () } }}} {{{ typeErrBug.hs:5:21: error: • GHC stage restriction: ‘getFrst’ is used in a top-level splice, quasi-quote, or annotation, and must be imported, not defined locally • In the second argument of ‘($)’, namely ‘mempty {getFrst = Just ()}’ In the expression: const (return []) $ mempty {getFrst = Just ()} typeErrBug.hs:5:30: error: Not in scope: ‘getFrst’ Perhaps you meant one of these: ‘getFirst’ (imported from Data.Monoid), ‘getLast’ (imported from Data.Monoid) }}} The stage restriction error shouldn't be mentioned: `getFrst` isn't defined at all while the "not defined locally" phrase says it's defined (in the wrong spot). -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/11941> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#11941: stage restriction mentioned when an identifier is out of scope -------------------------------------+------------------------------------- Reporter: aavogt | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.0.1-rc2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by Simon Peyton Jones <simonpj@…>): In [changeset:"c2b7a3d9f6ad946a2cb2773e96a377cc2216cb5b/ghc" c2b7a3d/ghc]: {{{ #!CommitTicketReference repository="ghc" revision="c2b7a3d9f6ad946a2cb2773e96a377cc2216cb5b" Avoid double error on out-of-scope identifier Trac #11941 demonstrated a case where an out-of-scope error also gave rise to a (bogus and confusing) stage restriction message. It's caused by the fact that out-of-scope errors do not stop renaming, but rather return an "unbound name". We need to detect this in the stage-restriction test to avoid the double error. Easy fix. }}} -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/11941#comment:1> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#11941: stage restriction mentioned when an identifier is out of scope -------------------------------------+------------------------------------- Reporter: aavogt | Owner: Type: bug | Status: merge Priority: normal | Milestone: 8.0.2 Component: Compiler | Version: 8.0.1-rc2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: th/T11941 Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by simonpj): * status: new => merge * testcase: => th/T11941 * milestone: => 8.0.2 Comment: Great error report, thank you. The fix is small and non-invasive, so I'll mark it as "merge". Simon -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/11941#comment:2> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#11941: stage restriction mentioned when an identifier is out of scope -------------------------------------+------------------------------------- Reporter: aavogt | Owner: Type: bug | Status: closed Priority: normal | Milestone: 8.0.2 Component: Compiler | Version: 8.0.1-rc2 Resolution: fixed | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: th/T11941 Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by bgamari): * status: merge => closed * resolution: => fixed Comment: Merged to `ghc-8.0` as 8405c2edddd0cc76c748b109d99f096c33d1dc50. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/11941#comment:3> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
participants (1)
-
GHC