ghc.git
14 months agobase: Add default implementation for Data.Bits.bitSize
Ben Gamari [Sun, 17 Jun 2018 03:44:03 +0000 (23:44 -0400)] 
base: Add default implementation for Data.Bits.bitSize

Fixes #12970 and will provide a reasonable migration path for the
eventual remove of this function.

Test Plan: Validate

Reviewers: ekmett, hvr

Subscribers: rwbarton, thomie, carter

GHC Trac Issues: #12970

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

14 months agoRevert "Amend configure script to support lndir build tree"
Ben Gamari [Sun, 17 Jun 2018 03:31:07 +0000 (23:31 -0400)] 
Revert "Amend configure script to support lndir build tree"

This appears to inexplicably break the OS X build, which fails with:
```
make[1]: *** No rule to make target `utils/unlit/fs.c', needed by
         `utils/unlit/dist/build/.depend.c_asm'.  Stop.
make[1]: *** Waiting for unfinished jobs....
make: *** [all] Error 2
```

This reverts commit 8ee9c574a6d2105ace858f0fee31750acafe0a0f.

14 months agoEnhanced constant folding
Sylvain Henry [Fri, 13 Apr 2018 17:29:07 +0000 (13:29 -0400)] 
Enhanced constant folding

Until now GHC only supported basic constant folding (lit op lit, expr op
0, etc.).

This patch uses laws of +/-/* (associativity, commutativity,
distributivity) to support some constant folding into nested
expressions.

Examples of new transformations:

   - simple nesting: (10 + x) + 10 becomes 20 + x
   - deep nesting: 5 + x + (y + (z + (t + 5))) becomes 10 + (x + (y + (z + t)))
   - distribution: (5 + x) * 6 becomes 30 + 6*x
   - simple factorization: 5 + x + (x + (x + (x + 5))) becomes 10 + (4 *x)
   - siblings: (5 + 4*x) - (3*x + 2) becomes 3 + x

Test Plan: validate

Reviewers: simonpj, austin, bgamari

Reviewed By: bgamari

Subscribers: thomie

GHC Trac Issues: #9136

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

(cherry picked from commit fea04defa64871caab6339ff3fc5511a272f37c7)

14 months agocircleci: Add a reference to the documentation on the Wiki
Ben Gamari [Sat, 16 Jun 2018 19:36:09 +0000 (15:36 -0400)] 
circleci: Add a reference to the documentation on the Wiki

14 months agocircleci: Bump fedora docker image tag
Ben Gamari [Sat, 16 Jun 2018 19:21:49 +0000 (15:21 -0400)] 
circleci: Bump fedora docker image tag

14 months agorts: Remove use of __USE_MINGW_ANSI_STDIO
Ben Gamari [Sat, 16 Jun 2018 17:22:31 +0000 (13:22 -0400)] 
rts: Remove use of __USE_MINGW_ANSI_STDIO

As pointed out in #12951, this was a temporary measure to allow GHC to be
bootstrapped on Windows with GHC 7.10. This release is now out of our bootstrap
support window so let's remove it.

14 months agobase: Improve the documentation of the enumFrom series of functions
ARJANEN Loïc Jean David [Sat, 16 Jun 2018 17:00:33 +0000 (13:00 -0400)] 
base: Improve the documentation of the enumFrom series of functions

Fixes #15134.

Reviewers: dfeuer, hvr, bgamari

Reviewed By: bgamari

Subscribers: rwbarton, thomie, carter

GHC Trac Issues: #15134

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

14 months agoBump nofib submodule
Ben Gamari [Sat, 16 Jun 2018 16:35:16 +0000 (12:35 -0400)] 
Bump nofib submodule

14 months agoPreserve parenthesis in function application in typechecker
Zubin Duggal [Sat, 16 Jun 2018 16:19:43 +0000 (12:19 -0400)] 
Preserve parenthesis in function application in typechecker

Preserve HsPars while typechecking

Test Plan: T15242

Reviewers: bgamari, alanz, simonpj

Reviewed By: alanz, simonpj

Subscribers: simonpj, AndreasK, rwbarton, thomie, carter

GHC Trac Issues: #15242

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

14 months agorts: Use .cfi_{start|end}proc directives
Ben Gamari [Sat, 16 Jun 2018 15:34:28 +0000 (11:34 -0400)] 
rts: Use .cfi_{start|end}proc directives

Test Plan: Validate using LLVM assembler

Reviewers: carter, erikd, simonmar

Reviewed By: simonmar

Subscribers: rwbarton, thomie

GHC Trac Issues: #15207

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

14 months agotestsuite: Mark overflow1 as broken on 32-bit platforms due to #15255
Ben Gamari [Sat, 16 Jun 2018 15:33:18 +0000 (11:33 -0400)] 
testsuite: Mark overflow1 as broken on 32-bit platforms due to #15255

Test Plan: Validate on i386

Reviewers: simonmar

Subscribers: rwbarton, thomie, carter

GHC Trac Issues: #15255

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

14 months agotestsuite: Mark num009 as broken due to #15062
Ben Gamari [Sat, 16 Jun 2018 15:33:11 +0000 (11:33 -0400)] 
testsuite: Mark num009 as broken due to #15062

Test Plan: Validate

Reviewers: hvr

Subscribers: rwbarton, thomie, carter

GHC Trac Issues: #15062

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

14 months agoAmend configure script to support lndir build tree
Adam Gundry [Sat, 16 Jun 2018 15:32:55 +0000 (11:32 -0400)] 
Amend configure script to support lndir build tree

Test Plan: ./validate

Reviewers: bgamari

Subscribers: rwbarton, thomie, erikd, carter

GHC Trac Issues: #15257

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

14 months agoQuantify unfixed kind variables in CUSKs
Richard Eisenberg [Thu, 14 Jun 2018 12:50:06 +0000 (08:50 -0400)] 
Quantify unfixed kind variables in CUSKs

This is a small change in user-facing behavior. When we
have a unification variable left over in a CUSK, we previously
would issue an error. But, we can just quantify. This also
teaches kcLHsQTyVars to use quantifyTyVars instead of its own,
ad-hoc quantification scheme.

Fixes #15273.

test case: polykinds/T11648b

14 months agoBuilt-in Natural literals in Core
Sylvain Henry [Fri, 15 Jun 2018 20:23:53 +0000 (16:23 -0400)] 
Built-in Natural literals in Core

Add support for built-in Natural literals in Core.

- Replace MachInt,MachWord, LitInteger, etc. with a single LitNumber
  constructor with a LitNumType field
- Support built-in Natural literals
- Add desugar warning for negative literals
- Move Maybe(..) from GHC.Base to GHC.Maybe for module dependency
  reasons

This patch introduces only a few rules for Natural literals (compared
to Integer's rules). Factorization of the built-in rules for numeric
literals will be done in another patch as this one is already big to
review.

Test Plan:
  validate
  test build with integer-simple

Reviewers: hvr, bgamari, goldfire, Bodigrim, simonmar

Reviewed By: bgamari

Subscribers: phadej, simonpj, RyanGlScott, carter, hsyl20, rwbarton,
thomie

GHC Trac Issues: #14170, #14465

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

14 months agoFix #13833: accept type literals with no FlexibleInstances
Kirill Zaborsky [Fri, 15 Jun 2018 18:12:58 +0000 (14:12 -0400)] 
Fix #13833: accept type literals with no FlexibleInstances

Test Plan: ./validate

Reviewers: bgamari, simonpj

Reviewed By: bgamari, simonpj

Subscribers: simonpj, rwbarton, thomie, carter

GHC Trac Issues: #13833

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

14 months agoUse data con name instead of parent in lookupRecFieldOcc
Adam Gundry [Fri, 15 Jun 2018 18:11:22 +0000 (14:11 -0400)] 
Use data con name instead of parent in lookupRecFieldOcc

Test Plan: new tests rename/should_compile/{T14747,T15149}

Reviewers: simonpj, bgamari

Reviewed By: bgamari

Subscribers: rwbarton, thomie, carter

GHC Trac Issues: #14747, #15149

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

14 months agoMake dtrace enabled GHC work as a bootstrap compiler on FreeBSD
Ben Gamari [Fri, 15 Jun 2018 18:07:51 +0000 (14:07 -0400)] 
Make dtrace enabled GHC work as a bootstrap compiler on FreeBSD

Fixes #15040.

Reviewers: bgamari, simonmar

Reviewed By: bgamari

Subscribers: rwbarton, thomie, carter

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

14 months agoAdd "quantified constraint" context in error message, fix #15231.
HE, Tao [Fri, 15 Jun 2018 17:45:42 +0000 (13:45 -0400)] 
Add "quantified constraint" context in error message, fix #15231.

This patch adds "quantified constraint" context in error message when
UndecidableInstances checking fails for quantified constraints.
See Trac #15231:comment#1.

This patch also pretty-prints the instance head for better error messages.

Test Plan: make test TEST="T15231"

Reviewers: bgamari, simonpj

Reviewed By: simonpj

Subscribers: simonpj, rwbarton, thomie, carter

GHC Trac Issues: #15231

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

14 months agoMake NameSort note into proper Note
Matthew Pickering [Fri, 15 Jun 2018 17:45:17 +0000 (13:45 -0400)] 
Make NameSort note into proper Note

Reviewers: adamgundry, bgamari

Reviewed By: bgamari

Subscribers: rwbarton, thomie, carter

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

14 months agoNo Unicode in Parser.y
Vladislav Zavialov [Fri, 15 Jun 2018 17:45:03 +0000 (13:45 -0400)] 
No Unicode in Parser.y

Unicode characters in Parser.y cause build failures
on systems where the locale does not support Unicode.

See https://mail.haskell.org/pipermail/ghc-devs/2018-June/015874.html

Test Plan: ./validate

Reviewers: bgamari

Reviewed By: bgamari

Subscribers: rwbarton, thomie, mpickering, carter

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

14 months agoBump supported LLVM version to 6.0
Ben Gamari [Fri, 15 Jun 2018 01:37:05 +0000 (21:37 -0400)] 
Bump supported LLVM version to 6.0

This seems to fix a number of segmentation faults.

14 months agotestsuite: Make T4442 compile on i386 and mark as broken
Ben Gamari [Fri, 15 Jun 2018 16:58:59 +0000 (12:58 -0400)] 
testsuite: Make T4442 compile on i386 and mark as broken

There are some rather suspicious failures in the 64-bit case. See #15184 for
details.

14 months agoFix documentation for `-dth-dec-file`
Nathan Collins [Thu, 14 Jun 2018 23:36:23 +0000 (16:36 -0700)] 
Fix documentation for `-dth-dec-file`

The docs said that it took a file argument, as in
`-dth-dec-file=<file>`, but it does not take a file argument!

14 months agocircleci: Remove systemd from Fedora nsswitch configuration
Ben Gamari [Fri, 15 Jun 2018 14:02:06 +0000 (10:02 -0400)] 
circleci: Remove systemd from Fedora nsswitch configuration

Lest we end up with a non-functional user/group lookup, resulting in #15230.

14 months agoMake better "fake tycons" in error recovery
Simon Peyton Jones [Fri, 15 Jun 2018 08:46:30 +0000 (09:46 +0100)] 
Make better "fake tycons" in error recovery

Consider (Trac #15215)
  data T a = MkT ...
  data S a = ...T...MkT....

If there is an error in the definition of 'T' we add a
"fake type constructor" to the type environment, so that we
can continue to typecheck 'S'.  But we /were not/ adding
a fake anything for 'MkT' and so there was an internal
error when we met 'MkT' in the body of 'S'.

The fix is to add fake tycons for all the 'implicits' of 'T'.
This is done by mk_fake_tc in TcTyClsDecls.checkValidTyCl,
which now returns a /list/ of TyCons rather than just one.

On the way I did some refactoring:

* Rename TcTyDecls.tcAddImplicits to tcAddTyConsToGblEnv
  and make it /include/ the TyCons themeselves as well
  as their implicits

* Some incidental refactoring about tcRecSelBinds. The main
  thing is that I've avoided creating a HsValBinds that we
  immediately decompose.  That meant moving some deck chairs
  around.

NB: The new error message for the regression test T15215
has the opaque error "Illegal constraint in a type:", flagged
in Trac #14845.  But that's the fault of the latter ticket.
The fix here not to blame.

14 months agoFix corner case in typeKind, plus refactoring
Simon Peyton Jones [Fri, 15 Jun 2018 08:19:55 +0000 (09:19 +0100)] 
Fix corner case in typeKind, plus refactoring

This is a continuation of

    commit 9d600ea68c283b0d38ac663c3cc48baba6b94f57
    Author: Simon Peyton Jones <simonpj@microsoft.com>
    Date:   Fri Jun 1 16:36:57 2018 +0100

        Expand type synonyms when Linting a forall

That patch pointed out that there was a lurking hole in
typeKind, where it could return an ill-scoped kind, because
of not expanding type synonyms enough.

This patch fixes it, quite nicely

* Use occCheckExpand to expand those synonyms (it was always
  designed for that exact purpose), and call it from
         Type.typeKind
         CoreUtils.coreAltType
         CoreLint.lintTYpe

* Consequently, move occCheckExpand from TcUnify.hs to
  Type.hs, and generalise it to take a list of type variables.

I also tidied up lintType a bit.

14 months agoFix the bind-recovery type
Simon Peyton Jones [Fri, 15 Jun 2018 08:08:58 +0000 (09:08 +0100)] 
Fix the bind-recovery type

This patch uses (forall (a::*). a) for the type to
use when recovering from an error in a binding.

Previously (Trac #15276) we had (forall r (a :: TYPE r). a),
which is ill-kinded.

It's quite hard to provoke an error arising from this, because
it only happens in programs that have a type error anyway,
but in a subequent patch I make typeKind fall over if it returns
an ill-scoped kind, and that makes ghci/scripts/T13202 crash
without this fix.

14 months agoUNREG: PprC: add support for of W16 literals (Ticket #15237)
Sergei Trofimovich [Thu, 14 Jun 2018 22:13:16 +0000 (23:13 +0100)] 
UNREG: PprC: add support for of W16 literals (Ticket #15237)

Fix UNREG build failure for 32-bit targets.

This change is an equivalent of commit
0238a6c78102d43dae2f56192bd3486e4f9ecf1d
("UNREG: PprC: add support for of W32 literals")

The change allows combining two subwords into one word
on 32-bit targets. Tested on nios2-unknown-linux-gnu.

GHC Trac Issues: #15237

Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
14 months agoExclude libraries/libiserv/ghc.mk and other things via .gitignore.
HE, Tao [Thu, 14 Jun 2018 23:25:37 +0000 (19:25 -0400)] 
Exclude libraries/libiserv/ghc.mk and other things via .gitignore.

The ghc.mk file is generated by `./boot` and should be excluded from git
via .gitignore, since the file `ghc.mk` may have different line ends on
windows.

The file GNUmakefile and dir dist, dist-install should also be excluded
via .gitignore, just as other libraries.

Test Plan: [skip ci]

Reviewers: bgamari

Reviewed By: bgamari

Subscribers: osa1, rwbarton, thomie, carter

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

14 months agoFix broken link
Nathan Collins [Thu, 14 Jun 2018 22:00:22 +0000 (15:00 -0700)] 
Fix broken link

See https://ghc.haskell.org/trac/ghc/ticket/12578.

14 months agoBump haddock submodule
Ben Gamari [Thu, 14 Jun 2018 22:06:23 +0000 (18:06 -0400)] 
Bump haddock submodule

14 months agoFix binary and haddock submodule commits
Ben Gamari [Thu, 14 Jun 2018 20:25:21 +0000 (16:25 -0400)] 
Fix binary and haddock submodule commits

14 months agoRevert "rts: Don't keep findPtr symbol alive if not -DDEBUG"
Ben Gamari [Thu, 14 Jun 2018 21:18:29 +0000 (17:18 -0400)] 
Revert "rts: Don't keep findPtr symbol alive if not -DDEBUG"

This reverts commit e4c41ec2b1f2f222c9c8a83ef64d4e566aa47a44.

rts.cabal.in isn't processed by CPP.

14 months agoRevert inadvertant changes to .gitmodules
Ben Gamari [Thu, 14 Jun 2018 19:33:33 +0000 (15:33 -0400)] 
Revert inadvertant changes to .gitmodules

14 months agoEmbrace -XTypeInType, add -XStarIsType
Vladislav Zavialov [Thu, 14 Jun 2018 19:02:36 +0000 (15:02 -0400)] 
Embrace -XTypeInType, add -XStarIsType

Summary:
Implement the "Embrace Type :: Type" GHC proposal,
.../ghc-proposals/blob/master/proposals/0020-no-type-in-type.rst

GHC 8.0 included a major change to GHC's type system: the Type :: Type
axiom. Though casual users were protected from this by hiding its
features behind the -XTypeInType extension, all programs written in GHC
8+ have the axiom behind the scenes. In order to preserve backward
compatibility, various legacy features were left unchanged. For example,
with -XDataKinds but not -XTypeInType, GADTs could not be used in types.
Now these restrictions are lifted and -XTypeInType becomes a redundant
flag that will be eventually deprecated.

* Incorporate the features currently in -XTypeInType into the
  -XPolyKinds and -XDataKinds extensions.
* Introduce a new extension -XStarIsType to control how to parse * in
  code and whether to print it in error messages.

Test Plan: Validate

Reviewers: goldfire, hvr, bgamari, alanz, simonpj

Reviewed By: goldfire, simonpj

Subscribers: rwbarton, thomie, mpickering, carter

GHC Trac Issues: #15195

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

14 months agorelnotes: Add mention of QuantifiedConstraints
Ben Gamari [Thu, 14 Jun 2018 15:44:36 +0000 (11:44 -0400)] 
relnotes: Add mention of QuantifiedConstraints

14 months agorts: Don't keep findPtr symbol alive if not -DDEBUG
Ben Gamari [Thu, 14 Jun 2018 15:37:05 +0000 (11:37 -0400)] 
rts: Don't keep findPtr symbol alive if not -DDEBUG

Test Plan: Test with Hadrian

Reviewers: simonmar, snowleopard, erikd

Subscribers: rwbarton, thomie, carter

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

14 months agodesugar: Rip out unsafeGlobalDynFlags usage in decomposeRuleLhs
Ben Gamari [Thu, 14 Jun 2018 13:19:51 +0000 (09:19 -0400)] 
desugar: Rip out unsafeGlobalDynFlags usage in decomposeRuleLhs

Reviewers: dfeuer

Reviewed By: dfeuer

Subscribers: dfeuer, rwbarton, thomie, carter

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

14 months agorts: Ignore RLIMIT_AS if it is zero
Ben Gamari [Thu, 14 Jun 2018 13:19:11 +0000 (09:19 -0400)] 
rts: Ignore RLIMIT_AS if it is zero

Reviewers: erikd, simonmar

Reviewed By: simonmar

Subscribers: rwbarton, thomie, carter

GHC Trac Issues: #14492

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

14 months agoReplace `showSDocUnsafe` with `showSDoc` in extending_ghc.rst
HE, Tao [Thu, 14 Jun 2018 13:18:49 +0000 (09:18 -0400)] 
Replace `showSDocUnsafe` with `showSDoc` in extending_ghc.rst

... and fix compile errors.

Replace the usage of `showSDocUnsafe` with `showSDoc dflags`
in example code in extending_ghc.rts.

This example contains several compile errors (missing import
and syntax error), this patch also fixes that.

Test Plan: [skip ci]

Reviewers: bgamari, mpickering

Reviewed By: mpickering

Subscribers: mpickering, rwbarton, thomie, carter

GHC Trac Issues: #15228

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

14 months agoFix deserialization of docs (#15240)
Simon Jakobi [Thu, 14 Jun 2018 13:18:35 +0000 (09:18 -0400)] 
Fix deserialization of docs (#15240)

We were using Map.fromDistinctAscList to deserialize a
(Map Name HsDocString). As the Names' Uniques had changed, we
ended up with an invalid map in which we couldn't lookup certain keys.

Switching to Map.fromList fixed the issue.

Added comments in several places.

Reviewers: alexbiehl, hvr, bgamari

Reviewed By: bgamari

Subscribers: rwbarton, thomie, carter

GHC Trac Issues: #15240

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

14 months agousers-guide: Fix PtrRepLifted to LiftedRep
Takenobu Tani [Thu, 14 Jun 2018 13:18:19 +0000 (09:18 -0400)] 
users-guide: Fix PtrRepLifted to LiftedRep

Fix `TYPE 'PtrRepLifted` to `TYPE 'LiftedRep`

[ci skip]

Test Plan: build

Reviewers: bgamari

Reviewed By: bgamari

Subscribers: rwbarton, thomie, carter

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

14 months agoMark test broken on powerpc64[le]
Peter Trommler [Thu, 14 Jun 2018 13:15:40 +0000 (09:15 -0400)] 
Mark test broken on powerpc64[le]

Test num009 fails different results. #15062 lists more issues on other
platforms. Test T14894 fails because DWARF support is not implemented in
the PowerPC native code backend. T5435_v_asm_b fails because the runtime
linker is not implemented for PowerPC 64-bit systems.

Test Plan: validate

Reviewers: bgamari, hvr, erikd, simonmar

Reviewed By: bgamari

Subscribers: rwbarton, thomie, carter

GHC Trac Issues: #13634, #11261, #11259, #15062

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

14 months agoMake Control.Exception.throw levity polymorphic.
Félix Baylac-Jacqué [Thu, 14 Jun 2018 13:15:26 +0000 (09:15 -0400)] 
Make Control.Exception.throw levity polymorphic.

Test Plan: Validate.

Reviewers: hvr, bgamari, sighingnow

Reviewed By: sighingnow

Subscribers: tdammers, sighingnow, rwbarton, thomie, carter

GHC Trac Issues: #15180

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

14 months agoDisable `-fdefer-out-of-scope-variables` in ghci.
HE, Tao [Thu, 14 Jun 2018 13:14:58 +0000 (09:14 -0400)] 
Disable `-fdefer-out-of-scope-variables` in ghci.

We have already disabled `-fdefer-type-errors` and
`-fdefer-typed-holes` in ghci.
This patch disables `-fdefer-out-of-scope-variables` as well.

Fixes Trac #15259, as well as #14963.

Test Plan: make test TEST="T15259 T14963a T14963b T14963c"

Reviewers: bgamari, tdammers

Reviewed By: tdammers

Subscribers: tdammers, rwbarton, thomie, carter

GHC Trac Issues: #15259, #14963

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

14 months agoUNREG: PprC: add support for of W32 literals
Sergei Trofimovich [Thu, 14 Jun 2018 13:13:32 +0000 (09:13 -0400)] 
UNREG: PprC: add support for of W32 literals

Today UNREG build fails to generate sub-word literals:
```
  rts_dist_HC rts/dist/build/StgStartup.o
ghc-stage1: panic! (the 'impossible' happened)
  (GHC version 8.5.20180612 for x86_64-unknown-linux):
        pprStatics: cannot emit a non-word-sized static literal
  W32
```

The change allows combining two subwords into one word.

Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
Reviewers: simonmar, bgamari

Reviewed By: bgamari

Subscribers: rwbarton, thomie, carter

GHC Trac Issues: #15237

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

14 months agotestsuite: Fix T4442 on i386
Ben Gamari [Thu, 14 Jun 2018 13:13:11 +0000 (09:13 -0400)] 
testsuite: Fix T4442 on i386

Test Plan: Validate on i386

Reviewers: tdammers

Reviewed By: tdammers

Subscribers: rwbarton, thomie, carter

GHC Trac Issues: #15184

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

14 months agoUpdate user manual sections for -rtsopts and -with-rtsopts
Ömer Sinan Ağacan [Thu, 14 Jun 2018 13:12:57 +0000 (09:12 -0400)] 
Update user manual sections for -rtsopts and -with-rtsopts

- References to -rtsopts updated for the new ignore and ignoreAll
  options.

- Short description of -rtsopts updated. ignore and ignoreAll are now
  shown in the man page.

- Add a few clarifications about -rtsopts and -with-rtsopts interaction.

Reviewers: bgamari, AndreasK

Reviewed By: AndreasK

Subscribers: Phyx, rwbarton, thomie, carter

GHC Trac Issues: #15268

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

14 months agoDuplicated and
Gabor Greif [Fri, 8 Jun 2018 16:24:47 +0000 (18:24 +0200)] 
Duplicated and

14 months agotestsuite: Add Windows-specific output for T5611
Ben Gamari [Thu, 14 Jun 2018 13:09:56 +0000 (09:09 -0400)] 
testsuite: Add Windows-specific output for T5611

It's not entirely clear why this is necessary, but this currently fails
on Windows and the difference seems rather minor.

Test Plan: Validate on Windows

Reviewers: Phyx

Subscribers: rwbarton, thomie, carter

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

14 months agotestsuite: Add -fghci-leak-check to expected output on mingw32
Ben Gamari [Thu, 14 Jun 2018 13:09:38 +0000 (09:09 -0400)] 
testsuite: Add -fghci-leak-check to expected output on mingw32

Test Plan: Validate on Windows

Subscribers: rwbarton, thomie, carter

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

14 months agolibiserv: Add license file
Ben Gamari [Thu, 14 Jun 2018 13:09:23 +0000 (09:09 -0400)] 
libiserv: Add license file

Test Plan: Run `make bindist` on built tree.

Subscribers: rwbarton, thomie, carter, angerman

GHC Trac Issues: #14392

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

14 months agoOptCoercion: Ensure we use new UnivCo provenance to construct optimised cos.
Ben Gamari [Tue, 12 Jun 2018 17:31:08 +0000 (13:31 -0400)] 
OptCoercion: Ensure we use new UnivCo provenance to construct optimised cos.

@goldfire noticed that there were several points in OptOercion.opt_univ where
we constructed the optimised coercion using the untransformed provenance.

14 months agoDisable T12903 on Darwin due to flakiness
Tamar Christina [Mon, 12 Dec 2016 13:21:27 +0000 (14:21 +0100)] 
Disable T12903 on Darwin due to flakiness

Test seems to randomly fail on harbormaster and CircleCI. Disabling it
until it can be fixed.

Test Plan: make test TEST=T12903

Reviewers: austin, bgamari, simonmar, mpickering

Reviewed By: mpickering

Subscribers: mpickering, thomie, qnikst

GHC Trac Issues: #12903

14 months agoMinor refactoring and docs in selector optimisation
Ömer Sinan Ağacan [Thu, 14 Jun 2018 11:26:15 +0000 (14:26 +0300)] 
Minor refactoring and docs in selector optimisation

Reviewers: bgamari, simonmar, erikd

Reviewed By: simonmar

Subscribers: rwbarton, thomie, carter

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

14 months agotestsuite: Print summary even if interrupted
Ben Gamari [Thu, 14 Jun 2018 09:33:35 +0000 (12:33 +0300)] 
testsuite: Print summary even if interrupted

Fixes #15265.

Reviewers: osa1

Reviewed By: osa1

Subscribers: rwbarton, thomie, carter

GHC Trac Issues: #15265

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

14 months agoDo not skip conc004 in GHCi way
Ömer Sinan Ağacan [Thu, 14 Jun 2018 06:07:56 +0000 (09:07 +0300)] 
Do not skip conc004 in GHCi way

According to the comments it used to allocate too much, but currently I
get

    205,987,176 bytes allocated in the heap
     50,352,200 bytes copied during GC
     14,244,968 bytes maximum residency (6 sample(s))
        172,952 bytes maximum slop
             36 MB total memory in use (0 MB lost due to fragmentation)

Reviewers: bgamari, tdammers, simonmar

Subscribers: tdammers, rwbarton, thomie, carter

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

14 months agotestuite: remove strace call.
Tamar Christina [Wed, 13 Jun 2018 19:29:35 +0000 (20:29 +0100)] 
testuite: remove strace call.

14 months agoFix some of the failures in sanity way
Ömer Sinan Ağacan [Wed, 13 Jun 2018 12:29:11 +0000 (15:29 +0300)] 
Fix some of the failures in sanity way

Tests for runtime argument parsing should only run in normal way to
avoid breakage caused by way-specific RTS arguments.

Reviewers: bgamari, AndreasK, simonmar

Reviewed By: bgamari

Subscribers: rwbarton, thomie, carter

GHC Trac Issues: #15241

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

14 months agoBump hadrian submodule
Ben Gamari [Tue, 12 Jun 2018 14:56:32 +0000 (10:56 -0400)] 
Bump hadrian submodule

14 months agoRefactor TcExpr.tcSeq
Simon Peyton Jones [Tue, 12 Jun 2018 16:36:44 +0000 (17:36 +0100)] 
Refactor TcExpr.tcSeq

The function TcExpr.tcSeq seemed much longer that is really
justifiable; and was set to get worse with the fix to Trac #15242.

This patch refactors the special cases for function applications,
so that the special case for 'seq' can use the regular tcFunApp,
which makes the code both clearer and shorter.  And smooths the
way for #15242.

The special case for 'tagToEnum#' is even more weird and ad-hoc,
so I refrained from meddling iwth it for now.

I also combined HsUtils.mkHsAppType and mkHsAppTypeOut, so that
I could have a single 'wrapHsArgs' function, thereby fixing a
ToDo from Alan Zimmerman.  That means tha tmkHsAppType now has
an equality predicate, but I guess that's fair enough.

14 months agodocs: Add mentions of new plugins mechanisms to users guide
Ben Gamari [Tue, 12 Jun 2018 13:57:14 +0000 (09:57 -0400)] 
docs: Add mentions of new plugins mechanisms to users guide

14 months agorts: Fix a var name in a comment, fix a typo
Ömer Sinan Ağacan [Tue, 12 Jun 2018 07:12:26 +0000 (10:12 +0300)] 
rts: Fix a var name in a comment, fix a typo

14 months agoRemove a tc-trace
Simon Peyton Jones [Mon, 11 Jun 2018 12:58:40 +0000 (13:58 +0100)] 
Remove a tc-trace

14 months agoSmall refactor, adding checkBadTelescope
Simon Peyton Jones [Mon, 11 Jun 2018 12:58:05 +0000 (13:58 +0100)] 
Small refactor, adding checkBadTelescope

No change in behaviour

14 months agoRemove duplicate quantified constraints
Simon Peyton Jones [Mon, 11 Jun 2018 12:55:56 +0000 (13:55 +0100)] 
Remove duplicate quantified constraints

This is an easy fix for Trac #15244: just avoid adding
the same quantified Given constraint to the inert set twice.

See TcSMonad Note [Do not add duplicate quantified instances].

14 months agoComments only
Simon Peyton Jones [Mon, 11 Jun 2018 12:55:10 +0000 (13:55 +0100)] 
Comments only

14 months agoMake seq# evaluatedness look through casts
David Feuer [Mon, 11 Jun 2018 14:32:23 +0000 (10:32 -0400)] 
Make seq# evaluatedness look through casts

In d964b05, I forgot to look through casts to find the `seq#`
identifier. Fix that.

Reviewers: bgamari

Reviewed By: bgamari

Subscribers: rwbarton, thomie, carter

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

14 months agotestsuite: Remove uniques from T15243's stderr output
Ben Gamari [Mon, 11 Jun 2018 02:26:13 +0000 (22:26 -0400)] 
testsuite: Remove uniques from T15243's stderr output

14 months agotestsuite: Suppress uniques in T15243 output
Ben Gamari [Sun, 10 Jun 2018 22:13:10 +0000 (18:13 -0400)] 
testsuite: Suppress uniques in T15243 output

Fixes test for #15243.

14 months agoBump Cabal submodule
Ben Gamari [Sun, 10 Jun 2018 22:10:47 +0000 (18:10 -0400)] 
Bump Cabal submodule

Fixes #15254.

14 months agotestsuite: Bump performance metrics of T9233 and T13035
Ben Gamari [Sun, 10 Jun 2018 14:20:55 +0000 (10:20 -0400)] 
testsuite: Bump performance metrics of T9233 and T13035

Unfortunately it's very unclear which commit caused these two to regress; they
only fail on Darwin and not even deterministically it sesems.

14 months agousers-guide: Spelling and style pass over QuantifiedConstraints docs
Ben Gamari [Fri, 8 Jun 2018 19:35:48 +0000 (15:35 -0400)] 
users-guide: Spelling and style pass over QuantifiedConstraints docs

14 months agoDo not omit T4030 in GHCi mode
Ömer Sinan Ağacan [Sun, 10 Jun 2018 07:25:40 +0000 (10:25 +0300)] 
Do not omit T4030 in GHCi mode

(it currently works fine in GHCi)

Reviewers: bgamari

Reviewed By: bgamari

Subscribers: simonmar, rwbarton, thomie, carter

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

14 months agorts: Handle SMALL_MUT_ARR_PTRS in checkClosure
Ömer Sinan Ağacan [Sat, 9 Jun 2018 09:49:19 +0000 (12:49 +0300)] 
rts: Handle SMALL_MUT_ARR_PTRS in checkClosure

14 months agousers guide: Fix spelling
Ben Gamari [Fri, 8 Jun 2018 13:15:10 +0000 (09:15 -0400)] 
users guide: Fix spelling

14 months agoFix `print-explicit-runtime-reps` (#11786).
HE, Tao [Fri, 8 Jun 2018 00:43:55 +0000 (20:43 -0400)] 
Fix `print-explicit-runtime-reps` (#11786).

By fixing splitting of IfaceTypes in splitIfaceSigmaTy.

Test Plan: make test TEST="T11549 T11376 T11786"

Reviewers: goldfire, bgamari

Subscribers: rwbarton, thomie, carter

GHC Trac Issues: #11786, #11376

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

14 months agoRun Linux slow validate nightly on Circle CI
Alp Mestanogullari [Thu, 24 May 2018 22:07:02 +0000 (00:07 +0200)] 
Run Linux slow validate nightly on Circle CI

14 months agotypecheck: Don't warn about "redundant" TypeError constraints
Ben Gamari [Thu, 7 Jun 2018 17:40:57 +0000 (13:40 -0400)] 
typecheck: Don't warn about "redundant" TypeError constraints

Summary: This fixes #15232, where we would warn about `TypeError` constraints being redundant.

Test Plan: Validate

Subscribers: rwbarton, thomie, carter

GHC Trac Issues: #15232

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

14 months agoAdd support for FreeBSD arm
Ben Gamari [Thu, 7 Jun 2018 18:13:04 +0000 (14:13 -0400)] 
Add support for FreeBSD arm

Test Plan: Tested on armv6, armv7 and aarch64 on FreeBSD 12-CURRENT.

Reviewers: bgamari

Reviewed By: bgamari

Subscribers: rwbarton, thomie, erikd, carter

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

14 months agoMove `iserv` into `utils` and change package name from `iserv-bin` to `iserv`
Moritz Angermann [Thu, 7 Jun 2018 17:36:24 +0000 (13:36 -0400)] 
Move `iserv` into `utils` and change package name from `iserv-bin` to `iserv`

This is done for consistency. We usually call the package file the same name the
folder has.  The move into `utils` is done so that we can move the library into
`libraries/iserv` and the proxy into `utils/iserv-proxy` and then break the
`iserv.cabal` apart.  This will make building the cross compiler with TH
simpler, because we can build the library and proxy as separate packages.

Test Plan: ./validate

Reviewers: bgamari, goldfire, erikd

Reviewed By: bgamari

Subscribers: rwbarton, thomie, carter

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

14 months agoAllow Haddock comments before function arguments.
Iavor Diatchki [Thu, 7 Jun 2018 17:32:27 +0000 (13:32 -0400)] 
Allow Haddock comments before function arguments.

Currently, documentation strings on function arguments has to be written
after the argument (i.e., using `{-^ -}` comments).  This patch allows
us to use `{-| -}` comments to put the comment string before an
argument.   The same works for the results of functions.

Reviewers: bgamari

Reviewed By: bgamari

Subscribers: rwbarton, thomie, mpickering, carter

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

14 months agoRun typeCheckResultAction and renamedResultAction in TcM rather than Hsc
Matthew Pickering [Thu, 7 Jun 2018 17:31:52 +0000 (13:31 -0400)] 
Run typeCheckResultAction and renamedResultAction in TcM rather than Hsc

The primary motivation for this is that this allows users to access
the warnings and error machinery present in TcM. However, it also allows
users to use TcM actions which means they can typecheck GhcPs which
could be significantly easier than constructing GhcTc.

Reviewers: bgamari

Reviewed By: bgamari

Subscribers: rwbarton, thomie, carter

GHC Trac Issues: #15229

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

14 months agoRename dataConRepNameUnique to dataConTyRepNameUnique
Matthew Pickering [Thu, 7 Jun 2018 17:31:38 +0000 (13:31 -0400)] 
Rename dataConRepNameUnique to dataConTyRepNameUnique

The `DataCon` rep also applies to the worker. For example, see
`MkId.mkDataConRep`.  `dataConTyRepNameUnique` is for the type
representation, so we rename it to make this distinction clear.

Reviewers: bgamari

Reviewed By: bgamari

Subscribers: rwbarton, thomie, carter

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

14 months agorts: Fix reference to srt_bitmap in ASSERT in RetainerProfile
Ben Gamari [Thu, 7 Jun 2018 17:31:26 +0000 (13:31 -0400)] 
rts: Fix reference to srt_bitmap in ASSERT in RetainerProfile

Test Plan: Validate

Reviewers: erikd, simonmar

Reviewed By: simonmar

Subscribers: rwbarton, thomie, carter

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

14 months agoFix #15236 by removing parentheses from funTyConName
Ryan Scott [Thu, 7 Jun 2018 17:30:44 +0000 (13:30 -0400)] 
Fix #15236 by removing parentheses from funTyConName

Currently, `funTyConName` is defined as:

```lang=haskell
funTyConName = mkPrimTyConName (fsLit "(->)") funTyConKey funTyCon
```

What's strange about this definition is that there are extraneous
parentheses around `->`, which is quite unlike every other infix
`Name`. As a result, the `:info (->)` output is totally garbled (see
Trac #15236).

It's quite straightforward to fix that particular bug by removing the
extraneous parentheses. However, it turns out that this makes some
test output involving `Show` instances for `TypeRep` look less
appealing, since `->` is no longer surrounded with parentheses when
applied prefix. But neither were any /other/ infix type constructors!
The right fix there was to change `showTypeable` to put parentheses
around prefix applications of infix tycons.

Test Plan: ./validate

Reviewers: bgamari, hvr

Reviewed By: bgamari

Subscribers: rwbarton, thomie, carter

GHC Trac Issues: #15236

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

14 months agoDon't expose (~#), (~R#), (~P#) from GHC.Prim
Ryan Scott [Thu, 7 Jun 2018 17:30:28 +0000 (13:30 -0400)] 
Don't expose (~#), (~R#), (~P#) from GHC.Prim

Currently, the primitive `(~#)`, `(~R#)`, and `(~P#)` type
constructors are wired in to be exported from `GHC.Prim`. This has
some unfortunate consequences, however. It turns out that `(~#)` is
actually a legal infix identifier, so users can make use of unboxed
equalities in strange ways in user code (see #15209). The other two,
`(~R#)` and `(~P#)`, can't be used in source code, but they can be
observed with GHCi's `:browse` command, which is somewhat unnerving.

The fix for both of these problems is simple: just don't wire them
to be exported from `GHC.Prim`.

Test Plan: make test TEST="T12023 T15209"

Reviewers: bgamari, dfeuer

Reviewed By: bgamari, dfeuer

Subscribers: rwbarton, thomie, carter, dfeuer

GHC Trac Issues: #12023, #15209

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

14 months agotestsuite: Skip T13838 in ghci way
Ben Gamari [Thu, 7 Jun 2018 17:30:13 +0000 (13:30 -0400)] 
testsuite: Skip T13838 in ghci way

Test Plan: `make slowtest TEST=T13838`

Reviewers: alpmestan, dfeuer

Reviewed By: dfeuer

Subscribers: dfeuer, rwbarton, thomie, carter

GHC Trac Issues: #15238

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

14 months agoDocument #15079 in the users' guide
Ryan Scott [Thu, 7 Jun 2018 17:29:12 +0000 (13:29 -0400)] 
Document #15079 in the users' guide

Trac #15079 revealed an interesting limitation in the interaction
between variable visibility and higher-rank kinds. We (Richard and I)
came to the conclusion that this is an acceptable (albeit surprising)
limitation, so this documents in the users' guide to hopefully eliminate
some confusion for others in the future.

Test Plan: Read it

Reviewers: goldfire, bgamari

Reviewed By: bgamari

Subscribers: rwbarton, thomie, carter

GHC Trac Issues: #15079

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

14 months agoFix #15243 by fixing incorrect uses of NotPromoted
Ryan Scott [Thu, 7 Jun 2018 17:28:53 +0000 (13:28 -0400)] 
Fix #15243 by fixing incorrect uses of NotPromoted

In `Convert`, we were incorrectly using `NotPromoted` to
denote type constructors that were actually intended to be promoted,
resulting in poor `-ddump-splices` output (as seen in #15243).
Easily fixed.

Test Plan: make test TEST=T15243

Reviewers: bgamari, goldfire

Reviewed By: bgamari

Subscribers: rwbarton, thomie, carter

GHC Trac Issues: #15243

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

14 months agotestsuite: Add test for #15232
Ben Gamari [Thu, 7 Jun 2018 17:27:37 +0000 (13:27 -0400)] 
testsuite: Add test for #15232

Subscribers: rwbarton, thomie, carter

GHC Trac Issues: #15232

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

14 months agoMove 'HsBangTy' out in constructor arguments
Alec Theriault [Thu, 7 Jun 2018 17:26:53 +0000 (13:26 -0400)] 
Move 'HsBangTy' out in constructor arguments

When run with -haddock, a constructor argument can have both a a
strictness/unpackedness annotation and a docstring. The parser binds
'HsBangTy' more tightly than 'HsDocTy', yet for constructor arguments we
really need the 'HsBangTy' on the outside.

This commit does this shuffling in the 'mkConDeclH98' and 'mkGadtDecl'
smart constructors.

Test Plan: haddockA038, haddockC038

Reviewers: bgamari, dfeuer

Reviewed By: bgamari

Subscribers: dfeuer, rwbarton, thomie, carter

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

14 months agoCheck if both branches of an Cmm if have the same target.
klebinger.andreas@gmx.at [Thu, 7 Jun 2018 17:26:19 +0000 (13:26 -0400)] 
Check if both branches of an Cmm if have the same target.

This for some reason or the other and makes it into the final
binary. I've added the check to ContFlowOpt as that seems
like a logical place for this.

In a regular nofib run there were 30 occurences of this pattern.

Test Plan: ci

Reviewers: bgamari, simonmar, dfeuer, jrtc27, tdammers

Reviewed By: bgamari, simonmar

Subscribers: tdammers, dfeuer, rwbarton, thomie, carter

GHC Trac Issues: #15188

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

14 months agoFix unparseable pretty-printing of promoted data cons
Andreas Herrmann [Thu, 7 Jun 2018 17:24:52 +0000 (13:24 -0400)] 
Fix unparseable pretty-printing of promoted data cons

Previously we would print code which would not round-trip:
```
> :set -XDataKinds
> :set -XPolyKinds
> data Proxy k = Proxy
> _ :: Proxy '[ 'True ]
error:
  Found hole: _ :: Proxy '['True]
> _ :: Proxy '['True]
error:
    Invalid type signature: _ :: ...
    Should be of form <variable> :: <type>
```

Test Plan: Validate with T14343

Reviewers: RyanGlScott, goldfire, bgamari, tdammers

Reviewed By: RyanGlScott, bgamari

Subscribers: tdammers, rwbarton, thomie, carter

GHC Trac Issues: #14343

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

14 months agoIndex arrays more eagerly
David Feuer [Thu, 7 Jun 2018 17:21:41 +0000 (13:21 -0400)] 
Index arrays more eagerly

Many basic functions in `GHC.Arr` were unreasonably lazy about
performing array lookups. This could lead to useless thunks
at best and memory leaks at worst. Use eager lookups where
they're obviously appropriate.

Reviewers: bgamari, hvr

Reviewed By: bgamari

Subscribers: rwbarton, thomie, carter

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

14 months agoWorkWrap: Rip out unsafeGlobalDynFlags usage in mkWwInlineRule
Ben Gamari [Thu, 7 Jun 2018 17:20:49 +0000 (13:20 -0400)] 
WorkWrap: Rip out unsafeGlobalDynFlags usage in mkWwInlineRule

Subscribers: rwbarton, thomie, carter

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

14 months agoDon't use unsafeGlobalDynFlags in optCoercion
Ben Gamari [Thu, 7 Jun 2018 17:20:30 +0000 (13:20 -0400)] 
Don't use unsafeGlobalDynFlags in optCoercion

This plumbs DynFlags through CoreOpt so optCoercion can finally
eliminate its usage of `unsafeGlobalDynFlags`.

Note that this doesn't completely eliminate `unsafeGlobalDynFlags`
usage from this bit of the compiler. A few uses are introduced in
call-sites where we don't (yet) have ready access to `DynFlags`.

Test Plan: Validate

Reviewers: goldfire

Subscribers: rwbarton, thomie, carter

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

14 months agoUpdate hadrian submodule
Ben Gamari [Tue, 5 Jun 2018 15:27:21 +0000 (11:27 -0400)] 
Update hadrian submodule

14 months agotestsuite: Fix dynamic-paper stderr file
Ben Gamari [Thu, 7 Jun 2018 22:05:51 +0000 (22:05 +0000)] 
testsuite: Fix dynamic-paper stderr file

The stderr file was empty, yet GHC fails with an error.