Skip to content
  • Simon Peyton Jones's avatar
    53aa59f3
    Add a missing zonk (fixes #16902) · 53aa59f3
    Simon Peyton Jones authored and Marge Bot's avatar Marge Bot committed
    In the eager unifier, when unifying (tv1 ~ tv2),
    when we decide to swap them over, to unify (tv2 ~ tv1),
    I'd forgotten to ensure that tv1's kind was fully zonked,
    which is an invariant of uUnfilledTyVar2.
    
    That could lead us to build an infinite kind, or (in the
    case of #16902) update the same unification variable twice.
    
    Yikes.
    
    Now we get an error message rather than non-termination,
    which is much better.  The error message is not great,
    but it's a very strange program, and I can't see an easy way
    to improve it, so for now I'm just committing this fix.
    
    Here's the decl
     data F (a :: k) :: (a ~~ k) => Type where
        MkF :: F a
    
    and the rather error message of which I am not proud
    
      T16902.hs:11:10: error:
        • Expected a type, but found something with kind ‘a1’
        • In the type ‘F a’
    53aa59f3
    Add a missing zonk (fixes #16902)
    Simon Peyton Jones authored and Marge Bot's avatar Marge Bot committed
    In the eager unifier, when unifying (tv1 ~ tv2),
    when we decide to swap them over, to unify (tv2 ~ tv1),
    I'd forgotten to ensure that tv1's kind was fully zonked,
    which is an invariant of uUnfilledTyVar2.
    
    That could lead us to build an infinite kind, or (in the
    case of #16902) update the same unification variable twice.
    
    Yikes.
    
    Now we get an error message rather than non-termination,
    which is much better.  The error message is not great,
    but it's a very strange program, and I can't see an easy way
    to improve it, so for now I'm just committing this fix.
    
    Here's the decl
     data F (a :: k) :: (a ~~ k) => Type where
        MkF :: F a
    
    and the rather error message of which I am not proud
    
      T16902.hs:11:10: error:
        • Expected a type, but found something with kind ‘a1’
        • In the type ‘F a’
Loading