Skip to content
  • Simon Peyton Jones's avatar
    Fix decompsePiCos and visible type application · aedbf7f1
    Simon Peyton Jones authored
    Trac #15343 was caused by two things
    
    First, in TcHsType.tcHsTypeApp, which deals with the type argment
    in visible type application, we were failing to call
    solveLocalEqualities. But the type argument is like a user type
    signature so it's at least inconsitent not to do so.
    
    I thought that would nail it.  But it didn't. It turned out that we
    were ended up calling decomposePiCos on a type looking like this
        (f |> co) Int
    
    where co :: (forall a. ty) ~ (t1 -> t2)
    
    Now, 'co' is insoluble, and we'll report that later.  But meanwhile
    we don't want to crash in decomposePiCos.
    
    My fix involves keeping track of the type on both sides of the
    coercion, and ensuring that the outer shape matches before
    decomposing.  I wish there was a simpler way to do this. But
    I think this one is at least robust.
    
    I suppose it is possible that the decomposePiCos fix would
    have cured the original report, but I'm leaving the one-line
    tcHsTypeApp fix in too because it just seems more consistent.
    aedbf7f1