[Git][ghc/ghc][wip/T18191] 8 commits: docs: fix formatting and add some links

Ryan Scott gitlab at gitlab.haskell.org
Sat May 23 17:54:24 UTC 2020



Ryan Scott pushed to branch wip/T18191 at Glasgow Haskell Compiler / GHC


Commits:
d830bbc9 by Adam Sandberg Ericsson at 2020-05-23T13:36:20-04:00
docs: fix formatting and add some links

[skip ci]

- - - - -
49301ad6 by Andrew Martin at 2020-05-23T13:37:01-04:00
Implement cstringLength# and FinalPtr

This function and its accompanying rule resolve issue #5218.
A future PR to the bytestring library will make the internal
Data.ByteString.Internal.unsafePackAddress compute string length
with cstringLength#. This will improve the status quo because it is
eligible for constant folding.

Additionally, introduce a new data constructor to ForeignPtrContents
named FinalPtr. This additional data constructor, when used in the
IsString instance for ByteString, leads to more Core-to-Core
optimization opportunities, fewer runtime allocations, and smaller
binaries.

Also, this commit re-exports all the functions from GHC.CString
(including cstringLength#) in GHC.Exts. It also adds a new test
driver. This test driver is used to perform substring matches on Core
that is dumped after all the simplifier passes. In this commit, it is
used to check that constant folding of cstringLength# works.

- - - - -
dcd6bdcc by Ben Gamari at 2020-05-23T13:37:48-04:00
simplCore: Ignore ticks in rule templates

This fixes #17619, where a tick snuck in to the template of a rule,
resulting in a panic during rule matching. The tick in question was
introduced via post-inlining, as discussed in `Note [Simplifying
rules]`. The solution we decided upon was to simply ignore ticks in the
rule template, as discussed in `Note [Tick annotations in RULE
matching]`.

Fixes #18162.
Fixes #17619.

- - - - -
82cb8913 by John Ericson at 2020-05-23T13:38:32-04:00
Fix #18145 and also avoid needless work with implicit vars

 - `forAllOrNothing` now is monadic, so we can trace whether we bind
   an explicit `forall` or not.

 - #18145 arose because the free vars calculation was needlessly
   complex. It is now greatly simplified.

 - Replaced some other implicit var code with `filterFreeVarsToBind`.

Co-authored-by: Ryan Scott <ryan.gl.scott at gmail.com>

- - - - -
a60dc835 by Ben Gamari at 2020-05-23T13:39:12-04:00
Bump process submodule

Fixes #17926.

- - - - -
856adf54 by Ben Gamari at 2020-05-23T13:40:21-04:00
users-guide: Clarify meaning of -haddock flag

Fixes #18206.

- - - - -
7ae57afd by Ben Gamari at 2020-05-23T13:41:03-04:00
git: Add ignored commits file

This can be used to tell git to ignore bulk renaming commits like the
recently-finished module hierarchy refactoring. Configured with,

    git config blame.ignoreRevsFile .git-ignore-revs

- - - - -
0d541790 by Ryan Scott at 2020-05-23T13:53:52-04:00
Make GADT constructors adhere to the forall-or-nothing rule properly

Issue #18191 revealed that the types of GADT constructors don't quite
adhere to the `forall`-or-nothing rule. This patch serves to clean up
this sad state of affairs somewhat. The main change is not in the
code itself, but in the documentation, as this patch introduces two
sections to the GHC User's Guide:

* A "Formal syntax for GADTs" section that presents a BNF-style
  grammar for what is and isn't allowed in GADT constructor types.
  This mostly exists to codify GHC's existing behavior, but it also
  imposes a new restriction that addresses #18191: the outermost
  `forall` and/or context in a GADT constructor is not allowed to be
  surrounded by parentheses. Doing so would make these
  `forall`s/contexts nested, and GADTs do not support nested
  `forall`s/contexts at present.

* A "`forall`-or-nothing rule" section that describes exactly what
  the `forall`-or-nothing rule is all about. Surprisingly, there was
  no mention of this anywhere in the User's Guide up until now!

To adhere the new specification in the "Formal syntax for GADTs"
section of the User's Guide, the following code changes were made:

* `GHC.Parser.PostProcess.mkGadtDecl` no longer strips away
  parentheses from the outermost `forall` and context. Instead, these
  parentheses are preserved so that the renamer can check for nested
  `forall`s/contexts later. See
  `Note [No nested foralls or contexts in GADT constructors]` in
  `GHC.Parser.PostProcess` for more details.

  One nice side effect of this change is that we can get rid of the
  explicit `AddAnn` tracking in `mkGadtDecl`, as we no longer need to
  remember the `AddAnn`s for stripped-away parentheses.

* `GHC.Renamer.Module.rnConDecl` now checks for nested
  `forall`s/contexts, rather than checking for this in the typechcker
  (in `GHC.Tc.TyCl.badDataConTyCon`). For the most part, this code
  was ported directly from `badDataConTyCon`, but designed to work
  over `HsType`s instead of `Type`s.

  One nice side effect of this change is that we are able to give a
  more accurate error message for GADT constructors that use visible
  dependent quantification (e.g., `MkFoo :: forall a -> a -> Foo a`),
  which improves the stderr in the `T16326_Fail6` test case.

Fixes #18191.

- - - - -


30 changed files:

- + .git-ignore-revs
- compiler/GHC/Builtin/Names.hs
- compiler/GHC/Core/Opt/ConstantFold.hs
- compiler/GHC/Core/Opt/Simplify/Utils.hs
- compiler/GHC/Core/Rules.hs
- compiler/GHC/Data/FastString.hs
- compiler/GHC/Hs/Lit.hs
- compiler/GHC/Hs/Types.hs
- compiler/GHC/Parser.y
- compiler/GHC/Parser/PostProcess.hs
- compiler/GHC/Rename/HsType.hs
- compiler/GHC/Rename/Module.hs
- compiler/GHC/Tc/TyCl.hs
- compiler/GHC/ThToHs.hs
- compiler/GHC/Types/Literal.hs
- docs/users_guide/8.12.1-notes.rst
- docs/users_guide/exts/explicit_forall.rst
- docs/users_guide/exts/gadt_syntax.rst
- docs/users_guide/exts/template_haskell.rst
- docs/users_guide/using.rst
- libraries/base/GHC/Exts.hs
- libraries/base/GHC/ForeignPtr.hs
- libraries/ghc-prim/GHC/CString.hs
- libraries/ghc-prim/changelog.md
- libraries/process
- testsuite/.gitignore
- testsuite/driver/testlib.py
- testsuite/tests/dependent/should_fail/T16326_Fail6.stderr
- testsuite/tests/gadt/T12087.stderr
- testsuite/tests/gadt/T14320.hs


The diff was not included because it is too large.


View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/069f2a8d7f9aa7f8a46a71a33586c47c94289334...0d54179051725461fa5a74cb80ed1e0880fb74b1

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/069f2a8d7f9aa7f8a46a71a33586c47c94289334...0d54179051725461fa5a74cb80ed1e0880fb74b1
You're receiving this email because of your account on gitlab.haskell.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20200523/46c1b2f4/attachment.html>


More information about the ghc-commits mailing list