[GHC] #12788: While using Data.Aeson.TH, "Irrefutable pattern failed for pattern sel_id : _"

GHC ghc-devs at haskell.org
Thu Nov 3 11:34:06 UTC 2016


#12788: While using Data.Aeson.TH, "Irrefutable pattern failed for pattern sel_id :
_"
-------------------------------------+-------------------------------------
        Reporter:  jchia             |                Owner:
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  8.0.1
      Resolution:                    |             Keywords:
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):

 Well that's odd.  I get
 {{{
 T12788.hs:11:14: error: Empty record update
 }}}
 which comes from `RnPat.rnHsRecUpdFields`.  And is quite correct.

 If I change the program to
 {{{
 $(deriveJSON defaultOptions{unwrapUnaryRecords = True} ''Bad)
 }}}
 then I get
 {{{
 T12788.hs:11:14: error:
     Variable not in scope: defaultOptions :: Options
 }}}
 which is also correct; `defaultOptions` is not in scope.

 All this happens with the 8.0.2 release candidate and HEAD.  I can't
 easily try 8.0 itself.

 Can you try with the 8.0 branch and HEAD?

 It really would be better if the "empty record update" didn't mask the
 other error, namely that `defaultOptions` isn't in scope.  Reason is the
 latter is reported by the type checker so that we can give the type of the
 out-of-scope variable, whereas the former comes from the renamer.

 Regardless, I can't make it crash.  Maybe it got fixed, somehow?  Can you
 double-check the repro case.

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


More information about the ghc-tickets mailing list