[Git][ghc/ghc][wip/expand-do] 28 commits: cleanup: Remove unused field from SelfBoot

Apoorv Ingle (@ani) gitlab at gitlab.haskell.org
Wed Jun 7 22:16:32 UTC 2023



Apoorv Ingle pushed to branch wip/expand-do at Glasgow Haskell Compiler / GHC


Commits:
f6e060cc by Krzysztof Gogolewski at 2023-06-02T09:07:25-04:00
cleanup: Remove unused field from SelfBoot

It is no longer needed since Note [Extra dependencies from .hs-boot files]
was deleted in 6998772043.

I've also added tildes to Note headers, otherwise they're not detected
by the linter.

- - - - -
82eacab6 by sheaf at 2023-06-02T09:08:01-04:00
Delete GHC.Tc.Utils.Zonk

This module was split up into GHC.Tc.Zonk.Type and GHC.Tc.Zonk.TcType
in commit f62d8195, but I forgot to delete the original module
- - - - -
4a4eb761 by Ben Gamari at 2023-06-02T23:53:21-04:00
base: Add build-order import of GHC.Types in GHC.IO.Handle.Types

For reasons similar to those described in Note [Depend on
GHC.Num.Integer].

Fixes #23411.

- - - - -
f53ac0ae by Sylvain Henry at 2023-06-02T23:54:01-04:00
JS: fix and enhance non-minimized code generation (#22455)

Flag -ddisable-js-minimizer was producing invalid code. Fix that and
also a few other things to generate nicer JS code for debugging.

The added test checks that we don't regress when using the flag.

- - - - -
f7744e8e by Andrey Mokhov at 2023-06-03T16:49:44-04:00
[hadrian] Fix multiline synopsis rendering

- - - - -
b2c745db by Bodigrim at 2023-06-03T16:50:23-04:00
Elaborate on performance properties of Data.List.++

- - - - -
7cd8a61e by Matthew Pickering at 2023-06-05T11:46:23+01:00
Big TcLclEnv and CtLoc refactoring

The overall goal of this refactoring is to reduce the dependency
footprint of the parser and syntax tree. Good reasons include:

- Better module graph parallelisability
- Make it easier to migrate error messages without introducing module loops
- Philosophically, there's not reason for the AST to depend on half the
  compiler.

One of the key edges which added this dependency was

> GHC.Hs.Expr -> GHC.Tc.Types (TcLclEnv)

As this in turn depending on TcM which depends on HscEnv and so on.

Therefore the goal of this patch is to move `TcLclEnv` out of
`GHC.Tc.Types` so that `GHC.Hs.Expr` can import TcLclEnv without
incurring a huge dependency chain.

The changes in this patch are:

* Move TcLclEnv from GHC.Tc.Types to GHC.Tc.Types.LclEnv
* Create new smaller modules for the types used in TcLclEnv
  New Modules:
  - GHC.Tc.Types.ErrCtxt
  - GHC.Tc.Types.BasicTypes
  - GHC.Tc.Types.TH
  - GHC.Tc.Types.LclEnv
  - GHC.Tc.Types.CtLocEnv
  - GHC.Tc.Errors.Types.PromotionErr

  Removed Boot File:
  - {-# SOURCE #-} GHC.Tc.Types

* Introduce TcLclCtxt, the part of the TcLclEnv which doesn't
  participate in restoreLclEnv.

* Replace TcLclEnv in CtLoc with specific CtLocEnv which is defined in
  GHC.Tc.Types.CtLocEnv. Use CtLocEnv in Implic and CtLoc to record the
  location of the implication and constraint.

By splitting up TcLclEnv from GHC.Tc.Types we allow GHC.Hs.Expr to no
longer depend on the TcM monad and all that entails.

Fixes #23389 #23409

- - - - -
3d8d39d1 by Matthew Pickering at 2023-06-05T11:46:23+01:00
Remove dependency of GHC.Tc.Utils.TcType on GHC.Driver.Session

This removes the usage of DynFlags from Tc.Utils.TcType  so that it no
longer depends on GHC.Driver.Session. In general we don't want anything
which is a dependency of Language.Haskell.Syntax to depend on
GHC.Driver.Session and removing this edge gets us closer to that goal.

- - - - -
18db5ada by Matthew Pickering at 2023-06-05T11:46:23+01:00
Move isIrrefutableHsPat to GHC.Rename.Utils and rename to isIrrefutableHsPatRn

This removes edge from GHC.Hs.Pat to GHC.Driver.Session, which makes
Language.Haskell.Syntax end up depending on GHC.Driver.Session.

- - - - -
12919dd5 by Matthew Pickering at 2023-06-05T11:46:23+01:00
Remove dependency of GHC.Tc.Types.Constraint on GHC.Driver.Session

- - - - -
eb852371 by Matthew Pickering at 2023-06-05T11:46:24+01:00
hole fit plugins: Split definition into own module

The hole fit plugins are defined in terms of TcM, a type we want to
avoid depending on from `GHC.Tc.Errors.Types`. By moving it into its own
module we can remove this dependency. It also simplifies the necessary
boot file.

- - - - -
9e5246d7 by Matthew Pickering at 2023-06-05T11:46:24+01:00
Move GHC.Core.Opt.CallerCC Types into separate module

This allows `GHC.Driver.DynFlags` to depend on these types without
depending on CoreM and hence the entire simplifier pipeline.

We can also remove a hs-boot file with this change.

- - - - -
52d6a7d7 by Matthew Pickering at 2023-06-05T11:46:24+01:00
Remove unecessary SOURCE import

- - - - -
698d160c by Matthew Pickering at 2023-06-05T11:46:24+01:00
testsuite: Accept new output for CountDepsAst and CountDepsParser tests

These are in a separate commit as the improvement to these tests is the
cumulative effect of the previous set of patches rather than just the
responsibility of the last one in the patchset.

- - - - -
58ccf02e by sheaf at 2023-06-05T16:00:47-04:00
TTG: only allow VarBind at GhcTc

The VarBind constructor of HsBind is only used at the GhcTc stage.
This commit makes that explicit by setting the extension field of
VarBind to be DataConCantHappen at all other stages.

This allows us to delete a dead code path in GHC.HsToCore.Quote.rep_bind,
and remove some panics.

- - - - -
54b83253 by Matthew Craven at 2023-06-06T12:59:25-04:00
Generate Addr# access ops programmatically

The existing utils/genprimopcode/gen_bytearray_ops.py was
relocated and extended for this purpose.  Additionally, hadrian
now knows about this script and uses it when generating primops.txt

- - - - -
ecadbc7e by Matthew Pickering at 2023-06-06T13:00:01-04:00
ghcup-metadata: Only add Nightly tag when replacing LatestNightly

Previously we were always adding the Nightly tag, but this led to all
the previous builds getting an increasing number of nightly tags over
time. Now we just add it once, when we remove the LatestNightly tag.

- - - - -
4aea0a72 by Vladislav Zavialov at 2023-06-07T12:06:46+02:00
Invisible binders in type declarations (#22560)

This patch implements @k-binders introduced in GHC Proposal #425
and guarded behind the TypeAbstractions extension:

	type D :: forall k j. k -> j -> Type
	data D @k @j a b = ...
	       ^^ ^^

To represent the new syntax, we modify LHsQTyVars as follows:

	-  hsq_explicit :: [LHsTyVarBndr () pass]
	+  hsq_explicit :: [LHsTyVarBndr (HsBndrVis pass) pass]

HsBndrVis is a new data type that records the distinction between
type variable binders written with and without the @ sign:

	data HsBndrVis pass
	  = HsBndrRequired
	  | HsBndrInvisible (LHsToken "@" pass)

The rest of the patch updates GHC, template-haskell, and haddock
to handle the new syntax.

Parser:
  The PsErrUnexpectedTypeAppInDecl error message is removed.
  The syntax it used to reject is now permitted.

Renamer:
  The @ sign does not affect the scope of a binder, so the changes to
  the renamer are minimal.  See rnLHsTyVarBndrVisFlag.

Type checker:
  There are three code paths that were updated to deal with the newly
  introduced invisible type variable binders:

    1. checking SAKS: see kcCheckDeclHeader_sig, matchUpSigWithDecl
    2. checking CUSK: see kcCheckDeclHeader_cusk
    3. inference: see kcInferDeclHeader, rejectInvisibleBinders

  Helper functions bindExplicitTKBndrs_Q_Skol and bindExplicitTKBndrs_Q_Tv
  are generalized to work with HsBndrVis.

Updates the haddock submodule.

Metric Increase:
    MultiLayerModulesTH_OneShot

Co-authored-by: Simon Peyton Jones <simon.peytonjones at gmail.com>

- - - - -
b7600997 by Josh Meredith at 2023-06-07T13:10:21-04:00
JS: clean up FFI 'fat arrow' calls in base:System.Posix.Internals (#23481)

- - - - -
9dddf6ba by Apoorv Ingle at 2023-06-07T16:56:58-05:00
Fixes #18324 #23147
Expands do notation before typechecking using `HsExpansion`
- Adds testcases T18324, T18324b, DoubleMatch
Expands
- Do statements
- Monadic do statements
- monadic fix blocks
- make sure fail is used for pattern match failures in bind statments
- Makes sure unused binds generate warnings
- runs the pattern match check in generated lambda exprs to avoid getting suprious pattern match failures. c.f. pmcheck/should_compile/DoubleMatch.hs
- PopSrcSpan in HsExpr to pop error context
- Discards default monad fail alternatives that are spuriously generated
- Make sure we check for generated loc span for checking if the (>>) is user written or expanded for /do/ purposes

- - - - -
2b05513f by Apoorv Ingle at 2023-06-07T16:57:57-05:00
- Add PopSrcSpan (XXExprGhcRn) in appropriate places while expanding statements
- correct source spans displayed for warnDiscardedDoBindings
- use `mkExpandStmt` to store original stmts along with expanded expr for using the right context for error message printing
- improves error messages for applicative do
- remove special case from isMatchContextPmChecked (long distance info is now properly propogated)
- set correct src spans to statement expansions
- Match ctxt while type checking HsLam is different if the lambda match is due to an expression generated from a do block
- call tcExpr and not tcApp in PopSrcSpan so make sure impredicativity works fine
- look into XExprs in tcInferAppHead_maybe for infering the type to make T18324 typecheck and run

- - - - -
8e515523 by Apoorv Ingle at 2023-06-07T16:58:04-05:00
generate incomplete uni patterns warnings if the origin context is a generated do expansion

- - - - -
813f98b3 by Apoorv Ingle at 2023-06-07T16:58:04-05:00
use the correct bind operator for qualified rebindable rec do expansions

- - - - -
0e857ea4 by Apoorv Ingle at 2023-06-07T16:58:04-05:00
trying out changes to heralds

- - - - -
06fc5dcb by Apoorv Ingle at 2023-06-07T16:58:04-05:00
add location information for last statements

- - - - -
e353a690 by Apoorv Ingle at 2023-06-07T16:58:04-05:00
do not pop context while checking the second argument to expanded (>>)

- - - - -
40f44b8d by Apoorv Ingle at 2023-06-07T16:58:04-05:00
adjusting the generated spans for proper error messages

- - - - -
4bd0e329 by Apoorv Ingle at 2023-06-07T17:16:19-05:00
change the addHeadCtxt to include the first statement of the do block for more precise error messages

- - - - -


30 changed files:

- .gitlab/rel_eng/mk-ghcup-metadata/mk_ghcup_metadata.py
- compiler/GHC/Builtin/Names/TH.hs
- − compiler/GHC/Builtin/bytearray-ops.txt.pp
- utils/genprimopcode/gen_bytearray_ops.py → compiler/GHC/Builtin/gen_bytearray_addr_access_ops.py
- compiler/GHC/Builtin/primops.txt.pp
- compiler/GHC/Core/Opt/CallerCC.hs
- − compiler/GHC/Core/Opt/CallerCC.hs-boot
- + compiler/GHC/Core/Opt/CallerCC/Types.hs
- compiler/GHC/Core/TyCon.hs
- compiler/GHC/Driver/DynFlags.hs
- compiler/GHC/Driver/Plugins.hs
- compiler/GHC/Hs/Binds.hs
- compiler/GHC/Hs/Expr.hs
- compiler/GHC/Hs/Instances.hs
- compiler/GHC/Hs/Pat.hs
- compiler/GHC/Hs/Type.hs
- compiler/GHC/Hs/Utils.hs
- compiler/GHC/HsToCore/Arrows.hs
- compiler/GHC/HsToCore/Binds.hs
- compiler/GHC/HsToCore/Expr.hs
- compiler/GHC/HsToCore/Match.hs
- compiler/GHC/HsToCore/Match/Constructor.hs
- compiler/GHC/HsToCore/Monad.hs
- compiler/GHC/HsToCore/Pmc.hs
- compiler/GHC/HsToCore/Quote.hs
- compiler/GHC/Iface/Errors/Types.hs
- compiler/GHC/Iface/Ext/Ast.hs
- compiler/GHC/IfaceToCore.hs
- compiler/GHC/JS/Make.hs
- compiler/GHC/JS/Optimizer.hs


The diff was not included because it is too large.


View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/39ac8d8f65452b619447c66770c5dc6f46a28219...4bd0e329e6948967d047650946692ca6cc5cb933

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/39ac8d8f65452b619447c66770c5dc6f46a28219...4bd0e329e6948967d047650946692ca6cc5cb933
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/20230607/7cb88eb6/attachment-0001.html>


More information about the ghc-commits mailing list