[GHC] #14845: TypeInType, index GADT by constraint witness

GHC ghc-devs at haskell.org
Fri Jun 15 11:12:50 UTC 2018


#14845: TypeInType, index GADT by constraint witness
-------------------------------------+-------------------------------------
        Reporter:  Iceland_jack      |                Owner:  (none)
            Type:  feature request   |               Status:  patch
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  8.5
      Resolution:                    |             Keywords:  TypeInType
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:  #13895, #15215    |  Differential Rev(s):  Phab:D4728
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by Simon Peyton Jones <simonpj@…>):

 In [changeset:"2f6069ccf21d7be0e09016896238f417d2492ffa/ghc" 2f6069c/ghc]:
 {{{
 #!CommitTicketReference repository="ghc"
 revision="2f6069ccf21d7be0e09016896238f417d2492ffa"
 Make better "fake tycons" in error recovery

 Consider (Trac #15215)
   data T a = MkT ...
   data S a = ...T...MkT....

 If there is an error in the definition of 'T' we add a
 "fake type constructor" to the type environment, so that we
 can continue to typecheck 'S'.  But we /were not/ adding
 a fake anything for 'MkT' and so there was an internal
 error when we met 'MkT' in the body of 'S'.

 The fix is to add fake tycons for all the 'implicits' of 'T'.
 This is done by mk_fake_tc in TcTyClsDecls.checkValidTyCl,
 which now returns a /list/ of TyCons rather than just one.

 On the way I did some refactoring:

 * Rename TcTyDecls.tcAddImplicits to tcAddTyConsToGblEnv
   and make it /include/ the TyCons themeselves as well
   as their implicits

 * Some incidental refactoring about tcRecSelBinds. The main
   thing is that I've avoided creating a HsValBinds that we
   immediately decompose.  That meant moving some deck chairs
   around.

 NB: The new error message for the regression test T15215
 has the opaque error "Illegal constraint in a type:", flagged
 in Trac #14845.  But that's the fault of the latter ticket.
 The fix here not to blame.
 }}}

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


More information about the ghc-tickets mailing list