[commit: ghc] master: Fix TcType.anyRewritableTyVar (a7f64c6)
git at git.haskell.org
git at git.haskell.org
Sun Oct 28 17:41:18 UTC 2018
Repository : ssh://git@git.haskell.org/ghc
On branch : master
Link : http://ghc.haskell.org/trac/ghc/changeset/a7f64c6cbfc5562adff207945576d1c9db2a58d9/ghc
>---------------------------------------------------------------
commit a7f64c6cbfc5562adff207945576d1c9db2a58d9
Author: Ningning Xie <xnningxie at gmail.com>
Date: Sun Oct 28 12:29:55 2018 -0400
Fix TcType.anyRewritableTyVar
Summary:
This patch fixes #15805, where we found that
`TcType.anyRewritableTyVar` has one wrong case.
Besides the fix, it also:
- removed some unnecessary `ASSERT2(tcIsTcTyVar...)` in `TcType`, as now we have
`tcIsTcTyVar = isTyVar`.
- fixed some comments
Test Plan: ./validate
Reviewers: goldfire, simonpj, bgamari
Reviewed By: simonpj
Subscribers: rwbarton, carter
GHC Trac Issues: #15805
Differential Revision: https://phabricator.haskell.org/D5263
>---------------------------------------------------------------
a7f64c6cbfc5562adff207945576d1c9db2a58d9
compiler/typecheck/TcType.hs | 22 +++++++++-------------
1 file changed, 9 insertions(+), 13 deletions(-)
diff --git a/compiler/typecheck/TcType.hs b/compiler/typecheck/TcType.hs
index 5bbaa0f..8fcdde1 100644
--- a/compiler/typecheck/TcType.hs
+++ b/compiler/typecheck/TcType.hs
@@ -569,7 +569,7 @@ pprTcTyVarDetails (MetaTv { mtv_info = info, mtv_tclvl = tclvl })
-------------------------------------
-- UserTypeCtxt describes the origin of the polymorphic type
--- in the places where we need to an expression has that type
+-- in the places where we need an expression to have that type
data UserTypeCtxt
= FunSigCtxt -- Function type signature, when checking the type
@@ -708,7 +708,7 @@ Note [TcLevel and untouchable type variables]
* A unification variable is *touchable* if its level number
is EQUAL TO that of its immediate parent implication,
- and it is a TauTv or TyVarTv (but /not/ FlatMetaTv or FlatSkolTv
+ and it is a TauTv or TyVarTv (but /not/ FlatMetaTv or FlatSkolTv)
Note [WantedInv]
~~~~~~~~~~~~~~~~
@@ -975,7 +975,7 @@ anyRewritableTyVar ignore_cos role pred ty
go rl bvs (CoercionTy co) = go_co rl bvs co -- ToDo: check
go_tc NomEq bvs _ tys = any (go NomEq bvs) tys
- go_tc ReprEq bvs tc tys = foldr ((&&) . go_arg bvs) False $
+ go_tc ReprEq bvs tc tys = any (go_arg bvs)
(tyConRolesRepresentational tc `zip` tys)
go_arg bvs (Nominal, ty) = go NomEq bvs ty
@@ -1014,7 +1014,7 @@ out the other (Trac #14363).
********************************************************************* -}
data CandidatesQTvs -- See Note [Dependent type variables]
- -- See Note [CandidatesQTvs determinism]
+ -- See Note [CandidatesQTvs determinism and order]
= DV { dv_kvs :: DTyCoVarSet -- "kind" variables (dependent)
, dv_tvs :: DTyVarSet -- "type" variables (non-dependent)
-- A variable may appear in both sets
@@ -1178,8 +1178,7 @@ isFloatedTouchableMetaTyVar ctxt_tclvl tv
| isTyVar tv -- See Note [Coercion variables in free variable lists]
, MetaTv { mtv_tclvl = tv_tclvl, mtv_info = info } <- tcTyVarDetails tv
, not (isFlattenInfo info)
- = ASSERT2( tcIsTcTyVar tv, ppr tv )
- tv_tclvl `strictlyDeeperThan` ctxt_tclvl
+ = tv_tclvl `strictlyDeeperThan` ctxt_tclvl
| otherwise = False
@@ -1195,8 +1194,7 @@ isTyConableTyVar tv
-- with a type constructor application; in particular,
-- not a TyVarTv
| isTyVar tv -- See Note [Coercion variables in free variable lists]
- = ASSERT2( tcIsTcTyVar tv, ppr tv )
- case tcTyVarDetails tv of
+ = case tcTyVarDetails tv of
MetaTv { mtv_info = TyVarTv } -> False
_ -> True
| otherwise = True
@@ -1213,7 +1211,7 @@ isFskTyVar tv
MetaTv { mtv_info = FlatSkolTv } -> True
_ -> False
--- | True of both given and wanted flatten-skolems (fak and usk)
+-- | True of both given and wanted flatten-skolems (fmv and fsk)
isFlattenTyVar tv
= ASSERT2( tcIsTcTyVar tv, ppr tv )
case tcTyVarDetails tv of
@@ -1228,16 +1226,14 @@ isSkolemTyVar tv
isOverlappableTyVar tv
| isTyVar tv -- See Note [Coercion variables in free variable lists]
- = ASSERT2( tcIsTcTyVar tv, ppr tv )
- case tcTyVarDetails tv of
+ = case tcTyVarDetails tv of
SkolemTv _ overlappable -> overlappable
_ -> False
| otherwise = False
isMetaTyVar tv
| isTyVar tv -- See Note [Coercion variables in free variable lists]
- = ASSERT2( tcIsTcTyVar tv, ppr tv )
- case tcTyVarDetails tv of
+ = case tcTyVarDetails tv of
MetaTv {} -> True
_ -> False
| otherwise = False
More information about the ghc-commits
mailing list