[GHC] #12153: Bug in pattern synonyms with template haskell

#12153: Bug in pattern synonyms with template haskell -------------------------------------+------------------------------------- Reporter: MikeIzbicki | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.1 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: -------------------------------------+------------------------------------- #8761 added template haskell support for pattern synonyms, but I believe the implementation has a bug. If I create the following template Haskell syntax trees: {{{ PatSynD AST_sin (RecordPatSyn [a0]) Unidir (ConP HomFree [ViewP (VarE embedSig) (ConP HomSig_sin [VarP a0])]) PatSynD AST_cos (RecordPatSyn [a0]) Unidir (ConP HomFree [ViewP (VarE embedSig) (ConP HomSig_cos [VarP a0])]) }}} the compiler complains that `a0` is being redefined. Of course, this should be allowed because `a0` is local to each pattern synonym. A temporary workaround is to rename each variable to be unique to the pattern. The following template haskell compiles just fine. {{{ PatSynD AST_sin (RecordPatSyn [a0_sin]) Unidir (ConP HomFree [ViewP (VarE embedSig) (ConP HomSig_sin [VarP a0_sin])]) PatSynD AST_cos (RecordPatSyn [a0_cos]) Unidir (ConP HomFree [ViewP (VarE embedSig) (ConP HomSig_cos [VarP a0_cos])]) }}} This is with GHC 8.1.20160518 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12153 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#12153: Bug in pattern synonyms with template haskell -------------------------------------+------------------------------------- Reporter: MikeIzbicki | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.1 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 MikeIzbicki): Sorry, I just realized I was using `RecordPatSyn` when I meant to use `PrefixPatSyn`. Using the latter, the former compiles like I expected. I'm not sure how to delete/close the issue. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12153#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#12153: Bug in pattern synonyms with template haskell -------------------------------------+------------------------------------- Reporter: MikeIzbicki | Owner: Type: bug | Status: closed Priority: normal | Milestone: Component: Compiler | Version: 8.1 Resolution: invalid | Keywords: | PatternSynonyms Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by thomie): * keywords: => PatternSynonyms * status: new => closed * resolution: => invalid Comment:
I'm not sure how to delete/close the issue.
You can click on "Modify Ticket" and choose "resolve as". -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12153#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC