[GHC] #15659: Wacky error message when RULE mentions out-of-scope variable
#15659: Wacky error message when RULE mentions out-of-scope variable -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: 8.8.1 Component: Compiler | Version: 8.4.3 Keywords: newcomer | Operating System: Unknown/Multiple Architecture: | Type of failure: Poor/confusing Unknown/Multiple | error message Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- If I compile the following program with GHC 8.4 or later: {{{#!hs module Foo where {-# RULES "test" forall x. f x = x #-} }}} The error message I get is somewhat eyebrow-raising: {{{ $ /opt/ghc/8.4.3/bin/ghc Foo.hs [1 of 1] Compiling Foo ( Foo.hs, Foo.o ) Foo.hs:3:11: error: Rule "test": Not in scope: OutOfScope(f) in left-hand side: f x LHS must be of form (f e1 .. en) where f is not forall'd | 3 | {-# RULES "test" forall x. f x = x #-} | ^^^^^^^^^^^^^^^^^^^^^^^^ }}} I'm not sure what this `OutOfScope` business is, but I doubt we want to be referring to it in error messages. The error in GHC 8.2 and earlier was much less confusing: {{{ $ /opt/ghc/8.2.2/bin/ghc Foo.hs [1 of 1] Compiling Foo ( Foo.hs, Foo.o ) Foo.hs:3:11: error: Rule "test": Not in scope: f in left-hand side: f x LHS must be of form (f e1 .. en) where f is not forall'd | 3 | {-# RULES "test" forall x. f x = x #-} | ^^^^^^^^^^^^^^^^^^^^^^^^ }}} -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/15659> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#15659: Wacky error message when RULE mentions out-of-scope variable -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: 8.8.1 Component: Compiler | Version: 8.4.3 Resolution: | Keywords: newcomer Operating System: Unknown/Multiple | Architecture: Type of failure: Poor/confusing | Unknown/Multiple error message | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by Simon Peyton Jones <simonpj@…>): In [changeset:"cad5d0b69bc039b635a6eb0e5c9ed47d7c5a38ed/ghc" cad5d0b/ghc]: {{{ #!CommitTicketReference repository="ghc" revision="cad5d0b69bc039b635a6eb0e5c9ed47d7c5a38ed" Buglet in reporting out of scope errors in rules Most out of scope errors get reported by the type checker these days, but not all. Example, the function on the LHS of a RULE. Trace #15659 pointed out that this less-heavily-used code path produce a "wacky" error message. Indeed so. Easily fixed. }}} -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/15659#comment:1> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#15659: Wacky error message when RULE mentions out-of-scope variable -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: (none) Type: bug | Status: closed Priority: normal | Milestone: 8.8.1 Component: Compiler | Version: 8.4.3 Resolution: fixed | Keywords: newcomer Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: Poor/confusing | Test Case: error message | rename/should_fail/T15659 Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by simonpj): * status: new => closed * testcase: => rename/should_fail/T15659 * resolution: => fixed Comment: a plane journey gave me a chance to fix this. Thanks for reporting it! -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/15659#comment:2> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
participants (1)
-
GHC