[Git][ghc/ghc][wip/T18914] 3 commits: Add Addr# atomic primops (#17751)

Ryan Scott gitlab at gitlab.haskell.org
Thu Nov 19 11:12:05 UTC 2020



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


Commits:
52114fa0 by Sylvain Henry at 2020-11-16T11:48:47+01:00
Add Addr# atomic primops (#17751)

This reuses the codegen used for ByteArray#'s atomic primops.

- - - - -
8150f654 by Sebastian Graf at 2020-11-18T23:38:40-05:00
PmCheck: Print types of uncovered patterns (#18932)

In order to avoid confusion as in #18932, we display the type of the
match variables in the non-exhaustiveness warning, e.g.

```
T18932.hs:14:1: warning: [-Wincomplete-patterns]
    Pattern match(es) are non-exhaustive
    In an equation for ‘g’:
        Patterns of type  ‘T a’, ‘T a’, ‘T a’ not matched:
            (MkT2 _) (MkT1 _) (MkT1 _)
            (MkT2 _) (MkT1 _) (MkT2 _)
            (MkT2 _) (MkT2 _) (MkT1 _)
            (MkT2 _) (MkT2 _) (MkT2 _)
            ...
   |
14 | g (MkT1 x) (MkT1 _) (MkT1 _) = x
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
```

It also allows us to omit the type signature on wildcard matches which
we previously showed in only some situations, particularly
`-XEmptyCase`.

Fixes #18932.

- - - - -
6d08443b by Ryan Scott at 2020-11-19T06:12:01-05:00
Use HsOuterExplicit in instance sigs in deriving-generated code

Issue #18914 revealed that `GeneralizedNewtypeDeriving` would generate code
that mentions unbound type variables, which is dangerously fragile. The
problem (and fix) is described in the new `Wrinkle: Use HsOuterExplicit`
in `Note [GND and QuantifiedConstraints]`. The gist of it: make sure to
put the top-level `forall`s in `deriving`-generated instance signatures in an
`HsOuterExplicit` to ensure that they scope over the bodies of methods
correctly. A side effect of this process is that it will expand any type
synonyms in the instance signature, which will surface any `forall`s that
are hidden underneath type synonyms (such as in the test case for #18914).

While I was in town, I also performed some maintenance on `NewHsTypeX`, which
powers `GeneralizedNewtypeDeriving`:

* I renamed `NewHsTypeX` to `HsCoreTy`, which more accurately describes its
  intended purpose (#15706). I also made `HsCoreTy` a type synonym instead of
  a newtype, as making it a distinct data type wasn't buying us much.
* To make sure that mistakes similar to #18914 do not occur later, I added an
  additional validity check when renaming `HsCoreTy`s that complains if an
  `HsCoreTy`s contains an out-of-scope type variable. See the new
  `Note [Renaming HsCoreTys]` in `GHC.Rename.HsType` for the details.

Fixes #15706. Fixes #18914. Bumps the `haddock` submodule.

- - - - -


30 changed files:

- compiler/GHC/Builtin/primops.txt.pp
- compiler/GHC/CmmToAsm/X86/CodeGen.hs
- compiler/GHC/Hs/Type.hs
- compiler/GHC/HsToCore/Pmc.hs
- compiler/GHC/HsToCore/Pmc/Ppr.hs
- compiler/GHC/Rename/HsType.hs
- compiler/GHC/StgToCmm/Prim.hs
- compiler/GHC/Tc/Deriv/Generate.hs
- compiler/GHC/Tc/Gen/HsType.hs
- compiler/GHC/Tc/Gen/Sig.hs
- compiler/GHC/Tc/TyCl/Instance.hs
- testsuite/tests/concurrent/should_run/AtomicPrimops.hs
- testsuite/tests/concurrent/should_run/AtomicPrimops.stdout
- testsuite/tests/deSugar/should_compile/DsStrictWarn.stderr
- testsuite/tests/deSugar/should_compile/GadtOverlap.stderr
- testsuite/tests/deSugar/should_compile/T14135.stderr
- testsuite/tests/deSugar/should_compile/T14546a.stderr
- testsuite/tests/deSugar/should_compile/T14546d.stderr
- testsuite/tests/deSugar/should_compile/T5455.stderr
- testsuite/tests/dependent/should_compile/KindEqualities.stderr
- testsuite/tests/deriving/should_compile/T14578.stderr
- + testsuite/tests/deriving/should_compile/T18914.hs
- testsuite/tests/deriving/should_compile/all.T
- testsuite/tests/driver/T8101.stderr
- testsuite/tests/driver/T8101b.stderr
- testsuite/tests/driver/werror.stderr
- testsuite/tests/ghci/prog018/prog018.stdout
- testsuite/tests/parser/should_compile/T15139.stderr
- testsuite/tests/pmcheck/complete_sigs/T13964.stderr
- testsuite/tests/pmcheck/complete_sigs/T14059a.stderr


The diff was not included because it is too large.


View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/e3ad23abd9f554df383eef9cd293505911b58ac2...6d08443b3dd6a5343b6485f19a68eae158594446

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/e3ad23abd9f554df383eef9cd293505911b58ac2...6d08443b3dd6a5343b6485f19a68eae158594446
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/20201119/b1e5a6cc/attachment.html>


More information about the ghc-commits mailing list