diff options
author | Simon Peyton Jones <simonpj@microsoft.com> | 2017-05-26 09:27:08 +0100 |
---|---|---|
committer | Simon Peyton Jones <simonpj@microsoft.com> | 2017-05-26 09:32:29 +0100 |
commit | c2eea089e7978416c6882a5456117db27b8f45ba (patch) | |
tree | cf313d5d53c228f164b03f46d3322b8e6c30a074 | |
parent | 17055da185b8e3ba03f92401f1c0f7a225f55e00 (diff) | |
download | haskell-c2eea089e7978416c6882a5456117db27b8f45ba.tar.gz |
Make isInsolubleOccursCheck more aggressive
Consider
type family F a :: * -> *
Then (a ~ F Int a) is an insoluble occurs check, and can be reported
as such. Previous to this patch, TcType.isInsolubleOccursCheck was
treating any type-family application (including an over-saturated one)
as unconditionally not-insoluble.
This really only affects error messages, and then only slightly. I
tripped over this when investigating Trac #13674.
-rw-r--r-- | compiler/typecheck/TcType.hs | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/compiler/typecheck/TcType.hs b/compiler/typecheck/TcType.hs index ab2f8430d8..bd72981511 100644 --- a/compiler/typecheck/TcType.hs +++ b/compiler/typecheck/TcType.hs @@ -2152,7 +2152,9 @@ isInsolubleOccursCheck eq_rel tv ty go (CoercionTy _) = False -- ToDo: what about the coercion go (TyConApp tc tys) | isGenerativeTyCon tc role = any go tys - | otherwise = False + | otherwise = any go (drop (tyConArity tc) tys) + -- (a ~ F b a), where F has arity 1, + -- has an insoluble occurs check role = eqRelRole eq_rel |