diff options
author | Simon Peyton Jones <simonpj@microsoft.com> | 2018-08-31 11:33:08 +0100 |
---|---|---|
committer | Simon Peyton Jones <simonpj@microsoft.com> | 2018-08-31 12:56:44 +0100 |
commit | 565ef4cc036905f9f9801c1e775236bb007b026c (patch) | |
tree | 75025acdba91366b02d8e432cb57d18271d460b5 /compiler/ghci | |
parent | fda2ea5830176236380a6976dfd0d5802395c6a9 (diff) | |
download | haskell-565ef4cc036905f9f9801c1e775236bb007b026c.tar.gz |
Remove knot-tying bug in TcHsSyn.zonkTyVarOcc
There was a subtle knot-tying bug in TcHsSyn.zonkTyVarOcc, revealed
in Trac #15552.
I fixed it by
* Eliminating the short-circuiting optimisation in zonkTyVarOcc,
instead adding a finite map to get sharing of zonked unification
variables.
See Note [Sharing when zonking to Type] in TcHsSyn
* On the way I /added/ the short-circuiting optimisation to
TcMType.zonkTcTyVar, which has no such problem. This turned
out (based on non-systematic measurements) to be a modest win.
See Note [Sharing in zonking] in TcMType
On the way I renamed some of the functions in TcHsSyn:
* Ones ending in "X" (like zonkTcTypeToTypeX) take a ZonkEnv
* Ones that do not end in "x" (like zonkTcTypeToType), don't.
Instead they whiz up an empty ZonkEnv.
Diffstat (limited to 'compiler/ghci')
-rw-r--r-- | compiler/ghci/RtClosureInspect.hs | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/compiler/ghci/RtClosureInspect.hs b/compiler/ghci/RtClosureInspect.hs index 34a0098bda..e2c76c49af 100644 --- a/compiler/ghci/RtClosureInspect.hs +++ b/compiler/ghci/RtClosureInspect.hs @@ -39,7 +39,7 @@ import Var import TcRnMonad import TcType import TcMType -import TcHsSyn ( zonkTcTypeToType, mkEmptyZonkEnv, ZonkFlexi( RuntimeUnkFlexi ) ) +import TcHsSyn ( zonkTcTypeToTypeX, mkEmptyZonkEnv, ZonkFlexi( RuntimeUnkFlexi ) ) import TcUnify import TcEnv @@ -1258,7 +1258,8 @@ zonkTerm = foldTermM (TermFoldM zonkRttiType :: TcType -> TcM Type -- Zonk the type, replacing any unbound Meta tyvars -- by RuntimeUnk skolems, safely out of Meta-tyvar-land -zonkRttiType = zonkTcTypeToType (mkEmptyZonkEnv RuntimeUnkFlexi) +zonkRttiType ty= do { ze <- mkEmptyZonkEnv RuntimeUnkFlexi + ; zonkTcTypeToTypeX ze ty } -------------------------------------------------------------------------------- -- Restore Class predicates out of a representation type |