[Git][ghc/ghc][wip/marge_bot_batch_merge_job] 19 commits: Implement type applications in patterns

Marge Bot gitlab at gitlab.haskell.org
Wed Dec 16 21:44:26 UTC 2020



 Marge Bot pushed to branch wip/marge_bot_batch_merge_job at Glasgow Haskell Compiler / GHC


Commits:
c696bb2f by Cale Gibbard at 2020-12-14T13:37:09-05:00
Implement type applications in patterns

The haddock submodule is also updated so that it understands the changes
to patterns.

- - - - -
7e9debd4 by Ben Gamari at 2020-12-14T13:37:09-05:00
Optimise nullary type constructor usage

During the compilation of programs GHC very frequently deals with
the `Type` type, which is a synonym of `TYPE 'LiftedRep`. This patch
teaches GHC to avoid expanding the `Type` synonym (and other nullary
type synonyms) during type comparisons, saving a good amount of work.
This optimisation is described in `Note [Comparing nullary type
synonyms]`.

To maximize the impact of this optimisation, we introduce a few
special-cases to reduce `TYPE 'LiftedRep` to `Type`. See
`Note [Prefer Type over TYPE 'LiftedPtrRep]`.

Closes #17958.

Metric Decrease:
   T18698b
   T1969
   T12227
   T12545
   T12707
   T14683
   T3064
   T5631
   T5642
   T9020
   T9630
   T9872a
   T13035
   haddock.Cabal
   haddock.base

- - - - -
92377c27 by Ben Gamari at 2020-12-14T13:41:58-05:00
Revert "Optimise nullary type constructor usage"

This was inadvertently merged.

This reverts commit 7e9debd4ceb068effe8ac81892d2cabcb8f55850.

- - - - -
d0e8c10d by Sylvain Henry at 2020-12-14T19:45:13+01:00
Move Unit related fields from DynFlags to HscEnv

The unit database cache, the home unit and the unit state were stored in
DynFlags while they ought to be stored in the compiler session state
(HscEnv). This patch fixes this.

It introduces a new UnitEnv type that should be used in the future to
handle separate unit environments (especially host vs target units).

Related to #17957

Bump haddock submodule

- - - - -
af855ac1 by Andreas Klebinger at 2020-12-14T15:22:13-05:00
Optimize dumping of consecutive whitespace.

The naive way of putting out n characters of indent would be something
like `hPutStr hdl (replicate n ' ')`. However this is quite inefficient
as we allocate an absurd number of strings consisting of simply spaces
as we don't cache them.

To improve on this we now track if we can simply write ascii spaces via
hPutBuf instead. This is the case when running with -ddump-to-file where
we force the encoding to be UTF8.

This avoids both the cost of going through encoding as well as avoiding
allocation churn from all the white space. Instead we simply use hPutBuf
on a preallocated unlifted string.

When dumping stg like this:

> nofib/spectral/simple/Main.hs -fforce-recomp -ddump-stg-final -ddump-to-file -c +RTS -s

Allocations went from 1,778 MB to 1,702MB. About a 4% reduction of
allocation! I did not measure the difference in runtime but expect it
to be similar.

Bumps the haddock submodule since the interface of GHC's Pretty
slightly changed.

-------------------------
Metric Decrease:
    T12227
-------------------------

- - - - -
dad87210 by Ben Gamari at 2020-12-14T15:22:29-05:00
Optimise nullary type constructor usage

During the compilation of programs GHC very frequently deals with
the `Type` type, which is a synonym of `TYPE 'LiftedRep`. This patch
teaches GHC to avoid expanding the `Type` synonym (and other nullary
type synonyms) during type comparisons, saving a good amount of work.
This optimisation is described in `Note [Comparing nullary type
synonyms]`.

To maximize the impact of this optimisation, we introduce a few
special-cases to reduce `TYPE 'LiftedRep` to `Type`. See
`Note [Prefer Type over TYPE 'LiftedPtrRep]`.

Closes #17958.

Metric Decrease:
   T18698b
   T1969
   T12227
   T12545
   T12707
   T14683
   T3064
   T5631
   T5642
   T9020
   T9630
   T9872a
   T13035
   haddock.Cabal
   haddock.base

- - - - -
6c2eb223 by Andrew Martin at 2020-12-14T18:48:51-05:00
Implement BoxedRep proposal

This implements the BoxedRep proposal, refacoring the `RuntimeRep`
hierarchy from:

```haskell
data RuntimeRep = LiftedPtrRep | UnliftedPtrRep | ...
```

to

```haskell
data RuntimeRep = BoxedRep Levity | ...
data Levity = Lifted | Unlifted
```

Closes #17526.

- - - - -
3ee696cc by Sebastian Graf at 2020-12-15T10:53:31-05:00
Add regression test for #19053

- - - - -
535dae66 by Ben Gamari at 2020-12-15T10:53:58-05:00
testsuite: Mark divbyzero, derefnull as fragile

Due to #18548.
- - - - -
331f5568 by Ben Gamari at 2020-12-15T11:21:06-05:00
Revert "Implement BoxedRep proposal"

This was inadvertently merged.

This reverts commit 6c2eb2232b39ff4720fda0a4a009fb6afbc9dcea.

- - - - -
50fae07d by Ben Gamari at 2020-12-15T15:15:16-05:00
Roll-back broken haddock commit

Updates haddock submodule to revert a commit that does not build.

- - - - -
e9b18a75 by Ben Gamari at 2020-12-15T15:55:38-05:00
Revert haddock submodule yet again

- - - - -
b58cb63a by GHC GitLab CI at 2020-12-16T03:46:31+00:00
Bump haddock submodule

To adapt haddock for the nullary tyconapp optimisation patch.

- - - - -
e28192d0 by David Eichmann at 2020-12-16T16:44:06-05:00
User guide minor typo

[ci skip]

- - - - -
dd2c1762 by nineonine at 2020-12-16T16:44:09-05:00
Force module recompilation if '*' prefix was used to load modules in ghci (#8042)

Usually pre-compiled code is preferred to be loaded in ghci if available, which means
that if we try to load module with '*' prefix and compilation artifacts are available
on disc (.o and .hi files) or the source code was untouched, the driver would think
no recompilation is required. Therefore, we need to force recompilation so that desired
byte-code is generated and loaded. Forcing in this case should be ok, since this is what
happens for interpreted code anyways when reloading modules.

- - - - -
dee79fa0 by Ryan Scott at 2020-12-16T16:44:09-05:00
Reject dodgy scoping in associated family instance RHSes

Commit e63518f5d6a93be111f9108c0990a1162f88d615 tried to push all of the logic
of detecting out-of-scope type variables on the RHSes of associated type family
instances to `GHC.Tc.Validity` by deleting a similar check in the renamer.
Unfortunately, this commit went a little too far, as there are some corner
cases that `GHC.Tc.Validity` doesn't detect. Consider this example:

```hs
class C a where
  data D a

instance forall a. C Int where
  data instance D Int = MkD a
```

If this program isn't rejected by the time it reaches the typechecker, then
GHC will believe the `a` in `MkD a` is existentially quantified and accept it.
This is almost surely not what the user wants! The simplest way to reject
programs like this is to restore the old validity check in the renamer
(search for `improperly_scoped` in `rnFamEqn`).

Note that this is technically a breaking change, since the program in the
`polykinds/T9574` test case (which previously compiled) will now be rejected:

```hs
instance Funct ('KProxy :: KProxy o) where
    type Codomain 'KProxy = NatTr (Proxy :: o -> *)
```

This is because the `o` on the RHS will now be rejected for being out of scope.
Luckily, this is simple to repair:

```hs
instance Funct ('KProxy :: KProxy o) where
    type Codomain ('KProxy @o) = NatTr (Proxy :: o -> *)
```

All of the discussion is now a part of the revamped
`Note [Renaming associated types]` in `GHC.Rename.Module`.

A different design would be to make associated type family instances have
completely separate scoping from the parent instance declaration, much like
how associated type family default declarations work today. See the discussion
beginning at https://gitlab.haskell.org/ghc/ghc/-/issues/18021#note_265729 for
more on this point. This, however, would break even more programs that are
accepted today and likely warrants a GHC proposal before going forward. In the
meantime, this patch fixes the issue described in #18021 in the least invasive
way possible. There are programs that are accepted today that will no longer
be accepted after this patch, but they are arguably pathological programs, and
they are simple to repair.

Fixes #18021.

- - - - -
f8b7704b by Tom Ellis at 2020-12-16T16:44:11-05:00
submodule update: containers and stm

Needed for https://gitlab.haskell.org/ghc/ghc/-/issues/15656 as it
stops the packages triggering incomplete-uni-patterns and
incomplete-record-updates

- - - - -
49c2df48 by Richard Eisenberg at 2020-12-16T16:44:12-05:00
Unfortunate dirty hack to overcome #18998.

See commentary in tcCheckUsage.

Close #18998.

Test case: typecheck/should_compile/T18998

- - - - -
04ad0cc9 by Sylvain Henry at 2020-12-16T16:44:16-05:00
Fix project version for ProjectVersionMunged (fix #19058)

- - - - -


30 changed files:

- .gitlab/linters/check-version-number.sh
- compiler/GHC.hs
- compiler/GHC/Builtin/Types.hs
- compiler/GHC/Builtin/Types/Prim.hs
- + compiler/GHC/Builtin/Types/Prim.hs-boot
- compiler/GHC/Cmm/Lexer.x
- compiler/GHC/Cmm/Parser.y
- compiler/GHC/Cmm/Parser/Monad.hs
- compiler/GHC/Core/Opt/Pipeline.hs
- compiler/GHC/Core/TyCo/Rep.hs
- compiler/GHC/Core/TyCo/Subst.hs
- compiler/GHC/Core/TyCon.hs
- compiler/GHC/Core/Type.hs
- compiler/GHC/Core/Unify.hs
- compiler/GHC/Driver/Backpack.hs
- compiler/GHC/Driver/CodeOutput.hs
- compiler/GHC/Driver/Env.hs
- compiler/GHC/Driver/Hooks.hs
- compiler/GHC/Driver/Main.hs
- compiler/GHC/Driver/Make.hs
- compiler/GHC/Driver/MakeFile.hs
- compiler/GHC/Driver/Pipeline.hs
- compiler/GHC/Driver/Pipeline/Monad.hs
- compiler/GHC/Driver/Ppr.hs
- compiler/GHC/Driver/Session.hs
- compiler/GHC/Driver/Session.hs-boot
- compiler/GHC/Hs/Binds.hs
- compiler/GHC/Hs/Decls.hs
- compiler/GHC/Hs/Pat.hs
- compiler/GHC/Hs/Type.hs


The diff was not included because it is too large.


View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/e990a9aceb129ac0dc406a41e92633e23ec9753f...04ad0cc9fa6e33cfd6dccb5056355423009061d0

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/e990a9aceb129ac0dc406a41e92633e23ec9753f...04ad0cc9fa6e33cfd6dccb5056355423009061d0
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/20201216/06c06256/attachment-0001.html>


More information about the ghc-commits mailing list