[GHC] #15270: TH doesn't verify name types during conversion

GHC ghc-devs at haskell.org
Wed Jun 13 16:35:36 UTC 2018


#15270: TH doesn't verify name types during conversion
-------------------------------------+-------------------------------------
        Reporter:  bgamari           |                Owner:  (none)
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:  8.6.1
       Component:  Template Haskell  |              Version:  8.4.3
      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:                    |
-------------------------------------+-------------------------------------
Description changed by bgamari:

Old description:

> Angerman reported that a use of the [[http://hackage.haskell.org/package
> /deriving-compat-0.4.2/docs/src/Data.Eq.Deriving.Internal.html#deriveEq1
> `deriveEq`]] splice is causing GHC to abort with an assertion failure:
> {{{#!hs
> zonkExpr env (HsVar x (L l id))
>   = ASSERT2( isNothing (isDataConId_maybe id), ppr id )
>     return (HsVar x (L l (zonkIdOcc env id)))
> }}}
>
> I suspect the `deriveEq1` is calling `varE` with a DataCon name. We
> should catch this case and throw a better error message.

New description:

 Angerman reported that a use of the [[http://hackage.haskell.org/package
 /deriving-
 compat-0.4.2/docs/src/Data.Eq.Deriving.Internal.html#deriveEq1|`deriveEq`]]
 splice is causing GHC to abort with an assertion failure:
 {{{#!hs
 zonkExpr env (HsVar x (L l id))
   = ASSERT2( isNothing (isDataConId_maybe id), ppr id )
     return (HsVar x (L l (zonkIdOcc env id)))
 }}}

 I suspect the `deriveEq1` is calling `varE` with a DataCon name. We should
 catch this case and throw a better error message.

--

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


More information about the ghc-tickets mailing list