[GHC] #9815: Runtime error with RecordWildCards and a non-record constructor
#9815: Runtime error with RecordWildCards and a non-record constructor -------------------------------------+------------------------------------- Reporter: akio | Owner: Type: feature request | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.8.3 Keywords: RecordWildCards, | Operating System: warning | Unknown/Multiple Architecture: Unknown/Multiple | Type of failure: GHC Difficulty: Unknown | accepts invalid program Blocked By: | Test Case: Related Tickets: | Blocking: | Differential Revisions: -------------------------------------+------------------------------------- The following program is accepted with no warning, and crashes at runtime with an error: {{{#!hs {-# LANGUAGE RecordWildCards #-} newtype N = N Int deriving (Show) main = print N{..} }}} {{{ % runghc wildcards.hs wildcards.hs: wildcards.hs:4:14-18: Missing field in record construction }}} I find this behavior surprising. Would it be better to either disallow it or have `-fwarn-missing-fields` warn it? -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/9815> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#9815: Runtime error with RecordWildCards and a non-record constructor -------------------------------------+------------------------------------- Reporter: akio | Owner: Type: feature | Status: new request | Milestone: Priority: normal | Version: 7.8.3 Component: Compiler | Keywords: RecordWildCards, Resolution: | warning Operating System: | Architecture: Unknown/Multiple Unknown/Multiple | Difficulty: Unknown Type of failure: GHC | Blocked By: accepts invalid program | Related Tickets: Test Case: | Blocking: | Differential Revisions: | -------------------------------------+------------------------------------- Changes (by liyang): * cc: ghc.haskell.org@… (added) -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/9815#comment:1> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#9815: Runtime error with RecordWildCards and a non-record constructor -------------------------------------+------------------------------------- Reporter: akio | Owner: Type: feature | Status: new request | Milestone: Priority: normal | Version: 7.8.3 Component: Compiler | Keywords: RecordWildCards, Resolution: | warning Operating System: | Architecture: Unknown/Multiple Unknown/Multiple | Difficulty: Unknown Type of failure: GHC | Blocked By: accepts invalid program | Related Tickets: Test Case: | Blocking: | Differential Revisions: | -------------------------------------+------------------------------------- Comment (by Simon Peyton Jones <simonpj@…>): In [changeset:"4ba4cc7aaaf2bff31bc8474c8ba40e1cbe3e3875/ghc"]: {{{ #!CommitTicketReference repository="ghc" revision="4ba4cc7aaaf2bff31bc8474c8ba40e1cbe3e3875" Fix Trac #9815 Dot-dot record-wildcard notation is simply illegal for constructors without any named fields, but that was neither documented nor checked. This patch does so - Make the check in RnPat - Add test T9815 - Fix CmmLayoutStack which was using the illegal form (!) - Document in user manual }}} -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/9815#comment:2> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#9815: Runtime error with RecordWildCards and a non-record constructor -------------------------------------+------------------------------------- Reporter: akio | Owner: Type: feature | Status: closed request | Milestone: Priority: normal | Version: 7.8.3 Component: Compiler | Keywords: RecordWildCards, Resolution: fixed | warning Operating System: | Architecture: Unknown/Multiple Unknown/Multiple | Difficulty: Unknown Type of failure: GHC | Blocked By: accepts invalid program | Related Tickets: Test Case: | rename/should_fail/T9815 | Blocking: | Differential Revisions: | -------------------------------------+------------------------------------- Changes (by simonpj): * status: new => closed * testcase: => rename/should_fail/T9815 * resolution: => fixed Comment: Excellent point, thank you. Now fixed. Simon -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/9815#comment:3> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
participants (1)
-
GHC