[GHC] #11987: Allow record wildcards with pattern synonyms

#11987: Allow record wildcards with pattern synonyms -------------------------------------+------------------------------------- Reporter: Iceland_jack | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.1 Keywords: | Operating System: Unknown/Multiple PatternSynonyms | Architecture: | Type of failure: None/Unknown Unknown/Multiple | Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- With pattern synonym `pattern Point {x, y} = (x, y)` we can write {{{
let { x = 1; y = 2 } in Point { x = x, y = y } (1, 2) }}} {{{ let { x = 1; y = 2 } in Point { x, y } (1, 2) }}}
but record wildcards ain't workin {{{#!hs
let { x = 1; y = 2 } in Point {..} <interactive>:342:25-36: error: Pattern synonym ‘Point’ used as a data constructor }}}
-- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11987 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11987: Allow record wildcards with pattern synonyms -------------------------------------+------------------------------------- Reporter: Iceland_jack | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.1 Resolution: | 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 mpickering): * cc: adamgundry (added) Comment: I was under the impression that Adam fixed this but maybe it was a different bug. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11987#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11987: Allow record wildcards with pattern synonyms -------------------------------------+------------------------------------- Reporter: Iceland_jack | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.1 Resolution: | 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: | -------------------------------------+------------------------------------- Comment (by mpickering): Again, this only happens in ghci. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11987#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11987: Allow record wildcards with pattern synonyms which are defined in GHCi -------------------------------------+------------------------------------- Reporter: Iceland_jack | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.1 Resolution: | 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: | -------------------------------------+------------------------------------- -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11987#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11987: Allow record wildcards with pattern synonyms which are defined in GHCi -------------------------------------+------------------------------------- Reporter: Iceland_jack | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.1 Resolution: | 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: | -------------------------------------+------------------------------------- Comment (by gelisam): I can reproduce the problem outside of ghci, but only if the pattern synonym is defined in a separate file: {{{#!hs {-# LANGUAGE NamedFieldPuns, PatternSynonyms, RecordWildCards #-} module Point where pattern Point :: Int -> Int -> (Int, Int) pattern Point{x, y} = (x, y) -- works sameFile :: (Int,Int) sameFile = let { x = 1; y = 2 } in Point { .. } }}} {{{#!hs {-# LANGUAGE NamedFieldPuns, PatternSynonyms, RecordWildCards #-} module Test where import Point -- works namedFieldPuns :: (Int,Int) namedFieldPuns = let { x = 1; y = 2 } in Point { x, y } -- error: Pattern synonym ‘Point’ used as a data constructor recordWildCards :: (Int,Int) recordWildCards = let { x = 1; y = 2 } in Point { .. } }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11987#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11987: Allow record wildcards with pattern synonyms which are defined in GHCi -------------------------------------+------------------------------------- Reporter: Iceland_jack | Owner: mpickering Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.1 Resolution: | 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 mpickering): * owner: => mpickering Comment: Fix is easy. Sorry for not looking sooner. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11987#comment:5 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11987: Allow record wildcards with pattern synonyms which are defined in GHCi -------------------------------------+------------------------------------- Reporter: Iceland_jack | Owner: mpickering Type: bug | Status: patch Priority: normal | Milestone: Component: Compiler | Version: 8.1 Resolution: | 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 mpickering): * status: new => patch Comment: Would be good to merge I think Ben. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11987#comment:6 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11987: Allow record wildcards with pattern synonyms which are defined in GHCi -------------------------------------+------------------------------------- Reporter: Iceland_jack | Owner: mpickering Type: bug | Status: patch Priority: normal | Milestone: Component: Compiler | Version: 8.1 Resolution: | 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: | -------------------------------------+------------------------------------- Comment (by simonpj): You've put it in patch status, but I see no patch -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11987#comment:7 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11987: Allow record wildcards with pattern synonyms which are defined in GHCi -------------------------------------+------------------------------------- Reporter: Iceland_jack | Owner: mpickering Type: bug | Status: patch Priority: normal | Milestone: Component: Compiler | Version: 8.1 Resolution: | Keywords: | PatternSynonyms Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D2544 Wiki Page: | -------------------------------------+------------------------------------- Changes (by mpickering): * differential: => Phab:D2544 Comment: Patch is here: https://phabricator.haskell.org/D2544 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11987#comment:8 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11987: Allow record wildcards with pattern synonyms which are defined in GHCi -------------------------------------+------------------------------------- Reporter: Iceland_jack | Owner: mpickering Type: bug | Status: patch Priority: normal | Milestone: Component: Compiler | Version: 8.1 Resolution: | Keywords: | PatternSynonyms Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D2544 Wiki Page: | -------------------------------------+------------------------------------- Comment (by mpickering): Ah, I was mistaken, there is two separate problems here. The patch fixes the second on reported today but the first one is a different issue. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11987#comment:9 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11987: Allow record wildcards with pattern synonyms which are defined in GHCi -------------------------------------+------------------------------------- Reporter: Iceland_jack | Owner: mpickering Type: bug | Status: patch Priority: normal | Milestone: Component: Compiler | Version: 8.1 Resolution: | Keywords: | PatternSynonyms Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D2544 Wiki Page: | -------------------------------------+------------------------------------- Comment (by simonpj): What is "first" and "second"? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11987#comment:10 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11987: Allow record wildcards with pattern synonyms which are defined in GHCi -------------------------------------+------------------------------------- Reporter: Iceland_jack | Owner: mpickering Type: bug | Status: patch Priority: normal | Milestone: Component: Compiler | Version: 8.1 Resolution: | Keywords: | PatternSynonyms Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D2544 Wiki Page: | -------------------------------------+------------------------------------- Comment (by mpickering): The patch fixes comment:4 but doesn't fix the case where a user defines a record pattern synonym in the GHCi prompt. To be specific, here is the exact example which still fails. {{{ *Test Prelude> pattern P{x} = Just x *Test Prelude> let x=5 in P{..} <interactive>:8:12: error: Illegal `..' notation for constructor ‘P’ The constructor has no labelled fields }}} It seems that `tcg_field_env` is not updated properly somewhere with the record pattern synonym selectors. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11987#comment:11 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11987: Allow record wildcards with pattern synonyms which are defined in GHCi
-------------------------------------+-------------------------------------
Reporter: Iceland_jack | Owner: mpickering
Type: bug | Status: patch
Priority: normal | Milestone:
Component: Compiler | Version: 8.1
Resolution: | Keywords:
| PatternSynonyms
Operating System: Unknown/Multiple | Architecture:
| Unknown/Multiple
Type of failure: None/Unknown | Test Case:
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s): Phab:D2544
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by Ben Gamari

#11987: Allow record wildcards with pattern synonyms which are defined in GHCi -------------------------------------+------------------------------------- Reporter: Iceland_jack | Owner: mpickering Type: bug | Status: merge Priority: normal | Milestone: 8.0.2 Component: Compiler | Version: 8.0.1 Resolution: | Keywords: | PatternSynonyms Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D2544 Wiki Page: | -------------------------------------+------------------------------------- Changes (by bgamari): * status: patch => merge * version: 8.1 => 8.0.1 * milestone: => 8.0.2 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11987#comment:13 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11987: Allow record wildcards with pattern synonyms which are defined in GHCi -------------------------------------+------------------------------------- Reporter: Iceland_jack | Owner: mpickering Type: bug | Status: closed Priority: normal | Milestone: 8.0.2 Component: Compiler | Version: 8.0.1 Resolution: fixed | Keywords: | PatternSynonyms Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D2544 Wiki Page: | -------------------------------------+------------------------------------- Changes (by bgamari): * status: merge => closed * resolution: => fixed Comment: comment:12 merged to `ghc-8.0 ` as 50e7157b97bf9bd06508fec656836b92668a859c. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11987#comment:14 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC