[GHC] #13847: record construction accepts local unqualified name instead of qualified imported name

GHC ghc-devs at haskell.org
Mon Jun 19 09:24:37 UTC 2017


#13847: record construction accepts local unqualified name instead of qualified
imported name
-------------------------------------+-------------------------------------
           Reporter:  j.waldmann     |             Owner:  (none)
               Type:  bug            |            Status:  new
           Priority:  normal         |         Milestone:
          Component:  Compiler       |           Version:  8.0.1
           Keywords:                 |  Operating System:  Unknown/Multiple
       Architecture:                 |   Type of failure:  GHC accepts
  Unknown/Multiple                   |  invalid program
          Test Case:                 |        Blocked By:
           Blocking:                 |   Related Tickets:
Differential Rev(s):                 |         Wiki Page:
-------------------------------------+-------------------------------------
 Given
 {{{
 module A where
 data A = A { foo :: () } deriving Show
 }}}
 the following code is accepted
 {{{
 module Main where
 import qualified A
 foo = "foo"
 main = print $ A.A { foo = () }
 }}}
 albeit with a warning
 {{{
 B.hs:4:16: warning: [-Wmissing-fields]
     • Fields of ‘A.A’ not initialised: foo
 }}}
 Indeed the `foo = ()` is type-checked as if it were `A.foo = ()`
 but the `foo` field is actually not assigned. Evaluation gives
 {{{
 *Main> main
 A {foo = *** Exception: B.hs:4:16-31: Missing field in record construction
 foo
 }}}
 The code should be rejected outright?

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


More information about the ghc-tickets mailing list