ghc.git
10 months agoDocumentation and refactoring in CCS related code
Ömer Sinan Ağacan [Thu, 10 Jan 2019 11:39:16 +0000 (14:39 +0300)] 
Documentation and refactoring in CCS related code

- Remove REGISTER_CC and REGISTER_CCS macros, add functions registerCC
  and registerCCS to Profiling.c.

- Reduce scope of symbols: CC_LIST, CCS_LIST, CC_ID, CCS_ID

- Document CC_LIST and CCS_LIST

10 months agoMore minor comment improvements
Richard Eisenberg [Fri, 11 Jan 2019 21:42:06 +0000 (16:42 -0500)] 
More minor comment improvements

[skip ci]

10 months agoRun typed splices in the zonker
Matthew Pickering [Wed, 9 Jan 2019 14:52:30 +0000 (14:52 +0000)] 
Run typed splices in the zonker

Summary:
This fixes #15471

In the typechecker we check that the splice has the right type but we
crucially don't zonk the generated expression. This is because we might
end up unifying type variables from outer scopes later on.

Reviewers: simonpj, goldfire, bgamari

Subscribers: rwbarton, carter

GHC Trac Issues: #15471

Differential Revision: https://phabricator.haskell.org/D5286

10 months agoImplement a sanity check for CCS fields in profiling builds
Ömer Sinan Ağacan [Thu, 10 Jan 2019 09:42:04 +0000 (12:42 +0300)] 
Implement a sanity check for CCS fields in profiling builds

This helped me debug one of the bugs in #15508. I'm not sure if this is
a good idea, but it worked for me, so wanted to submit this as a MR.

10 months agoHadrian: Add support for building stage3
Matthew Pickering [Sun, 16 Dec 2018 08:58:41 +0000 (08:58 +0000)] 
Hadrian: Add support for building stage3

This ticket enables the building of a `stage3` compiler by making the
build logic more consistent and predictable in Hadrian.

Two of the main changes are:

1. In order to build anything at stageN we use the package database
present at stageN. Fixing #16069
2. `haddock` and `ghc-tags` are built
as stage1 executables (with the stage1 compiler) rather than as
stage2 compiler. Fixing
[hadrian#661](https://github.com/snowleopard/hadrian/issues/661)

In order to build a stage3 compiler, you have to set the new `finalStage` hadrian option to `Stage3`.

10 months agoBe pickier about unsaturated synonyms in :kind
Ryan Scott [Tue, 8 Jan 2019 12:37:18 +0000 (07:37 -0500)] 
Be pickier about unsaturated synonyms in :kind

Summary:
We currently permit any and all uses of unsaturated type
synonyms and type families in GHCi's `:kind` command, which allows
strange interactions like this one:

```
> :set -XTypeFamilies -XPolyKinds
> type family Id (a :: k)
> type instance Id a = a
> type Foo x = Maybe
> :kind! Id Foo
```

This is probably a stretch too far, so this patch moves to disallow
unsaturated synonyms that aren't at the top level (we still want to
allow `:kind Id`, for instance). We do this by augmenting `GhciCtxt`
with an additional `Bool` field to indicate if we are at the
outermost level of the type being passed to `:kind` or not. See
`Note [Unsaturated type synonyms in GHCi]` in `TcValidity` for the
full story.

Test Plan: make test TEST=T16013

Reviewers: goldfire, bgamari

Reviewed By: goldfire

Subscribers: simonpj, goldfire, rwbarton, carter

GHC Trac Issues: #16013

Differential Revision: https://phabricator.haskell.org/D5471

10 months agoCheck that libs found by GCC aren't folders
Alec Theriault [Mon, 7 Jan 2019 20:59:36 +0000 (12:59 -0800)] 
Check that libs found by GCC aren't folders

Summary:
We use 'gcc -B<base-location> --print-file-name mylib.a' as a way of
checking if 'gcc' can discover 'mylib.a' at the given location. However,
this can break down if there is a folder caller 'mylib.a' that 'gcc' can
discover. We can guard against this by explicitly checking that the path
returned by 'gcc' is a file.

This may seem like a far-fetched scenario, but since
3d17f1f10fc00540ac052f2fd03182906aa47e35, we look for libraries without
any prefix or suffix (ie. 'extra-libraries: softfloat', we look for just
'softfloat' as well as 'softloat.a', 'softfloat.dll.a', etc.) which means
that there might actusally be a folder of that name in one of the base
locations.

Reviewers: Phyx, bgamari, hvr, angerman

Reviewed By: Phyx, angerman

Subscribers: angerman, rwbarton, carter

GHC Trac Issues: #16063

Differential Revision: https://phabricator.haskell.org/D5462

10 months agofix-submodules: Rip out typing
Ben Gamari [Sun, 6 Jan 2019 04:34:12 +0000 (23:34 -0500)] 
fix-submodules: Rip out typing

Debian Jessie only runs Python 3.4, whereas typing was introduced in Python 3.5.

10 months agogitlab-ci: Clone haddock from its upstream repository
Ben Gamari [Sat, 5 Jan 2019 19:16:56 +0000 (14:16 -0500)] 
gitlab-ci: Clone haddock from its upstream repository

This ensures that changes requiring haddock changes can be built under CI.

10 months agoHadrian: merge sections in profiling _p.a to .p_o for ghci
Zejun Wu [Sun, 6 Jan 2019 12:40:05 +0000 (07:40 -0500)] 
Hadrian: merge sections in profiling _p.a to .p_o for ghci

This is the hadrain version of {D5169}

* We build squashed .o and .p_o for ghci when `dynamicGhcPrograms` is
`False`
* We no longer build them for rts as ghci never loads it

we need https://github.com/haskell/cabal/pull/5592 for cabal to copy
the built `.p_o` file.

Test Plan:
```
$ grep dynamicGhc hadrian/UserSettings.hs
  , dynamicGhcPrograms = return False
$ touch ...
$ hadrian/build.sh --flavour=user -j --digest-or
$ find _build/stage1/libraries/ -name 'HS*-*.*o' | wc
     62      62    3664
```

```
$ grep -C3 dynamicGhc hadrian/UserSettings.hs
userFlavour :: Flavour
userFlavour = performanceFlavour
  { name = "user"
  , dynamicGhcPrograms = return False
  }
$ hadrian/build.sh -j --flavour=user test --verbose
Unexpected results from:
TEST="T3807 T9208 T9293 annth_make ghci057 haddock.Cabal haddock.base
haddock.compiler"

SUMMARY for test run started at Wed Dec  5 17:45:39 2018 PST
 0:03:16 spent to go through
    6708 total tests, which gave rise to
   26015 test cases, of which
   19290 were skipped

      29 had missing libraries
    6600 expected passes
      88 expected failures

       3 caused framework failures
       0 caused framework warnings
       1 unexpected passes
       7 unexpected failures
       0 unexpected stat failures
$ find _build -name 'HSbase*.*o'
_build/stage1/lib/x86_64-linux-ghc-8.7.20181204/base-4.12.0.0/HSbase-4.1
2.0.0.o
_build/stage1/lib/x86_64-linux-ghc-8.7.20181204/base-4.12.0.0/HSbase-4.1
2.0.0.p_o
_build/stage1/libraries/base/build/HSbase-4.12.0.0.o
_build/stage1/libraries/base/build/HSbase-4.12.0.0.p_o
```

Reviewers: bgamari, simonmar, snowleopard

Reviewed By: snowleopard

Subscribers: alpmestan, rwbarton, carter

GHC Trac Issues: #15779

Differential Revision: https://phabricator.haskell.org/D5270

10 months agoFix #16133 by checking for TypeApplications in rnExpr
Ryan Scott [Sat, 5 Jan 2019 17:40:39 +0000 (12:40 -0500)] 
Fix #16133 by checking for TypeApplications in rnExpr

10 months agoFix bindist for ghci library
Zejun Wu [Wed, 2 Jan 2019 02:59:23 +0000 (18:59 -0800)] 
Fix bindist for ghci library

Summary:
https://phabricator.haskell.org/D5169 built libghci for both vanilla way
and profiling way. We need to include both in the bindist list so they
will be installed.

Test Plan:
```
$ grep '^BuildFlavour' mk/build.mk
BuildFlavour=perf
$ make test_bindist
$ grep HSghc-prim bindist-list.uniq
ghc-8.7.20190101/libraries/ghc-prim/dist-install/build/HSghc-prim-0.5.3.o
ghc-8.7.20190101/libraries/ghc-prim/dist-install/build/HSghc-prim-0.5.3.p_o
ghc-8.7.20190101/libraries/ghc-prim/dist-install/build/libHSghc-prim-0.5.3.a
ghc-8.7.20190101/libraries/ghc-prim/dist-install/build/libHSghc-prim-0.5.3-ghc8.7.20190101.so
ghc-8.7.20190101/libraries/ghc-prim/dist-install/build/libHSghc-prim-0.5.3_p.a
```

10 months agomake: Silence some xelatex output
Ben Gamari [Sun, 30 Dec 2018 21:36:21 +0000 (16:36 -0500)] 
make: Silence some xelatex output

Currently build logs from GitLab CI around around 7 megabytes each. Of this,
around 2 megabytes is latex output. This is quite silly as essentially all of
this output is unresolved references in the early latex iterations.
Here we silence this output.

However, to make sure that we don't silence errors we allow each xelatex
invocation besides the last to fail.

10 months agoRemove OPTIONS_HADDOCK hide in favour for not-home
Adam Sandberg Eriksson [Sun, 30 Dec 2018 19:04:15 +0000 (20:04 +0100)] 
Remove OPTIONS_HADDOCK hide in favour for not-home

GHC Trac Issues: #15447

10 months agogitlab-ci: Try reenabling PDF documentation on Darwin
Ben Gamari [Sun, 30 Dec 2018 18:49:47 +0000 (13:49 -0500)] 
gitlab-ci: Try reenabling PDF documentation on Darwin

Carter says that the builder issues have now been sorted.

10 months agoAdd entry for #16031 to base/changelog.md
Sven Tennie [Thu, 27 Dec 2018 16:21:41 +0000 (17:21 +0100)] 
Add entry for #16031 to base/changelog.md

10 months agoFix precedence handling for Data.Fixed's Show instance (#16031)
Sven Tennie [Wed, 26 Dec 2018 11:04:36 +0000 (12:04 +0100)] 
Fix precedence handling for Data.Fixed's Show instance (#16031)

Use `showsPrec` instead of `show` to respect the precedence of the surrounding
context.

10 months agoAdd -Wmissing-deriving-strategies
chessai [Wed, 26 Dec 2018 17:12:37 +0000 (12:12 -0500)] 
Add -Wmissing-deriving-strategies

Warn users when -XDerivingStrategies is enabled but not used, at each
potential use site.

add -Wmissing-deriving-strategies

Reviewers: bgamari, RyanGlScott

Subscribers: andrewthad, rwbarton, carter

GHC Trac Issues: #15798

Differential Revision: https://phabricator.haskell.org/D5451

10 months agoRespect prompt in GhciSettings
Zejun Wu [Wed, 19 Dec 2018 02:29:44 +0000 (18:29 -0800)] 
Respect prompt in GhciSettings

Summary:
This was broken when PromptFunction was introduced that the settings are
ignored and default values are always used.

Test Plan: ./validate

10 months agoFix broken links (#16125)
Sven Tennie [Fri, 4 Jan 2019 19:17:07 +0000 (20:17 +0100)] 
Fix broken links (#16125)

10 months agoDump Cmm with -ddump-cmm when building .cmm files
Ömer Sinan Ağacan [Sat, 5 Jan 2019 05:40:19 +0000 (08:40 +0300)] 
Dump Cmm with -ddump-cmm when building .cmm files

Fixes #16131

10 months agoMark GHC.Maybe as not-home for haddock
Simon Jakobi [Fri, 4 Jan 2019 02:56:51 +0000 (03:56 +0100)] 
Mark GHC.Maybe as not-home for haddock

Previously haddock would link 'Maybe' to GHC.Maybe.
Now it links to Data.Maybe.

10 months agoFix some typos, etc., in comments.
Richard Eisenberg [Fri, 4 Jan 2019 00:02:10 +0000 (19:02 -0500)] 
Fix some typos, etc., in comments.

[ci skip]

10 months agoVisible kind application
mynguyen [Tue, 18 Dec 2018 16:52:26 +0000 (11:52 -0500)] 
Visible kind application

Summary:
This patch implements visible kind application (GHC Proposal 15/#12045), as well as #15360 and #15362.
It also refactors unnamed wildcard handling, and requires that type equations in type families in Template Haskell be
written with full type on lhs. PartialTypeSignatures are on and warnings are off automatically with visible kind
application, just like in term-level.

There are a few remaining issues with this patch, as documented in
ticket #16082.

Includes a submodule update for Haddock.

Test Plan: Tests T12045a/b/c/TH1/TH2, T15362, T15592a

Reviewers: simonpj, goldfire, bgamari, alanz, RyanGlScott, Iceland_jack

Subscribers: ningning, Iceland_jack, RyanGlScott, int-index, rwbarton, mpickering, carter

GHC Trac Issues: `#12045`, `#15362`, `#15592`, `#15788`, `#15793`, `#15795`, `#15797`, `#15799`, `#15801`, `#15807`, `#15816`

Differential Revision: https://phabricator.haskell.org/D5229

10 months agoMinor refactoring and documentation in profiling RTS code
Ömer Sinan Ağacan [Wed, 2 Jan 2019 10:13:59 +0000 (13:13 +0300)] 
Minor refactoring and documentation in profiling RTS code

10 months agostg-spec: Modify `.lhs` to `.hs`
Takenobu Tani [Thu, 3 Jan 2019 01:09:29 +0000 (10:09 +0900)] 
stg-spec: Modify `.lhs` to `.hs`

Modify old filename `.lhs` to `.hs` in the following file:

  * docs/stg-spec/StgSyn.ott

Since PDF has not been registered in the past, I have not committed generated PDF(`stg-spec.pdf`).

[ci skip]

10 months agocore-spec: Modify `.lhs` to `.hs` (generated PDF)
Takenobu Tani [Wed, 2 Jan 2019 03:03:03 +0000 (12:03 +0900)] 
core-spec: Modify `.lhs` to `.hs` (generated PDF)

Modify old filename `.lhs` to `.hs` in following file:

  * docs/core-spec/core-spec.pdf (generated PDF)

[ci skip]

10 months agocore-spec: Modify `.lhs` to `.hs` (source files)
Takenobu Tani [Wed, 2 Jan 2019 03:01:47 +0000 (12:01 +0900)] 
core-spec: Modify `.lhs` to `.hs` (source files)

Modify old filename `.lhs` to `.hs` in following files:

  * docs/core-spec/README
  * docs/core-spec/CoreLint.ott
  * docs/core-spec/CoreSyn.ott
  * docs/core-spec/core-spec.mng

[ci skip]

10 months agoconfigure: introduce HAPPY and ALEX vars and deprecate --with-ghc in favour of the...
Adam Sandberg Eriksson [Sun, 30 Dec 2018 23:42:35 +0000 (00:42 +0100)] 
configure: introduce HAPPY and ALEX vars and deprecate --with-ghc in favour of the GHC var

Also updates the windows gitlab ci to use the new configure variables.

10 months agoPPC NCG: Remove Darwin support
Peter Trommler [Sun, 30 Dec 2018 21:23:53 +0000 (22:23 +0100)] 
PPC NCG: Remove Darwin support

Support for Mac OS X on PowerPC has been dropped by Apple years ago. We
follow suit and remove PowerPC support for Darwin.

Fixes #16106.

10 months agoIntroduce NCG config flag and add helper
Gabor Greif [Sun, 30 Dec 2018 09:57:46 +0000 (10:57 +0100)] 
Introduce NCG config flag and add helper

... for testing presence of NCG

This commit adds a criterion for checking whether we can expect sensible
output from --ddump-asm.

10 months agoPPC NCG: Simple 64-bit condition code on 32-bit
Peter Trommler [Sun, 30 Dec 2018 07:39:23 +0000 (02:39 -0500)] 
PPC NCG: Simple 64-bit condition code on 32-bit

10 months agorts: fix build failure on OpenBSD (_DYNAMIC symbol collision)
Sergei Trofimovich [Tue, 18 Dec 2018 23:17:45 +0000 (23:17 +0000)] 
rts: fix build failure on OpenBSD (_DYNAMIC symbol collision)

Summary:
Build failure on OpenBSD-6.4 the the following:
```
rts/RtsSymbols.c:994:1: error:
     error: redefinition of '_DYNAMIC' as different kind of symbol
    |
994 | RTS_OPENBSD_ONLY_SYMBOLS
    | ^
RTS_OPENBSD_ONLY_SYMBOLS
^
```

On OpenBSD `_DYNAMIC` was always defined in `<elf.h>` headers
but used not to be included.

The change explicitly includes `<elf.h>` as a source of symbol definition.

Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
Test Plan: build-tested on OpenBSD-6.4

Reviewers: bgamari, erikd, simonmar

Subscribers: rwbarton, carter

GHC Trac Issues: #15945

Differential Revision: https://phabricator.haskell.org/D5461

10 months agotestsuite: Disable more tests in unregisterised build
Ben Gamari [Sat, 29 Dec 2018 00:19:48 +0000 (19:19 -0500)] 
testsuite: Disable more tests in unregisterised build

This disables `ghcilink005`, `foreignInterruptable`, and `T7040_ghci` in
the unregisterised build as they tend to fail non-deterministically. See
ticket #16085.

10 months agorebindable-clash-warning-fix : correct warning logic
Shayne Fletcher [Sat, 29 Dec 2018 00:13:51 +0000 (19:13 -0500)] 
rebindable-clash-warning-fix : correct warning logic

10 months agoSkip test when external interpreter missing
Peter Trommler [Sat, 15 Dec 2018 21:22:47 +0000 (22:22 +0100)] 
Skip test when external interpreter missing

10 months agoarith011 is no longer broken with integer-simple
Alec Theriault [Wed, 26 Dec 2018 15:05:47 +0000 (10:05 -0500)] 
arith011 is no longer broken with integer-simple

10 months agoDivision fails fast for `divMod` \w integer-simple
Alec Theriault [Mon, 24 Dec 2018 18:35:18 +0000 (13:35 -0500)] 
Division fails fast for `divMod` \w integer-simple

We want to match the behaviour of `Integer` as well as
`Integer`/`Natural` from `integer-gmp`, namely to have

     divMod x 0 = _|_

not

     divMod x 0 = (_|_, _|_)

See #16091 for an example of where this matters.

10 months agoaclocal.m4: drop obsolete -fno-stack-protector
Sergei Trofimovich [Wed, 19 Dec 2018 23:21:28 +0000 (23:21 +0000)] 
aclocal.m4: drop obsolete -fno-stack-protector

Summary:
Initially -fno-stack-protector was added for openbsd specifically for ghc-6.5:
    changeset:f638fdfe1d9de1307355c8074fbff9c28342c0ef (2006)
and later it was extended to cover osx:
    changeset:c2cd83e7d85c11e6a33e1cde263eb2312566d535 (2009)

None of the reports hint at exact breakage. I guess both happened
in -fvia-C mode where GHC's Evil Mangler had a chance to mangle
stack canaries generated by fstack-protector.

ghc has no evil mangler anymore and the change is not needed
at least for C codegen.

validated the patch on OpenBSD-6.4. No new failures compared to
clean master branch.

Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
Test Plan: validated on OpenBSD

Reviewers: bgamari

Subscribers: rwbarton, erikd, carter

GHC Trac Issues: #16046

Differential Revision: https://phabricator.haskell.org/D5465

10 months agogitlab-ci: Try only building Windows in the quick flavour
Ben Gamari [Tue, 25 Dec 2018 10:12:40 +0000 (05:12 -0500)] 
gitlab-ci: Try only building Windows in the quick flavour

It seems no matter how many machines I throw at Windows it's constantly behind.
Perhaps the quick build flavour will be fast enough to allow us to keep until
while we sort out our toolchain issues (#16084).

10 months agogitlab-ci: Allow Windows to fail for now
Ben Gamari [Tue, 25 Dec 2018 21:54:25 +0000 (16:54 -0500)] 
gitlab-ci: Allow Windows to fail for now

While we sort out #16084.

10 months agogitlab-ci: Require that integer-simple configuration passes
Ben Gamari [Tue, 25 Dec 2018 21:52:59 +0000 (16:52 -0500)] 
gitlab-ci: Require that integer-simple configuration passes

The last step of #15915.

10 months agorts: Turn ASSERT in LDV_recordDead into a normal if
Ben Gamari [Sun, 23 Dec 2018 00:43:41 +0000 (19:43 -0500)] 
rts: Turn ASSERT in LDV_recordDead into a normal if

As reported in #15382 the `ASSERT(ctr != NULL)` is currently getting routinely
hit during testsuite runs. While this is certainly a bug I would far prefer
getting a proper error message than a segmentation fault. Consequently I'm
turning the `ASSERT` into a proper `if` so we get a proper error in non-debug
builds.

10 months agotestsuite: Skip ffi018_ghci when unregisterised
Ben Gamari [Tue, 25 Dec 2018 10:03:21 +0000 (05:03 -0500)] 
testsuite: Skip ffi018_ghci when unregisterised

As noted in #16085 this test is fragile in unregisterised compilers.

10 months agogitlab-ci: Clean tree on Windows after job
Ben Gamari [Mon, 24 Dec 2018 20:34:00 +0000 (15:34 -0500)] 
gitlab-ci: Clean tree on Windows after job

It seems like currently the runner doesn't delete the working tree after
finishing a job. At least we can delete the binary artifacts for now.

10 months agogitlab-ci: Use robocopy instead of bash to copy cabal cache
Ben Gamari [Sun, 23 Dec 2018 18:12:46 +0000 (13:12 -0500)] 
gitlab-ci: Use robocopy instead of bash to copy cabal cache

10 months agogitlab-ci: Use per-build temporary directory on Windows
Ben Gamari [Sun, 23 Dec 2018 06:19:36 +0000 (01:19 -0500)] 
gitlab-ci: Use per-build temporary directory on Windows

I have seen several instances of inexplicable "Access denied" errors on Windows.
Using per-build temporary directories avoids any chance of interference between
builds and eliminates the possibility of temporary files leaking beyond the life
of the build.

10 months agoRevert "hadrian: Pass integer_backend to testsuite driver"
Ben Gamari [Sun, 23 Dec 2018 22:57:12 +0000 (17:57 -0500)] 
Revert "hadrian: Pass integer_backend to testsuite driver"

This reverts commit 442be690e1ca162e22d632df695c29f90625f33e.

10 months agotestsuite: Fix a variety of issues when building with integer-simple
Ben Gamari [Sun, 23 Dec 2018 06:34:00 +0000 (06:34 +0000)] 
testsuite: Fix a variety of issues when building with integer-simple

 * Mark arith011 as broken with integer-simple

   As noted in #16091, arith011 fails when run against integer-simple with a
   "divide by zero" exception. This suggests that integer-gmp and integer-simple
   are handling division by zero differently.

 * This also fixes broken_without_gmp; the lack of types made the previous
   failure silent, sadly. Improves situation of #16043.

 * Mark several tests implicitly depending upon integer-gmp as broken
   with integer-simple. These expect to see Core coming from integer-gmp,
   which breaks with integer-simple.

 * Increase runtime timeout multiplier of T11627a with integer-simple

   I previously saw that T11627a timed out in all profiling ways when run against
   integer-simple. I suspect this is due to integer-simple's rather verbose heap
   representation. Let's see whether increasing the runtime timeout helps.

   Fixes test for #11627.

This is all in service of fixing #16043.

10 months agotestsuite: Enable T11627a on Darwin
Ben Gamari [Sun, 23 Dec 2018 17:36:50 +0000 (12:36 -0500)] 
testsuite: Enable T11627a on Darwin

The retainer profiler no longer uses the C stack for its mark stack (#14758).
Consequently even the small C stack provided on Darwin should be sufficient to
run this test. See #11627

10 months agoghc-compact: Use Char instead of Integer in compact_share test
Ben Gamari [Sun, 23 Dec 2018 17:33:12 +0000 (12:33 -0500)] 
ghc-compact: Use Char instead of Integer in compact_share test

The representation of Integer depends upon the choice of integer backend whereas
Char should be consistent.

10 months agoSimplify Core output with -dsuppress-type-signatures
Ömer Sinan Ağacan [Mon, 24 Dec 2018 12:02:27 +0000 (15:02 +0300)] 
Simplify Core output with -dsuppress-type-signatures

Currently we duplicate top-level binder ids for no reason:

    $fEqHsExpr_$c/=
    $fEqHsExpr_$c/=
      = \ @ id_a27U $dEq_a27V eta_B2 eta1_B1 ->
          case $fEqHsExpr_$c== $dEq_a27V eta_B2 eta1_B1 of {
            False -> True;
            True -> False
          }

with this patch we drop the first line when type signatures are not
printed (-dsuppress-type-signatures, which is implied by -dsuppress-all)

Reviewers: simonpj, bgamari

Reviewed By: simonpj

Subscribers: rwbarton, carter

Differential Revision: https://phabricator.haskell.org/D5472

10 months agotestsuite: Mark th tests as broken in ext-interp way in LLVM build flavours
Ben Gamari [Sun, 23 Dec 2018 07:24:17 +0000 (02:24 -0500)] 
testsuite: Mark th tests as broken in ext-interp way in LLVM build flavours

This is due to the failures documented in #16087. The condition here could be
improved as it matches on `BUILD_FLAVOUR` instead of looking at the compiler
flags. However, it's better than nothing and I hope we will be able to fix these
issues before long.

10 months agogitlab-ci: Disable CircleCI Darwin builds
Ben Gamari [Sun, 23 Dec 2018 21:52:27 +0000 (16:52 -0500)] 
gitlab-ci: Disable CircleCI Darwin builds

They aren't finishing correctly anyways.

10 months agoRevert "testsuite: Fix broken_without_gmp"
Ben Gamari [Sun, 23 Dec 2018 18:45:24 +0000 (13:45 -0500)] 
Revert "testsuite: Fix broken_without_gmp"

This reverts commit e59439af3222d151918ad1ad2a03942ce9e6a1ff.

This is causing unexpected failures in some test ways. Further proof
that no change is too trivial for CI.

10 months agotestsuite: Fix broken_without_gmp
Ben Gamari [Sun, 23 Dec 2018 06:34:00 +0000 (06:34 +0000)] 
testsuite: Fix broken_without_gmp

The lack of types made the previous failure silent, sadly. Improves
situation of #16043.

11 months agotestsuite: Mark heapprof001 as broken in prof_hc_hb way on i386
Ben Gamari [Sat, 22 Dec 2018 18:02:08 +0000 (13:02 -0500)] 
testsuite: Mark heapprof001 as broken in prof_hc_hb way on i386

As documented in #15382, this is known to fail in prof_hc_hb on i386.
Concerningly, I have also seen this test non-deterministically fail in
prof_hc_hb on amd64. We should really investigate this.

11 months agotestsuite: Mark objcpp-hi and T13366 as broken on Darwin due to #16083
Ben Gamari [Sat, 22 Dec 2018 15:01:46 +0000 (10:01 -0500)] 
testsuite: Mark objcpp-hi and T13366 as broken on Darwin due to #16083

11 months agotestsuite: Remove expect_broken on readFail032 and readFail048
Ben Gamari [Sat, 22 Dec 2018 14:49:28 +0000 (09:49 -0500)] 
testsuite: Remove expect_broken on readFail032 and readFail048

As noted in #15662, these used to be broken on Darwin due to a Clang toolchain
bug. However, this bug appears to be fixed in the Clang shipped with macOS
Mojave. Unfortunately, we don't really have any way to only mark it as broken on
certain operation system releases so I am just removing the expect_broken
entirely.

11 months agogitlab-ci: Allow Darwin CircleCI build to fail
Ben Gamari [Sat, 22 Dec 2018 06:09:20 +0000 (01:09 -0500)] 
gitlab-ci: Allow Darwin CircleCI build to fail

This is currently spuriously failing. Moreover, we have the Mac Mini builder
running again so this is much less necessary now.

11 months agoAdd test for #16038
Ömer Sinan Ağacan [Sat, 22 Dec 2018 07:11:49 +0000 (10:11 +0300)] 
Add test for #16038

11 months agolinters: Check for WARN macro with space separating it from its paren
Ben Gamari [Sat, 22 Dec 2018 05:53:45 +0000 (00:53 -0500)] 
linters: Check for WARN macro with space separating it from its paren

11 months agoLoadIface: Fix another CPP/Clang issue
Ben Gamari [Sat, 22 Dec 2018 05:53:00 +0000 (00:53 -0500)] 
LoadIface: Fix another CPP/Clang issue

11 months agogitlab-ci: Fix Darwin build
Ben Gamari [Sat, 22 Dec 2018 04:23:56 +0000 (23:23 -0500)] 
gitlab-ci: Fix Darwin build

Previously the toolchain directory was wiped away by git clean.

11 months agogitlab-ci: Only run nightly-i386-linux-deb9 when NIGHTLY is set
Ben Gamari [Sat, 22 Dec 2018 02:29:54 +0000 (21:29 -0500)] 
gitlab-ci: Only run nightly-i386-linux-deb9 when NIGHTLY is set

11 months agogitlab-ci: More aggressive cleaning
Ben Gamari [Sat, 22 Dec 2018 02:28:09 +0000 (21:28 -0500)] 
gitlab-ci: More aggressive cleaning

11 months agogitlab-ci: Only run CircleCI Darwin build in full-build stage
Ben Gamari [Fri, 21 Dec 2018 23:42:04 +0000 (18:42 -0500)] 
gitlab-ci: Only run CircleCI Darwin build in full-build stage

11 months agoTcRnDriver: Fix haddock-like comment
Ben Gamari [Fri, 21 Dec 2018 23:04:51 +0000 (18:04 -0500)] 
TcRnDriver: Fix haddock-like comment

11 months agogitlab-ci: Add i386 Debian 9 builds
Ben Gamari [Fri, 21 Dec 2018 21:51:37 +0000 (16:51 -0500)] 
gitlab-ci: Add i386 Debian 9 builds

11 months agogitlab-ci: Ensure that build environment is clean
Ben Gamari [Fri, 21 Dec 2018 19:49:57 +0000 (14:49 -0500)] 
gitlab-ci: Ensure that build environment is clean

11 months agogitlab-ci: Set locale
Ben Gamari [Fri, 21 Dec 2018 15:10:28 +0000 (10:10 -0500)] 
gitlab-ci: Set locale

11 months agogitlab-ci: Set thread count properly on Windows
Ben Gamari [Fri, 21 Dec 2018 15:10:09 +0000 (10:10 -0500)] 
gitlab-ci: Set thread count properly on Windows

11 months agogitlab-ci: Tag linter stage
Ben Gamari [Wed, 19 Dec 2018 19:25:49 +0000 (14:25 -0500)] 
gitlab-ci: Tag linter stage

Previously the linters were tagged with x86_64-linux, meaning that linting jobs
would often get stuck behind builds in the queue. Given that linting jobs are
fairly low-cost they hold up later build stages it is important that we reduce
this latency.

11 months agogitlab-ci: Fix Windows build
Ben Gamari [Wed, 19 Dec 2018 17:47:43 +0000 (12:47 -0500)] 
gitlab-ci: Fix Windows build

11 months agogitlab-ci: Remove CircleCI configuration
Ben Gamari [Tue, 18 Dec 2018 22:38:07 +0000 (17:38 -0500)] 
gitlab-ci: Remove CircleCI configuration

Our CircleCI builds will fail anyways without large instances.

11 months agoCircleCI: Fix check for git push retry limit.
David Eichmann [Wed, 19 Dec 2018 16:46:13 +0000 (11:46 -0500)] 
CircleCI: Fix check for git push retry limit.

Test Plan: Observe CircleCI

Reviewers: bgamari

Reviewed By: bgamari

Subscribers: rwbarton, carter

Differential Revision: https://phabricator.haskell.org/D5464

11 months agogitlab-ci: Allow Hadrian build on Windows to fail
Ben Gamari [Wed, 19 Dec 2018 16:42:56 +0000 (11:42 -0500)] 
gitlab-ci: Allow Hadrian build on Windows to fail

Due to #16073.

11 months agoremove option
Gabor Greif [Fri, 14 Dec 2018 19:01:43 +0000 (20:01 +0100)] 
remove option

11 months agoRevert "gitlab: Drop submodules hack"
Ben Gamari [Wed, 19 Dec 2018 15:57:11 +0000 (10:57 -0500)] 
Revert "gitlab: Drop submodules hack"

It turns out that the submodules hack is useful to ensure that
CI works in forks.

This reverts commit 90ceafa8b9ad60e3c7b72cdd2dacdbeb96bdcddc.

11 months agoImprove documention of TypeInType
Simon Peyton Jones [Fri, 21 Dec 2018 16:54:26 +0000 (16:54 +0000)] 
Improve documention of TypeInType

11 months agoFix treatment of hi-boot files and dfuns
Simon Peyton Jones [Thu, 20 Dec 2018 17:49:34 +0000 (17:49 +0000)] 
Fix treatment of hi-boot files and dfuns

Trac #16038 exposed the fact that TcRnDriver.checkHiBootIface
was creating a binding, in the module being compiled, for
   $fxBlah = $fBlah

 but $fxBlah was a /GlobalId/. But all bindings should be for
 /LocalIds/ else dependency analysis goes down the tubes.

* I added a CoreLint check that an occurrence of a GlobalId
  is not bound by an binding of a LocalId.  (There is already
  a binding-site check that no binding binds a GlobalId.)

* I refactored (and actually signficantly simplified) the
  tricky code for dfuns in checkHiBootIface to ensure that
  we get LocalIds for those boot-dfuns.

Alas, I then got "duplicate instance" messages when compiling
HsExpr. It turns out that this is a long-standing, but extremely
delicate, bug: even before this patch, if you compile HsExpr
with -ddump-tc-trace, you get "duplicate instance". Without
-ddump-tc-trace, it's OK.  What a mess!

The reason for the duplicate-instance is now explained in
Note [Loading your own hi-boot file] in LoadIface.  I fixed
it by a Gross Hack in LoadIface.loadInterface. This is at
least no worse than before.

But there should be a better way. I have opened #16081 for this.

11 months agoTiny refactor to tcExtendRecEnv
Simon Peyton Jones [Thu, 20 Dec 2018 12:41:14 +0000 (12:41 +0000)] 
Tiny refactor to tcExtendRecEnv

In tcExtendRecEnv, there is no need to us setGlobalTypeEnv
(which side-effects the tcg_type_env_var).  tcExtendRecEnv
is used only when kind-checking a group of type/class decls
and no knot-tying via tcg_type_env_var is needed.

There is no change in functionality.

11 months agoComments only
Simon Peyton Jones [Mon, 10 Dec 2018 17:32:34 +0000 (17:32 +0000)] 
Comments only

11 months agoMake candidateQTvs contain tyvar with zonked kinds
Simon Peyton Jones [Fri, 21 Dec 2018 11:11:31 +0000 (11:11 +0000)] 
Make candidateQTvs contain tyvar with zonked kinds

candidateQTyVars was failing to return fully-zonked
tyvars, and that made things fall over chaotically
when we try to sort them into a well-scoped telescope.
Result: Trac #15795

So I made candidateQTvs guarantee to have fully-zonked
tyvars (i.e. with zonked kinds).  That's a bit annoying
but not really difficult.

11 months agoFix #16002 by moving a validity check to the renamer
Ryan Scott [Fri, 21 Dec 2018 04:00:21 +0000 (23:00 -0500)] 
Fix #16002 by moving a validity check to the renamer

Summary:
The validity check which rejected things like:

```lang=haskell
type family B x where
  A x = x
```

Used to live in the typechecker. But it turns out that this validity
check was //only// being run on closed type families without CUSKs!
This meant that GHC would silently accept something like this:

```lang=haskell
type family B (x :: *) :: * where
  A x = x
```

This patch fixes the issue by moving this validity check to the
renamer, where we can be sure that the check will //always// be run.

Test Plan: make test TEST=T16002

Reviewers: simonpj, bgamari

Reviewed By: simonpj

Subscribers: goldfire, rwbarton, carter

GHC Trac Issues: #16002

Differential Revision: https://phabricator.haskell.org/D5420

11 months agoRefine the suppression of RuntimeRep variables
Simon Peyton Jones [Thu, 20 Dec 2018 14:05:27 +0000 (14:05 +0000)] 
Refine the suppression of RuntimeRep variables

When we pretty-print types, we suppress RuntimeRep variables, but
we were being too aggressive in doing so, resulting in Trac #16074.

This patch makes the suppression a bit less aggressive.
See Note [Defaulting RuntimeRep variables]

11 months agoAdd solveLocalEqualities to tcHsPatSigType
Simon Peyton Jones [Thu, 20 Dec 2018 12:42:46 +0000 (12:42 +0000)] 
Add solveLocalEqualities to tcHsPatSigType

This call plain missing, and as a result the casts
messed up deep-skolemisation in tcSubType

Fixes Trac #16033

11 months agoRemove an old OPTIONS_GHC
Ömer Sinan Ağacan [Thu, 20 Dec 2018 12:36:54 +0000 (15:36 +0300)] 
Remove an old OPTIONS_GHC

11 months agoFix #16030 by refactoring IfaceSyn's treatment of GADT constructors
Ryan Scott [Wed, 19 Dec 2018 18:17:58 +0000 (19:17 +0100)] 
Fix #16030 by refactoring IfaceSyn's treatment of GADT constructors

Summary:
GHCi's `:info` command was pretty-printined GADT
constructors suboptimally in the following ways:

1. Sometimes, fields were parenthesized when they did not need it,
   e.g.,

```lang=haskell
data Foo a where
  MkFoo :: (Maybe a) -> Foo a
```

   I fixed this by refactoring some code in `pprIfaceConDecl` to be a
   little smarter with respect to GADT syntax. See `pprFieldArgTy`
   and `pprArgTy`.
2. With `-fprint-explicit-kinds` enabled, there would be times when
   specified arguments would be printed without a leading `@` in GADT
   return types, e.g.,

```lang=haskell
data Bar @k (a :: k) where
  MkBar :: Bar k a
```

   It turns out that `ppr_tc_app`, the function which pretty-prints
   these return types, was not using the proper machinery to print
   out the arguments, which caused the visibilities to be forgotten
   entirely. I refactored `ppr_tc_app` to do this correctly.

Test Plan: make test TEST=T16030

Reviewers: goldfire, bgamari, simonpj

Reviewed By: simonpj

Subscribers: simonpj, rwbarton, carter

GHC Trac Issues: #16030

Differential Revision: https://phabricator.haskell.org/D5440

11 months agoUse unicode arrows with -fprint-unicode-syntax
Krzysztof Gogolewski [Wed, 19 Dec 2018 18:17:20 +0000 (19:17 +0100)] 
Use unicode arrows with -fprint-unicode-syntax

Summary:
See #8959, this is one more place where we
can pretty-print Unicode syntax.

Test Plan: validate

Reviewers: nomeata, bgamari

Reviewed By: bgamari

Subscribers: rwbarton, carter

GHC Trac Issues: #8959

Differential Revision: https://phabricator.haskell.org/D5439

11 months agodon't suggest Rank2Types in error messages (Fixed #16000)
chessai [Wed, 19 Dec 2018 18:16:49 +0000 (19:16 +0100)] 
don't suggest Rank2Types in error messages (Fixed #16000)

Summary: Rank2Types is deprecated. Don't suggest to users to use it.

Reviewers: bgamari, RyanGlScott, simonpj

Reviewed By: RyanGlScott, simonpj

Subscribers: RyanGlScott, rwbarton, carter

GHC Trac Issues: #16000

Differential Revision: https://phabricator.haskell.org/D5447

11 months agogitlab-ci: Split build into two halves
Ben Gamari [Wed, 19 Dec 2018 16:49:25 +0000 (11:49 -0500)] 
gitlab-ci: Split build into two halves

Currently we are having quite some trouble keeping up with our build volume due
to the number of configurations we have. I've split the pipeline into two
halves:

 * build, which builds just vanilla deb9-linux with make and hadrian
 * full-build, which builds everything else

This will trade-off some latency to more efficient use of our builders.

11 months agogitlab-ci: Fix locale on Darwin only
Ben Gamari [Wed, 19 Dec 2018 14:06:01 +0000 (09:06 -0500)] 
gitlab-ci: Fix locale on Darwin only

Setting LANG causes trouble on Debian.

11 months agoFix warning that 'hugs-options' isn't supported any more
Gabor Greif [Wed, 12 Dec 2018 12:56:50 +0000 (13:56 +0100)] 
Fix warning that 'hugs-options' isn't supported any more

11 months agogitlab-ci: Ensure that locale is set
Ben Gamari [Wed, 19 Dec 2018 00:50:06 +0000 (19:50 -0500)] 
gitlab-ci: Ensure that locale is set

11 months agogitlab-ci: Make Windows PATH more robust
Ben Gamari [Tue, 18 Dec 2018 23:51:27 +0000 (18:51 -0500)] 
gitlab-ci: Make Windows PATH more robust

11 months agogitlab-ci: Remove CircleCI configuration
Ben Gamari [Tue, 18 Dec 2018 22:38:07 +0000 (17:38 -0500)] 
gitlab-ci: Remove CircleCI configuration

Our CircleCI builds will fail anyways without large instances.

11 months agogitlab-ci: Try fixing Windows build
Ben Gamari [Tue, 18 Dec 2018 22:36:55 +0000 (17:36 -0500)] 
gitlab-ci: Try fixing Windows build

For some reason curl isn't found on the new builder.

11 months agocircleci: Fix LLVM build
Ben Gamari [Tue, 18 Dec 2018 22:35:43 +0000 (17:35 -0500)] 
circleci: Fix LLVM build

Might as well make sure it works before we retire it.

11 months agoAdd some complexities to Data.List documentation (#15003)
Sven Tennie [Sun, 16 Dec 2018 16:25:24 +0000 (17:25 +0100)] 
Add some complexities to Data.List documentation (#15003)

Namely for:
- stripPrefix
- isPrefixOf
- intersperse
- tails
- map
- scanl
- scanl1
- scanl'
- scanr
- scanr1
- zip
- zipWith

Add examples to `zipWith` and `map`.