[commit: ghc] master: Update levity polymorphism (e7985ed)
git at git.haskell.org
git at git.haskell.org
Thu Jan 19 15:37:53 UTC 2017
Repository : ssh://git@git.haskell.org/ghc
On branch : master
Link : http://ghc.haskell.org/trac/ghc/changeset/e7985ed23ddc68b6a2e4af753578dc1d9e8ab4c9/ghc
>---------------------------------------------------------------
commit e7985ed23ddc68b6a2e4af753578dc1d9e8ab4c9
Author: Richard Eisenberg <rae at cs.brynmawr.edu>
Date: Wed Dec 14 21:37:43 2016 -0500
Update levity polymorphism
This commit implements the proposal in
https://github.com/ghc-proposals/ghc-proposals/pull/29 and
https://github.com/ghc-proposals/ghc-proposals/pull/35.
Here are some of the pieces of that proposal:
* Some of RuntimeRep's constructors have been shortened.
* TupleRep and SumRep are now parameterized over a list of RuntimeReps.
* This
means that two types with the same kind surely have the same
representation.
Previously, all unboxed tuples had the same kind, and thus the fact
above was
false.
* RepType.typePrimRep and friends now return a *list* of PrimReps. These
functions can now work successfully on unboxed tuples. This change is
necessary because we allow abstraction over unboxed tuple types and so
cannot
always handle unboxed tuples specially as we did before.
* We sometimes have to create an Id from a PrimRep. I thus split PtrRep
* into
LiftedRep and UnliftedRep, so that the created Ids have the right
strictness.
* The RepType.RepType type was removed, as it didn't seem to help with
* much.
* The RepType.repType function is also removed, in favor of typePrimRep.
* I have waffled a good deal on whether or not to keep VoidRep in
TyCon.PrimRep. In the end, I decided to keep it there. PrimRep is *not*
represented in RuntimeRep, and typePrimRep will never return a list
including
VoidRep. But it's handy to have in, e.g., ByteCodeGen and friends. I can
imagine another design choice where we have a PrimRepV type that is
PrimRep
with an extra constructor. That seemed to be a heavier design, though,
and I'm
not sure what the benefit would be.
* The last, unused vestiges of # (unliftedTypeKind) have been removed.
* There were several pretty-printing bugs that this change exposed;
* these are fixed.
* We previously checked for levity polymorphism in the types of binders.
* But we
also must exclude levity polymorphism in function arguments. This is
hard to check
for, requiring a good deal of care in the desugarer. See Note [Levity
polymorphism
checking] in DsMonad.
* In order to efficiently check for levity polymorphism in functions, it
* was necessary
to add a new bit of IdInfo. See Note [Levity info] in IdInfo.
* It is now safe for unlifted types to be unsaturated in Core. Core Lint
* is updated
accordingly.
* We can only know strictness after zonking, so several checks around
* strictness
in the type-checker (checkStrictBinds, the check for unlifted variables
under a ~
pattern) have been moved to the desugarer.
* Along the way, I improved the treatment of unlifted vs. banged
* bindings. See
Note [Strict binds checks] in DsBinds and #13075.
* Now that we print type-checked source, we must be careful to print
* ConLikes correctly.
This is facilitated by a new HsConLikeOut constructor to HsExpr.
Particularly troublesome
are unlifted pattern synonyms that get an extra void# argument.
* Includes a submodule update for haddock, getting rid of #.
* New testcases:
typecheck/should_fail/StrictBinds
typecheck/should_fail/T12973
typecheck/should_run/StrictPats
typecheck/should_run/T12809
typecheck/should_fail/T13105
patsyn/should_fail/UnliftedPSBind
typecheck/should_fail/LevPolyBounded
typecheck/should_compile/T12987
typecheck/should_compile/T11736
* Fixed tickets:
#12809
#12973
#11736
#13075
#12987
* This also adds a test case for #13105. This test case is
* "compile_fail" and
succeeds, because I want the testsuite to monitor the error message.
When #13105 is fixed, the test case will compile cleanly.
>---------------------------------------------------------------
e7985ed23ddc68b6a2e4af753578dc1d9e8ab4c9
compiler/basicTypes/BasicTypes.hs | 2 +-
compiler/basicTypes/Id.hs | 10 +-
compiler/basicTypes/IdInfo.hs | 94 +++++-
compiler/basicTypes/MkId.hs | 58 ++--
compiler/cmm/CmmUtils.hs | 14 +-
compiler/codeGen/StgCmm.hs | 6 +-
compiler/codeGen/StgCmmArgRep.hs | 3 +-
compiler/codeGen/StgCmmClosure.hs | 10 +-
compiler/codeGen/StgCmmEnv.hs | 5 +-
compiler/codeGen/StgCmmExpr.hs | 18 +-
compiler/codeGen/StgCmmForeign.hs | 11 +-
compiler/codeGen/StgCmmUtils.hs | 6 +-
compiler/coreSyn/CoreArity.hs | 8 +-
compiler/coreSyn/CoreLint.hs | 35 ++-
compiler/coreSyn/CoreSubst.hs | 11 +-
compiler/coreSyn/CoreSyn.hs | 3 +
compiler/coreSyn/CoreUtils.hs | 42 ++-
compiler/coreSyn/MkCore.hs | 3 +-
compiler/coreSyn/PprCore.hs | 1 +
compiler/deSugar/Coverage.hs | 3 +
compiler/deSugar/DsArrows.hs | 103 +++++--
compiler/deSugar/DsBinds.hs | 91 +++++-
compiler/deSugar/DsCCall.hs | 5 +-
compiler/deSugar/DsExpr.hs | 177 +++++++----
compiler/deSugar/DsExpr.hs-boot | 6 +-
compiler/deSugar/DsForeign.hs | 11 +-
compiler/deSugar/DsGRHSs.hs | 5 +-
compiler/deSugar/DsListComp.hs | 39 ++-
compiler/deSugar/DsMonad.hs | 138 ++++++++-
compiler/deSugar/DsUtils.hs | 4 +-
compiler/deSugar/Match.hs | 18 +-
compiler/deSugar/MatchCon.hs | 2 +-
compiler/deSugar/PmExpr.hs | 2 +
compiler/ghci/ByteCodeGen.hs | 64 ++--
compiler/ghci/ByteCodeItbls.hs | 6 +-
compiler/ghci/Debugger.hs | 3 +-
compiler/ghci/GHCi.hsc | 4 +-
compiler/ghci/RtClosureInspect.hs | 49 ++-
compiler/hsSyn/HsBinds.hs | 5 +
compiler/hsSyn/HsExpr.hs | 77 +++--
compiler/hsSyn/HsPat.hs | 30 +-
compiler/hsSyn/HsUtils.hs | 74 ++++-
compiler/iface/IfaceSyn.hs | 6 +-
compiler/iface/IfaceType.hs | 22 +-
compiler/iface/TcIface.hs | 1 +
compiler/iface/ToIface.hs | 6 +-
compiler/main/DynFlags.hs | 9 +-
compiler/main/HscTypes.hs | 1 -
compiler/main/InteractiveEval.hs | 9 +-
compiler/prelude/PrelNames.hs | 20 +-
compiler/prelude/PrimOp.hs | 10 +-
compiler/prelude/TysPrim.hs | 170 +++++-----
compiler/prelude/TysWiredIn.hs | 185 +++++++----
compiler/prelude/TysWiredIn.hs-boot | 9 +-
compiler/simplCore/SetLevels.hs | 4 +-
compiler/simplCore/SimplEnv.hs | 2 +-
compiler/simplCore/SimplUtils.hs | 25 +-
compiler/simplCore/Simplify.hs | 4 +
compiler/simplStg/RepType.hs | 341 ++++++++++-----------
compiler/simplStg/UnariseStg.hs | 58 ++--
compiler/stgSyn/CoreToStg.hs | 33 +-
compiler/stgSyn/StgLint.hs | 34 +-
compiler/stgSyn/StgSyn.hs | 18 +-
compiler/typecheck/TcBinds.hs | 132 +-------
compiler/typecheck/TcCanonical.hs | 3 +-
compiler/typecheck/TcEnv.hs | 4 +-
compiler/typecheck/TcErrors.hs | 17 +-
compiler/typecheck/TcEvidence.hs | 88 +++++-
compiler/typecheck/TcExpr.hs | 19 +-
compiler/typecheck/TcGenFunctor.hs | 12 +-
compiler/typecheck/TcHsSyn.hs | 183 +++--------
compiler/typecheck/TcHsType.hs | 16 +-
compiler/typecheck/TcInstDcls.hs | 6 +-
compiler/typecheck/TcMType.hs | 60 +++-
compiler/typecheck/TcPat.hs | 24 +-
compiler/typecheck/TcPatSyn.hs | 15 +-
compiler/typecheck/TcRnTypes.hs | 1 +
compiler/typecheck/TcSigs.hs | 3 +-
compiler/typecheck/TcSimplify.hs | 13 +-
compiler/typecheck/TcTyClsDecls.hs | 9 +-
compiler/typecheck/TcType.hs | 28 +-
compiler/typecheck/TcTypeable.hs | 19 +-
compiler/typecheck/TcUnify.hs | 19 +-
compiler/types/FamInstEnv.hs | 2 -
compiler/types/Kind.hs | 40 ++-
compiler/types/TyCoRep.hs | 99 ++++--
compiler/types/TyCon.hs | 39 ++-
compiler/types/Type.hs | 92 ++++--
compiler/utils/Bag.hs | 8 +-
compiler/utils/Outputable.hs | 6 +
docs/users_guide/glasgow_exts.rst | 79 +++--
docs/users_guide/using-warnings.rst | 7 +
docs/users_guide/using.rst | 2 +-
libraries/base/Data/Typeable/Internal.hs | 9 +-
libraries/base/Unsafe/Coerce.hs | 6 +-
libraries/base/tests/T11334a.hs | 4 +-
libraries/base/tests/T11334a.stdout | 2 +-
libraries/ghc-prim/GHC/Types.hs | 17 +-
.../integer-gmp/src/GHC/Integer/Logarithms.hs | 3 +-
libraries/integer-gmp/src/GHC/Integer/Type.hs | 32 +-
.../tests/deSugar/should_compile/T10662.stderr | 2 +-
.../tests/dependent/should_compile/RaeJobTalk.hs | 6 +-
.../tests/dependent/should_fail/T11473.stderr | 2 +-
testsuite/tests/deriving/should_fail/T12512.hs | 7 +-
testsuite/tests/deriving/should_fail/T12512.stderr | 4 +-
testsuite/tests/ghci/scripts/GhciKinds.stdout | 6 +-
testsuite/tests/ghci/scripts/T9140.stdout | 10 +-
.../tests/patsyn/should_fail/UnliftedPSBind.hs | 12 +
.../tests/patsyn/should_fail/UnliftedPSBind.stderr | 8 +
testsuite/tests/patsyn/should_fail/all.T | 1 +
testsuite/tests/patsyn/should_fail/unboxed-bind.hs | 1 +
.../tests/patsyn/should_fail/unboxed-bind.stderr | 10 +-
testsuite/tests/quasiquotation/T7918.stdout | 8 -
.../tests/simplCore/should_compile/T9400.stderr | 2 +-
.../simplCore/should_compile/spec-inline.stderr | 2 +-
testsuite/tests/th/T12403.stdout | 6 +-
testsuite/tests/th/T12478_1.stdout | 2 +-
testsuite/tests/th/T5358.stderr | 16 +-
testsuite/tests/th/T5976.stderr | 4 +-
testsuite/tests/th/T8987.stderr | 6 +-
testsuite/tests/typecheck/should_compile/T11723.hs | 7 +
testsuite/tests/typecheck/should_compile/T11736.hs | 8 +
testsuite/tests/typecheck/should_compile/T12987.hs | 7 +
testsuite/tests/typecheck/should_compile/all.T | 3 +
.../tests/typecheck/should_fail/BadUnboxedTuple.hs | 10 -
.../typecheck/should_fail/BadUnboxedTuple.stderr | 6 -
.../tests/typecheck/should_fail/LevPolyBounded.hs | 11 +
.../typecheck/should_fail/LevPolyBounded.stderr | 5 +
.../tests/typecheck/should_fail/StrictBinds.hs | 9 +
.../tests/typecheck/should_fail/StrictBinds.stderr | 5 +
testsuite/tests/typecheck/should_fail/T11723.hs | 8 -
.../tests/typecheck/should_fail/T11723.stderr | 7 -
.../tests/typecheck/should_fail/T11724.stderr | 2 +-
testsuite/tests/typecheck/should_fail/T12973.hs | 15 +
.../tests/typecheck/should_fail/T12973.stderr | 12 +
testsuite/tests/typecheck/should_fail/T13105.hs | 23 ++
.../tests/typecheck/should_fail/T13105.stderr | 6 +
testsuite/tests/typecheck/should_fail/T2806.hs | 2 +-
testsuite/tests/typecheck/should_fail/T2806.stderr | 10 +-
testsuite/tests/typecheck/should_fail/T6078.stderr | 10 +-
testsuite/tests/typecheck/should_fail/all.T | 10 +-
testsuite/tests/typecheck/should_fail/tcfail203.hs | 1 +
.../tests/typecheck/should_fail/tcfail203.stderr | 66 ++--
.../tests/typecheck/should_fail/tcfail203a.stderr | 9 +-
.../tests/typecheck/should_run/EtaExpandLevPoly.hs | 32 ++
.../typecheck/should_run/EtaExpandLevPoly.stdout | 4 +
.../typecheck/should_run/KindInvariant.stderr | 2 +-
testsuite/tests/typecheck/should_run/StrictPats.hs | 122 ++++++++
.../tests/typecheck/should_run/StrictPats.stdout | 19 ++
testsuite/tests/typecheck/should_run/T12809.hs | 44 +++
testsuite/tests/typecheck/should_run/T12809.stdout | 4 +
testsuite/tests/typecheck/should_run/TypeOf.hs | 4 +-
testsuite/tests/typecheck/should_run/TypeOf.stdout | 2 +-
testsuite/tests/typecheck/should_run/TypeRep.hs | 4 +-
.../tests/typecheck/should_run/TypeRep.stdout | 2 +-
testsuite/tests/typecheck/should_run/all.T | 3 +
testsuite/tests/unboxedsums/T12711.stdout | 3 +-
testsuite/tests/unboxedsums/UbxSumLevPoly.hs | 12 +
testsuite/tests/unboxedsums/all.T | 4 +-
testsuite/tests/unboxedsums/sum_rr.hs | 4 +-
testsuite/tests/unboxedsums/sum_rr.stderr | 7 -
.../tests/unboxedsums/unboxedsums_unit_tests.hs | 2 +-
utils/haddock | 2 +-
163 files changed, 2522 insertions(+), 1462 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 e7985ed23ddc68b6a2e4af753578dc1d9e8ab4c9
More information about the ghc-commits
mailing list