diff options
author | Simon Peyton Jones <simonpj@microsoft.com> | 2020-12-02 10:27:47 +0000 |
---|---|---|
committer | Simon Peyton Jones <simonpj@microsoft.com> | 2020-12-04 22:06:53 +0000 |
commit | 1a9e9996e17f73b40fcdfc18f0a3d4dd39c2f187 (patch) | |
tree | f740237e948d16fd46564892d00aca4a37e4e8bb /compiler/GHC/Hs/Extension.hs | |
parent | 41c64eb5db50c80e110e47b7ab1c1ee18dada46b (diff) | |
download | haskell-wip/T18891.tar.gz |
Fix kind inference for data types. Again.wip/T18891
This patch fixes several aspects of kind inference for data type
declarations, especially data /instance/ declarations
Specifically
1. In kcConDecls/kcConDecl make it clear that the tc_res_kind argument
is only used in the H98 case; and in that case there is no result
kind signature; and hence no need for the disgusting splitPiTys in
kcConDecls (now thankfully gone).
The GADT case is a bit different to before, and much nicer.
This is what fixes #18891.
See Note [kcConDecls: kind-checking data type decls]
2. Do not look at the constructor decls of a data/newtype instance
in tcDataFamInstanceHeader. See GHC.Tc.TyCl.Instance
Note [Kind inference for data family instances]. This was a
new realisation that arose when doing (1)
This causes a few knock-on effects in the tests suite, because
we require more information than before in the instance /header/.
New user-manual material about this in "Kind inference in data type
declarations" and "Kind inference for data/newtype instance
declarations".
3. Minor improvement in kcTyClDecl, combining GADT and H98 cases
4. Fix #14111 and #8707 by allowing the header of a data instance
to affect kind inferece for the the data constructor signatures;
as described at length in Note [GADT return types] in GHC.Tc.TyCl
This led to a modest refactoring of the arguments (and argument
order) of tcConDecl/tcConDecls.
5. Fix #19000 by inverting the sense of the test in new_locs
in GHC.Tc.Solver.Canonical.canDecomposableTyConAppOK.
Diffstat (limited to 'compiler/GHC/Hs/Extension.hs')
-rw-r--r-- | compiler/GHC/Hs/Extension.hs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/compiler/GHC/Hs/Extension.hs b/compiler/GHC/Hs/Extension.hs index 4310d1a5dd..3e9bac5442 100644 --- a/compiler/GHC/Hs/Extension.hs +++ b/compiler/GHC/Hs/Extension.hs @@ -253,9 +253,9 @@ sure that any uses of it as a field are strict. -- | Used as a data type index for the hsSyn AST; also serves -- as a singleton type for Pass data GhcPass (c :: Pass) where - GhcPs :: GhcPs - GhcRn :: GhcRn - GhcTc :: GhcTc + GhcPs :: GhcPass 'Parsed + GhcRn :: GhcPass 'Renamed + GhcTc :: GhcPass 'Typechecked -- This really should never be entered, but the data-deriving machinery -- needs the instance to exist. |