Commit a0899b2f authored by Simon Peyton Jones's avatar Simon Peyton Jones
Browse files

Remove unnecessary isTyVar tests in TcType

These extra tests were added by Richard when he had CoVars floating
around in places where previously only TyVars had been.  But
fortunately those days are gone, so these tests are unnecessary,
and are slowing GHC down.

Let's remove them.
parent 2d52c3ad
...@@ -860,7 +860,6 @@ isTouchableOrFmv ctxt_tclvl tv ...@@ -860,7 +860,6 @@ isTouchableOrFmv ctxt_tclvl tv
isTouchableMetaTyVar :: TcLevel -> TcTyVar -> Bool isTouchableMetaTyVar :: TcLevel -> TcTyVar -> Bool
isTouchableMetaTyVar ctxt_tclvl tv isTouchableMetaTyVar ctxt_tclvl tv
| isTyVar tv
= ASSERT2( isTcTyVar tv, ppr tv ) = ASSERT2( isTcTyVar tv, ppr tv )
case tcTyVarDetails tv of case tcTyVarDetails tv of
MetaTv { mtv_tclvl = tv_tclvl } MetaTv { mtv_tclvl = tv_tclvl }
...@@ -868,16 +867,13 @@ isTouchableMetaTyVar ctxt_tclvl tv ...@@ -868,16 +867,13 @@ isTouchableMetaTyVar ctxt_tclvl tv
ppr tv $$ ppr tv_tclvl $$ ppr ctxt_tclvl ) ppr tv $$ ppr tv_tclvl $$ ppr ctxt_tclvl )
tv_tclvl `sameDepthAs` ctxt_tclvl tv_tclvl `sameDepthAs` ctxt_tclvl
_ -> False _ -> False
| otherwise = False
isFloatedTouchableMetaTyVar :: TcLevel -> TcTyVar -> Bool isFloatedTouchableMetaTyVar :: TcLevel -> TcTyVar -> Bool
isFloatedTouchableMetaTyVar ctxt_tclvl tv isFloatedTouchableMetaTyVar ctxt_tclvl tv
| isTyVar tv
= ASSERT2( isTcTyVar tv, ppr tv ) = ASSERT2( isTcTyVar tv, ppr tv )
case tcTyVarDetails tv of case tcTyVarDetails tv of
MetaTv { mtv_tclvl = tv_tclvl } -> tv_tclvl `strictlyDeeperThan` ctxt_tclvl MetaTv { mtv_tclvl = tv_tclvl } -> tv_tclvl `strictlyDeeperThan` ctxt_tclvl
_ -> False _ -> False
| otherwise = False
isImmutableTyVar :: TyVar -> Bool isImmutableTyVar :: TyVar -> Bool
isImmutableTyVar tv isImmutableTyVar tv
...@@ -892,12 +888,10 @@ isTyConableTyVar tv ...@@ -892,12 +888,10 @@ isTyConableTyVar tv
-- True of a meta-type variable that can be filled in -- True of a meta-type variable that can be filled in
-- with a type constructor application; in particular, -- with a type constructor application; in particular,
-- not a SigTv -- not a SigTv
| isTyVar tv
= ASSERT2( isTcTyVar tv, ppr tv ) = ASSERT2( isTcTyVar tv, ppr tv )
case tcTyVarDetails tv of case tcTyVarDetails tv of
MetaTv { mtv_info = SigTv } -> False MetaTv { mtv_info = SigTv } -> False
_ -> True _ -> True
| otherwise = True
isFmvTyVar tv isFmvTyVar tv
= ASSERT2( isTcTyVar tv, ppr tv ) = ASSERT2( isTcTyVar tv, ppr tv )
...@@ -927,20 +921,16 @@ isSkolemTyVar tv ...@@ -927,20 +921,16 @@ isSkolemTyVar tv
_other -> True _other -> True
isOverlappableTyVar tv isOverlappableTyVar tv
| isTyVar tv
= ASSERT2( isTcTyVar tv, ppr tv ) = ASSERT2( isTcTyVar tv, ppr tv )
case tcTyVarDetails tv of case tcTyVarDetails tv of
SkolemTv overlappable -> overlappable SkolemTv overlappable -> overlappable
_ -> False _ -> False
| otherwise = False
isMetaTyVar tv isMetaTyVar tv
| isTyVar tv
= ASSERT2( isTcTyVar tv, ppr tv ) = ASSERT2( isTcTyVar tv, ppr tv )
case tcTyVarDetails tv of case tcTyVarDetails tv of
MetaTv {} -> True MetaTv {} -> True
_ -> False _ -> False
| otherwise = False
-- isAmbiguousTyVar is used only when reporting type errors -- isAmbiguousTyVar is used only when reporting type errors
-- It picks out variables that are unbound, namely meta -- It picks out variables that are unbound, namely meta
...@@ -948,12 +938,10 @@ isMetaTyVar tv ...@@ -948,12 +938,10 @@ isMetaTyVar tv
-- RtClosureInspect.zonkRTTIType. These are "ambiguous" in -- RtClosureInspect.zonkRTTIType. These are "ambiguous" in
-- the sense that they stand for an as-yet-unknown type -- the sense that they stand for an as-yet-unknown type
isAmbiguousTyVar tv isAmbiguousTyVar tv
| isTyVar tv
= case tcTyVarDetails tv of = case tcTyVarDetails tv of
MetaTv {} -> True MetaTv {} -> True
RuntimeUnk {} -> True RuntimeUnk {} -> True
_ -> False _ -> False
| otherwise = False
isMetaTyVarTy :: TcType -> Bool isMetaTyVarTy :: TcType -> Bool
isMetaTyVarTy (TyVarTy tv) = isMetaTyVar tv isMetaTyVarTy (TyVarTy tv) = isMetaTyVar tv
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment