diff options
author | Simon Peyton Jones <simonpj@microsoft.com> | 2016-05-16 22:08:08 +0100 |
---|---|---|
committer | Simon Peyton Jones <simonpj@microsoft.com> | 2016-06-13 10:50:19 +0100 |
commit | d25cb61a1c2a135a2564143a332f8b2962f134bc (patch) | |
tree | a5b6f3f9ff310b1d172d975ab4ac3dd549867489 | |
parent | 2bb6ba62b8d0e9c79b59e39e225758cf999eff83 (diff) | |
download | haskell-d25cb61a1c2a135a2564143a332f8b2962f134bc.tar.gz |
Kill off redundant SigTv check in occurCheckExpand
This patch simply deletes code, the SigTv check in
occurCheckExpand. As the new comment says
In the past we also rejected a SigTv matched with a non-tyvar
But it is wrong to reject that for Givens;
and SigTv is in any case handled separately by
- TcUnify.checkTauTvUpdate (on-the-fly unifier)
- TcInteract.canSolveByUnification (main constraint solver)
-rw-r--r-- | compiler/typecheck/TcType.hs | 19 |
1 files changed, 6 insertions, 13 deletions
diff --git a/compiler/typecheck/TcType.hs b/compiler/typecheck/TcType.hs index 3a469bc8e7..06f6a45a18 100644 --- a/compiler/typecheck/TcType.hs +++ b/compiler/typecheck/TcType.hs @@ -1570,7 +1570,6 @@ See also Note [occurCheckExpand] in TcCanonical data OccCheckResult a = OC_OK a | OC_Forall - | OC_NonTyVar | OC_Occurs instance Functor OccCheckResult where @@ -1583,7 +1582,6 @@ instance Applicative OccCheckResult where instance Monad OccCheckResult where OC_OK x >>= k = k x OC_Forall >>= _ = OC_Forall - OC_NonTyVar >>= _ = OC_NonTyVar OC_Occurs >>= _ = OC_Occurs occurCheckExpand :: DynFlags -> TcTyVar -> Type -> OccCheckResult Type @@ -1591,16 +1589,19 @@ occurCheckExpand :: DynFlags -> TcTyVar -> Type -> OccCheckResult Type -- Check whether -- a) the given variable occurs in the given type. -- b) there is a forall in the type (unless we have -XImpredicativeTypes) --- c) if it's a SigTv, ty should be a tyvar -- -- We may have needed to do some type synonym unfolding in order to -- get rid of the variable (or forall), so we also return the unfolded -- version of the type, which is guaranteed to be syntactically free -- of the given type variable. If the type is already syntactically -- free of the variable, then the same type is returned. +-- +-- NB: in the past we also rejected a SigTv matched with a non-tyvar +-- But it is wrong to reject that for Givens; +-- and SigTv is in any case handled separately by +-- - TcUnify.checkTauTvUpdate (on-the-fly unifier) +-- - TcInteract.canSolveByUnification (main constraint solver) occurCheckExpand dflags tv ty - | MetaTv { mtv_info = SigTv } <- details - = go_sig_tv ty | fast_check ty = return ty | otherwise = go emptyVarEnv ty where @@ -1608,14 +1609,6 @@ occurCheckExpand dflags tv ty impredicative = canUnifyWithPolyType dflags details - -- Check 'ty' is a tyvar, or can be expanded into one - go_sig_tv ty@(TyVarTy tv') - | fast_check (tyVarKind tv') = return ty - | otherwise = do { k' <- go emptyVarEnv (tyVarKind tv') - ; return (mkTyVarTy (setTyVarKind tv' k')) } - go_sig_tv ty | Just ty' <- coreView ty = go_sig_tv ty' - go_sig_tv _ = OC_NonTyVar - -- True => fine fast_check (LitTy {}) = True fast_check (TyVarTy tv') = tv /= tv' && fast_check (tyVarKind tv') |