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

10 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

10 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

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

10 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

10 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.

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

10 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.

10 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

10 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.

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

10 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.

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

10 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.

10 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.

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

10 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.

10 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

10 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]

10 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

10 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

10 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

10 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

10 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

10 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.

10 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.

10 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

10 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

10 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

10 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.

10 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.

10 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.

10 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`.

10 months agohadrian: introduce make-user-oriented docs
Alp Mestanogullari [Tue, 18 Dec 2018 04:38:20 +0000 (23:38 -0500)] 
hadrian: introduce make-user-oriented docs

This commit introduces Hadrian docs specifically
targeted at GHC devs who are used to building GHC with the make
build system, adapting a good chunk of the following quickstart
page we wrote over the last few months:

  https://ghc.haskell.org/trac/ghc/wiki/Building/Hadrian/QuickStart

Reviewers: snowleopard, bgamari

Reviewed By: snowleopard

Subscribers: rwbarton, carter

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

10 months agoAdd missing comma in 'libdw' configure check
Alec Theriault [Tue, 18 Dec 2018 04:36:31 +0000 (23:36 -0500)] 
Add missing comma in 'libdw' configure check

Fix a bug from cb882fc993b4972f7f212b291229ef9e9ade0af9. Without the
comma, all non-diverging codepaths set 'UseLibdw=NO'.

Reviewers: bgamari, nh2

Reviewed By: nh2

Subscribers: rwbarton, erikd, carter

GHC Trac Issues: #15968

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

10 months agomake QSem and QSemN newtypes
chessai [Tue, 18 Dec 2018 04:36:20 +0000 (23:36 -0500)] 
make QSem and QSemN newtypes

Reviewers: RyanGlScott, ekmett, hvr, bgamari

Reviewed By: bgamari

Subscribers: rwbarton, carter

GHC Trac Issues: #15995

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

10 months agoFix ghci crash when starting with -fno-implicit-import-qualified
Zejun Wu [Tue, 18 Dec 2018 04:35:44 +0000 (23:35 -0500)] 
Fix ghci crash when starting with -fno-implicit-import-qualified

`ghci -fno-implicit-import-qualified` didn't start with error message:

```
GHCi, version 8.6.2: http://www.haskell.org/ghc/  :? for help

<interactive>:1:6: error:
    Not in scope: ‘System.IO.hSetBuffering’
        No module named ‘System.IO’ is imported.

...
```

This change fixes it and update test T2452 to cover this.

Test Plan:
  TEST=T2452 make accept

harbormaster build runs

Reviewers: simonmar, bgamari, RyanGlScott

Reviewed By: simonmar

Subscribers: rwbarton, carter

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

10 months agogitlab-ci: Fix spelling of GIT_SUBMODULE_STRATEGY
Ben Gamari [Tue, 18 Dec 2018 03:58:43 +0000 (22:58 -0500)] 
gitlab-ci: Fix spelling of GIT_SUBMODULE_STRATEGY

10 months agocircleci: Don't use xlarge instances
Ben Gamari [Tue, 18 Dec 2018 03:38:39 +0000 (22:38 -0500)] 
circleci: Don't use xlarge instances

As discussed on ghc-devops, CircleCI is changing their billing policy to require
users of instances larger than `medium` to use a paid account. Consequently
these instances will no longer be available to us starting tomorrow.

10 months agodarwin: Build with in-tree GMP
Ben Gamari [Tue, 18 Dec 2018 00:56:08 +0000 (19:56 -0500)] 
darwin: Build with in-tree GMP

10 months agogitlab: Drop submodules hack
Ben Gamari [Tue, 18 Dec 2018 00:41:22 +0000 (19:41 -0500)] 
gitlab: Drop submodules hack

10 months agogitlab-ci/deb8-hadrian: Fix submodule paths
Ben Gamari [Tue, 18 Dec 2018 00:39:32 +0000 (19:39 -0500)] 
gitlab-ci/deb8-hadrian: Fix submodule paths

10 months agoStgCRun: Disable unwinding on Darwin
Ben Gamari [Mon, 17 Dec 2018 00:10:07 +0000 (19:10 -0500)] 
StgCRun: Disable unwinding on Darwin

See #15207.

10 months agogitlab-ci: Use cabal-install 2.4 on Darwin
Ben Gamari [Mon, 17 Dec 2018 01:32:45 +0000 (20:32 -0500)] 
gitlab-ci: Use cabal-install 2.4 on Darwin

10 months agoghci: Fix unused binder warnings when building with integer-simple
Ben Gamari [Sun, 16 Dec 2018 19:10:54 +0000 (14:10 -0500)] 
ghci: Fix unused binder warnings when building with integer-simple

10 months agogitlab-ci: Run Windows builds via make as well
Ben Gamari [Sun, 16 Dec 2018 16:30:30 +0000 (11:30 -0500)] 
gitlab-ci: Run Windows builds via make as well

10 months agogitlab-ci: Disable Hadrian linting on Windows
Ben Gamari [Sun, 16 Dec 2018 16:26:46 +0000 (11:26 -0500)] 
gitlab-ci: Disable Hadrian linting on Windows

The lint checks currently fail due to #15950.

10 months agogitlab-ci: Introduce nightly builds
Ben Gamari [Sun, 16 Dec 2018 15:13:01 +0000 (10:13 -0500)] 
gitlab-ci: Introduce nightly builds

These run slowtest and their artifacts are preserved for two years.

10 months agogitlab-ci: Expire artifacts more aggressively
Ben Gamari [Sun, 16 Dec 2018 15:12:39 +0000 (10:12 -0500)] 
gitlab-ci: Expire artifacts more aggressively

Namely after 2 weeks

10 months agoStomp a few typos and grammaros
Gabor Greif [Sat, 15 Dec 2018 11:44:59 +0000 (12:44 +0100)] 
Stomp a few typos and grammaros

Also use 'id'

10 months agoHandle :cd in external interpreter in a more robust way
Zejun Wu [Mon, 17 Dec 2018 06:16:00 +0000 (01:16 -0500)] 
Handle :cd in external interpreter in a more robust way

We used to enqueue another command to change directory in the external
interpreter subprocess, this is not as robust as:

* it can fail with -fno-implict-import-qualified;
* it doesn't work when we `setGHCiMonad` to something other than `IO`.

Neither of them works if `directory` package is hidden though.

Test Plan:
```
$ inplace/bin/ghc-stage2 --interactive # -fexternal-interpreter
GHCi, version 8.7.20181213: http://www.haskell.org/ghc/  :? for help
Prelude> :cd ..
Prelude> System.Directory.getCurrentDirectory
"/data/users/watashi"
Prelude> :!pwd
/data/users/watashi
Prelude>
Leaving GHCi.
```

  ./validate

Reviewers: simonmar, bgamari, RyanGlScott

Reviewed By: simonmar

Subscribers: rwbarton, carter

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

10 months agoHadrian: introduce userDefaultFlavour, making default flavour overridable
Alp Mestanogullari [Mon, 17 Dec 2018 06:15:45 +0000 (01:15 -0500)] 
Hadrian: introduce userDefaultFlavour, making default flavour overridable

This patch introduces the `userDefaultFlavour` user setting. It should
be the name of the default flavour to use when no --flavour argument is
passed. Before this patch, we would just always default to... the
`default` flavour. With this patch, we default to whatever Flavour whose
name is `userDefaultFlavour`, therefore providing a way for users to
"persist" their choice of flavour, not having to repeat --flavour=[...]
in every hadrian command.

Test Plan:
Set `userDefaultFlavour = "quickest"`, run `hadrian/build.sh`, check
that the quickest flavour is indeed picked.

Reviewers: snowleopard, bgamari

Reviewed By: snowleopard

Subscribers: mpickering, rwbarton, carter

GHC Trac Issues: #15890

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

10 months agogitlab-ci: Enable Windows builds
Ben Gamari [Sun, 16 Dec 2018 00:40:26 +0000 (19:40 -0500)] 
gitlab-ci: Enable Windows builds

10 months agoMerge sections in profiling .a to .p_o and use it whenever it exists
Zejun Wu [Mon, 17 Dec 2018 00:27:18 +0000 (00:27 +0000)] 
Merge sections in profiling .a to .p_o and use it whenever it exists

Summary:
We do this for vanilla way already.
Let's also merge sections for profiling way and use it instead of the .a
library when it exists.

Test Plan:
```
 $ inplace/bin/ghc-stage2 --interactive -prof -fexternal-interpreter
 GHCi, version 8.7.20180921: http://www.haskell.org/ghc/  :? for help
 Prelude> pid <- System.Posix.Process.getProcessID
 Prelude> maps <- readFile $ "/proc/" ++ show pid ++ "/maps"
 Prelude> pid
 3807346
 Prelude> putStrLn $ unlines $ take 20 $ lines maps
 00400000-02103000 r-xp 00000000 00:1a 199277344
 /data/users/watashi/ghc/inplace/lib/bin/ghc-iserv-prof
 02104000-02106000 r--p 01d03000 00:1a 199277344
 /data/users/watashi/ghc/inplace/lib/bin/ghc-iserv-prof
 02106000-02417000 rw-p 01d05000 00:1a 199277344
 /data/users/watashi/ghc/inplace/lib/bin/ghc-iserv-prof
 02417000-0280a000 rw-p 00000000 00:00 0
 [heap]
 40098000-400b0000 rwxp 000d2000 00:1a 199276023
 /data/users/watashi/ghc/libraries/bytestring/dist-install/build/HSbytestring-0.10.8.2.p_o
 400b7000-400d8000 rwxp 00000000 00:00 0
 401d1000-401d2000 rwxp 000e9000 00:1a 199276023
 /data/users/watashi/ghc/libraries/bytestring/dist-install/build/HSbytestring-0.10.8.2.p_o
 40415000-40419000 rwxp 0000b000 00:1a 199275165
 /data/users/watashi/ghc/libraries/deepseq/dist-install/build/HSdeepseq-1.4.4.0.p_o
 404f8000-40526000 rwxp 000af000 00:1a 199274234
 /data/users/watashi/ghc/libraries/ghc-prim/dist-install/build/HSghc-prim-0.5.3.p_o
```

Reviewers: simonmar, bgamari, austin, hvr

Reviewed By: simonmar

Subscribers: rwbarton, carter

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

10 months agogitlab-ci: Add aarch64 target
Ben Gamari [Sat, 15 Dec 2018 06:20:16 +0000 (01:20 -0500)] 
gitlab-ci: Add aarch64 target

10 months agohadrian: Pass integer_backend to testsuite driver
Ben Gamari [Fri, 14 Dec 2018 20:11:54 +0000 (15:11 -0500)] 
hadrian: Pass integer_backend to testsuite driver

10 months agoUse https links in user-facing startup and error messages
Ingo Blechschmidt [Fri, 14 Dec 2018 16:10:56 +0000 (11:10 -0500)] 
Use https links in user-facing startup and error messages

I consider myself lucky that in my circle of friends, `http` urls (as
opposed to `https` urls) are frowned upon in that we generally
apologize in the rase cases that we share an `http` url.

This pull request changes `http` links into their `https` analogues in
the following places:

* In the GHCI startup message (and parts of the User's Guide, where
there are verbatim transcripts of GHCi sessions).
* In a couple of error messages, asking the user to report a bug.

(I also took the liberty to change a single space before the reportabug
url into two spaces, harmonizing this occurence with the others.)

I'm not trying to start a war. I just had a moment to spare and felt
like preparing this diff. Merge or don't merge as you wish!

Reviewers: bgamari, erikd, simonmar

Subscribers: goldfire, rwbarton, carter

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

10 months agorts: Annotate fallthroughs in AArch64 linker
Ben Gamari [Fri, 14 Dec 2018 14:55:15 +0000 (09:55 -0500)] 
rts: Annotate fallthroughs in AArch64 linker

10 months agoUpdate -F RTS help:
Ömer Sinan Ağacan [Fri, 14 Dec 2018 04:31:00 +0000 (07:31 +0300)] 
Update -F RTS help:

- Add default value
- Update the help line as multiple short lines instead of one long line,
  for consistency with other lines.

Reviewers: simonmar, bgamari, erikd

Reviewed By: bgamari

Subscribers: rwbarton, carter

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

10 months agogitlab-ci: Bump Darwin boot compiler to 8.6.3
Ben Gamari [Thu, 13 Dec 2018 23:00:28 +0000 (18:00 -0500)] 
gitlab-ci: Bump Darwin boot compiler to 8.6.3

10 months agogitlab-ci: Add linters
Ben Gamari [Thu, 13 Dec 2018 18:53:27 +0000 (13:53 -0500)] 
gitlab-ci: Add linters

These are taken from our previous arcanist linters as well as the
gitolite hooks but with some heavy refactoring.

10 months agollvm-targets: Add amd64-unknown-freebsd triple
Ben Gamari [Thu, 13 Dec 2018 18:25:05 +0000 (13:25 -0500)] 
llvm-targets: Add amd64-unknown-freebsd triple

396aac4c65a47b6252e0a73d2a3066e924d53f11 added the
amd64-portbld-freebsd triple but #15718 suggests that we should rather
be using x86_64-unknown-freebsd. Not knowing which is correct I've left
the amd64-portbld- triplet in place.

10 months agotestsuite: Fix typo: integer-gimp /= integer-gmp
Ben Gamari [Thu, 13 Dec 2018 16:45:27 +0000 (11:45 -0500)] 
testsuite: Fix typo: integer-gimp /= integer-gmp

10 months agogitlab-ci: Add LLVM way
Ben Gamari [Thu, 13 Dec 2018 05:26:59 +0000 (00:26 -0500)] 
gitlab-ci: Add LLVM way

10 months agogitlab-ci: Enable darwin builds
Ben Gamari [Thu, 13 Dec 2018 05:26:19 +0000 (00:26 -0500)] 
gitlab-ci: Enable darwin builds

10 months agogitlab-ci: Don't save artifacts for unreg and integer-simple ways
Ben Gamari [Thu, 13 Dec 2018 05:25:58 +0000 (00:25 -0500)] 
gitlab-ci: Don't save artifacts for unreg and integer-simple ways

10 months agoAdd some complexities to Data.List documentation (#15003)
Sven Tennie [Wed, 5 Dec 2018 16:58:40 +0000 (17:58 +0100)] 
Add some complexities to Data.List documentation (#15003)

Describe complexity and add an example for `GHC.List.filter`.

10 months agollvmGen: Fix minor correctness issue
Gabor Greif [Tue, 20 Nov 2018 17:18:55 +0000 (18:18 +0100)] 
llvmGen: Fix minor correctness issue

The alias is of type i8, so its global variable name
should have type i8*. Anyway we should never deal
with pointers to (i8*)!

10 months agoFix broken link in comment (#16010)
Sven Tennie [Tue, 11 Dec 2018 17:04:20 +0000 (18:04 +0100)] 
Fix broken link in comment (#16010)

10 months agoRemove another unused import from WwLib
Simon Peyton Jones [Thu, 13 Dec 2018 23:37:04 +0000 (23:37 +0000)] 
Remove another unused import from WwLib

10 months agoShow recursive Stg bindings in Rec {} blocks
Ömer Sinan Ağacan [Thu, 13 Dec 2018 04:55:38 +0000 (07:55 +0300)] 
Show recursive Stg bindings in Rec {} blocks

Makes the printer same as Rec binding printer in Core

Reviewers: sgraf, bgamari

Reviewed By: sgraf

Subscribers: rwbarton, carter

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

10 months agotestsuite: Normalise away package name differences from safePkg01
Ben Gamari [Wed, 12 Dec 2018 21:57:01 +0000 (16:57 -0500)] 
testsuite: Normalise away package name differences from safePkg01

Spurious changes observed in a integer-simple build. In service of #16043.

10 months agotestsuite: Normalise away spurious differences in out-of-scope instances
Ben Gamari [Wed, 12 Dec 2018 21:45:55 +0000 (16:45 -0500)] 
testsuite: Normalise away spurious differences in out-of-scope instances

This fixes a variety of testsuite failures with integer-simple of the form

```
--- typecheck/should_fail/tcfail072.run/tcfail072.stderr.normalised
+++ typecheck/should_fail/tcfail072.run/tcfail072.comp.stderr.normalised
@@ -12,7 +12,7 @@
           -- Defined in ‘integer-<IMPL>-<VERSION>:GHC.Integer.Type’
         instance Ord () -- Defined in ‘GHC.Classes’
         ...plus 21 others
-        ...plus three instances involving out-of-scope types
+        ...plus two instances involving out-of-scope types
         (use -fprint-potential-instances to see them all)
      In the expression: g A
       In an equation for ‘g’: g (B _ _) = g A
```

In service of fixing #16043.

10 months agotestsuite: Fix a number of GHCi-related failures due to integer-simple
Ben Gamari [Wed, 12 Dec 2018 21:42:37 +0000 (16:42 -0500)] 
testsuite: Fix a number of GHCi-related failures due to integer-simple

Towards fixing #16043.

10 months agotestsuite: Print which ways we are going to run
Ben Gamari [Wed, 12 Dec 2018 21:41:49 +0000 (16:41 -0500)] 
testsuite: Print which ways we are going to run

10 months agoconfigure: Disable LD_NO_GOLD logic when cross-compiling
Ben Gamari [Wed, 12 Dec 2018 17:17:21 +0000 (12:17 -0500)] 
configure: Disable LD_NO_GOLD logic when cross-compiling

This is generally terrible: see #16025. In short, we previously just blindly
used an un-prefixed ld for LD_NO_GOLD. This is blatantly wrong. Ideally we would
actually verify that ld.gold is indeed broken (by binutils #22266) before
insisting on using another linker but sadly we cannot do so when cross-compiling
since this would require running host code.

For now we simply disable the LD_NO_GOLD logic when cross-compiling and hope
that the user has verified that their ld.gold isn't affected by #22266.

10 months agoRetainerProfiler: Update retainer profiler debugging
Alexander Vershilov [Wed, 12 Dec 2018 14:53:57 +0000 (09:53 -0500)] 
RetainerProfiler: Update retainer profiler debugging

Debug code have not been updated for a long time,
now it's changed to it compiles with recent RTS.

Reviewers: bgamari, erikd, simonmar

Reviewed By: simonmar

Subscribers: rwbarton, carter

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

10 months agotestsuite: Try accepting new output for memcpy test
Ben Gamari [Wed, 12 Dec 2018 04:55:47 +0000 (23:55 -0500)] 
testsuite: Try accepting new output for memcpy test

See #16037.

10 months agoEnable more GitLab CI ways
Ben Gamari [Wed, 12 Dec 2018 01:12:10 +0000 (20:12 -0500)] 
Enable more GitLab CI ways

But allow failure since CircleCI is still our source of truth.

10 months agogitlab-ci: Fix job names
Ben Gamari [Wed, 12 Dec 2018 01:03:35 +0000 (20:03 -0500)] 
gitlab-ci: Fix job names

10 months agogitlab-ci: Enable Haddock documentation
Ben Gamari [Sat, 1 Dec 2018 20:36:19 +0000 (15:36 -0500)] 
gitlab-ci: Enable Haddock documentation

10 months agoFix recompilation checking of pure plugins
Daniel Gröber [Tue, 11 Dec 2018 23:36:00 +0000 (18:36 -0500)] 
Fix recompilation checking of pure plugins

Previously when switching from using a Plugin with
`RecompMaybe`/`ForceRecompile` in `pluginRecompile` to a Plugin with
`NoForceRecompile` GHC would never even consider recompiling.

However the previously active plugin could have modified the
compilation output so we should recompile.

Test Plan: validate

Reviewers: bgamari, mpickering

Subscribers: mpickering, rwbarton, carter

GHC Trac Issues: #15858

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

10 months agoRemove dead code
Simon Peyton Jones [Wed, 12 Dec 2018 20:21:12 +0000 (20:21 +0000)] 
Remove dead code

This is a follow-up to
 d77501cd5b Improvements to demand analysis

I forgot to remove some now-dead code

10 months agoImprovements to demand analysis
Simon Peyton Jones [Wed, 12 Dec 2018 17:22:07 +0000 (17:22 +0000)] 
Improvements to demand analysis

This patch collects a few improvements triggered by Trac #15696,
and fixing Trac #16029

* Stop making toCleanDmd behave specially for unlifted types.
  This special case was the cause of stupid behaviour in Trac
  #16029.  And to my joy I discovered the let/app invariant
  rendered it unnecessary.  (Maybe the special case pre-dated
  the let/app invariant.)

  Result: less special-case handling in the compiler, and
  better perf for the compiled code.

* In WwLib.mkWWstr_one, treat seqDmd like U(AAA).  It was not
  being so treated before, which again led to stupid code.

* Update and improve Notes

There are .stderr test wibbles because we get slightly different
strictness signatures for an argumment of unlifted type:
    <L,U> rather than <S,U>        for Int#
    <S,U> rather than <S(S),U(U)>  for Int

10 months agoTypo fix, replace a foldl with foldl'
Ömer Sinan Ağacan [Wed, 12 Dec 2018 08:51:20 +0000 (11:51 +0300)] 
Typo fix, replace a foldl with foldl'

10 months agotestsuite: Mark linkwhole as broken on FreeBSD
Ben Gamari [Tue, 11 Dec 2018 22:57:11 +0000 (17:57 -0500)] 
testsuite: Mark linkwhole as broken on FreeBSD

See #16035.

10 months agotestsuite: Mark keep-cafs and keep-cafs-fail as broken on FreeBSD
Ben Gamari [Tue, 11 Dec 2018 22:51:21 +0000 (17:51 -0500)] 
testsuite: Mark keep-cafs and keep-cafs-fail as broken on FreeBSD

See #16035.

10 months agotestsuite: Skip T703 on non-Linux platforms
Ben Gamari [Tue, 11 Dec 2018 22:44:43 +0000 (17:44 -0500)] 
testsuite: Skip T703 on non-Linux platforms

While the test is in principle applicable to many platforms, the current
implementation requires readelf, which we can only assume is present on
ELF-based platforms (e.g. Linux).

See Trac #703.

10 months agotestsuite: Don't use sed -i in T15369
Ben Gamari [Tue, 11 Dec 2018 22:39:58 +0000 (17:39 -0500)] 
testsuite: Don't use sed -i in T15369

BSD sed doesn't allow use of sed -i on symlinks and the source file is symlinked
into place.

10 months agotestsuite: Ensure that unregisterised function is called
Ben Gamari [Tue, 11 Dec 2018 22:34:10 +0000 (17:34 -0500)] 
testsuite: Ensure that unregisterised function is called

Strangely the previous formulation works locally and under CircleCI but fails on
another machine. Odd.

10 months agoEnable rebindable fail with overloaded strings
Shayne Fletcher [Tue, 11 Dec 2018 18:49:48 +0000 (13:49 -0500)] 
Enable rebindable fail with overloaded strings

Summary: enable rebindable fail with overloaded strings

Reviewers: bgamari, simonpj

Reviewed By: bgamari, simonpj

Subscribers: simonpj, ndmitchell, rwbarton, carter

GHC Trac Issues: #15645

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

10 months agoExplicitly pass -fno-PIC to C compiler on linux
Zejun Wu [Tue, 11 Dec 2018 18:49:12 +0000 (13:49 -0500)] 
Explicitly pass -fno-PIC to C compiler on linux

Recent gcc on some linux ditributions may have -fPIC on by default

```
$ uname -a
Linux watashi-arch32 4.18.5-arch1-1.0-ARCH #1 SMP PREEMPT Tue Aug 28
20:45:30 CEST 2018 i686 GNU/Linux
$ gcc --version
gcc (GCC) 7.3.1 20180312
$ touch dummy.c
$ gcc -Q -v dummy.c 2>&1 | grep PIC
options enabled:  -fPIC -fPIE -faggressive-loop-optimizations
```

This results in following error for i686:

```
$ TEST=T13366 make test
...
c-iserv.bin:
/home/watashi/github/ghc/libraries/ghc-prim/dist-install/build/HSghc-pri
m-0.5.3.o:
unknown symbol `_GLOBAL_OFFSET_TABLE_'
ghc-stage2: unable to load package `ghc-prim-0.5.3'
...
```

As our runtime linker doesn't support R_386_GOTPC relocations at all
(#15847).
Also while we don't have such problem on x86_64, it's not desired to
build PIC objects either.

Test Plan: `TEST=T13366 make test` passed on
{rGHC82a716431cc680392e332bc2b1a1fd0d7faa4cd8}

Reviewers: simonmar, bgamari, austin

Reviewed By: simonmar

Subscribers: rwbarton, carter

GHC Trac Issues: #15848

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

10 months agotestsuite: Add tests for #15270
Ben Gamari [Tue, 11 Dec 2018 18:48:08 +0000 (13:48 -0500)] 
testsuite: Add tests for #15270

Reviewers: alpmestan

Reviewed By: alpmestan

Subscribers: rwbarton, carter

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

10 months agoSupport generating HIE files
Alec Theriault [Tue, 11 Dec 2018 18:47:35 +0000 (13:47 -0500)] 
Support generating HIE files

Adds a `-fenable-ide-info` flag which instructs GHC to generate `.hie`
files (see the wiki page:
https://ghc.haskell.org/trac/ghc/wiki/HIEFiles).

This is a rebased version of Zubin Duggal's (@wz1000) GHC changes for
his GSOC project, as posted here:
https://gist.github.com/wz1000/5ed4ddd0d3e96d6bc75e095cef95363d.

Test Plan: ./validate

Reviewers: bgamari, gershomb, nomeata, alanz, sjakobi

Reviewed By: alanz, sjakobi

Subscribers: alanz, hvr, sjakobi, rwbarton, wz1000, carter

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

10 months agoRTS linker: don't crash early when not finding extra-libraries
Kyrill Briantsev [Tue, 11 Dec 2018 18:45:10 +0000 (13:45 -0500)] 
RTS linker: don't crash early when not finding extra-libraries

Allow GHCi to not crash when no assumed DLL is found in the standard
location.  E.g. when loading the package built "dyn" way, we may well
have the package's DLL around, and it's the system linker which loads
necessary dependencies.

Why does this (partially) fix #11042? It's because we often (and when
having packages built `dyn` way -- almost always) don't need to load
anything recorded in the `extra-libraries` stanza, since if the package
DLL exists, GHCi linker simply calls the system linker (via `dlopen`/
`LoadLibrary` APIs) to load it and doesn't bother to load package
prelinked object file (if any) or package static library.

Thus, all "regular" (with no fancy low-level package content
manipulation) packages built "dyn" way should be OK after this fix.

Reviewers: hvr, bgamari, int-index

Reviewed By: bgamari, int-index

Subscribers: Phyx, int-index, rwbarton, carter

GHC Trac Issues: #11042

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

10 months agodmdAnal: Move handling of datacon strictness to mkWWstr_one
Ben Gamari [Tue, 11 Dec 2018 18:34:47 +0000 (13:34 -0500)] 
dmdAnal: Move handling of datacon strictness to mkWWstr_one

Previously datacon strictness was accounted for when we demand analysed a case
analysis. However, this results in pessimistic demands in some cases. For
instance, consider the program (from T10482)

    data family Bar a
    data instance Bar (a, b) = BarPair !(Bar a) !(Bar b)
    newtype instance Bar Int = Bar Int

    foo :: Bar ((Int, Int), Int) -> Int -> Int
    foo f k =
      case f of
        BarPair x y -> case burble of
                          True -> case x of
                                    BarPair p q -> ...
                          False -> ...

We really should be able to assume that `p` is already evaluated since it came
from a strict field of BarPair.

However, as written the demand analyser can not conclude this since we may end
up in the False branch of the case on `burble` (which places no demand on `x`).
By accounting for the data con strictness later, applied to the demand of the
RHS, we get the strict demand signature we want.

See Note [Add demands for strict constructors] for a more comprehensive
discussion.

Test Plan: Validate

Reviewers: simonpj, osa1, goldfire

Subscribers: rwbarton, carter

GHC Trac Issues: #15696

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

10 months agoPPC NCG: Generate MO_?_QuotRem for subword sizes
Peter Trommler [Tue, 11 Dec 2018 18:22:00 +0000 (13:22 -0500)] 
PPC NCG: Generate MO_?_QuotRem for subword sizes

Handle Int*QuotRemOP and Word*QuotRemOp in PPC NCG.
Refactor common code with remainder operation.

Test Plan: validate (I validated on Linux powerpc64le and x86_64)

Reviewers: erikd, hvr, bgamari, simonmar

Reviewed By: bgamari

Subscribers: rwbarton, carter

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

10 months agoSupport registering Plugins through the GHC API
Daniel Gröber [Tue, 11 Dec 2018 18:24:12 +0000 (13:24 -0500)] 
Support registering Plugins through the GHC API

This allows tooling using the GHC API to use plugins internally.
Hopefully this will make it possible to decouple the development of
useful plugins from (currently) kitchen-sink type tooling projects
such as ghc-mod or HIE -- at least to some extent.

Test Plan: validate

Reviewers: bgamari, mpickering

Subscribers: mpickering, alanz, rwbarton, carter

GHC Trac Issues: #15826

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

10 months agoPPC NCG: Implement MachOps for smaller sizes
Peter Trommler [Tue, 11 Dec 2018 18:21:50 +0000 (13:21 -0500)] 
PPC NCG: Implement MachOps for smaller sizes

Generate code for MachOps with smaller than wordsize data.
Refactor conversion MachOps.

Fixes #15854

Test Plan: validate (I validated on powerpc64le and x86_64 Linux)

Reviewers: bgamari, hvr, erikd, simonmar

Subscribers: rwbarton, carter

GHC Trac Issues: #15854

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

10 months agoMisleading msg with qualified imports "No module named X imported"
Roland Senn [Tue, 11 Dec 2018 18:20:37 +0000 (13:20 -0500)] 
Misleading msg with qualified imports "No module named X imported"

To check whether a given module has been imported, we do the following:
From the list of all qualified names we extract the distinct module
names to a list of module names.
Then we check whether the given module name is in this list of module
names.

Test Plan: make test TEST=T14225

Reviewers: mpickering, hvr, monoidal, osa1, bgamari

Reviewed By: bgamari

Subscribers: rwbarton, carter

GHC Trac Issues: #14225

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