[GHC] #11028: Refactor ConDecl

GHC ghc-devs at haskell.org
Sun Nov 29 14:27:12 UTC 2015


#11028: Refactor ConDecl
-------------------------------------+-------------------------------------
        Reporter:  simonpj           |                Owner:  alanz
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  7.10.2
      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 alanz):

 I am now using `rnHsSigType` to rename the RHS of a `ConDeclGADT`, passing
 in a `ConDeclCtx`.

 This ends up calling

 {{{#!hs
 rnHsTyKi _ doc ty@(HsForAllTy { hst_bndrs = tyvars, hst_body  = tau })
   = bindLHsTyVarBndrs doc Nothing tyvars $ \ tyvars' ->
     do { (tau',  fvs) <- rnLHsType doc tau
        ; warnUnusedForAlls (inTypeDoc ty) tyvars' fvs
        ; return ( HsForAllTy { hst_bndrs = tyvars', hst_body =  tau' }
                 , fvs) }
 }}}

 `warnUnusedForAlls` does not use the passed in context, but `inTypeDoc ty`
 instead, causing tests such as T5331 to fail.

 Possible solutions seem to be

 1. use the passed in context for the `warnUnusedForalls`, which has the
 disadvantage of giving a less precise location.

 2. Combine the `doc` and the `inTypeDoc ty` contexts for the warning.

 3. Update the expected warning in the test, the forall context is good
 enough.


 Which is the best option, or is there another solution?

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


More information about the ghc-tickets mailing list