[GHC] #9436: Confusing error message with RecordWildCards

GHC ghc-devs at haskell.org
Tue Aug 12 17:58:11 UTC 2014


#9436: Confusing error message with RecordWildCards
-------------------------------------+-------------------------------------
       Reporter:  elliottt           |                   Owner:
           Type:  bug                |                  Status:  new
       Priority:  normal             |               Milestone:
      Component:  Compiler           |                 Version:  7.8.3
       Keywords:                     |        Operating System:
   Architecture:  Unknown/Multiple   |  Unknown/Multiple
     Difficulty:  Unknown            |         Type of failure:
     Blocked By:                     |  None/Unknown
Related Tickets:                     |               Test Case:
                                     |                Blocking:
                                     |  Differential Revisions:
-------------------------------------+-------------------------------------
 When using the RecordWildCards extension, a confusing error message is
 given when the constructor name is invalid.  For example, this module:

 {{{
 {-# LANGUAGE RecordWildCards #-}

 module Test where

 data T = T { x :: Int }

 f :: T -> Int
 f T' { .. } = x + 1
 }}}

 yields two error messages.  The first is about the constructor T' not
 being in scope, and the second is a confusing message about how `..' is
 not valid in a record pattern:

 {{{
 GHCi, version 7.8.3: http://www.haskell.org/ghc/  :? for help
 Loading package ghc-prim ... linking ... done.
 Loading package integer-gmp ... linking ... done.
 Loading package base ... linking ... done.
 [1 of 1] Compiling Test             ( Test.hs, interpreted )

 Test.hs:8:3:
     Not in scope: data constructor ‘T'’
     Perhaps you meant ‘T’ (line 5)

 Test.hs:8:3: You cannot use `..' in a record pattern
 Failed, modules loaded: none.
 }}}

 It seems like the second error should be left out in this case, as it's
 enough to report that the name isn't in scope.

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


More information about the ghc-tickets mailing list