[GHC] #9889: Pattern synonym does not work at top level

#9889: Pattern synonym does not work at top level -------------------------------------+------------------------------------- Reporter: goldfire | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.9 Keywords: PatternSynonyms | Operating System: Architecture: Unknown/Multiple | Unknown/Multiple Difficulty: Unknown | Type of failure: Blocked By: | None/Unknown Related Tickets: | Test Case: | Blocking: | Differential Revisions: -------------------------------------+------------------------------------- When I say {{{ pattern Id x = x Id x = True }}} I get {{{ Not in scope: data constructor ‘Id’ }}} This happens with both 7.8.3 and HEAD. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9889 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9889: Pattern synonym does not work at top level -------------------------------------+------------------------------------- Reporter: goldfire | Owner: cactus Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.9 Resolution: | Keywords: PatternSynonyms Operating System: | Architecture: Unknown/Multiple Unknown/Multiple | Difficulty: Unknown Type of failure: | Blocked By: None/Unknown | Related Tickets: Test Case: | Blocking: | Differential Revisions: | -------------------------------------+------------------------------------- Changes (by simonpj): * owner: => cactus Comment: Gergo: for you! -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9889#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9889: Pattern synonym does not work in top-level pattern bind -------------------------------------+------------------------------------- Reporter: goldfire | Owner: cactus Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.9 (Type checker) | Keywords: PatternSynonyms Resolution: | Architecture: Unknown/Multiple Operating System: | Difficulty: Unknown Unknown/Multiple | Blocked By: Type of failure: GHC | Related Tickets: rejects valid program | Test Case: | Blocking: | Differential Revisions: | -------------------------------------+------------------------------------- Changes (by cactus): * failure: None/Unknown => GHC rejects valid program * component: Compiler => Compiler (Type checker) Old description:
When I say
{{{ pattern Id x = x
Id x = True }}}
I get
{{{ Not in scope: data constructor ‘Id’ }}}
This happens with both 7.8.3 and HEAD.
New description: When I say {{{ {-# LANGUAGE PatternSynonyms #-} pattern Id x = x Id x = True }}} I get {{{ Not in scope: data constructor ‘Id’ }}} This happens with both 7.8.3 and HEAD. -- Comment: Note that pattern binds, in general, don't have this problem, only at the top level; e.g. the following works as expected: {{{ {-# LANGUAGE PatternSynonyms #-} pattern Id x = x foo = x where Id x = True }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9889#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9889: Pattern synonym does not work in top-level pattern bind
-------------------------------------+-------------------------------------
Reporter: goldfire | Owner: cactus
Type: bug | Status: patch
Priority: normal | Milestone:
Component: Compiler | Version: 7.9
(Type checker) | Keywords: PatternSynonyms
Resolution: | Architecture: Unknown/Multiple
Operating System: | Difficulty: Unknown
Unknown/Multiple | Blocked By:
Type of failure: GHC | Related Tickets:
rejects valid program |
Test Case: |
Blocking: |
Differential Revisions: |
-------------------------------------+-------------------------------------
Changes (by cactus):
* status: new => patch
Comment:
I've pushed a proposed fix for this to the `wip/T9889` branch, but it
might be a bit of a sensitive change, since it requires introducing
pattern synonym names in the renamer in a separate pass between renaming
`TyClDecl`s and `HsValBind`s. Simon, please review.
{{{
commit e5f429cbc02df745df1517d53c8ca170de41757b
Author: Dr. ERDI Gergo

#9889: Pattern synonym does not work in top-level pattern bind
-------------------------------------+-------------------------------------
Reporter: goldfire | Owner: cactus
Type: bug | Status: patch
Priority: normal | Milestone:
Component: Compiler (Type | Version: 7.9
checker) | Keywords:
Resolution: | PatternSynonyms
Operating System: Unknown/Multiple | Architecture:
Type of failure: GHC rejects | Unknown/Multiple
valid program | Test Case:
Blocked By: | Blocking:
Related Tickets: | Differential Revisions:
-------------------------------------+-------------------------------------
Comment (by Simon Peyton Jones

#9889: Pattern synonym does not work in top-level pattern bind -------------------------------------+------------------------------------- Reporter: goldfire | Owner: cactus Type: bug | Status: merge Priority: normal | Milestone: 7.10.1 Component: Compiler (Type | Version: 7.9 checker) | Keywords: Resolution: | PatternSynonyms Operating System: Unknown/Multiple | Architecture: Type of failure: GHC rejects | Unknown/Multiple valid program | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Revisions: -------------------------------------+------------------------------------- Changes (by cactus): * status: patch => merge * milestone: => 7.10.1 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9889#comment:5 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9889: Pattern synonym does not work in top-level pattern bind -------------------------------------+------------------------------------- Reporter: goldfire | Owner: cactus Type: bug | Status: closed Priority: normal | Milestone: 7.10.1 Component: Compiler (Type | Version: 7.9 checker) | Keywords: Resolution: fixed | PatternSynonyms Operating System: Unknown/Multiple | Architecture: Type of failure: GHC rejects | Unknown/Multiple valid program | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Revisions: -------------------------------------+------------------------------------- Changes (by thoughtpolice): * status: merge => closed * resolution: => fixed Comment: Merged to `ghc-7.10`. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9889#comment:6 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC