[commit: ghc] master: Fix #14060 by more conservatively annotating TH-reified types (ad7b945)
git at git.haskell.org
git at git.haskell.org
Tue Aug 15 01:35:37 UTC 2017
Repository : ssh://git@git.haskell.org/ghc
On branch : master
Link : http://ghc.haskell.org/trac/ghc/changeset/ad7b945257ea262e3f6f46daa4ff3e451aeeae0b/ghc
>---------------------------------------------------------------
commit ad7b945257ea262e3f6f46daa4ff3e451aeeae0b
Author: Ryan Scott <ryan.gl.scott at gmail.com>
Date: Mon Aug 14 20:53:57 2017 -0400
Fix #14060 by more conservatively annotating TH-reified types
Before, TH was quite generous in applying kind annotations to reified
type constructors whose result kind happened to mention type variables.
This could result in agonizingly large reified types, so this patch aims
to quell this a bit by adopting a more nuanced algorithm for determining
when a tycon application deserves a kind annotation.
This implements the algorithm laid out in
https://ghc.haskell.org/trac/ghc/ticket/14060#comment:1. I've updated
`Note [Kind annotations on TyConApps]` to reflect the new wisdom.
Essentially, instead of only checking if the result kind contains free
variables, we also check if any of those variables do not appear free in
injective positions in the argument kinds—only then do we put on a kind
annotation.
Bumps `haddock` submodule.
Test Plan: make test TEST=T14060
Reviewers: goldfire, austin, bgamari
Reviewed By: goldfire
Subscribers: rwbarton, thomie
GHC Trac Issues: #14060
Differential Revision: https://phabricator.haskell.org/D3807
>---------------------------------------------------------------
ad7b945257ea262e3f6f46daa4ff3e451aeeae0b
compiler/iface/MkIface.hs | 2 +-
compiler/typecheck/FamInst.hs | 4 +-
compiler/typecheck/TcInteract.hs | 6 +-
compiler/typecheck/TcRnDriver.hs | 4 +-
compiler/typecheck/TcSplice.hs | 128 +++++++++++++++++++++++++++++++------
compiler/typecheck/TcValidity.hs | 2 +-
compiler/types/TyCon.hs | 18 ++++--
compiler/types/Unify.hs | 2 +-
testsuite/tests/th/T12403.stdout | 6 +-
testsuite/tests/th/T12478_1.stdout | 2 +-
testsuite/tests/th/T14060.hs | 38 +++++++++++
testsuite/tests/th/T14060.stdout | 11 ++++
testsuite/tests/th/T8953.stderr | 6 +-
testsuite/tests/th/all.T | 1 +
utils/haddock | 2 +-
15 files changed, 188 insertions(+), 44 deletions(-)
Diff suppressed because of size. To see it, use:
git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc ad7b945257ea262e3f6f46daa4ff3e451aeeae0b
More information about the ghc-commits
mailing list