diff options
author | Simon Peyton Jones <simonpj@microsoft.com> | 2016-03-02 15:12:12 +0000 |
---|---|---|
committer | Simon Peyton Jones <simonpj@microsoft.com> | 2016-03-02 15:24:49 +0000 |
commit | 286dc021ef515d02453cd5e31774b852d3a1310f (patch) | |
tree | 4263fc500bb0331e6b8e995e1ea69fedc327ea06 /compiler/utils | |
parent | 57b4c5524fcbf02f61dfc8d9395906dc7f50f048 (diff) | |
download | haskell-286dc021ef515d02453cd5e31774b852d3a1310f.tar.gz |
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".
Diffstat (limited to 'compiler/utils')
0 files changed, 0 insertions, 0 deletions