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

GHC ghc-devs at haskell.org
Sat Jun 16 19:15:43 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:                    |
-------------------------------------+-------------------------------------

Comment (by RyanGlScott):

 Indeed, this is an odd one. Some other observations:

 * `conE 'id` fails with:

 {{{
     • Illegal data constructor name: ‘id’
       When splicing a TH expression: GHC.Base.id
     • In the untyped splice: $(conE 'id)
 }}}

 * `varE 'True` fails with:

 {{{
     • Illegal variable name: ‘True’
       When splicing a TH expression: GHC.Types.True
     • In the untyped splice: $(varE 'True)
 }}}

 * Finally, `$(varE (mkNameG_d "base" "GHC.Base" "id"))` fails with:

 {{{
     • Can't find interface-file declaration for data constructor
 GHC.Base.id
         Probable cause: bug in .hi-boot file, or inconsistent .hi file
         Use -ddump-if-trace to get an idea of which file caused the error
     • In the expression: (GHC.Base.id)
       In an equation for ‘it’: it = (GHC.Base.id)
 }}}

 I suppose we want something like that last error if we try to use `$(conE
 (mkNameG_v "ghc-prim" "GHC.Types" "True"))` as in comment:4. That being
 said, I can't figure out why we don't //currently// get that error. After
 all, that error message is caused by looking up a `Name` in an EPS and
 failing, so if `$(conE (mkNameG_v "ghc-prim" "GHC.Types" "True"))` isn't
 erroring, does that mean that a value named `True` //is// located in the
 EPS?

 I'm afraid I don't know how to proceed at this point, so do you think you
 could look at this, Ben?

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


More information about the ghc-tickets mailing list