[GHC] #13658: Assertion failure on HEAD: "optCoercion changed types!"

GHC ghc-devs at haskell.org
Sun May 7 18:31:54 UTC 2017


#13658: Assertion failure on HEAD: "optCoercion changed types!"
-------------------------------------+-------------------------------------
        Reporter:  bgamari           |                Owner:  (none)
            Type:  bug               |               Status:  new
        Priority:  high              |            Milestone:  8.2.1
       Component:  Compiler          |              Version:  8.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 bgamari):

 The problem here appears to be that the `TyConAppCo` case of
 `OptCoercion.opt_univ` fires,
 {{{#!hs
 opt_univ env sym prov role oty1 oty2
   | Just (tc1, tys1) <- splitTyConApp_maybe oty1
   , Just (tc2, tys2) <- splitTyConApp_maybe oty2
   , tc1 == tc2
   = pprTrace "opt_univ(tyconapp)" (ppr tc1 <+> ppr tys1 $$ ppr tc2 <+> ppr
 tys2) $
     let roles    = tyConRolesX role tc1
         arg_cos  = zipWith3 (mkUnivCo prov) roles tys1 tys2
         arg_cos' = zipWith (opt_co4 env sym False) roles arg_cos
     in
     mkTyConAppCo role tc1 arg_cos'
 }}}

 This emits,
 {{{
 opt_univ(tyconapp)
   Any [Any -> Any, Any]
   Any [Any -> Any]
 }}}
 for the problematic coercion.

 The issue here is that we end up dropping the second argument from `tys1`
 due to the `zipWith`. I suspect we want to add a guard to this equation
 asserting that `tys1` and `tys2` are of equal lengths.

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


More information about the ghc-tickets mailing list