ghc.git
12 months agoghc-pkg: recompute `abi-depends` for updated packages ghc-8.4.3-release
Austin Seipp [Sun, 20 May 2018 17:25:09 +0000 (13:25 -0400)] 
ghc-pkg: recompute `abi-depends` for updated packages

See `Note [Recompute abi-depends]` for more information.

Signed-off-by: Austin Seipp <aseipp@pobox.com>
Test Plan: `./validate`

Reviewers: bgamari, ezyang

Reviewed By: bgamari

Subscribers: tdammers, juhp, carter, alexbiehl, shlevy, cocreature,
rwbarton, thomie

GHC Trac Issues: #14381

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

(cherry picked from commit 1cdc14f9c014f1a520638f7c0a01799ac6d104e6)

12 months agousers guide: initial commit of 8.4.3 release notes
Ben Gamari [Sun, 20 May 2018 23:06:35 +0000 (19:06 -0400)] 
users guide: initial commit of 8.4.3 release notes

12 months agoSet RELEASE=YES, version 8.4.3
Ben Gamari [Sun, 20 May 2018 22:52:53 +0000 (18:52 -0400)] 
Set RELEASE=YES, version 8.4.3

12 months agostorageAddCapabilities: fix bug in updating nursery pointers
Simon Marlow [Fri, 27 Apr 2018 18:31:19 +0000 (11:31 -0700)] 
storageAddCapabilities: fix bug in updating nursery pointers

Summary:
We were unconditionally updating the nursery pointers to be
`nurseries[cap->no]`, but when using nursery chunks this might be
wrong. This manifested as a later assertion failure in allocate().

Test Plan: new test case

Reviewers: bgamari, niteria, erikd

Subscribers: thomie, carter

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

(cherry picked from commit 4cb5595e5e800818721a623a5419cad29a528000)

12 months agoEmit info-level log message when package envs are loaded
Herbert Valerio Riedel [Sun, 13 May 2018 17:32:29 +0000 (19:32 +0200)] 
Emit info-level log message when package envs are loaded

A common complaint with the new package environment files feature is
that it's not obvious when package environments have been picked up.
This patch applies the same strategy that was already used for `.ghci` files
(which exhibit similar potential for confusion, c.f. #11389) to package
environment files.

For instance, this new notification looks like below for a GHCi invocation which
loads both, a GHCi configuration as well as a package environment:

  GHCi, version 8.5.20180512: http://www.haskell.org/ghc/  :? for help
  Loaded package environment from /tmp/parsec-3.1.13.0/.ghc.environment.x86_64-linux-8.5.20180512
  Loaded GHCi configuration from /home/hvr/.ghci
  Prelude>

Addresses #15145

Reviewed By: bgamari, angerman

GHC Trac Issues: #15145

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

(cherry picked from commit 00049e2dce93b1e468c3fde3287371eb988aafdc)

12 months agoCompute DW_FORM_block length correctly; also fixes #15068
Bertram Felgenhauer [Thu, 3 May 2018 15:03:53 +0000 (18:03 +0300)] 
Compute DW_FORM_block length correctly; also fixes #15068

Before this patch, the pprUnwindwExpr function computed the length of
by the following assembly fragment:

.uleb128 1f-.-1
<expression data>
1:

That is, to compute the length, it takes the difference of the label 1
and the address of the .uleb128 directive, and subtracts 1.

In #15068 it was reported that `as` from binutils 4.30 has trouble with
evaluating the `.` part of the expression. However, there is actually a
problem with the expression, if the length of the data ever becomes
larger than 128: In that case, the .uleb128 directive will emit more
than 1 byte, and the computed length will be wrong.

The present patch changes the assembly fragment to use two labels,
which fixes both these problems.

.uleb128 2f-1f
1:
<expression data>
2:

Test Plan: validate

Reviewers: bgamari, osa1

Reviewed By: bgamari

Subscribers: thomie, carter

GHC Trac Issues: #15068

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

(cherry picked from commit 358b508051333882d4099acca8f269e6fb2b7d65)

12 months agorts: export new absentSumFieldError from base
Sergei Trofimovich [Mon, 14 May 2018 20:51:48 +0000 (21:51 +0100)] 
rts: export new absentSumFieldError from base

commit b2ff5dde399cd012218578945ada1d9ff68daa35 "Fix #15038"
added new stable closure 'absentSumFieldError_closure' to
base package. This closure is used in rts package.

Unfortunately the symbol was not explicitly exported and build
failed on windows as:

```
"inplace/bin/ghc-stage1" -o ...hsc2hs.exe ...
rts/dist/build/libHSrts.a(RtsStartup.o): In function `hs_init_ghc':

rts/RtsStartup.c:272:0: error:
     undefined reference to `base_ControlziExceptionziBase_absentSumFieldError_closure'
    |
272 |     getStablePtr((StgPtr)absentSumFieldError_closure);
    | ^

```

This change adds 'absentSumFieldError_closure' to explicit export
into libHSbase.def.

Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
(cherry picked from commit 79bbb23fd3085c3dc52497175e9e74f73f7f6b68)

12 months agoFix #15038
Ömer Sinan Ağacan [Thu, 10 May 2018 08:13:37 +0000 (11:13 +0300)] 
Fix #15038

We introduce a new Id for unused pointer values in unboxed sums that is
not CAFFY. Because the Id is not CAFFY it doesn't make non-CAFFY
definitions CAFFY, fixing #15038.

To make sure anything referenced by the new id will be retained we get a
stable pointer to in on RTS startup.

Test Plan: Passes validate

Reviewers: simonmar, simonpj, hvr, bgamari, erikd

Reviewed By: simonmar

Subscribers: rwbarton, thomie, carter

GHC Trac Issues: #15038

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

(cherry picked from commit b2ff5dde399cd012218578945ada1d9ff68daa35)

12 months agorts: Fix compaction of SmallMutArrPtrs
Ben Gamari [Sat, 19 May 2018 18:00:59 +0000 (14:00 -0400)] 
rts: Fix compaction of SmallMutArrPtrs

This was blatantly wrong due to copy-paste blindness:

 * labels were shadowed, which GHC doesn't warn about(!), resulting in
   plainly wrong behavior
 * the sharing check was omitted
 * the wrong closure layout was being used

Moreover, the test wasn't being run due to its primitive dependency, so
I didn't even notice. Sillyness.

Test Plan: install `primitive`, `make test TEST=compact_small_array`

Reviewers: simonmar, erikd

Reviewed By: simonmar

Subscribers: rwbarton, thomie, carter

GHC Trac Issues: #13857.

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

(cherry picked from commit 12deb9a97c05ad462ef04e8d2062c3d11c52c6ff)

13 months agousers-guide: Override mathjax_path
Ben Gamari [Thu, 19 Apr 2018 15:28:19 +0000 (11:28 -0400)] 
users-guide: Override mathjax_path

The Mathjax CDN no longer exists. Use CDNJS instead.

See #15006.

Test Plan: Build HTML users guide, see whether math is rendered.

Reviewers: alpmestan

Reviewed By: alpmestan

Subscribers: thomie, carter

GHC Trac Issues: #15006

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

(cherry picked from commit 803178a5383cdb5383e5b9fedd8feb3d65f9183b)

13 months ago8.4.2-notes: Make wording on #13930 a bit stronger
Ben Gamari [Wed, 2 May 2018 20:00:23 +0000 (16:00 -0400)] 
8.4.2-notes: Make wording on #13930 a bit stronger

13 months agoconfigure: Set RELEASE=NO
Ben Gamari [Fri, 20 Apr 2018 00:20:23 +0000 (20:20 -0400)] 
configure: Set RELEASE=NO

13 months agoA few more release notes
Ben Gamari [Thu, 19 Apr 2018 23:28:40 +0000 (19:28 -0400)] 
A few more release notes

14 months agoRelease 8.4.2 ghc-8.4.2-release
Ben Gamari [Mon, 16 Apr 2018 13:50:06 +0000 (09:50 -0400)] 
Release 8.4.2

14 months agolibraries: Update changelogs
Ben Gamari [Tue, 17 Apr 2018 17:30:00 +0000 (13:30 -0400)] 
libraries: Update changelogs

14 months agousers-guide: Write release notes for 8.4.2
Ben Gamari [Tue, 17 Apr 2018 17:29:40 +0000 (13:29 -0400)] 
users-guide: Write release notes for 8.4.2

14 months agoBump mtl submodule to 2.2.2
Ben Gamari [Mon, 16 Apr 2018 13:49:58 +0000 (09:49 -0400)] 
Bump mtl submodule to 2.2.2

14 months agoSpecConstr: accommodate casts in value arguments
Simon Peyton Jones [Mon, 2 Apr 2018 13:57:37 +0000 (14:57 +0100)] 
SpecConstr: accommodate casts in value arguments

This commit:

  commit fb050a330ad202c1eb43038dc18cca2a5be26f4a
  Author: Simon Peyton Jones <simonpj@microsoft.com>
  Date:   Thu Oct 12 11:00:19 2017 +0100

  Do not bind coercion variables in SpecConstr rules

arranged to reject any SpecConstr call pattern that mentioned
a coercion in the pattern.

There was a good reason for that
-- see Note [SpecConstr and casts] --
but I didn't realise how important it was to accept patterns
that mention casts in /terms/.  Trac #14936 showed this up.

This patch just narrows the restriction to discard only
the cases where the coercion is mentioned only in types.
Fortunately that was pretty easy to do.

(cherry picked from commit 5ab8094e4579c08973260c2d18599be0738526ec)

14 months agoIn Exitify, zap idInfo of abstracted variables (fixes #15005)
Joachim Breitner [Tue, 10 Apr 2018 13:36:08 +0000 (09:36 -0400)] 
In Exitify, zap idInfo of abstracted variables (fixes #15005)

as helpfully outlined by SPJ.

This commit copies a small bit code from `SetLevels` which could
reasonably be put in `Id` as `zapAllIdinfo`; I did not do this to make
merging this commmit into `ghc-8.4` easier.

If this commit gets merged, then presumably after commit
3f59d3802170f495702674b4f8e4e80247803654 (test case) and
ae0cff0a1834d8b041b06d0e1ab6ce969aac44c8 (other fixes to Exitify.hs).

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

(cherry picked from commit 3cfb12d8adac37e5565d66fd173e4648cc041e65)

14 months agoAdd test case for #15005
Joachim Breitner [Tue, 10 Apr 2018 13:26:09 +0000 (09:26 -0400)] 
Add test case for #15005

this succeeds on `master` right now, but I confirmed that it fails on
ghc-8.4.1-release.

(cherry picked from commit 3f59d3802170f495702674b4f8e4e80247803654)

14 months agoCSE: Walk past join point lambdas (#15002)
Joachim Breitner [Thu, 5 Apr 2018 14:02:25 +0000 (10:02 -0400)] 
CSE: Walk past join point lambdas (#15002)

As the CSE transformation traverses the syntax tree, it needs to go past
the lambdas of a join point, and only look for CSE opportunities inside,
as a join point’s lambdas must be preserved. Simple fix; comes with a
Note and a test case.

Thanks to Ryan Scott for an excellently minimized test case, and for
bisecting GHC.

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

(cherry picked from commit ae0cff0a1834d8b041b06d0e1ab6ce969aac44c8)

14 months agoCorrect FixIOException's @since annotation retroactively
Ryan Scott [Fri, 13 Apr 2018 16:54:31 +0000 (12:54 -0400)] 
Correct FixIOException's @since annotation retroactively

Summary:
In D4113, a `FixIOException` data type was added with a
`@since TODO` annotation, but it seems that `TODO` made it out into
`base-4.11` itself. I've (retroactively) fixed this and added an
entry to the `base-4.11` entry in the `changelog`.

Test Plan: Read it

Reviewers: dfeuer, hvr, bgamari

Reviewed By: dfeuer

Subscribers: thomie, carter

GHC Trac Issues: #14356, #15025

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

(cherry picked from commit ce27c7d5fe3c335dcc354b70fdfc17831a6848f6)

14 months agoConfigure option to disable dtrace
Ben Gamari [Fri, 13 Apr 2018 18:18:03 +0000 (14:18 -0400)] 
Configure option to disable dtrace

Reviewers: hvr, bgamari

Subscribers: lelf, thomie, carter

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

(cherry picked from commit 4b831c27926d643b0b6fad82c1e946d05cde8645)

14 months agoBump version numbers: base-4.11.1.0, integer-gmp-1.0.2.0
Ryan Scott [Fri, 13 Apr 2018 15:31:09 +0000 (11:31 -0400)] 
Bump version numbers: base-4.11.1.0, integer-gmp-1.0.2.0

This takes care of bumping the `base` and `integer-gmp`
minor version numbers in anticipation of a GHC 8.4.2 release.

While I was in town, I also filled in a `@since TODO` Haddock
annotation for `powModSecInteger` in `integer-gmp` with
`1.0.2.0`, and updated the changelog accordingly.

Test Plan: ./validate

Reviewers: hvr, goldfire, bgamari

Reviewed By: bgamari

Subscribers: thomie, carter

GHC Trac Issues: #15025

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

(cherry picked from commit c4814ab6b8d756ae0e32c9a9f44e4888c4e24763)

14 months agoFix #9438 by converting a panic to an error message
Ryan Scott [Fri, 13 Apr 2018 15:33:54 +0000 (11:33 -0400)] 
Fix #9438 by converting a panic to an error message

Previously, GHC was quite eager to panic whenever it was fed
an archive file when `DYNAMIC_GHC_PROGRAMS=YES`. This ought to be an
explicit error message instead, so this patch accomplishes just that.

Test Plan: make test TEST=T14708

Reviewers: Phyx, hvr, bgamari

Reviewed By: Phyx

Subscribers: thomie, carter

GHC Trac Issues: #9438, #14708, #15032

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

(cherry picked from commit 7613a812888424b49cb334a4e63bd7280adf2774)

14 months agorts/RetainerProfile: Handle BLOCKING_QUEUES
Ben Gamari [Sat, 7 Apr 2018 17:32:04 +0000 (13:32 -0400)] 
rts/RetainerProfile: Handle BLOCKING_QUEUES

push() considers BLOCKING_QUEUES to be an invalid closure type which
should never be present on the stack. However, retainClosure made no
accomodation for this and ended up pushing such a closure. This lead
to #14947.

Test Plan: Validate

Reviewers: simonmar, erikd

Reviewed By: simonmar

Subscribers: thomie, carter, RyanGlScott

GHC Trac Issues: #14947

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

(cherry picked from commit d5f6d7a03d66a93ec05a90948126feffc9279dc6)

14 months agoBump haddock submodule again ghc-8.4.2-rc1
Ben Gamari [Thu, 29 Mar 2018 17:59:00 +0000 (13:59 -0400)] 
Bump haddock submodule again

14 months agoDon't permit data types with return kind Constraint
Ryan Scott [Mon, 19 Mar 2018 16:06:41 +0000 (12:06 -0400)] 
Don't permit data types with return kind Constraint

Previously, GHC allowed all of the following:

```lang=haskell
data Foo1 :: Constraint
data family Foo2 :: Constraint
data family Foo3 :: k
data instance Foo3 :: Constraint
```

Yikes! This is because GHC was confusing `Type` with `Constraint`
due to careless use of the `isLiftedTypeKind` function. To respect
this distinction, I swapped `isLiftedTypeKind` out for
`tcIsStarKind`—which does respect this distinction—in the right
places.

Test Plan: make test TEST="T14048a T14048b T14048c"

Reviewers: bgamari

Reviewed By: bgamari

Subscribers: goldfire, rwbarton, thomie, carter

GHC Trac Issues: #14048

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

(cherry picked from commit f748c52997f61a9f58eccbf4b8df0a0c8c6887e5)

14 months agoFix tcDataKindSig
Simon Peyton Jones [Fri, 15 Dec 2017 09:29:12 +0000 (09:29 +0000)] 
Fix tcDataKindSig

This patch fixes an outright bug in tcDataKindSig, shown up in Trac
of a data type declaration.  See Note [TyConBinders for the result kind
signature of a data type]

I also took the opportunity to elminate the DataKindCheck argument
and data type from tcDataKindSig, instead moving the check to the
call site, which is easier to understand.

(cherry picked from commit 68149452a793aedd8d468b689dc93fb2ba5ec436)

14 months agoRevert "GHCi: Don't remove shadowed bindings from typechecker scope."
Ömer Sinan Ağacan [Thu, 8 Mar 2018 18:42:22 +0000 (21:42 +0300)] 
Revert "GHCi: Don't remove shadowed bindings from typechecker scope."

This reverts commit 59d7ee53906b9cee7f279c1f9567af7b930f8636 and enables
the test for #14052.

(See #14052 for the discussion)

Reviewers: bgamari

Reviewed By: bgamari

Subscribers: rwbarton, thomie, carter

GHC Trac Issues: #14052

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

(cherry picked from commit 98c7749cd360293bee96034056e260d70224cef6)

14 months agoFix typo in user guide about ConstraintKinds
Frank Steffahn [Tue, 13 Mar 2018 22:29:04 +0000 (23:29 +0100)] 
Fix typo in user guide about ConstraintKinds

The backslash currently in this type signature makes no sense. Without it, the example is fine.

(cherry picked from commit 960cd424fb2ca99389c8f041d519d661494d07c1)

14 months agoBump Cabal submodule to 2.2.0.1
Ben Gamari [Wed, 28 Mar 2018 17:13:36 +0000 (13:13 -0400)] 
Bump Cabal submodule to 2.2.0.1

14 months agoBump Haddock submodule
Ben Gamari [Mon, 26 Mar 2018 21:07:01 +0000 (17:07 -0400)] 
Bump Haddock submodule

14 months agoBump xhtml submodule to 3000.2.2.1
Ben Gamari [Mon, 26 Mar 2018 21:06:18 +0000 (17:06 -0400)] 
Bump xhtml submodule to 3000.2.2.1

14 months agoFix a nasty bug in the pure unifier
Simon Peyton Jones [Mon, 26 Feb 2018 17:44:55 +0000 (17:44 +0000)] 
Fix a nasty bug in the pure unifier

The pure unifier was building an infinite type, through a defective
occurs check.  So GHC went into an infinite loop.

Reason: we were neglecting the 'kco' part of the type, which
'unify_ty' maintains.  Yikes.

The fix is easy.  I refactored a bit to make it harder to
go wrong in future.

(cherry picked from commit e99fdf775540440c1c58dc5ade3c5984dc49246f)

14 months agoFix two pernicious bugs in DeriveAnyClass
Ryan Scott [Sun, 25 Mar 2018 18:00:39 +0000 (14:00 -0400)] 
Fix two pernicious bugs in DeriveAnyClass

The way GHC was handling `DeriveAnyClass` was subtly wrong
in two notable ways:

* In `inferConstraintsDAC`, we were //always// bumping the `TcLevel`
  of newly created unification variables, under the assumption that
  we would always place those unification variables inside an
  implication constraint. But #14932 showed precisely the scenario
  where we had `DeriveAnyClass` //without// any of the generated
  constraints being used inside an implication, which made GHC
  incorrectly believe the unification variables were untouchable.
* Even worse, we were using the generated unification variables from
  `inferConstraintsDAC` in every single iteration of `simplifyDeriv`.
  In #14933, however, we have a scenario where we fill in a
  unification variable with a skolem in one iteration, discard it,
  proceed on to another iteration, use the same unification variable
  (still filled in with the old skolem), and try to unify it with
  a //new// skolem! This results in an utter disaster.

The root of both these problems is `inferConstraintsDAC`. This patch
fixes the issue by no longer generating unification variables
directly in `inferConstraintsDAC`. Instead, we store the original
variables from a generic default type signature in `to_metas`, a new
field of `ThetaOrigin`, and in each iteration of `simplifyDeriv`, we
generate fresh meta tyvars (avoiding the second issue). Moreover,
this allows us to more carefully fine-tune the `TcLevel` under which
we create these meta tyvars, fixing the first issue.

Test Plan: make test TEST="T14932 T14933"

Reviewers: simonpj, bgamari

Reviewed By: simonpj

Subscribers: rwbarton, thomie, carter

GHC Trac Issues: #14932, #14933

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

(cherry picked from commit 9893042604cda5260cb0f7b674ed5c34b419e403)

14 months agoUnboxedTuples can't be used as constraints
HE, Tao [Thu, 1 Feb 2018 02:40:03 +0000 (21:40 -0500)] 
UnboxedTuples can't be used as constraints

Fixes #14740.

Test Plan: make test TEST="14740"

Reviewers: bgamari, simonpj

Reviewed By: simonpj

Subscribers: simonpj, rwbarton, thomie, carter

GHC Trac Issues: #14740

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

(cherry picked from commit ced9fbd3913e1316498961bc389bfb1e141221a1)

14 months agoFix #14934 by including axSub0R in typeNatCoAxiomRules
Ryan Scott [Mon, 19 Mar 2018 16:05:36 +0000 (12:05 -0400)] 
Fix #14934 by including axSub0R in typeNatCoAxiomRules

For some reason, `axSub0R` was left out of `typeNatCoAxiomRules` in
`TcTypeNats`, which led to disaster when trying to look up `Sub0R` from
an interface file, as demonstrated in #14934.

The fix is simple—just add `axSub0R` to that list. To help prevent
an issue like this happening in the future, I added a
`Note [Adding built-in type families]` to `TcTypeNats`, which
contains a walkthrough of all the definitions in `TcTypeNats` you
need to update when adding a new built-in type family.

Test Plan: make test TEST=T14934

Reviewers: bgamari, simonpj

Reviewed By: simonpj

Subscribers: simonpj, rwbarton, thomie, carter

GHC Trac Issues: #14934

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

(cherry picked from commit c3aea39678398fdf88166f30f0d01225a1874a32)

14 months agoFix seq# case of exprOkForSpeculation
Simon Peyton Jones [Tue, 20 Mar 2018 16:30:01 +0000 (16:30 +0000)] 
Fix seq# case of exprOkForSpeculation

This subtle patch fixes Trac #5129 (again; comment:20
and following).

I took the opportunity to document seq# properly; see
Note [seq# magic] in PrelRules, and Note [seq# and expr_ok]
in CoreUtils.

(cherry picked from commit abaf43d9d88d6fdf7345b936a571d17cfe1fa140)

14 months agoFix over-eager constant folding in bitInteger
Simon Peyton Jones [Thu, 22 Mar 2018 09:51:24 +0000 (09:51 +0000)] 
Fix over-eager constant folding in bitInteger

The RULE for bitInteger was trying to constant-fold

    bitInteger 9223372036854775807#

which meant constructing a gigantic Integer at compile
time.  Very bad idea!  Easily fixed.

Fixes Trac #14959, #14962.

(cherry picked from commit efc844f5b955385d69d8e20b80d38311083a6665)

14 months agoFix a debug print in disassembler (#14905)
Ömer Sinan Ağacan [Fri, 9 Mar 2018 12:38:58 +0000 (15:38 +0300)] 
Fix a debug print in disassembler (#14905)

When interpreter is not profiled (see `interpreterProfiled` in
`DynFlags`) bytecode generator generates a NULL pointer as the cost
centre of a `BRK_FUN` instruction:

    let cc | interpreterProfiled dflags = cc_arr ! tick_no
           | otherwise = toRemotePtr nullPtr
    let breakInstr = BRK_FUN (fromIntegral tick_no) (getUnique this_mod) cc
    return $ breakInstr `consOL` code

We now take this into account when disassembling `BRK_FUN`.

Reviewers: bgamari, simonmar, erikd

Subscribers: rwbarton, thomie, carter

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

(cherry picked from commit 8e3410134bd7419db638988d74fcc600b03e2a1a)

14 months agoSlighly improve infix con app pattern errors
Ömer Sinan Ağacan [Wed, 14 Mar 2018 06:16:51 +0000 (09:16 +0300)] 
Slighly improve infix con app pattern errors

Given this program:

    main = do
      f $ do
        a <- return 3
          c <- do
          return 5

GHC previously gave this error message:

    Main.hs:2:7: error:
        Parse error in pattern: do a <- return 3 c
        Possibly caused by a missing 'do'?
      |
    2 |   f $ do
      |       ^^...

What happened is GHC considered the whole `f $ do a <- return 3 c` as a
pattern. When parsed as an expression it becomes an infix application of
`($)`, and GHC checks left and right hand sides before checking if `($)`
is a valid infix constructor name, and shows the first error it got.

If instead we first check if the infix op is valid in pattern context,
the error message becomes much clearer:

    Main.hs:2:3: error:
        Parse error in pattern: f $ do a <- return 3 c
        Possibly caused by a missing 'do'?
      |
    2 |   f $ do
      |   ^^^^^^...

This may not entirely fix #11188 but I think it's an improvement.

Reviewers: bgamari

Reviewed By: bgamari

Subscribers: rwbarton, thomie, carter

GHC Trac Issues: #11188

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

(cherry picked from commit cb6d8589c83247ec96d5faa82df3e93f419bbfe0)

14 months agobase: Fix Unicode handling of TyCon's Show instance
Ben Gamari [Mon, 26 Mar 2018 02:12:49 +0000 (22:12 -0400)] 
base: Fix Unicode handling of TyCon's Show instance

Test Plan: `make test TEST=T14925`

Reviewers: hvr, dfeuer

Reviewed By: dfeuer

Subscribers: rwbarton, thomie, carter

GHC Trac Issues: #14925

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

(cherry picked from commit 20ae19fc7297dceaefde8d3443099bfd9cd1e905)

14 months agoFix #14916 with an additional validity check in deriveTyData
Ryan Scott [Sun, 25 Mar 2018 19:34:05 +0000 (15:34 -0400)] 
Fix #14916 with an additional validity check in deriveTyData

Manually-written instances and standalone-derived instances
have the benefit of having the `checkValidInstHead` function run over
them, which catches manual instances of built-in types like `(~)` and
`Coercible`. However, instances generated from `deriving` clauses
weren't being passed through `checkValidInstHead`, leading to
confusing results as in #14916.

`checkValidInstHead` also has additional validity checks for language
extensions like `FlexibleInstances` and `MultiParamTypeClasses`. Up
until now, GHC has never required these language extensions for
`deriving` clause, so to avoid unnecessary breakage, I opted to
suppress these language extension checks for `deriving` clauses, just
like we currently suppress them for `SPECIALIZE instance` pragmas.

Test Plan: make test TEST=T14916

Reviewers: goldfire, bgamari

Reviewed By: bgamari

Subscribers: rwbarton, thomie, carter

GHC Trac Issues: #14916

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

(cherry picked from commit 20f14b4fd4eaf2c3ab375b8fc6d40ee9e6db94fd)

14 months agoDon't refer to blocks in debug info when -g1
Bartosz Nitka [Sun, 25 Mar 2018 19:34:27 +0000 (15:34 -0400)] 
Don't refer to blocks in debug info when -g1

-g1 removes block information, but it turns out that procs can
refer to block information through parents.
Note [Splitting DebugBlocks] explains the parentage relationship.

Test Plan:
* ./validate
* added a new test

Reviewers: bgamari, simonmar

Reviewed By: bgamari

Subscribers: rwbarton, thomie, carter

GHC Trac Issues: #14894

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

(cherry picked from commit 0cbb13b3dfd70b4c9665109cd6c4a150cb7b99df)

14 months agorelnotes: Fix parsing of Version: field from Cabal file
Ben Gamari [Mon, 19 Mar 2018 17:31:46 +0000 (13:31 -0400)] 
relnotes: Fix parsing of Version: field from Cabal file

Subscribers: rwbarton, thomie, carter

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

(cherry picked from commit d718023e86c8681b87f212bd64eb6ca10ac8935e)

14 months agoSpecial-case record fields ending with hash when deriving Read
Ryan Scott [Fri, 23 Mar 2018 15:40:02 +0000 (11:40 -0400)] 
Special-case record fields ending with hash when deriving Read

Summary:
In commit dbd81f7e86514498218572b9d978373b1699cc5b, a
regression was inadvertently introduced which caused derived `Read`
instances for record data types with fields ending in a `#` symbol
(using `MagicHash`) would no longer parse on valid output. This
is ultimately due to the same reasons as #5041, as we cannot parse
a field name like `foo#` as a single identifier. We fix this issue
by employing the same workaround as in #5041: first parse the
identifier name `foo`, then then symbol `#`.

This is accomplished by the new `readFieldHash` function in
`GHC.Read`. This will likely warrant a `base-4.11.1.0` release.

Test Plan: make test TEST=T14918

Reviewers: tdammers, hvr, bgamari

Reviewed By: bgamari

Subscribers: rwbarton, thomie, carter

GHC Trac Issues: #14918

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

(cherry picked from commit d5577f44eaf3b9dfdfc77828038782bf818c176a)

14 months agoconfigure: Accept suffix in OpenBSD triple's OS name
Ben Gamari [Thu, 8 Mar 2018 18:29:01 +0000 (13:29 -0500)] 
configure: Accept suffix in OpenBSD triple's OS name

Reviewers: hvr

Subscribers: rwbarton, thomie, erikd, carter

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

(cherry picked from commit a25b763fa9e09d3bf7c82fef1eaed89a7afc54f7)

14 months agoconfigure: Accept version suffix in solaris name
Ben Gamari [Mon, 19 Mar 2018 17:32:14 +0000 (13:32 -0400)] 
configure: Accept version suffix in solaris name

Summary: OpenIndiana apparently reports a triple of i386-pc-solaris2.11.

Reviewers: hvr

Subscribers: rwbarton, thomie, erikd, carter

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

(cherry picked from commit 4fa077a2a1d6e6e7a45ef03a1075ff3c7dddb23d)

15 months agoconfigure: Accept version suffix in solaris name
Ben Gamari [Thu, 8 Mar 2018 20:26:09 +0000 (15:26 -0500)] 
configure: Accept version suffix in solaris name

OpenIndiana apparently reports a triple of i386-pc-solaris2.11.

15 months agoconfigure: Set RELEASE=NO
Ben Gamari [Thu, 8 Mar 2018 19:09:36 +0000 (14:09 -0500)] 
configure: Set RELEASE=NO

15 months agorel-notes: Fix typo
Ben Gamari [Thu, 8 Mar 2018 03:17:18 +0000 (22:17 -0500)] 
rel-notes: Fix typo

Thanks to Gabor for pointing this out.

15 months agoFix interpreter with profiling
Simon Marlow [Mon, 5 Mar 2018 20:12:57 +0000 (15:12 -0500)] 
Fix interpreter with profiling

This was broken by D3746 and/or D3809, but unfortunately we didn't
notice because CI at the time wasn't building the profiling way.

Test Plan:
```
cd testsuite/test/profiling/should_run
make WAY=ghci-ext-prof
```

Reviewers: bgamari, michalt, hvr, erikd

Subscribers: rwbarton, thomie, carter

GHC Trac Issues: #14705

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

(cherry picked from commit 488d63d6899d223ef87c26c218f0cf81ac670a90)

15 months agoforkProcess: fix task mutex release order
Ömer Sinan Ağacan [Fri, 2 Mar 2018 16:15:03 +0000 (11:15 -0500)] 
forkProcess: fix task mutex release order

`all_tasks_mutex` should be released before calling `releaseCapability_`
in the parent process as `releaseCapability_` spawns worker tasks in
some cases.

Reviewers: bgamari, erikd, simonmar

Subscribers: rwbarton, thomie, carter

GHC Trac Issues: #14538

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

(cherry picked from commit e261b8523eb547b93b8b9e194bc2566350e7cc60)

15 months agoSet RELEASE=YES, version 8.4.1
Ben Gamari [Sun, 4 Mar 2018 18:53:54 +0000 (13:53 -0500)] 
Set RELEASE=YES, version 8.4.1

15 months agoBump hsc2hs submodule
Ben Gamari [Tue, 6 Mar 2018 16:48:41 +0000 (11:48 -0500)] 
Bump hsc2hs submodule

15 months agoadd CCX=$(CXX) to integer-gmp
Moritz Angermann [Tue, 6 Mar 2018 03:20:22 +0000 (11:20 +0800)] 
add CCX=$(CXX) to integer-gmp

Summary:
This came up when trying to build GHC HEAD with nix. We
do not set CCX for integer-gmp when running ./configure. We do
this however for libffi.

The result is, that if CCX is not set, we default to the system
one, of which there might be none (as in nixos's case).  This
will not show on a debian+nix or similar setup, where the system
`cxx` is still in place, and only shows up when the system tries
hard to sandbox everything (even cxx) as nixOS does.

We use `CXX`, which is set to either `clang` or `CC_STAGE1`, and
also usedfor `CC`, similar to what we do for libffi.c

Test Plan: ./validate

Reviewers: bgamari, hvr

Reviewed By: hvr

Subscribers: rwbarton, thomie, carter

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

(cherry picked from commit cf5bc96e1b023275ec3c0399f3345ceebbc48df0)

15 months agoAllow top level ticked string literals
Bartosz Nitka [Fri, 2 Mar 2018 13:33:07 +0000 (05:33 -0800)] 
Allow top level ticked string literals

This reverts f5b275a239d2554c4da0b7621211642bf3b10650
and changes the places that looked for `Lit (MachStr _))`
to use `exprIsMbTickedLitString_maybe` to unwrap ticks as
necessary.
Also updated relevant comments.

Test Plan:
I added 3 new tests that previously reproduced.
GHC HEAD now builds with -g

Reviewers: simonpj, simonmar, bgamari, hvr, goldfire

Subscribers: rwbarton, thomie, carter

GHC Trac Issues: #14779

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

(cherry picked from commit 5bc195a2caddc5c29cf24e9c731dd8d5050f2c66)

15 months agoAnother Cabal submodule bump
Ben Gamari [Tue, 6 Mar 2018 16:11:51 +0000 (11:11 -0500)] 
Another Cabal submodule bump

15 months agoFixup include of gmp/config.mk to use new location
Herbert Valerio Riedel [Mon, 5 Mar 2018 20:13:28 +0000 (21:13 +0100)] 
Fixup include of gmp/config.mk to use new location

This wasn't spotted rightaway in
8f0b2f5eadf0fcb47c581907205a9db686214a69
because the include-site deliberately ignored include-errors as
a Hack with the justification below:

> Hack. The file gmp/config.mk doesn't exist yet after running ./configure in
> the toplevel (ghc) directory. To let some toplevel make commands such as
> sdist go through, right after ./configure, don't consider this an error.

This may have contributed to #14891.

(cherry picked from commit df7ac37d43bdbabbde9b09344f9425e8e5a879ff)

15 months agoCorrect -g flag description
Bartosz Nitka [Mon, 5 Mar 2018 20:14:36 +0000 (15:14 -0500)] 
Correct -g flag description

Since 7aaeaf81ea95c36fe1dc4da449cf6092a792fd09
`-g1` and `-g2` are actually different.
The tutorial below is correct.

Test Plan: harbormaster

Reviewers: bgamari, simonmar

Reviewed By: bgamari

Subscribers: rwbarton, thomie, carter

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

(cherry picked from commit 5b1132eefd0a75189b3527486b492c3dffc7bdf1)

15 months agoOne final sweep over release notes
Ben Gamari [Sun, 4 Mar 2018 17:42:05 +0000 (12:42 -0500)] 
One final sweep over release notes

15 months agoBump Cabal submodule to 2.2
Moritz Angermann [Sat, 3 Mar 2018 21:16:41 +0000 (16:16 -0500)] 
Bump Cabal submodule to 2.2

Requires some ghc-cabal changes as well.

Test Plan: ./validate

Reviewers: hvr, bgamari

Reviewed By: bgamari

Subscribers: hsyl20, erikd, alpmestan, rwbarton, thomie, carter

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

15 months agoVarious documentation improvements
Sergey Vinokurov [Wed, 7 Feb 2018 21:10:17 +0000 (21:10 +0000)] 
Various documentation improvements

 * Fix missing code example in changelog for 8.4.1

 * List 'setEnv' as opposite of 'getEnv'

   It seems best to direct users to use 'System.Environment.setEnv'
   rather than 'System.Posix.Env.putEnv'. This is due to 'setEnv' being
   located in the same module as 'getEnv' and my virtue of working on
   Windows platform, whereas 'putEnv' does not have that quality because
   it's part of the 'unix' package.

 * Reflect in docs the fact that 'readMVar' is not a composition of
   'takeMVVar' and 'putMVar' any more

(cherry picked from commit df449e1744d59eef7f41e09196629bc01815e984)

15 months agoconfigure: Enable LD_NO_GOLD is set in all codepaths
Ben Gamari [Fri, 2 Mar 2018 21:13:53 +0000 (16:13 -0500)] 
configure: Enable LD_NO_GOLD is set in all codepaths

Test Plan: `./configure --disable-ld-override; make; make install`

Reviewers: trofi, hvr

Reviewed By: trofi

Subscribers: rwbarton, thomie, erikd, carter, simonmar

GHC Trac Issues: #14675

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

(cherry picked from commit bc1bcaa2c0c66fb247d1338d6d0055a833918a7f)

15 months agoAdds *-cross-ncg flavour.
Moritz Angermann [Fri, 2 Mar 2018 21:15:09 +0000 (16:15 -0500)] 
Adds *-cross-ncg flavour.

Our *-cross flavours force -fllvm, this adds flavours for cross
compilation to x86_64, where we can use our native code generator.

Test Plan: ./validate

Reviewers: bgamari

Reviewed By: bgamari

Subscribers: rwbarton, thomie, carter

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

(cherry picked from commit e4dcebf899c796a13dabf8964038f78505b9f4ec)

15 months agoCorrect default -A value in RTS flag usage info
Simon Jakobi [Fri, 2 Mar 2018 21:17:44 +0000 (16:17 -0500)] 
Correct default -A value in RTS flag usage info

Reviewers: bgamari, erikd, simonmar

Reviewed By: bgamari

Subscribers: rwbarton, thomie, carter

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

(cherry picked from commit 821daadf65a3e146f8adf2802b3cb8b520d8d10e)

15 months agoUpdate haddock submodule
Ben Gamari [Sun, 25 Feb 2018 22:12:44 +0000 (17:12 -0500)] 
Update haddock submodule

Fixes file handle leak

15 months agoFix typo
Sergey Vinokurov [Thu, 8 Feb 2018 09:17:53 +0000 (09:17 +0000)] 
Fix typo

(cherry picked from commit 37e78029845a04d0ab4cc05e1790c648facdcb1f)

15 months agoList 'setEnv' as opposite of 'getEnv'
Sergey Vinokurov [Wed, 7 Feb 2018 21:49:56 +0000 (21:49 +0000)] 
List 'setEnv' as opposite of 'getEnv'

It seems best to direct users to use 'System.Environment.setEnv'
rather than 'System.Posix.Env.putEnv'. This is due to 'setEnv' being
located in the same module as 'getEnv' and my virtue of working on
Windows platform, whereas 'putEnv' does not have that quality because
it's part of the 'unix' package.

(cherry picked from commit c74fcf5d27744c67b09b29a78029c31c9371cf41)

15 months agoFix missing code example in changelog for 8.4.1
Sergey Vinokurov [Wed, 7 Feb 2018 21:10:17 +0000 (21:10 +0000)] 
Fix missing code example in changelog for 8.4.1

(cherry picked from commit 3ae408cf93d10b9a2e5acb4186dc8e0c62e0afb6)

15 months agoBump unix submodule back to 2.7 ghc-8.4.1-rc1
Ben Gamari [Fri, 23 Feb 2018 21:57:33 +0000 (16:57 -0500)] 
Bump unix submodule back to 2.7

15 months agoDon't use ld.gold when building libraries for GHCi
Simon Marlow [Wed, 21 Feb 2018 14:16:00 +0000 (14:16 +0000)] 
Don't use ld.gold when building libraries for GHCi

Summary:
ld.gold is buggy when using -r and a linker script.  See upstream bug
https://sourceware.org/bugzilla/show_bug.cgi?id=22266

This has been causing various brokenness for the GHC runtime linker,
where we load these broken object files.

Test Plan: Test program from #14675

Reviewers: bgamari, RyanGlScott, alpmestan, hvr, erikd

Subscribers: rwbarton, thomie, erikd, carter

GHC Trac Issues: #14328, #14675, #14291

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

(cherry picked from commit 0a3629af36e89de73b7012c726fd533c4c5460fb)

15 months agoImprove unboxed sum documentation
David Feuer [Mon, 5 Feb 2018 14:45:30 +0000 (09:45 -0500)] 
Improve unboxed sum documentation

* Clarify the representation of sums without fields.
* Try to improve language, clarity, and examples.

Fixes #14752

Reviewers: osa1, bgamari

Reviewed By: osa1

Subscribers: rwbarton, thomie, carter

GHC Trac Issues: #14752

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

(cherry picked from commit d987f71aa3200ce0c94bc57c43b4fcc92eaccf76)

15 months agoBump hadrian submodule
Ryan Scott [Fri, 16 Feb 2018 18:51:27 +0000 (13:51 -0500)] 
Bump hadrian submodule

15 months agoBump haddock submodule
Ben Gamari [Mon, 19 Feb 2018 05:00:06 +0000 (00:00 -0500)] 
Bump haddock submodule

15 months agoCBE: re-introduce bgamari's fixes
Michal Terepeta [Sun, 18 Feb 2018 16:09:40 +0000 (11:09 -0500)] 
CBE: re-introduce bgamari's fixes

During some recent work on CBE we discovered that `zipWith` is used to
check for equality, but that doesn't quite work if lists are of
different lengths! This was fixed by bgamari, but unfortunately the fix
had to be rolled back due to other changes in CBE in
50adbd7c5fe5894d3e6e2a58b353ed07e5f8949d. Since I wanted to have another
look at CBE anyway, we agreed that the first thing to do would be to
re-introduce the fix.

Sadly I don't have any actual test case that would exercise this.

Signed-off-by: Michal Terepeta <michal.terepeta@gmail.com>
Test Plan: ./validate

Reviewers: bgamari, simonmar

Reviewed By: bgamari

Subscribers: rwbarton, thomie, carter

GHC Trac Issues: #14226

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

(cherry picked from commit 4e513bf758c32804fc71b98215f96e8481697a36)

15 months agoImplement stopgap solution for #14728
Ryan Scott [Sun, 18 Feb 2018 16:00:40 +0000 (11:00 -0500)] 
Implement stopgap solution for #14728

It turns out that one can produce ill-formed Core by
combining `GeneralizedNewtypeDeriving`, `TypeInType`, and
`TypeFamilies`, as demonstrated in #14728. The root of the problem
is allowing the last parameter of a class to appear in a //kind// of
an associated type family, as our current approach to deriving
associated type family instances simply doesn't work well for that
situation.

Although it might be possible to properly implement this feature
today (see https://ghc.haskell.org/trac/ghc/ticket/14728#comment:3
for a sketch of how this might work), there does not currently exist
a performant implementation of the algorithm needed to accomplish
this. Until such an implementation surfaces, we will make this corner
case of `GeneralizedNewtypeDeriving` an error.

Test Plan: make test TEST="T14728a T14728b"

Reviewers: bgamari

Reviewed By: bgamari

Subscribers: rwbarton, thomie, carter

GHC Trac Issues: #14728

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

(cherry picked from commit 1ede46d415757f53af33bc6672bd9d3fba7f205d)

15 months agoBuild Haddocks with --quickjump
Ben Gamari [Sun, 18 Feb 2018 16:01:59 +0000 (11:01 -0500)] 
Build Haddocks with --quickjump

By request of @alexbiehl.
CCing @snowleopard and @alpmestan as the same should be done in Hadrian.

Bumps haddock submodule.

Reviewers: alexbiehl

Reviewed By: alexbiehl

Subscribers: rwbarton, thomie, carter, snowleopard, alpmestan, alexbiehl

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

(cherry picked from commit 9ff4cce373765cec064e2a41d4c6ddd84b873f04)

15 months agoBump text submodule to 1.2.3.0
Ben Gamari [Sun, 18 Feb 2018 16:31:41 +0000 (11:31 -0500)] 
Bump text submodule to 1.2.3.0

15 months agoBump haskeline submodule to 0.7.4.2
Ben Gamari [Sun, 18 Feb 2018 16:29:56 +0000 (11:29 -0500)] 
Bump haskeline submodule to 0.7.4.2

15 months agotestsuite: Add test for #14768
Ben Gamari [Tue, 6 Feb 2018 22:33:21 +0000 (17:33 -0500)] 
testsuite: Add test for #14768

(cherry picked from commit da4681303892804ea08b60bfd47cbb82ca8e6589)

15 months agoCollect CCs in CorePrep, including CCs in unfoldings
Ömer Sinan Ağacan [Tue, 13 Feb 2018 06:03:57 +0000 (09:03 +0300)] 
Collect CCs in CorePrep, including CCs in unfoldings

This patch includes two changes:

1. Move cost centre collection from `SCCfinal` to `CorePrep`, to be able
   to collect cost centres in unfoldings. `CorePrep` drops unfoldings, so
   that's the latest stage in the compilation pipeline for this.

   After this change `SCCfinal` no longer collects all cost centres, but
   it still generates & collects CAF cost centres + updates cost centre
   stacks of `StgRhsClosure` and `StgRhsCon`s.

   This fixes #5889.

2. Initialize cost centre stack fields of `StgRhs` in `coreToStg`. With
   this we no longer need to update cost centre stack fields in
   `SCCfinal`, so that module is removed.

   Cost centre initialization explained in Note [Cost-centre
   initialization plan].

   Because with -fcaf-all we need to attach a new cost-centre to each
   CAF, `coreTopBindToStg` now returns `CollectedCCs`.

Test Plan: validate

Reviewers: simonpj, bgamari, simonmar

Reviewed By: simonpj, bgamari

Subscribers: rwbarton, thomie, carter

GHC Trac Issues: #5889

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

(cherry picked from commit 5957405808fe89e9b108dc0bc3cf4b56aec37775)

15 months agoRemove unused extern cost centre collection
Ömer Sinan Ağacan [Thu, 18 Jan 2018 16:06:30 +0000 (11:06 -0500)] 
Remove unused extern cost centre collection

Reviewers: bgamari, simonmar

Reviewed By: simonmar

Subscribers: alexbiehl, rwbarton, thomie, carter

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

(cherry picked from commit 2a78cf773cb447ac91c4a23d7e921e091e499134)

15 months agoFix #14811 by wiring in $tcUnit#
Ryan Scott [Fri, 16 Feb 2018 18:51:27 +0000 (13:51 -0500)] 
Fix #14811 by wiring in $tcUnit#

Previously, we were skipping over `$tcUnit#` entirely when
wiring in `Typeable` tycons, resulting in #14811. Easily fixed.

Test Plan: make test TEST=T14811

Reviewers: bgamari, dfeuer

Reviewed By: dfeuer

Subscribers: dfeuer, rwbarton, thomie, carter

GHC Trac Issues: #14811

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

(cherry picked from commit d5ac5820111bc957e72c8ce11e59d7cbbdd63526)

15 months agobase: Fix changelog entry for openTempFile
Ben Gamari [Thu, 15 Feb 2018 18:01:09 +0000 (13:01 -0500)] 
base: Fix changelog entry for openTempFile

This change is present in 4.11.0.0.

(cherry picked from commit abecb2619acea5cf6ebaa7412401d9e660daf82c)

15 months agoBump parsec submodule to 0.3.13.0
Ben Gamari [Thu, 15 Feb 2018 16:43:35 +0000 (11:43 -0500)] 
Bump parsec submodule to 0.3.13.0

16 months agoBump primitive submodule to 0.6.3.0
Ben Gamari [Thu, 15 Feb 2018 16:42:35 +0000 (11:42 -0500)] 
Bump primitive submodule to 0.6.3.0

16 months agoFix isDroppableCt (Trac #14763)
Simon Peyton Jones [Thu, 8 Feb 2018 14:24:11 +0000 (14:24 +0000)] 
Fix isDroppableCt (Trac #14763)

When finishing up an implication constraint, it's a bit tricky to
decide which Derived constraints to retain (for error reporting) and
which to discard.  I got this wrong in commit
   f20cf982f126aea968ed6a482551550ffb6650cf
   (Remove wc_insol from WantedConstraints)

The particular problem in Trac #14763 was that we were reporting as an
error a fundep-generated constraint
  (ex ~ T)
where 'ex' is an existentially-bound variable in a pattern match.
But this isn't really an error at all.

This patch fixes the problem. Indeed, since I had to understand
this rather tricky code, I took the opportunity to clean it up
and document better.  See
  isDroppableCt :: Ct -> Bool
and Note [Dropping derived constraints]

I also removed wl_deriv altogether from the WorkList data type.  It
was there in the hope of gaining efficiency by not even processing
lots of derived constraints, but it has turned out that most derived
constraints (notably equalities) must be processed anyway; see
Note [Prioritise equalities] in TcSMonad.

The two are coupled because to decide which constraints to put in
wl_deriv I was using another variant of isDroppableCt.  Now it's much
simpler -- and perhaps even more efficient too.

(cherry picked from commit 6edafe3be0133fe69581fb3851a812c69ab9dbf7)

16 months agoFix utterly bogus TagToEnum rule in caseRules
Simon Peyton Jones [Wed, 7 Feb 2018 09:55:14 +0000 (09:55 +0000)] 
Fix utterly bogus TagToEnum rule in caseRules

In prelRules we had:

  tx_con_tte :: DynFlags -> AltCon -> AltCon
  tx_con_tte _      DEFAULT      = DEFAULT
  tx_con_tte dflags (DataAlt dc)
    | tag == 0  = DEFAULT   -- See Note [caseRules for tagToEnum]
    | otherwise = LitAlt (mkMachInt dflags (toInteger tag))

The tag==0 case is totally wrong, and led directly to Trac #14768.

See "Beware" in Note [caseRules for tagToEnum] (in the patch).

Easily fixed, though!

(cherry picked from commit 4aa98f4a3cb0c965c4df19af2f1ccc2c5483c3a5)

16 months agoUse SPDX syntax in rts/package.conf.in
Herbert Valerio Riedel [Wed, 7 Feb 2018 17:36:13 +0000 (18:36 +0100)] 
Use SPDX syntax in rts/package.conf.in

This was an oversight from 2671cccde749ed64129097358f81bff43480cdb9
as it wasn't obvious to assume one would go the trouble to manually
construct the pkg-db entries... :-)

(cherry picked from commit be53d19e08c8b6db338c9027db5a0635f470f32f)

16 months agoBump transformers submodule to 0.5.5.0 ghc-8.4.1-alpha3
Ben Gamari [Mon, 22 Jan 2018 01:09:20 +0000 (20:09 -0500)] 
Bump transformers submodule to 0.5.5.0

(cherry picked from commit 24e56ebd010846683b236b6ef3678c2217640120)

16 months agotestsuite: Add testcase for #14754
Ben Gamari [Sun, 4 Feb 2018 00:19:08 +0000 (19:19 -0500)] 
testsuite: Add testcase for #14754

(cherry picked from commit 606edbfba14b025ce85a02e5ed7c03e8a097d692)

16 months agocmm: Revert more aggressive CBE due to #14226
Ben Gamari [Sun, 4 Feb 2018 00:49:21 +0000 (19:49 -0500)] 
cmm: Revert more aggressive CBE due to #14226

Trac #14226 noted that the C-- CBE pass frequently fails to
common up semantically identical blocks due to the differences in local
register naming. These patches fixed this by making the pass consider
equality up to alpha-renaming.

However, the new logic failed to consider the possibility that local
register naming *may* matter across multiple blocks. This lead to the
regression #14754. I'll need to do a bit of thinking on a proper
solution to this but in the meantime I'm reverting all four patches.

This reverts commit a27056f9823f8bbe2302f1924b3ab38fd6752e37.
This reverts commit 6f990c54f922beae80362fe62426beededc21290.
This reverts commit 9aa73892e10e90a1799b9277da593e816a827364.
This reverts commit 7920a7d9c53083b234e060a3e72f00b601a46808.

(cherry picked from commit 50adbd7c5fe5894d3e6e2a58b353ed07e5f8949d)

16 months agoBump stm submodule to 2.4.5.0
Ben Gamari [Sat, 3 Feb 2018 21:23:05 +0000 (16:23 -0500)] 
Bump stm submodule to 2.4.5.0

16 months agointeger-gmp: Simplify gmp/configure invocation
Ben Gamari [Fri, 2 Feb 2018 18:58:14 +0000 (13:58 -0500)] 
integer-gmp: Simplify gmp/configure invocation

There weas lots of historical cruft to be found here. The `export
SHELLOPTS` breaks on NixOS due to bash syntax in the gcc wrapper script.

Reviewers: hvr

Subscribers: rwbarton, thomie, carter

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

(cherry picked from commit 3441b1455bf9f2e7cc9e064e3edae3607c70a1c0)

16 months agoDon't apply dataToTag's caseRules for data families
Ryan Scott [Sat, 3 Feb 2018 16:40:43 +0000 (11:40 -0500)] 
Don't apply dataToTag's caseRules for data families

Commit 193664d42dbceadaa1e4689dfa17ff1cf5a405a0 added a
special caseRule for `dataToTag`, but this transformation completely
broke when `dataToTag` was applied to somewith with a type headed by
a data family, leading to #14680. For now at least, the simplest
solution is to simply not apply this transformation when the type is
headed by a data family.

Test Plan: make test TEST=T14680

Reviewers: simonpj, bgamari

Reviewed By: bgamari

Subscribers: rwbarton, thomie, carter

GHC Trac Issues: #14680

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

(cherry picked from commit d8a0e6d322deaa3743c95a11a6b7272577d1f86e)

16 months agoghc-prim: Emulate C11 atomics when not available
Ben Gamari [Sat, 3 Feb 2018 16:37:01 +0000 (11:37 -0500)] 
ghc-prim: Emulate C11 atomics when not available

GCC's __sync primitives apparently "usually" imply a full barrier,
meaning they can be used to emulate the more precise C11 atomics albeit
with a loss of efficiency. This restores compatibility with GCC 4.4.

This partially reverts commit 59de290928e6903337f31c1f8107ac8a98ea145d.

Test Plan: Validate on Centos

Reviewers: hvr, simonmar, trommler

Subscribers: rwbarton, thomie, erikd, carter

GHC Trac Issues: #14244

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

(cherry picked from commit 217e4170bdce3df28a667803ce5e619553bfecdd)

16 months agoUpgrade containers submodule
David Feuer [Fri, 2 Feb 2018 18:58:28 +0000 (13:58 -0500)] 
Upgrade containers submodule

Reviewers: bgamari

Subscribers: rwbarton, thomie, carter

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

(cherry picked from commit fdf518c708dc5a34ae810c5d5f3a4db812d226f0)

16 months agoOption for LINE pragmas to get lexed into tokens
Alec Theriault [Fri, 26 Jan 2018 18:09:58 +0000 (13:09 -0500)] 
Option for LINE pragmas to get lexed into tokens

This adds a parser-level switch to have 'LINE' and 'COLUMN'
pragmas lexed into actual tokens (as opposed to updating the
position information in the parser).

'lexTokenStream' is the only place where this option is enabled.

Reviewers: bgamari, alexbiehl, mpickering

Reviewed By: mpickering

Subscribers: alanz, rwbarton, thomie, carter

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

(cherry picked from commit 9a57cfebd2e65109884712a27a0f29d1a71f57b7)