[GHC] #14549: RecordWildCards doesn't work properly in repl

GHC ghc-devs at haskell.org
Fri Dec 1 13:00:17 UTC 2017


#14549: RecordWildCards doesn't work properly in repl
-------------------------------------+-------------------------------------
           Reporter:  akegalj        |             Owner:  (none)
               Type:  bug            |            Status:  new
           Priority:  lowest         |         Milestone:
          Component:  GHCi           |           Version:  8.2.1
           Keywords:  repl,          |  Operating System:  Unknown/Multiple
  recordwildcards                    |
       Architecture:                 |   Type of failure:  Incorrect result
  Unknown/Multiple                   |  at runtime
          Test Case:                 |        Blocked By:
           Blocking:                 |   Related Tickets:
Differential Rev(s):                 |         Wiki Page:
-------------------------------------+-------------------------------------
 {{{#!hs
 Prelude> :set -XRecordWildCards
 Prelude> data Test = Test { t1 :: Int, t2 :: Int } deriving Show
 Prelude> t1 = 2
 Prelude> Test { t2 = 2, ..}

 <interactive>:15:1: warning: [-Wmissing-fields]
     • Fields of 'Test' not initialised: t1
     • In the expression: Test {t2 = 2, ..}
       In an equation for 'it': it = Test {t2 = 2, ..}

 <interactive>:15:1: warning: [-Wmissing-fields]
     • Fields of 'Test' not initialised: t1
     • In the expression: Test {t2 = 2, ..}
       In an equation for 'it': it = Test {t2 = 2, ..}
 Test {t1 = *** Exception: <interactive>:15:1-18: Missing field in record
 construction t1
 }}}


 I would expect above to return `Test {t1 = 2, t2 = 2}` instead of throwing
 an error.

-- 
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/14549>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list