summaryrefslogtreecommitdiff
path: root/compiler/GHC/Tc
diff options
context:
space:
mode:
authorsheaf <sam.derbyshire@gmail.com>2021-10-21 11:20:57 +0200
committerMarge Bot <ben+marge-bot@smart-cactus.org>2021-10-22 10:58:44 -0400
commit77c6f3e6be3b94c48ec6c9b7015dab69ae47564e (patch)
treee95282805588c9a03c95b86947b3d67406799d60 /compiler/GHC/Tc
parent7f4e0e91530117fd4d477d553a7f03993b86fe74 (diff)
downloadhaskell-77c6f3e6be3b94c48ec6c9b7015dab69ae47564e.tar.gz
Use tcEqType in GHC.Core.Unify.uVar
Because uVar used eqType instead of tcEqType, it was possible to accumulate a substitution that unified Type and Constraint. For example, a call to `tc_unify_tys` with arguments tys1 = [ k, k ] tys2 = [ Type, Constraint ] would first add `k = Type` to the substitution. That's fine, but then the second call to `uVar` would claim that the substitution also unifies `k` with `Constraint`. This could then be used to cause trouble, as per #20521. Fixes #20521
Diffstat (limited to 'compiler/GHC/Tc')
-rw-r--r--compiler/GHC/Tc/Utils/TcType.hs-boot4
1 files changed, 4 insertions, 0 deletions
diff --git a/compiler/GHC/Tc/Utils/TcType.hs-boot b/compiler/GHC/Tc/Utils/TcType.hs-boot
index 6b808dd7ab..2a7a34dc97 100644
--- a/compiler/GHC/Tc/Utils/TcType.hs-boot
+++ b/compiler/GHC/Tc/Utils/TcType.hs-boot
@@ -2,6 +2,8 @@ module GHC.Tc.Utils.TcType where
import GHC.Utils.Outputable( SDoc )
import GHC.Prelude ( Bool )
import {-# SOURCE #-} GHC.Types.Var ( TcTyVar )
+import {-# SOURCE #-} GHC.Core.TyCo.Rep
+import GHC.Utils.Misc ( HasDebugCallStack )
data MetaDetails
@@ -10,3 +12,5 @@ pprTcTyVarDetails :: TcTyVarDetails -> SDoc
vanillaSkolemTv :: TcTyVarDetails
isMetaTyVar :: TcTyVar -> Bool
isTyConableTyVar :: TcTyVar -> Bool
+
+tcEqType :: HasDebugCallStack => Type -> Type -> Bool