[GHC] #14885: TH breaks the scoping of quoted default method implementations when spliced

GHC ghc-devs at haskell.org
Sun Mar 4 05:19:43 UTC 2018


#14885: TH breaks the scoping of quoted default method implementations when spliced
-------------------------------------+-------------------------------------
        Reporter:  RyanGlScott       |                Owner:  sighingnow
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Template Haskell  |              Version:  8.2.2
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
 Type of failure:  GHC rejects       |  Unknown/Multiple
  valid program                      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------
Changes (by sighingnow):

 * owner:  (none) => sighingnow


Comment:

 We didn't consider the association of signatures and default
 implementations when representing TH declarations, rather than use
 `hsSigTvBinders` to handle scoped type variables (as in `repBinds`).

 {{{#!hs
 repTyClD (L loc (ClassDecl { tcdCtxt = cxt, tcdLName = cls,
                              tcdTyVars = tvs, tcdFDs = fds,
                              tcdSigs = sigs, tcdMeths = meth_binds,
                              tcdATs = ats, tcdATDefs = atds }))
   = do { cls1 <- lookupLOcc cls         -- See note [Binders and
 occurrences]
        ; dec  <- addTyVarBinds tvs $ \bndrs ->
            do { cxt1   <- repLContext cxt
               ; sigs1  <- rep_sigs sigs
               ; binds1 <- rep_binds meth_binds
               ; fds1   <- repLFunDeps fds
               ; ats1   <- repFamilyDecls ats
               ; atds1  <- repAssocTyFamDefaults atds
               ; decls1 <- coreList decQTyConName (ats1 ++ atds1 ++ sigs1
 ++ binds1)
               ; repClass cxt1 cls1 bndrs fds1 decls1
               }
        ; return $ Just (loc, dec)
        }
 }}}

 I think I could try on this ticket.

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


More information about the ghc-tickets mailing list