Reify oversaturated data family instances correctly (#17296)

Authored by RyanGlScott on Oct 3 2019, 5:40 PM.

Description

Reify oversaturated data family instances correctly (Trac #17296)

TcSplice was not properly handling oversaturated data family
instances, such as the example in Trac #17296, as it dropped arguments due
to carelessly zipping data family instance arguments with
tyConTyVars. For data families, the number of tyConTyVars can
sometimes be less than the number of arguments it can accept in a
data family instance due to the fact that data family instances can
be oversaturated.

To account for this, TcSplice.mkIsPolyTvs has now been renamed to
tyConArgsPolyKinded and now factors in tyConResKind in addition
to tyConTyVars. I've also added
Note [Reified instances and explicit kind signatures] which
explains the various subtleties in play here.

Fixes Trac #17296.

(cherry picked from commit e3636a688fe11a9a171c55416a507e7c520299ef)

Details

Committed
bgamariSun, Nov 3, 2:24 PM
Parents
rGHC963ed692e343: Fix #14579 by defining tyConAppNeedsKindSig, and using it
Branches
Unknown
Tags
Unknown