Fix an outright bug in expandTypeSynonyms
Fix an outright bug in expandTypeSynonyms

The bug was in this code:

    go subst (TyConApp tc tys)
      | Just (tenv, rhs, tys') <- expandSynTyCon_maybe tc tys
      = let subst' = unionTCvSubst subst (mkTvSubstPrs tenv) in
        go subst' (mkAppTys rhs tys')

This is wrong in two ways.
 * It is wrong to apply the expanded substitution to tys',
 * The unionTCvSubst is utterly wrong; after all, rhs is
   completely separate, and the union makes a non-idempotent
   substitution.

It was the non-idempotency that gave the Lint failure in Trac #11665,
when there was a type synonym whose RHS mentioned another type synonym,
something like

  type T a b = a -> b
  type S x y = T y x

It only affects SpecConstr because that's about the only place where
expandTypeSyonym is called.  I tried to trigger the failure with a
simple test case, but failed, so I have not added a regression test.

Fortunately the solution is very simple and solid.

FWIW, the culprit was 674654, "Add kind equalities to GHC".

mcschroeder/ghc,tjakway/ghcjvm,olsner/ghc,vikraman/ghc,mcschroeder/ghc,mettekou/ghc,mcschroeder/ghc,olsner/ghc,sgillespie/ghc,ezyang/ghc,olsner/ghc,ezyang/ghc,mettekou/ghc,shlevy/ghc,shlevy/ghc,sgillespie/ghc,mcschroeder/ghc,sdiehl/ghc,ezyang/ghc,sdiehl/ghc,shlevy/ghc,vTurbine/ghc,vikraman/ghc,ezyang/ghc,mettekou/ghc,sgillespie/ghc,vTurbine/ghc,sdiehl/ghc,sdiehl/ghc,olsner/ghc,olsner/ghc,sgillespie/ghc,vikraman/ghc,snoyberg/ghc,olsner/ghc,olsner/ghc,vikraman/ghc,mcschroeder/ghc,shlevy/ghc,shlevy/ghc,mcschroeder/ghc,tjakway/ghcjvm,ezyang/ghc,mettekou/ghc,snoyberg/ghc,shlevy/ghc,vikraman/ghc,tjakway/ghcjvm,vTurbine/ghc,sgillespie/ghc,sgillespie/ghc,snoyberg/ghc,shlevy/ghc,mcschroeder/ghc,ezyang/ghc,snoyberg/ghc,mettekou/ghc,vikraman/ghc,vTurbine/ghc,sdiehl/ghc,sdiehl/ghc,mettekou/ghc,tjakway/ghcjvm,sgillespie/ghc,tjakway/ghcjvm,vikraman/ghc,vTurbine/ghc,mettekou/ghc,snoyberg/ghc,ezyang/ghc,vTurbine/ghc,sdiehl/ghc,snoyberg/ghc,snoyberg/ghc,vTurbine/ghc,tjakway/ghcjvm,tjakway/ghcjvm