Fix Trac #8368.

Authored by goldfire on Oct 3 2013, 9:06 AM.

Description

Fix Trac Trac #8368.

Two different fixes were necessary here. First, we need to fail eagerly
in kcConDecl, to prevent the return-type error in tcConDecl from firing
twice. (This wasn't caught earlier because of the eager fail in the
datatype kind-checking code -- which isn't used for data instances!)
We also must check again in tcDataFamInstDecl, because it's possible for
a data instance return type to have the right head but the wrong body
(i.e., doesn't conform to the data instance type patterns). This check
is only possible *after* desugaring from HsType to Type, so it can't be
done in tcConRes with the first check.

This is documented in a comment at check_valid_data_con, a local
function within tcDataFamInstDecl.

Details

Committed
monoidalOct 3 2013, 2:58 PM
Pushed
bgamariAug 25 2016, 1:39 PM
Parents
rGHCDIFF9d908c523bf6: Close over kinds when checking fundep coverage (Trac #8391)
Branches
Unknown
Tags
Unknown