[commit: ghc] wip/hie-module: Make a smart mkAppTyM (6827838)
git at git.haskell.org
git at git.haskell.org
Fri Feb 15 10:15:58 UTC 2019
Repository : ssh://git@git.haskell.org/ghc
On branch : wip/hie-module
Link : http://ghc.haskell.org/trac/ghc/changeset/682783828275cca5fd8bf5be5b52054c75e0e22c/ghc
>---------------------------------------------------------------
commit 682783828275cca5fd8bf5be5b52054c75e0e22c
Author: Simon Peyton Jones <simonpj at microsoft.com>
Date: Thu Jan 24 11:53:03 2019 +0000
Make a smart mkAppTyM
This patch finally delivers on Trac #15952. Specifically
* Completely remove Note [The tcType invariant], along with
its complicated consequences (IT1-IT6).
* Replace Note [The well-kinded type invariant] with:
Note [The Purely Kinded Type Invariant (PKTI)]
* Instead, establish the (PKTI) in TcHsType.tcInferApps,
by using a new function mkAppTyM when building a type
application. See Note [mkAppTyM].
* As a result we can remove the delicate mkNakedXX functions
entirely. Specifically, mkNakedCastTy retained lots of
extremly delicate Refl coercions which just cluttered
everything up, and(worse) were very vulnerable to being
silently eliminated by (say) substTy. This led to a
succession of bug reports.
The result is noticeably simpler to explain, simpler
to code, and Richard and I are much more confident that
it is correct.
It does not actually fix any bugs, but it brings us closer.
E.g. I hoped it'd fix #15918 and #15799, but it doesn't quite
do so. However, it makes it much easier to fix.
I also did a raft of other minor refactorings:
* Use tcTypeKind consistently in the type checker
* Rename tcInstTyBinders to tcInvisibleTyBinders,
and refactor it a bit
* Refactor tcEqType, pickyEqType, tcEqTypeVis
Simpler, probably more efficient.
* Make zonkTcType zonk TcTyCons, at least if they have
any free unification variables -- see zonk_tc_tycon
in TcMType.zonkTcTypeMapper.
Not zonking these TcTyCons was actually a bug before.
* Simplify try_to_reduce_no_cache in TcFlatten (a lot)
* Combine checkExpectedKind and checkExpectedKindX.
And then combine the invisible-binder instantation code
Much simpler now.
* Fix a little bug in TcMType.skolemiseQuantifiedTyVar.
I'm not sure how I came across this originally.
* Fix a little bug in TyCoRep.isUnliftedRuntimeRep
(the ASSERT was over-zealous). Again I'm not certain
how I encountered this.
* Add a missing solveLocalEqualities in
TcHsType.tcHsPartialSigType.
I came across this when trying to get level numbers
right.
>---------------------------------------------------------------
682783828275cca5fd8bf5be5b52054c75e0e22c
compiler/hsSyn/HsTypes.hs | 12 +-
compiler/hsSyn/HsUtils.hs | 2 +-
compiler/main/GHC.hs | 2 +-
compiler/main/InteractiveEval.hs | 2 +-
compiler/typecheck/Inst.hs | 59 +-
compiler/typecheck/TcCanonical.hs | 21 +-
compiler/typecheck/TcErrors.hs | 11 +-
compiler/typecheck/TcFlatten.hs | 23 +-
compiler/typecheck/TcHsSyn.hs | 1 +
compiler/typecheck/TcHsType.hs | 853 +++++++++++++++----------
compiler/typecheck/TcInstDcls.hs | 13 +-
compiler/typecheck/TcMType.hs | 41 +-
compiler/typecheck/TcSMonad.hs | 4 +-
compiler/typecheck/TcTyClsDecls.hs | 53 +-
compiler/typecheck/TcType.hs | 297 +++------
compiler/typecheck/TcUnify.hs | 50 +-
compiler/types/Coercion.hs | 2 +-
compiler/types/OptCoercion.hs | 2 +-
compiler/types/TyCoRep.hs | 7 +-
compiler/types/TyCon.hs | 47 +-
compiler/types/Type.hs | 73 ++-
compiler/types/Type.hs-boot | 2 +-
compiler/utils/Outputable.hs | 6 +-
compiler/utils/Outputable.hs-boot | 3 +-
testsuite/tests/ghci/should_fail/T16287.stderr | 13 +-
25 files changed, 839 insertions(+), 760 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 682783828275cca5fd8bf5be5b52054c75e0e22c
More information about the ghc-commits
mailing list