[Git][ghc/ghc][wip/backports] 23 commits: Don't mark closed type family equations as occurrences

Ben Gamari gitlab at gitlab.haskell.org
Thu Sep 17 19:18:09 UTC 2020



Ben Gamari pushed to branch wip/backports at Glasgow Haskell Compiler / GHC


Commits:
3667e26f by Ryan Scott at 2020-09-17T14:59:42-04:00
Don't mark closed type family equations as occurrences

Previously, `rnFamInstEqn` would mark the name of the type/data
family used in an equation as an occurrence, regardless of what sort
of family it is. Most of the time, this is the correct thing to do.
The exception is closed type families, whose equations constitute its
definition and therefore should not be marked as occurrences.
Overzealously counting the equations of a closed type family as
occurrences can cause certain warnings to not be emitted, as observed
in #18470.  See `Note [Type family equations and occurrences]` in
`GHC.Rename.Module` for the full story.

This fixes #18470 with a little bit of extra-casing in
`rnFamInstEqn`. To accomplish this, I added an extra
`ClosedTyFamInfo` field to the `NonAssocTyFamEqn` constructor of
`AssocTyFamInfo` and refactored the relevant call sites accordingly
so that this information is propagated to `rnFamInstEqn`.

While I was in town, I moved `wrongTyFamName`, which checks that the
name of a closed type family matches the name in an equation for that
family, from the renamer to the typechecker to avoid the need for an
`ASSERT`. As an added bonus, this lets us simplify the details of
`ClosedTyFamInfo` a bit.

(cherry picked from commit 4f83e9ad76b1e7c67a440ea89f22f6fc03921b5d)

- - - - -
58afde89 by Ryan Scott at 2020-09-17T15:00:14-04:00
Clean up the inferred type variable restriction

This patch primarily:

* Documents `checkInferredVars` (previously called
  `check_inferred_vars`) more carefully. This is the
  function which throws an error message if a user quantifies an
  inferred type variable in a place where specificity cannot be
  observed. See `Note [Unobservably inferred type variables]` in
  `GHC.Rename.HsType`.

  Note that I now invoke `checkInferredVars` _alongside_
  `rnHsSigType`, `rnHsWcSigType`, etc. rather than doing so _inside_
  of these functions. This results in slightly more call sites for
  `checkInferredVars`, but it makes it much easier to enumerate the
  spots where the inferred type variable restriction comes into
  effect.
* Removes the inferred type variable restriction for default method
  type signatures, per the discussion in #18432. As a result, this
  patch fixes #18432.

Along the way, I performed some various cleanup:

* I moved `no_nested_foralls_contexts_err` into `GHC.Rename.Utils`
  (under the new name `noNestedForallsContextsErr`), since it now
  needs to be invoked from multiple modules. I also added a helper
  function `addNoNestedForallsContextsErr` that throws the error
  message after producing it, as this is a common idiom.
* In order to ensure that users cannot sneak inferred type variables
  into `SPECIALISE instance` pragmas by way of nested `forall`s, I
  now invoke `addNoNestedForallsContextsErr` when renaming
  `SPECIALISE instance` pragmas, much like when we rename normal
  instance declarations. (This probably should have originally been
  done as a part of the fix for #18240, but this task was somehow
  overlooked.) As a result, this patch fixes #18455 as a side effect.

(cherry picked from commit 502605f7ae9907a6b0b9823e8f055ae390c57b1d)

- - - - -
5f039752 by Ben Gamari at 2020-09-17T15:04:37-04:00
typecheck: Drop SPECIALISE pragmas when there is no unfolding

Previously the desugarer would instead fall over when it realized that
there was no unfolding for an imported function with a SPECIALISE
pragma. We now rather drop the SPECIALISE pragma and throw a warning.

Fixes #18118.

(cherry picked from commit 708e374a8bf108999c11b6cf59c7d27677ed24a8)

- - - - -
30a01228 by Ben Gamari at 2020-09-17T15:04:41-04:00
testsuite: Add test for #18118

(cherry picked from commit 2cdb72a569f6049a390626bca0dd6e362045ed65)

- - - - -
034e7d05 by Ben Gamari at 2020-09-17T15:05:05-04:00
testsuite: Drop --io-manager flag from testsuite configuration

This is no longer necessary as there are now dedicated testsuite ways
which run tests with WinIO.

(cherry picked from commit 77b1ebf6dd34df8068a07865d92301ff298cf5ca)

- - - - -
9b786e0e by Ben Gamari at 2020-09-17T15:05:19-04:00
llvm-targets: Add i686 targets

Addresses #18422.

(cherry picked from commit 12dadd04a09c23c91d7da6f5b17ef78688d93fe7)

- - - - -
73f42f00 by Krzysztof Gogolewski at 2020-09-17T15:08:59-04:00
Do not print synonyms in :i (->), :i Type (#18594)

This adds a new printing flag `sdocPrintTypeAbbreviations` that is used
specifically to avoid ghci printing 'type (->) = (->)' and 'type Type = Type'.

(cherry picked from commit 8b86509270227dbc61f0700c7d9261a4c7672361)

- - - - -
237d440a by Krzysztof Gogolewski at 2020-09-17T15:09:22-04:00
Move pprTyTcApp' inside pprTyTcApp

No semantic change

(cherry picked from commit d8f61182c3bdd1b6121c83be632b4941b907de88)

- - - - -
b4d761ee by Moritz Angermann at 2020-09-17T15:11:42-04:00
[fixup 3433] move debugBelch into IF_DEBUG(linker)

The commit in dff1cb3d9c111808fec60190747272b973547c52 incorrectly left
the `debugBelch` function without a comment or IF_DEBUG(linker,)
decoration. This rectifies it.

Needs at least a 8.10 backport, as it was backported in 6471cc6aff80d5deebbdb1bf7b677b31ed2af3d5

(cherry picked from commit d99397a0e8e0ce78e98efae67ee1ba2524ca16d6)

- - - - -
d3e0b905 by Takenobu Tani at 2020-09-17T15:12:57-04:00
Limit upper version of Happy for ghc-9.0 and earlier (#18620)

This patch adds the upper bound of a happy version for ghc-9.0
and earlier.

Currently, we can't use happy-1.20.0 for ghc-9.0.

See #18620.

(cherry picked from commit 84ec8daa016d07ae42f0f0f48575dd7d907d5f9d)

- - - - -
3221a451 by Ben Gamari at 2020-09-17T15:14:34-04:00
configure: Fix whitespace

(cherry picked from commit 1213fd87564ab092aa914d8633df4de07fe04905)

- - - - -
8f3a8706 by Ben Gamari at 2020-09-17T15:14:58-04:00
gitlab-ci: Bump Windows toolchain version

This should have been done when we bumped the bootstrap compiler to
8.8.4.

(cherry picked from commit 566ac68de70e5b580c96e8ab8b3b02ad0f1acd42)

- - - - -
b640cdf1 by Ben Gamari at 2020-09-17T15:15:07-04:00
gitlab-ci: Drop Windows make job

These are a significant burden on our CI resources and end up failing
quite often due to #18274. Here I drop the make jobs during
validaion; it is now run only during the nightly builds.

(cherry picked from commit 72036e1c03385aa4f5ed70179ab4b154beed81cb)

- - - - -
ba6fb181 by Ben Gamari at 2020-09-17T15:15:20-04:00
testsuite: Drop Windows-specific output for parseTree

The normalise_slashes normaliser should handle this.

(cherry picked from commit 4597752ad3c031e17fe3cceb20c61e4d5b58c52f)

- - - - -
4748afdc by Ben Gamari at 2020-09-17T15:15:24-04:00
testsuite: Mark T5975[ab] as broken on Windows

Due to #7305.

(cherry picked from commit 5b12bb7c98529374ff8e932d0c36104d1a0fe509)

- - - - -
51dcc6e2 by Ben Gamari at 2020-09-17T15:15:29-04:00
gitlab-ci: Fix typo

A small typo in a rule regular expression.

(cherry picked from commit c4fd8947f4104e7b6d6bf3d320a63a361191bde1)

- - - - -
42b8dabd by Ben Gamari at 2020-09-17T15:15:46-04:00
rts: Add stg_copyArray_barrier to RtsSymbols list

It's incredible that this wasn't noticed until now.

(cherry picked from commit c2fefaf37ae134aefc4136bae7e5976f991d76f4)

- - - - -
c908eac6 by Ryan Scott at 2020-09-17T15:15:55-04:00
Postpone associated tyfam default checks until after typechecking

Previously, associated type family defaults were validity-checked
during typechecking. Unfortunately, the error messages that these
checks produce run the risk of printing knot-tied type constructors,
which will cause GHC to diverge. In order to preserve the current
error message's descriptiveness, this patch postpones these validity
checks until after typechecking, which are now located in the new
function `GHC.Tc.Validity.checkValidAssocTyFamDeflt`.

Fixes #18648.

(cherry picked from commit 5e883375409efc2336da6295c7d81bd10b542210)

- - - - -
25743d99 by Ryan Scott at 2020-09-17T15:16:22-04:00
Don't quote argument to Hadrian's test-env flag (#18656)

Doing so causes the name of the test environment to gain an extra
set of double quotes, which changes the name entirely.

Fixes #18656.

(cherry picked from commit bc487caf830ce6cd2c03845b29416c6706185fbc)

- - - - -
ddd3a41e by Krzysztof Gogolewski at 2020-09-17T15:16:26-04:00
Make sure we can read past perf notes

See #18656.

(cherry picked from commit b8a9cff2ce651c085c84980d3e709db2ecda8c3f)

- - - - -
156e23ee by Ben Gamari at 2020-09-17T15:16:53-04:00
rts: Fix erroneous usage of vsnprintf

As pointed out in #18685, this should be snprintf not vsnprintf. This
appears to be due to a cut-and-paste error.

Fixes #18658.

(cherry picked from commit 35ea92708e17c90e476167163ae24747a3f5508e)

- - - - -
d01482b7 by HaskellMouse at 2020-09-17T15:17:27-04:00
Added explicit fixity to (~).

Solves #18252

(cherry picked from commit 3c94c81629ac9159775b8b70baf2c635f0331708)

- - - - -
d6440d5c by Ben Gamari at 2020-09-17T15:17:52-04:00
rts/nonmoving: Add missing STM write barrier

When updating a TRec for a TVar already part of a transaction we
previously neglected to add the old value to the update remembered set.
I suspect this was the cause of #18587.

(cherry picked from commit a64e94f98ca18e53ecc13f736d50b9cb2d156b05)

- - - - -


30 changed files:

- .gitlab-ci.yml
- aclocal.m4
- compiler/GHC/Core/Class.hs
- compiler/GHC/Driver/Session.hs
- compiler/GHC/Hs/Type.hs
- compiler/GHC/Iface/Syntax.hs
- compiler/GHC/Iface/Type.hs
- compiler/GHC/IfaceToCore.hs
- compiler/GHC/Rename/Bind.hs
- compiler/GHC/Rename/Expr.hs
- compiler/GHC/Rename/HsType.hs
- compiler/GHC/Rename/Module.hs
- compiler/GHC/Rename/Pat.hs
- compiler/GHC/Rename/Utils.hs
- compiler/GHC/Tc/Gen/Sig.hs
- compiler/GHC/Tc/Instance/Class.hs
- compiler/GHC/Tc/TyCl.hs
- compiler/GHC/Tc/Validity.hs
- compiler/GHC/Utils/Outputable.hs
- hadrian/hadrian.cabal
- hadrian/src/Settings/Builders/RunTest.hs
- libraries/ghc-prim/GHC/Types.hs
- libraries/ghc-prim/changelog.md
- llvm-targets
- rts/RtsMessages.c
- rts/RtsSymbols.c
- rts/STM.c
- rts/linker/Elf.c
- testsuite/driver/perf_notes.py
- testsuite/mk/test.mk


The diff was not included because it is too large.


View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/36fc0a06c1dc9bd01e61ec6728aac954d347c3d1...d6440d5ce59d6d95c00dcc50599d91f14018e6f5

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/36fc0a06c1dc9bd01e61ec6728aac954d347c3d1...d6440d5ce59d6d95c00dcc50599d91f14018e6f5
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/20200917/0c884c47/attachment-0001.html>


More information about the ghc-commits mailing list