Commit c2eea089 authored by Simon Peyton Jones's avatar Simon Peyton Jones

Make isInsolubleOccursCheck more aggressive

  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.
parent 17055da1
......@@ -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
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