ghc.git
2 years agobase: Fix documentation for forkIOWithUnmask ghc-8.2.1-rc2
Ben Gamari [Fri, 5 May 2017 20:47:00 +0000 (16:47 -0400)] 
base: Fix documentation for forkIOWithUnmask

forkIOUnmasked has been deprecated for several years now. Update reference to
it. See #4858 and #5546.

(cherry picked from commit 1840121078718fb2a2fe5a7895501100517f627c)

2 years agotestsuite: add new test for desugar warnings/errors with -fno-code
doug [Fri, 5 May 2017 13:18:53 +0000 (09:18 -0400)] 
testsuite: add new test for desugar warnings/errors with -fno-code

Add a new (expect_broken) test T10600 that checks that the error:
Top-level bindings for unlifted types aren't allowed: is thrown when
compiling with -fno-code. This test currently fails because modules
compiled with -fno-code aren't desugared. There are several other errors
which can be thrown during desugaring that aren't tested for,
discoverable by grepping for "errDs".

Update .stderr files T8101 and T8101b. Presumably the compilation output
has changed slightly since they were written.

Reviewers: austin, bgamari

Reviewed By: bgamari

Subscribers: rwbarton, thomie

GHC Trac Issues: #10600, #8101

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

(cherry picked from commit c326665c3742bb97904f7096689d40246ce6397f)

2 years agoTcTypeable: Simplify
Ben Gamari [Thu, 4 May 2017 14:06:33 +0000 (10:06 -0400)] 
TcTypeable: Simplify

Simon pointed out that the zonk of the tyConKinds was redundant as tycon kinds
will never contain mutable variables. This allows us to remove tycon_kind.
Add a few commments clarifying the need to bring TyCon binders into scope before
typechecking bindings.

(cherry picked from commit c8e4d4b387d6d057dea98d6a595e3712f24289dc)

2 years agoCoreTidy: Don't seq unfoldings
Ben Gamari [Tue, 2 May 2017 15:36:47 +0000 (11:36 -0400)] 
CoreTidy: Don't seq unfoldings

Previously we would force uf_is_value and friends to ensure that we didn't
retain a reference to the pre-tidying template, resulting in a space leak.
Instead, we now just reinitialize these fields (despite the fact that they
should not have changed). This may result in a bit more computation, but most of
the time we won't ever evaluate them anyways, so the damage shouldn't be so bad.

See #13564.

(cherry picked from commit b3da6a6c3546562d5c5e83b8af5d3fd04c07e0c1)

2 years agoBump Cabal submodule to 2.0.0.0
Ben Gamari [Fri, 5 May 2017 14:51:57 +0000 (10:51 -0400)] 
Bump Cabal submodule to 2.0.0.0

2 years agohpc: Output a legend at the top of output files
Santiago Munin [Thu, 4 May 2017 19:10:54 +0000 (15:10 -0400)] 
hpc: Output a legend at the top of output files

Updates hpc submodule.

Reviewers: austin, bgamari

Subscribers: rwbarton, thomie

GHC Trac Issues: #11799

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

(cherry picked from commit 8a2c2476b300969514888cb2084d083f8d18b6b0)

2 years agoImplement sequential name lookup properly
Matthew Pickering [Thu, 4 May 2017 18:15:43 +0000 (14:15 -0400)] 
Implement sequential name lookup properly

Previously we would run all the monadic actions and then
combine their results. This caused problems if later actions
raised errors but earlier lookups suceeded. We only want to run later
lookups if the earlier ones fail.

Fixes #13622

Reviewers: RyanGlScott, austin, bgamari, simonpj

Reviewed By: simonpj

Subscribers: simonpj, rwbarton, thomie

GHC Trac Issues: #13622

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

(cherry picked from commit 1829d265662ca8d052df3e5df1aa1137b19e39ce)

2 years agoFix markdown for new GitHub Flavored Markdown
Takenobu Tani [Thu, 4 May 2017 18:19:37 +0000 (14:19 -0400)] 
Fix markdown for new GitHub Flavored Markdown

Delete whitespace between brackets.  Because Github Flavored Markdown
was changed [1].

[1]: https://githubengineering.com/a-formal-spec-for-github-markdown/

Test Plan: build

Reviewers: austin, bgamari

Reviewed By: bgamari

Subscribers: rwbarton, thomie

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

(cherry picked from commit 74f31539ce48a218922368ca62e1c3c6023f27a8)

2 years agoAdd regression test for #11616
Ryan Scott [Thu, 4 May 2017 18:19:26 +0000 (14:19 -0400)] 
Add regression test for #11616

The code in #11616 has been working for a while (ever since 8.0.1),
so let's add a regression test for it to put the nail in the coffin.

Test Plan: make test TEST=T11616

Reviewers: austin, bgamari

Reviewed By: bgamari

Subscribers: rwbarton, thomie

GHC Trac Issues: #11616

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

(cherry picked from commit 03ca391f14f97486fd1c66d9c9d99686ae25cc10)

2 years agoFix comment for compact region
Takenobu Tani [Thu, 4 May 2017 18:16:49 +0000 (14:16 -0400)] 
Fix comment for compact region

There were old module names:

 * Data.Compact -> GHC.Compact
 * Data.Compact.Internal -> GHC.Compact

This commit is for ghc-8.2 branch.

Test Plan: build

Reviewers: austin, bgamari, hvr, erikd, simonmar

Reviewed By: bgamari

Subscribers: rwbarton, thomie

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

(cherry picked from commit 4fcaf8e97db89b0c040ca33f0503faf3403b918f)

2 years agouser-guide: fix links to compact region
Takenobu Tani [Thu, 4 May 2017 18:16:32 +0000 (14:16 -0400)] 
user-guide: fix links to compact region

There were broken links in users_guide for compact region.

  * Data-Compact -> GHC-Compact
  * compact-@LIBRARY_compact_VERSION@ ->
ghc-compact-@LIBRARY_compact_VERSION@

This commit is for ghc-8.2 branch.

Test Plan: build

Reviewers: austin, bgamari

Reviewed By: bgamari

Subscribers: rwbarton, thomie

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

(cherry picked from commit 0b41bbcdef5f690e6a8f549787775a52e6b70c5b)

2 years agoPass -ffrontend-opt arguments to frontend plugin in the correct order
doug [Thu, 4 May 2017 18:16:17 +0000 (14:16 -0400)] 
Pass -ffrontend-opt arguments to frontend plugin in the correct order

Previously they were passed in the reverse order that they're specified
on the command line.

Add a haddock to frontendPluginOpts in DynFlags.hs.

Modify test frontend01 to cover the case of multiple -ffrontend-opt.

Reviewers: austin, bgamari

Reviewed By: bgamari

Subscribers: rwbarton, thomie

GHC Trac Issues: #13632

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

(cherry picked from commit db10b79994f7728cbaaa906c6f6eda0b6783df29)

2 years agoAdd an Eq instance for UniqSet
David Feuer [Thu, 4 May 2017 18:16:02 +0000 (14:16 -0400)] 
Add an Eq instance for UniqSet

I left that out by mistake, and it apparently breaks at least one
existing plugin.

Reviewers: christiaanb, austin, bgamari

Reviewed By: bgamari

Subscribers: rwbarton, thomie

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

(cherry picked from commit a660844c0859b7a2e76c15f2fb4abec209afea90)

2 years agoAdd test for #13320
David Feuer [Thu, 4 May 2017 17:17:34 +0000 (13:17 -0400)] 
Add test for #13320

Reviewers: austin, bgamari

Reviewed By: bgamari

Subscribers: rwbarton, thomie

GHC Trac Issues: #13320

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

(cherry picked from commit cb850e01560adf12e83fcf85f479636be17d017c)

2 years agoDeal with exceptions in dsWhenNoErrs
Simon Peyton Jones [Thu, 4 May 2017 12:33:04 +0000 (13:33 +0100)] 
Deal with exceptions in dsWhenNoErrs

Gracious me.  Ever since this patch

  commit 374457809de343f409fbeea0a885877947a133a2
  Author: Jan Stolarek <jan.stolarek@p.lodz.pl>
  Date:   Fri Jul 11 13:54:45 2014 +0200

      Injective type families

TcRnMonad.askNoErrs has been wrong. It looked like this

   askNoErrs :: TcRn a -> TcRn (a, Bool)
   askNoErrs m
    = do { errs_var <- newTcRef emptyMessages
         ; res  <- setErrsVar errs_var m
         ; (warns, errs) <- readTcRef errs_var
         ; addMessages (warns, errs)
         ; return (res, isEmptyBag errs) }

The trouble comes if 'm' throws an exception in the TcRn monad.
Then 'errs_var is never read, so any errors are simply lost.

This mistake was then propgated into DsMonad.dsWhenNoErrs, where
it gave rise to Trac #13642.

Thank to Ryan for narrowing it down so sharply.

I did some refactoring, as usual.

(cherry picked from commit e77019767fe5327011c6dc8fe089c64884120aab)

2 years agoTest #13585 in typecheck/should_compile/T13585
Richard Eisenberg [Tue, 2 May 2017 03:16:20 +0000 (23:16 -0400)] 
Test #13585 in typecheck/should_compile/T13585

(cherry picked from commit 6df8bef054db0b95bb8f9e55bb82580e27d251d6)

2 years agoFix #13233 by checking for lev-poly primops
Richard Eisenberg [Sun, 23 Apr 2017 18:16:32 +0000 (14:16 -0400)] 
Fix #13233 by checking for lev-poly primops

The implementation plan is all in Note [Detecting forced eta expansion]
in DsExpr.

(cherry picked from commit 16b0a07e5d0c72c1171359e546d9373442ec0564)

2 years agoFix #13333 by fixing the covar's type in ctEvCoercion
Richard Eisenberg [Sun, 23 Apr 2017 14:24:30 +0000 (10:24 -0400)] 
Fix #13333 by fixing the covar's type in ctEvCoercion

The change is noted in Note [Given in ctEvCoercion]. This patch
also adds a bit more commentary to TcFlatten, documenting some
key invariants of the flattening algorithm. While in the area,
I also removed some stale commentary from TcCanonical.

(cherry picked from commit 09bf135ace55ce2572bf4168124d631e386c64bb)

2 years agoUse mkCastTy in subst_ty.
Richard Eisenberg [Fri, 7 Apr 2017 15:39:51 +0000 (11:39 -0400)] 
Use mkCastTy in subst_ty.

This allows mkCastTy to maintain invariants. Much like how
we use mkAppTy in subst_ty.

(cherry picked from commit 466803a0e9628ccd5feb55d062e141e0972fc19c)

2 years agoShave the hair off mkCastTy.
Richard Eisenberg [Fri, 7 Apr 2017 15:38:37 +0000 (11:38 -0400)] 
Shave the hair off mkCastTy.

Previously, mkCastTy went to great lengths to shove casts
around. But this doesn't seem to be necessary. However,
the reflexivity check currently in mkCastTy is not enough.
See the abortive Note [No reflexive casts in types]

(cherry picked from commit ef0ff34d462e3780210567a13d58b868ec3399e0)

2 years agoComments only
Simon Peyton Jones [Tue, 25 Apr 2017 12:15:44 +0000 (13:15 +0100)] 
Comments only

(cherry picked from commit 4d5ab1f89ab4c082c10f67616ca4308d67923486)

2 years agoFix loss-of-SpecConstr bug
Simon Peyton Jones [Tue, 2 May 2017 11:04:44 +0000 (12:04 +0100)] 
Fix loss-of-SpecConstr bug

This bug, reported in Trac #13623 has been present since

  commit b8b3e30a6eedf9f213b8a718573c4827cfa230ba
  Author: Edward Z. Yang <ezyang@cs.stanford.edu>
  Date:   Fri Jun 24 11:03:47 2016 -0700

      Axe RecFlag on TyCons.

SpecConstr tries not to specialise indefinitely, and had a
limit (see Note [Limit recursive specialisation]) that made
use of info about whether or not a data constructor was
"recursive".  This info vanished in the above commit, making
the limit fire much more often -- and indeed it fired in this
test case, in a situation where specialisation is /highly/
desirable.

I refactored the test, to look instead at the number of
iterations of the loop of "and now specialise calls that
arise from the specialisation".  Actually less code, and
more robust.

I also added record field names to a couple of constructors,
and renamed RuleInfo to SpecInfo.

(cherry picked from commit 9e47dc451788cce20acb6a8208c56a7e4dbe246b)

2 years agoImprove SpecConstr when there are many opportunities
Simon Peyton Jones [Thu, 27 Apr 2017 10:15:00 +0000 (11:15 +0100)] 
Improve SpecConstr when there are many opportunities

SpecConstr has -fspec-contr-count=N which limits the maximum
number of specialisations we make for any particular function.
But until now, if that limit was exceeded we discarded all the
candidates!  So adding a new specialisaiton opportunity (by
adding a new call site, or improving the optimiser) could result
in less specialisation and worse performance.

This patch instead picks the top N candidates, resulting in
less brittle behaviour.

See Note [Choosing patterns].

(cherry picked from commit c46a600f320b25e0ac73107acdb12a33d7fbd9c3)

2 years agoBump haddock submodule
Ben Gamari [Tue, 2 May 2017 00:44:42 +0000 (20:44 -0400)] 
Bump haddock submodule

Fixes previously buggy commit

2 years agoPPC NCG: Lower MO_*_Fabs as PowerPC fabs instruction
Peter Trommler [Mon, 1 May 2017 15:17:25 +0000 (11:17 -0400)] 
PPC NCG: Lower MO_*_Fabs as PowerPC fabs instruction

In Phab:D3265 we introduced MO_F32_Fabs and MO_F64_Fabs.
This patch improves code generation by generating PowerPC fabs
instructions.

Test Plan: run numeric/should_run/numrun015 or validate

Reviewers: austin, bgamari, hvr, simonmar, erikd

Reviewed By: erikd

Subscribers: rwbarton, thomie

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

(cherry picked from commit 068af0162a47b1fd7809d056ccc2d80e480d53f5)

2 years agoAvoid excessive space usage from unfoldings in CoreTidy
Reid Barton [Mon, 1 May 2017 15:17:47 +0000 (11:17 -0400)] 
Avoid excessive space usage from unfoldings in CoreTidy

Test Plan: validate

Reviewers: austin, bgamari

Reviewed By: bgamari

Subscribers: thomie

GHC Trac Issues: #13564

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

(cherry picked from commit 5c602d2228d28530621cc6c94fbb736b13f474fb)

2 years agoBump haddock submodule
Ben Gamari [Mon, 1 May 2017 15:41:41 +0000 (11:41 -0400)] 
Bump haddock submodule

2 years agoFix capitalization in message for #13609
Ben Gamari [Mon, 1 May 2017 15:06:08 +0000 (11:06 -0400)] 
Fix capitalization in message for #13609

I had meant to do this before merging but forgot.

(cherry picked from commit c04bd55a8daaf254436cef02934215d0b4ccfa2f)

2 years agotestsuite: Add test for #13609
Ben Gamari [Mon, 1 May 2017 03:19:26 +0000 (23:19 -0400)] 
testsuite: Add test for #13609

(cherry picked from commit 18fbb9d32cbc157e3bbd235e392f1625f77321e3)

2 years agoIgnore ANN pragmas with no TH and no external interpreter.
Shea Levy [Mon, 1 May 2017 03:20:54 +0000 (23:20 -0400)] 
Ignore ANN pragmas with no TH and no external interpreter.

Reviewers: hvr, austin, bgamari, RyanGlScott

Reviewed By: bgamari

Subscribers: angerman, RyanGlScott, rwbarton, thomie

GHC Trac Issues: #13609

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

(cherry picked from commit 7567b9ddba7c4304e8d0226e9bf82a054f37ce91)

2 years agoBump unix submodule
Ben Gamari [Sun, 30 Apr 2017 23:15:27 +0000 (19:15 -0400)] 
Bump unix submodule

2 years agoBump array submodule
Ben Gamari [Sun, 30 Apr 2017 23:15:06 +0000 (19:15 -0400)] 
Bump array submodule

2 years agoBump Cabal submodule
Ben Gamari [Sun, 30 Apr 2017 23:14:33 +0000 (19:14 -0400)] 
Bump Cabal submodule

2 years agoBump haddock submodule
Ben Gamari [Sun, 30 Apr 2017 16:53:38 +0000 (12:53 -0400)] 
Bump haddock submodule

2 years agoDon't setProgramDynFlags on every :load
Simon Marlow [Thu, 30 Mar 2017 09:31:08 +0000 (10:31 +0100)] 
Don't setProgramDynFlags on every :load

Summary:
setProgramDynFlags invalidates the whole module graph, forcing
everything to be re-summarised (including preprocessing) on every
:reload.

Looks like this was a bad regression in 8.0, but we didn't notice
because there was no test for it.  Now there is!

Test Plan:
* validate
* new unit test

Reviewers: bgamari, triple, austin, niteria, erikd, jme

Subscribers: rwbarton, thomie

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

(cherry picked from commit 914842e518bccafac16b3495bcec56be58b0387a)

2 years agoPPC NCG: Implement callish prim ops
Peter Trommler [Tue, 25 Apr 2017 22:37:16 +0000 (18:37 -0400)] 
PPC NCG: Implement callish prim ops

Provide PowerPC optimised implementations of callish prim ops.

MO_?_QuotRem
The generic implementation of quotient remainder prim ops uses
a division and a remainder operation. There is no remainder on
PowerPC and so we need to implement remainder "by hand" which
results in a duplication of the divide operation when using the
generic code.

Avoid this duplication by implementing the prim op in the native
code generator.

MO_U_Mul2
Use PowerPC's instructions for long multiplication.

Addition and subtraction
Use PowerPC add/subtract with carry/overflow instructions

MO_Clz and MO_Ctz
Use PowerPC's CNTLZ instruction and implement count trailing
zeros using count leading zeros

MO_QuotRem2
Implement an algorithm given by Henry Warren in "Hacker's Delight"
using PowerPC divide instruction. TODO: Use long division instructions
when available (POWER7 and later).

Test Plan: validate on AIX and 32-bit Linux

Reviewers: simonmar, erikd, hvr, austin, bgamari

Reviewed By: erikd, hvr, bgamari

Subscribers: trofi, kgardas, thomie

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

(cherry picked from commit 89a3241f708502e8fbcfaddbbe634790ad9cd02a)

2 years agoCSE: Fix cut and paste error
Ben Gamari [Fri, 28 Apr 2017 17:25:17 +0000 (13:25 -0400)] 
CSE: Fix cut and paste error

extendCSRecEnv took the map to be extended from cs_map instead of
cs_rec_map.  Oops!

Test Plan: Validate

Reviewers: simonpj, austin

Subscribers: rwbarton, thomie

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

(cherry picked from commit 9f9b90f1fb85fef568f535664f55c4674603e65b)

2 years agoMake the tyvars in TH-reified data family instances uniform
Ryan Scott [Fri, 28 Apr 2017 17:24:31 +0000 (13:24 -0400)] 
Make the tyvars in TH-reified data family instances uniform

It turns out we were using two different sets of type variables when
reifying data family instances in Template Haskell. We were using the
tyvars quantifying over the instance itself for the LHS, but using the
tyvars quantifying over the data family instance constructor for the
RHS. This commit uses the instance tyvars for both the LHS and the RHS,
fixing #13618.

Test Plan: make test TEST=T13618

Reviewers: goldfire, austin, bgamari

Reviewed By: goldfire, bgamari

Subscribers: rwbarton, thomie

GHC Trac Issues: #13618

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

(cherry picked from commit b2c38d6b4003d3dda60d15204283da5aab15c2ec)

2 years agoAdd regression test for #12104
Ryan Scott [Fri, 28 Apr 2017 17:24:11 +0000 (13:24 -0400)] 
Add regression test for #12104

Commit 2f9f1f86849ebc18af409c9b3fd809c9cd464021
(#13487) fixes #12104 as well. This adds a regression test for the
program reported in #12104 to keep it fixed.

Test Plan: make test TEST=T12104

Reviewers: bgamari, austin

Reviewed By: bgamari

Subscribers: rwbarton, thomie

GHC Trac Issues: #12104

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

(cherry picked from commit 69b9b853e3e68191cdfa8aec0e4da966298a2659)

2 years agoAdd a missing addDeferredBinding
Simon Peyton Jones [Wed, 5 Apr 2017 12:39:51 +0000 (13:39 +0100)] 
Add a missing addDeferredBinding

I'd forgotten to add deferred bindings for user type
errors.  Fixes Trac #13487.

(cherry picked from commit 2f9f1f86849ebc18af409c9b3fd809c9cd464021)

2 years agoget-win32-tarballs: Grab perl tarball from haskell.org, not GitHub
Ben Gamari [Fri, 28 Apr 2017 17:20:14 +0000 (13:20 -0400)] 
get-win32-tarballs: Grab perl tarball from haskell.org, not GitHub

Reviewers: austin, dfeuer

Reviewed By: dfeuer

Subscribers: Phyx, rwbarton, thomie

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

(cherry picked from commit ba597c1dd1daf9643b72dc7aeace8d6b3fce84eb)

2 years agoBe a bit more eager to inline in a strict context
Simon Peyton Jones [Thu, 27 Apr 2017 16:42:01 +0000 (17:42 +0100)] 
Be a bit more eager to inline in a strict context

If we see f (g x), and f is strict, we want to be a bit more eager to
inline g, because it may well expose an eval (on x perhaps) that can
be eliminated or shared.

I saw this in nofib boyer2, function RewriteFuns.onewayunify1.  It
showed up as a consequence of the preceding patch that makes the
simplifier do less work (Trac #13379).  We had

   f d (g x)

where f was a class-op. Previously we simplified both d and
(g x) with a RuleArgCtxt (making g a bit more eager to inline).
But now we simplify only d that way, then fire the rule, and
only then simplify (g x).  Firing the rule produces a strict
funciion, so we want to make a strict function encourage
inlining a bit.

(cherry picked from commit 29d88ee173bc9b04245a33d5268dda032f5dc331)

2 years agoCure exponential behaviour in the simplifier
Simon Peyton Jones [Wed, 26 Apr 2017 16:31:36 +0000 (17:31 +0100)] 
Cure exponential behaviour in the simplifier

This patch nails a Bad Bug exposed in Trac #13379. Roughly,
a deeply-nested application like
   f (f (f ....) ) )
could make the simplifier go exponential -- without producing
an exponential-sized result!

The reason was that we
  - simplified a (big) function argument
  - then decided to inline the function
  - then preInilneUnconditionally the argument
  - and then re-simplified the big argument

And if the "big argument" itself had a similar structure
things could get very bad.

Once I'd understood, it was easy to fix:

* See Note Note [Avoiding exponential behaviour] for an overview

* The key change is that Simplify.simplLam now as a case for
  (isSimplified dup). This is what removes the perf bug.

* But I also made simplCast more parsimonious about simplifying,
  avoiding doing so when the coercion is Refl

* And similarly I now try to avoid simplifying arguments
  where possible before applying rules.
  See Note [Trying rewrite rules]

The latter two points tackle common cases, and in those cases make the
simplifier take fewer iterations.

(cherry picked from commit a1b753e8b1475659440f524b3e66dfbea31c5787)

2 years agoDo Note [Improving seq] always
Simon Peyton Jones [Fri, 7 Apr 2017 15:19:56 +0000 (16:19 +0100)] 
Do Note [Improving seq] always

This patch fixes Trac #13468, and at the same time makes the
code simpler and more uniform.  In particular, I've eliminated
the awkward conflict between the old built-in rule for seq
(which elimianted a cast), and the desire to make case scrutinse
a data type by doing type-family reduction (which adds a cast).

Nice.

(cherry picked from commit f0d98fc6cdde26bf43a04d9f01b6ad2f4c88f0b9)

2 years agoPrint module when dumping rules
Matthew Pickering [Wed, 29 Mar 2017 20:08:40 +0000 (16:08 -0400)] 
Print module when dumping rules

It is sometimes hard to find where a rule is defined. Printing the
module where it comes from will make it much easier to find.

Reviewers: austin, bgamari

Reviewed By: bgamari

Subscribers: rwbarton, thomie

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

(cherry picked from commit 04ea4c3f86db4e2cc7b2683f58f2076233039ebf)

2 years agoBump process to 1.6
Ben Gamari [Fri, 21 Apr 2017 16:45:40 +0000 (12:45 -0400)] 
Bump process to 1.6

Also bumps hsc2hs submodule due to version bound bump.

(cherry picked from commit 2744c94124a0cfe18e589974e77b0283b28f210f)

2 years agoDocument mkWeak#
Ben Gamari [Tue, 25 Apr 2017 22:39:58 +0000 (18:39 -0400)] 
Document mkWeak#

Reviewers: simonmar, austin

Reviewed By: simonmar

Subscribers: RyanGlScott, rwbarton, thomie

GHC Trac Issues: #10640, #13611

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

(cherry picked from commit 244602697c30e03ba63076941e4742ceeb78dd7c)

2 years agoDon't describe tuple sections as "Python-style"
Chris Martin [Sat, 22 Apr 2017 22:26:22 +0000 (18:26 -0400)] 
Don't describe tuple sections as "Python-style"

(cherry picked from commit 960589e89da3dbf60e88042d7e064ad4a98fb2ff)
(cherry picked from commit 688272ba31df7bd0a094c3d86d60f7b77b9f5268)

2 years agoRevert "Remove special casing of Windows in generic files"
Ben Gamari [Tue, 25 Apr 2017 13:28:40 +0000 (09:28 -0400)] 
Revert "Remove special casing of Windows in generic files"

This commit didn't consider the fact that binary distributions on Windows must
have relative toolchain paths. This caused #13560.

This reverts commit 48385cb2fc295eb8af9188cbe140142c1807d5a7 (except for a
helpful comment).

(cherry picked from commit 66108864540601837ad77847f4062a670362361f)

2 years agoAdd regression test for #13603
Ryan Scott [Mon, 24 Apr 2017 14:47:51 +0000 (10:47 -0400)] 
Add regression test for #13603

Commit b207b536ded40156f9adb168565ca78e1eef2c74 (#11714) happened to
fix #13603 as well. Let's add a regression test so that it stays fixed.

Test Plan: make test TEST=T13603

Reviewers: bgamari, austin, simonpj

Reviewed By: bgamari, simonpj

Subscribers: simonpj, rwbarton, thomie

GHC Trac Issues: #13603

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

(cherry picked from commit ab27fdcfe26759f3e4cd7e2105e7e7e83e269e48)

2 years agoUpdate Cabal submodule, with necessary wibbles.
Edward Z. Yang [Wed, 26 Apr 2017 19:26:56 +0000 (15:26 -0400)] 
Update Cabal submodule, with necessary wibbles.

Test Plan: validate

Reviewers: bgamari, austin

Reviewed By: bgamari

Subscribers: rwbarton, thomie

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

(cherry picked from commit 579bb7669f40ed01841dd197ee535cf26fa19580)

2 years agotestsuite/driver: Fix deletion retry logic on Windows
Ben Gamari [Mon, 24 Apr 2017 13:41:56 +0000 (09:41 -0400)] 
testsuite/driver: Fix deletion retry logic on Windows

Previously rmtree's error callback would throw an exception, breaking
out of the retry loop.

Test Plan: Validate on Windows

Reviewers: Phyx, austin

Reviewed By: Phyx

Subscribers: rwbarton, thomie

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

(cherry picked from commit 6f9f5ff16599814d8b10869be6dd424a5f7645d8)

2 years agoDisable terminfo, if we don’t build it.
Moritz Angermann [Mon, 24 Apr 2017 13:38:14 +0000 (09:38 -0400)] 
Disable terminfo, if we don’t build it.

This is a derivation of a patch from @jophish.

This is necessary due to `haskeline`'s `terminfo` flag being marked as
`Manual` as of 43d7fa106027fcd4ec7f443923a8dd5b8c169f9c.

Reviewers: jophish, bgamari, austin

Reviewed By: bgamari

Subscribers: rwbarton, thomie, jophish

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

(cherry picked from commit d5cb4d2b7fab89ea1c3fc74da2317f86e75816ea)

2 years agoDocument the kind generalization behavior observed in #13555
Ryan Scott [Sun, 23 Apr 2017 14:02:45 +0000 (10:02 -0400)] 
Document the kind generalization behavior observed in #13555

The conclusion of #13555 was that a program which began to fail to
typecheck (starting in GHC 8.2) was never correct to begin with. Let's
document why this is the case with respect to `MonoLocalBinds`'
interaction with kind generalization. Also adds the reported program as
a `compile_fail` testcase.

Test Plan: make test TEST=T13555 # Also, read the docs

Reviewers: goldfire, simonpj, austin, bgamari

Reviewed By: goldfire, simonpj, bgamari

Subscribers: rwbarton, thomie

GHC Trac Issues: #13555

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

(cherry picked from commit 18c3a7ea0f7577514721feadefd9a62c228edb60)

2 years agoExport function for use in GHC API
Alan Zimmerman [Sun, 23 Apr 2017 16:53:33 +0000 (18:53 +0200)] 
Export function for use in GHC API

(cherry picked from commit 1f4fd37efac4795493677d5df81c83d22eac5f74)

2 years agoghc.mk: fix 'make install' for cross-mingw32
Sergei Trofimovich [Sun, 23 Apr 2017 14:31:13 +0000 (15:31 +0100)] 
ghc.mk: fix 'make install' for cross-mingw32

Attempt to install cross-compiled mingw32 GHC built on linux failed as:

    $ make install DESTDIR=$(pwd)/__i__

    "mv" "$(pwd)/__i__/usr/local/lib/ghc-8.3.20170422/bin/ghc-stage2" \
         "$(pwd)/__i__/usr/local/lib/ghc-8.3.20170422/bin/ghc"
    mv: failed to stat
         '$(pwd)/__i__/usr/local/lib/ghc-8.3.20170422/bin/ghc-stage2': \
         No such file or directory

The rename should not be performed for windows targets.

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

2 years agoghc: tweak cross-compilation to mingw32
Sergei Trofimovich [Sun, 23 Apr 2017 14:10:26 +0000 (15:10 +0100)] 
ghc: tweak cross-compilation to mingw32

The build failure when cross-compiling from
linux to windows looks like:

    HC [stage 1] ghc/stage2/build/tmp/ghc-stage2.exe
      Call hs_init_ghc() from your main() function to set these options.
  /usr/libexec/gcc/i686-w64-mingw32/ld: cannot find -lHSghc-8.3-0

Similar to commit 745032dd02da511067c2939259ed212852187e0f
("rts: tweak cross-compilation to mingw32") decision to split
stage2 should be done based based on TargetOS, not HostOS.

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

2 years agoFix compilation for !HAVE_FLOCK
Herbert Valerio Riedel [Sun, 23 Apr 2017 13:41:50 +0000 (15:41 +0200)] 
Fix compilation for !HAVE_FLOCK

(cherry picked from commit 2fa6873faf16a0f3b23742222a00f0647554395b)

2 years agoMinor reordering of `#include`s fixing compilation on AIX
Herbert Valerio Riedel [Sun, 23 Apr 2017 13:28:52 +0000 (15:28 +0200)] 
Minor reordering of `#include`s fixing compilation on AIX

This helps ensure that system includes on some more fragile
platforms (like e.g. AIX) see a more consistent set of CPP defines,
and consequently reduce the risk of conflicting typdefs/prototypes
being exposed.

(cherry picked from commit 0d975a623d6ad51ceb34bdb218a2d0f4a0448de6)

2 years agorts: tweak cross-compilation to mingw32
Sergei Trofimovich [Sun, 23 Apr 2017 10:44:45 +0000 (11:44 +0100)] 
rts: tweak cross-compilation to mingw32

Found the problem on x86_64-linux host where
I tried to cross-compile GHC to windows as:

    $ ./configure --target=i686-w64-mingw32 \
                  Windres=i686-w64-mingw32-windres \
                  DllWrap=i686-w64-mingw32-dllwrap

As a result build failed as POSIX bits of RTS.
For example 'rts/posix/OSMem.c' contains unix-specific
mmap() syscalls and constants and thus can't be compiled
by i686-w64-mingw32 toolchain.

It's caused by the following part of 'rts/ghc.mk':

  ifeq "$(HostOS_CPP)" "mingw32"
  ALL_DIRS += win32
  else
  ALL_DIRS += posix
  endif

In our case _CPP variables are defined this way (project.mk):
  BuildOS_CPP                = linux
  HostOS_CPP                 = linux
  TargetOS_CPP               = mingw32

RTS should never be built for 'BuildOS' or 'HostOS' as it's
always built by ghc-stage1 (targeted at TargetOS).

The change is to flip 'HostOS_CPP' to 'TargetOS_CPP' in 'rts/ghc.mk'.

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

2 years agoaclocal.m4: treat '*-w64-mingw32' targets as windows
Sergei Trofimovich [Sun, 23 Apr 2017 10:25:29 +0000 (11:25 +0100)] 
aclocal.m4: treat '*-w64-mingw32' targets as windows

Noticed when tried to cross-compile GHC from x86_64-linux
to --target=i686-w64-mingw32. Final ghc executables did
not have '.exe' extensions.

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

2 years agoconfigure.ac: print paths to dllwrap and windres
Sergei Trofimovich [Sun, 23 Apr 2017 10:22:44 +0000 (11:22 +0100)] 
configure.ac: print paths to dllwrap and windres

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

2 years agoconfigure.ac: print resolved 'ar' and 'ranlib' tools
Sergei Trofimovich [Mon, 17 Apr 2017 08:40:17 +0000 (09:40 +0100)] 
configure.ac: print resolved 'ar' and 'ranlib' tools

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

2 years agoUse non-canocalized triple as cross-compiler prefix
Sergei Trofimovich [Thu, 6 Apr 2017 07:51:22 +0000 (08:51 +0100)] 
Use non-canocalized triple as cross-compiler prefix

I've noticed the problem when tried to install
cross-compiler using following configuration:

    $ ./configure --target=s390x-unknown-linux-gnu
    make install Stage1Only=YES

Instead of expected tool prefix
    's390x-unknown-linux-gnu-'
Result was:
    's390x-ibm-linux-gnu-'

It's problematic as installed binaries appear in
unpredictable location.

The problem is caused by use of ${target} autoconf variable.
${target} contains a canocalized triplet.

Luckily we already have non-canonucalized target triplet
in ${TargetPlatformFull} variable. The change uses that
instead.

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

2 years agoUpdate haddock submodule
Ben Gamari [Sun, 23 Apr 2017 13:49:33 +0000 (09:49 -0400)] 
Update haddock submodule

2 years agoEdit eventlog-formats.rst to match implementation
Mitsutoshi Aoe [Sun, 16 Apr 2017 21:08:25 +0000 (06:08 +0900)] 
Edit eventlog-formats.rst to match implementation

* Add missing filters in EVENT_HEAP_PROF_BEGIN and reorder them
* EVENT_HEAP_PROF_SAMPLE_COST_CENTRE isn't used in retainer profiling
* Modify EVENT_HEAP_PROF_SAMPLE_STRING's format
* Biography break-down isn't implemented

(cherry picked from commit 9dd20a3fa523a9986a29f538dee7a570be72a677)

2 years agoFix build on DragonflyBSD
Ben Gamari [Fri, 21 Apr 2017 16:11:41 +0000 (12:11 -0400)] 
Fix build on DragonflyBSD

Test Plan: Validate on DragonflyBSD

Reviewers: austin, erikd, simonmar

Reviewed By: erikd

Subscribers: rwbarton, thomie

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

(cherry picked from commit cfff183f9ebcbe8ec4df9dcf39e95ac077d6e312)

2 years agobase: Fix hWaitForInput with timeout on POSIX
Ben Gamari [Fri, 21 Apr 2017 16:11:28 +0000 (12:11 -0400)] 
base: Fix hWaitForInput with timeout on POSIX

This was previously broken (#13252) by
f46369b8a1bf90a3bdc30f2b566c3a7e03672518, which ported the fdReady
function from `select` to `poll` and in so doing dropping support for
timeouts. Unfortunately, while `select` tells us the amount of time not
slept (on Linux anyways; it turns out this is implementation dependent),
`poll` does not give us this luxury. Consequently, we manually need to
track time slept in this case.

Unfortunately, portably measuring time is hard. Ideally we would use
`clock_gettime` with the monotonic clock here, but sadly this isn't
supported on most versions of Darwin. Consequently, we instead use
`gettimeofday`, running the risk of system time changes messing us up.

Test Plan: Validate

Reviewers: simonmar, austin, hvr

Reviewed By: simonmar

Subscribers: rwbarton, thomie

GHC Trac Issues: #13252

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

(cherry picked from commit e5732d2a28dfb8a754ee73e124e3558222a543bb)

2 years agobase: Add test for #13525
Ben Gamari [Wed, 5 Apr 2017 00:48:20 +0000 (20:48 -0400)] 
base: Add test for #13525

Reviewers: austin, hvr

Subscribers: rwbarton, thomie

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

(cherry picked from commit 3d523fd990bbb31ca97ea22059ec9d53f0705d8c)

2 years agobase: Fix offset initialization of Windows hLock implementation
Ben Gamari [Fri, 21 Apr 2017 16:10:33 +0000 (12:10 -0400)] 
base: Fix offset initialization of Windows hLock implementation

The previous implementation swapped the buffer size with the byte to be
set, essentially resulting in an uninitialized buffer.

Test Plan: Validate on Windows

Reviewers: austin, hvr

Subscribers: rwbarton, thomie

GHC Trac Issues: #13599

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

(cherry picked from commit e134af010bdd0d2a94fbfd68e0605dc55e1be3a8)

2 years agoBump parallel submodule
Ben Gamari [Fri, 21 Apr 2017 17:16:43 +0000 (13:16 -0400)] 
Bump parallel submodule

2 years agoBump unix submodule
Ben Gamari [Fri, 21 Apr 2017 17:11:07 +0000 (13:11 -0400)] 
Bump unix submodule

2 years agoBump time submodule
Ben Gamari [Fri, 21 Apr 2017 16:42:50 +0000 (12:42 -0400)] 
Bump time submodule

2 years agoBump filepath submodule
Ben Gamari [Fri, 21 Apr 2017 16:39:35 +0000 (12:39 -0400)] 
Bump filepath submodule

2 years agoBump deepseeq submodule
Ben Gamari [Fri, 21 Apr 2017 16:36:33 +0000 (12:36 -0400)] 
Bump deepseeq submodule

2 years agoBump haskeline and terminfo submodules
Ben Gamari [Fri, 21 Apr 2017 15:33:47 +0000 (11:33 -0400)] 
Bump haskeline and terminfo submodules

2 years agotestsuite: disable 'optllvm' for unregisterised compiler
Sergei Trofimovich [Thu, 20 Apr 2017 19:13:25 +0000 (20:13 +0100)] 
testsuite: disable 'optllvm' for unregisterised compiler

commit 74615f412ad3de2910a156ff494bfe5497fada7e
("UNREG: ignore -fllvm (Trac #13495)") enabled
'optllvm' tests to be ran in 'make fulltest' mode.

As a result many (~1000) tests fail due to stderr misamatch:
  +when making flags consistent: warning:
  +    Compiler unregisterised, so compiling via C

The change removes 'optllvm' tests for unregisterised compiler.

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

2 years agoutils: Lazily decode UTF8 strings
Ben Gamari [Mon, 17 Apr 2017 16:26:56 +0000 (12:26 -0400)] 
utils: Lazily decode UTF8 strings

Reviewers: austin, hvr

Subscribers: rwbarton, thomie

GHC Trac Issues: #13527

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

(cherry picked from commit 1cc82d38759c7a5f527ccc6cb514b8ba576cc3d1)

2 years agoCaret diag.: Avoid decoding whole module if only specific line is needed
alexbiehl [Mon, 17 Apr 2017 16:51:10 +0000 (12:51 -0400)] 
Caret diag.: Avoid decoding whole module if only specific line is needed

Before we were decoding the whole file to get to the desired line. This
patch introduces a fast function which searches a StringBuffer for the
desired line so we only need to utf8 decode a little portion.

This is especially interesting if we have big modules with lots of
warnings.

Reviewers: austin, bgamari, Rufflewind, trofi

Reviewed By: Rufflewind, trofi

Subscribers: rwbarton, thomie

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

(cherry picked from commit 065be6e9eb5114c5f0e3a20626ec93042ce47f13)

2 years agoUpdate xhtml submodule to potential 3000.2.2 release commit
Herbert Valerio Riedel [Tue, 18 Apr 2017 15:22:50 +0000 (17:22 +0200)] 
Update xhtml submodule to potential 3000.2.2 release commit

(cherry picked from commit 765a2e71f3dcc35fbe4b70677a67613c285dce60)

2 years agoAllow qualified names to be children in export lists
Matthew Pickering [Wed, 12 Apr 2017 18:10:54 +0000 (14:10 -0400)] 
Allow qualified names to be children in export lists

When doing this I noticed a horrible amount of duplication between
lookupSubBndrOcc and lookupExportChild (which I am responsible for).
I opened #13545 to keep track of this.

Reviewers: austin, bgamari

Reviewed By: bgamari

Subscribers: rwbarton, thomie

GHC Trac Issues: #13528

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

(cherry picked from commit fa5a73f0a86908da31ec72ce33d37a7a704a0600)

2 years agoYet more work on TcSimplify.simplifyInfer
Simon Peyton Jones [Wed, 12 Apr 2017 14:09:37 +0000 (15:09 +0100)] 
Yet more work on TcSimplify.simplifyInfer

The proximate cause for this patch is Trac #13482, which pointed out
further subtle interactions between
   - Inferring the most general type of a function
   - A partial type signature for that function

That led me into /further/ changes to the shiny new stuff in
TcSimplify.simplifyInfer, decideQuantification, decideMonoTyVars,
and related functions.

Happily, I was able to make some of it quite a bit simpler,
notably the bit about promoting free tyvars.  I'm happy with
the result.

Moreover I fixed Trac #13524 at the same time.  Happy days.

(cherry picked from commit 0ae72512255ba66ef89bdfeea65a23ea6eb35124)

2 years agotestsuite: Add test for #13524
Ben Gamari [Wed, 5 Apr 2017 00:47:20 +0000 (20:47 -0400)] 
testsuite: Add test for #13524

Reviewers: austin

Subscribers: rwbarton, thomie

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

(cherry picked from commit 5b7f504f3c190375903b57a541338bc939ca2dae)

2 years agoTypos in manual and comments
Gabor Greif [Tue, 14 Mar 2017 11:38:50 +0000 (12:38 +0100)] 
Typos in manual and comments

(cherry picked from commit 50512c6b2bd878f0be5e1c7b85cadf22094aaa5a)

2 years agotestsuite: Bump up timeout multiplier on T11195
Ben Gamari [Tue, 4 Apr 2017 22:04:07 +0000 (18:04 -0400)] 
testsuite: Bump up timeout multiplier on T11195

This has been failing a bit too often (on CI machines under load).

(cherry picked from commit 932b469687e17b7694f930314267899a10935cbe)

2 years ago[Elf/arm] Thumb indicator bit only for STT_FUNC
Moritz Angermann [Tue, 11 Apr 2017 01:39:19 +0000 (21:39 -0400)] 
[Elf/arm] Thumb indicator bit only for STT_FUNC

Reviewers: rwbarton, bgamari, austin, erikd, simonmar, trofi

Reviewed By: trofi

Subscribers: trofi, thomie

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

(cherry picked from commit e662a6cb9fb6459e0a15abbff25ae7b80f91b281)

2 years agobase: Fix erroneous reference to Data.Reflection in documentation
Ben Gamari [Mon, 10 Apr 2017 18:07:42 +0000 (14:07 -0400)] 
base: Fix erroneous reference to Data.Reflection in documentation

(cherry picked from commit 40a2ed058785d6caaf38d938f51659476622b29b)

2 years agoAdd a second regression test for #13536
Joachim Breitner [Mon, 10 Apr 2017 15:21:52 +0000 (11:21 -0400)] 
Add a second regression test for #13536

which counts allocations instead of observing recomputation directly.

(cherry picked from commit ddc05912565aedd6ef46236906fa06cdb3e5e06c)

2 years agoStgCse: Do not re-use trivial case scrutinees
Joachim Breitner [Sun, 9 Apr 2017 23:40:02 +0000 (19:40 -0400)] 
StgCse: Do not re-use trivial case scrutinees

as they might be marked as one-shot, and suddenly we’d evaluate them
multiple times. This came up in #13536 (test cases included).

The solution was layed out by SPJ in ticket:13536#comment:12.

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

(cherry picked from commit b55f310d06b8d3988d40aaccc0ff13601ee52b84)

2 years agoParenthesize type/data families correctly for -ddump-splices
Alan Zimmerman [Sun, 9 Apr 2017 19:06:06 +0000 (21:06 +0200)] 
Parenthesize type/data families correctly for -ddump-splices

Fix a regression in the pretty-printed code for -ddump-splices, which regressed
since 8.0.

Closes trac issue #13550

(cherry picked from commit 5282bb1772ba3f1dc999a177965e543822f342a0)

2 years agoImprove `readChan` documentation:
Ömer Sinan Ağacan [Mon, 10 Apr 2017 17:36:45 +0000 (20:36 +0300)] 
Improve `readChan` documentation:

- Mention that the read end is an `MVar`, so fairness guarantees are
  inherited.

- Mention that it can throw `BlockedIndefinitelyOnMVar` exception.

Reviewers: austin, hvr, bgamari

Reviewed By: bgamari

Subscribers: rwbarton, thomie

GHC Trac Issues: #5466

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

(cherry picked from commit 42ef0845d0d2a7cc524e7048502f651d66f6a543)

2 years agoYet another attempt at inferring the right quantification
Simon Peyton Jones [Wed, 5 Apr 2017 12:46:03 +0000 (13:46 +0100)] 
Yet another attempt at inferring the right quantification

TcSimplify.decideQuantification is truly a tricky function!
Trac #13509 showed that we were being over-eager with defaulting
of runtime-rep variables (levity polymorphism), which meant that
a program was wrongly rejected, and with a very odd error message
(c.f. Trac #13530)

I spent an unreasonably long time figuring out how to fix this
in a decent way, and ended up with a major refactoring of
decideQuantification, with a kock-on effect in simplifyInfer.

It is at least a bit more comprehensible now; but I still
can't say I like it.

(cherry picked from commit bac95f9de5bd8d0a647a3a1e4492497603c2fda2)

2 years agoFix TcSimplify.decideQuantification for kind variables
Simon Peyton Jones [Fri, 10 Mar 2017 11:20:00 +0000 (11:20 +0000)] 
Fix TcSimplify.decideQuantification for kind variables

TcSimplify.decideQuantification was doing the Wrong Thing when
"growing" the type variables to quantify over. We were trying to do
this on a tyvar set where we'd split off the dependent type varaibles;
and we just got it wrong.  A kind variable wasn't being generalised
properly, with confusing knock on consequences.

All this led to Trac #13371 and Trac #13393.

This commit tidies it all up:

* The type TcDepVars is renamed as CandidateQTvs;
  and splitDepVarsOfType to candidateQTyVarsOfType

* The code in TcSimplify.decideQuantification is simpler.
  It no longer does the tricky "grow" stuff over TcDepVars.
  Instead it use ordinary VarSets (thereby eliminating the
  nasty growThetaTyVarsDSet) and uses that to filter the
  result of candidateQTyVarsOfType.

* I documented that candidateQTyVarsOfType returns the type
  variables in a good order in which to quantify, and rewrote
  it to use an accumulator pattern, so that we would predicatably
  get left-to-right ordering.

In doing all this I also made UniqDFM behave a little more nicely:

* When inserting an element that is there already, keep the old tag,
  while still overwriting with the new value.

* This means that when doing udfmToList we get back elements in the
  order they were originally inserted, rather than in reverse order.

It's not a big deal, but in a subsequent commit I use it to improve
the order of type variables in inferred types.

All this led to a lot of error message wibbles:
 - changing the order of quantified variables
 - changing the order in which instances are listed in GHCi
 - changing the tidying of variables in typechecker erors

There's a submodule update for 'array' because one of its tests
has an error-message change.

I may not have associated all of them with the correct commit.

(cherry picked from commit 7e96526ac2ef5987ecb03217d3d616b6281c1441)

2 years agoTypos in bang patterns user manual [skip ci]
Ömer Sinan Ağacan [Mon, 10 Apr 2017 15:38:31 +0000 (18:38 +0300)] 
Typos in bang patterns user manual [skip ci]

(cherry picked from commit b1acb167b93f62eefab3f8cb24518eb0ce410d8c)

2 years agomk/boilerplate.mk defines STAGE1_GHC, not GHC_STAGE1.
Edward Z. Yang [Sun, 26 Mar 2017 21:40:29 +0000 (14:40 -0700)] 
mk/boilerplate.mk defines STAGE1_GHC, not GHC_STAGE1.

Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
(cherry picked from commit 5db415580e0738f934e35b7012fe35a79b7e97c7)

2 years agoAdd regression test for #13538
Ryan Scott [Thu, 6 Apr 2017 20:42:39 +0000 (16:42 -0400)] 
Add regression test for #13538

Commit 2b64e926a628fb2a3710b0360123ea73331166fe (#13135) ended
up fixing #13538 as well. Let's add a regression test so that it stays
fixed.

Test Plan: make test TEST=T13538

Reviewers: austin, bgamari

Reviewed By: bgamari

Subscribers: rwbarton, thomie

GHC Trac Issues: #13538

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

(cherry picked from commit e61900c994334c209a9de763993716314abf9f6d)

2 years agoMore changes to fix a space leak in the simplifier (#13426)
Reid Barton [Thu, 6 Apr 2017 21:44:08 +0000 (17:44 -0400)] 
More changes to fix a space leak in the simplifier (#13426)

Part of e13419c55 was accidentally lost during a rebase. This commit
adds the missing change, along with some more improvements
regarding where we do and don't use `seqType`.

Also include a comment about where the space leak showed up
and a Note explaining the strategy being used here.

Test Plan: harbormaster, plus local testing on DynFlags

Reviewers: austin, bgamari

Reviewed By: bgamari

Subscribers: thomie

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

(cherry picked from commit 59c925e88a1dcb98e62c2b5e0adaa299c3b15e44)

2 years agoBe less aggressive about fragile-context warrnings
Simon Peyton Jones [Thu, 6 Apr 2017 11:27:43 +0000 (12:27 +0100)] 
Be less aggressive about fragile-context warrnings

In the implementation of WarnSimplifiableClassConstraints, be
less aggressive about reporting a problem. We were complaining
about a "fragile" case that in fact was not fragile.

See Note [Simplifiable given constraints] in TcValidity.

This fixes Trac #13526.

(cherry picked from commit 65b185d4886b4efa3efe3cc5ecc8dd6e07d89afe)

2 years agobase: Mark unfold as deprecated
Ben Gamari [Wed, 5 Apr 2017 01:48:49 +0000 (21:48 -0400)] 
base: Mark unfold as deprecated

Test Plan: Read it

Reviewers: austin, hvr, RyanGlScott

Reviewed By: RyanGlScott

Subscribers: rwbarton, thomie, ekmett

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

(cherry picked from commit ce9b6170b0ac9ff417000d8e7bdff7b2298f2978)

2 years agoAdd regression test for #7944
Ryan Scott [Wed, 5 Apr 2017 01:46:55 +0000 (21:46 -0400)] 
Add regression test for #7944

Commit b8b3e30a6eedf9f213b8a718573c4827cfa230ba happened to fix the bug
reported in #7944. Let's add a regression test so that it stays that
way.

Fixes #7944.

Test Plan: make test TEST=T7944

Reviewers: austin, bgamari

Reviewed By: bgamari

Subscribers: rwbarton, thomie

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

(cherry picked from commit af941a96f62101a6539f3cc35d82df3fd964539c)