[GHC] #15419: GHC 8.6.1 regression (buildKindCoercion)

GHC ghc-devs at haskell.org
Thu Jul 19 23:30:23 UTC 2018


#15419: GHC 8.6.1 regression (buildKindCoercion)
-------------------------------------+-------------------------------------
        Reporter:  RyanGlScott       |                Owner:  goldfire
            Type:  bug               |               Status:  new
        Priority:  highest           |            Milestone:  8.6.1
       Component:  Compiler (Type    |              Version:  8.5
  checker)                           |
      Resolution:                    |             Keywords:  TypeInType
Operating System:  Unknown/Multiple  |         Architecture:
 Type of failure:  Compile-time      |  Unknown/Multiple
  crash or panic                     |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:  #15346            |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------
Changes (by RyanGlScott):

 * related:   => #15346


Comment:

 Amusingly enough, I think this simply a symptom of #15346. I tried
 applying this patch:

 {{{#!diff
 diff --git a/compiler/coreSyn/CoreOpt.hs b/compiler/coreSyn/CoreOpt.hs
 index 8684c84..11cbd1e 100644
 --- a/compiler/coreSyn/CoreOpt.hs
 +++ b/compiler/coreSyn/CoreOpt.hs
 @@ -979,7 +979,7 @@ pushCoTyArg co ty

    | isForAllTy tyL
    = ASSERT2( isForAllTy tyR, ppr co $$ ppr ty )
 -    Just (ty `mkCastTy` mkSymCo co1, MCo co2)
 +    Just (ty `mkCastTy` co1, MCo co2)

    | otherwise
    = Nothing
 @@ -989,8 +989,8 @@ pushCoTyArg co ty
         -- tyL = forall (a1 :: k1). ty1
         -- tyR = forall (a2 :: k2). ty2

 -    co1 = mkNthCo Nominal 0 co
 -       -- co1 :: k1 ~N k2
 +    co1 = mkSymCo (mkNthCo Nominal 0 co)
 +       -- co1 :: k2 ~N k1
         -- Note that NthCo can extract a Nominal equality between the
         -- kinds of the types related by a coercion between forall-types.
         -- See the NthCo case in CoreLint.
 diff --git a/compiler/types/Coercion.hs b/compiler/types/Coercion.hs
 index 2ca5151..1557ce0 100644
 --- a/compiler/types/Coercion.hs
 +++ b/compiler/types/Coercion.hs
 @@ -1812,7 +1812,7 @@ liftCoSubstVarBndrUsing fun lc@(LC subst cenv)
 old_var
      Pair k1 _    = coercionKind eta
      new_var      = uniqAway (getTCvInScope subst) (setVarType old_var k1)

 -    lifted   = Refl (TyVarTy new_var)
 +    lifted   = GRefl Nominal (TyVarTy new_var) (MCo eta)
      new_cenv = extendVarEnv cenv old_var lifted

  -- | Is a var in the domain of a lifting context?
 }}}

 And with that, the program in this ticket no longer panics.

 Richard, you're currently validating this patch, yes? Would you mind
 adding this as a regression test?

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


More information about the ghc-tickets mailing list