ghc.git
14 months agoMark AutoDeriveTypeable as deprecated
Krzysztof Gogolewski [Fri, 6 Jul 2018 14:59:43 +0000 (10:59 -0400)] 
Mark AutoDeriveTypeable as deprecated

Test Plan: validate

Reviewers: bgamari, alpmestan

Reviewed By: alpmestan

Subscribers: rwbarton, thomie, carter

GHC Trac Issues: #15342

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

14 months agousers guide: Mention -fprint-typechecker-elaboration in -ddump-tc docs
Ben Gamari [Fri, 6 Jul 2018 14:58:15 +0000 (10:58 -0400)] 
users guide: Mention -fprint-typechecker-elaboration in -ddump-tc docs

Reviewers: mpickering

Reviewed By: mpickering

Subscribers: mpickering, rwbarton, thomie, carter

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

14 months agocircleci: Detect core count
Ben Gamari [Fri, 6 Jul 2018 14:57:55 +0000 (10:57 -0400)] 
circleci: Detect core count

Test Plan: Try `./validate`, CircleCI build; make sure core count
detection works in both cases.

Reviewers: alpmestan

Reviewed By: alpmestan

Subscribers: rwbarton, thomie, carter

GHC Trac Issues: #14470

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

14 months agoRemove BUILD_DPH, not used
Krzysztof Gogolewski [Fri, 6 Jul 2018 17:04:30 +0000 (19:04 +0200)] 
Remove BUILD_DPH, not used

14 months agoMake a variant of mkCastErr for kind coercions
Ryan Scott [Fri, 6 Jul 2018 14:53:00 +0000 (10:53 -0400)] 
Make a variant of mkCastErr for kind coercions

Summary:
I discovered when debugging #15346 that the Core Lint error
message for ill typed casts always mentions types of enclosed
//expressions//, even if the thing being casted is actually a type.
This generalizes `mkCastErr` a bit to allow it to give the proper
labelling for kind coercions.

Test Plan: Run on failing program in #15346, read the Core Lint error

Reviewers: goldfire, bgamari, simonpj

Reviewed By: simonpj

Subscribers: simonpj, rwbarton, thomie, carter

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

14 months agoAccept new stdout for tcrun045
Ryan Scott [Thu, 5 Jul 2018 13:44:18 +0000 (09:44 -0400)] 
Accept new stdout for tcrun045

The stdout produced by test tcrun045 changed in commit
45f44e2c9d5db2f25c52abb402f197c20579400f. The change appears to be
benign, so I've decided to accept it.

14 months agoComment out a pprTrace
Ryan Scott [Thu, 5 Jul 2018 12:54:03 +0000 (08:54 -0400)] 
Comment out a pprTrace

This was introduced in commit
45f44e2c9d5db2f25c52abb402f197c20579400f, but it results in lots of
"check_class ~" messages when validating. I've decided to just
comment it out.

14 months agoMake ppr_tc_args aware of -fprint-explicit-kinds
Ryan Scott [Thu, 5 Jul 2018 12:52:20 +0000 (08:52 -0400)] 
Make ppr_tc_args aware of -fprint-explicit-kinds

Summary:
`ppr_tc_args` was printing invisible kind arguments even
when `-fprint-explicit-kinds` wasn't enabled. Easily fixed.

Test Plan: make test TEST=T15341

Reviewers: goldfire, bgamari, simonpj

Reviewed By: simonpj

Subscribers: simonpj, rwbarton, thomie, carter

GHC Trac Issues: #15341

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

14 months agoFix #15331 with careful blasts of parenthesizeHsType
Ryan Scott [Thu, 5 Jul 2018 12:51:43 +0000 (08:51 -0400)] 
Fix #15331 with careful blasts of parenthesizeHsType

Summary:
Another `-ddump-splices` bug that can be solved with more
judicious use of parentheses.

Test Plan: make test TEST=T15331

Reviewers: goldfire, bgamari, alanz, tdammers

Reviewed By: tdammers

Subscribers: rwbarton, thomie, carter

GHC Trac Issues: #15331

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

14 months agoParenthesize rank-n contexts in Convert
Ryan Scott [Thu, 5 Jul 2018 12:50:56 +0000 (08:50 -0400)] 
Parenthesize rank-n contexts in Convert

Summary: A simple oversight.

Test Plan: make test TEST=T15324

Reviewers: goldfire, bgamari

Reviewed By: bgamari

Subscribers: rwbarton, thomie, carter

GHC Trac Issues: #15324

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

14 months agoFix newtype instance GADTs
Ryan Scott [Thu, 5 Jul 2018 12:49:50 +0000 (08:49 -0400)] 
Fix newtype instance GADTs

Summary: This was taken from Richard's branch, which in turn was
submitted to Phab by Matthew, which in turn was commandeered by Ryan.

This fixes an issue with newtype instances in which too many
coercions were being applied in the worker. This fixes the issue by
removing the data family instance axiom from the worker and moving
to the wrapper. Moreover, we now require all newtype instances
to have wrappers, for symmetry with data instances.

Reviewers: goldfire, bgamari, simonpj, mpickering

Reviewed By: mpickering

Subscribers: simonpj, rwbarton, thomie, carter

GHC Trac Issues: #15318

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

14 months agoInstantiate GND bindings with an explicit type signature
Ryan Scott [Thu, 5 Jul 2018 12:30:05 +0000 (08:30 -0400)] 
Instantiate GND bindings with an explicit type signature

Summary:
Before, we were using visible type application to apply
impredicative types to `coerce` in
`GeneralizedNewtypeDeriving`-generated bindings. This approach breaks
down when combined with `QuantifiedConstraints` in certain ways,
which #14883 and #15290 provide examples of. See
Note [GND and QuantifiedConstraints] for all the gory details.

To avoid this issue, we instead use an explicit type signature to
instantiate each GND binding, and use that to bind any type variables
that might be bound by a class method's type signature. This reduces
the need to impredicative type applications, and more importantly,
makes the programs from #14883 and #15290 work again.

Test Plan: make test TEST="T15290b T15290c T15290d T14883"

Reviewers: simonpj, bgamari

Reviewed By: simonpj

Subscribers: rwbarton, thomie, carter

GHC Trac Issues: #14883, #15290

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

14 months agoFix #15308 by suppressing invisble args more rigorously
Ryan Scott [Thu, 5 Jul 2018 12:30:02 +0000 (08:30 -0400)] 
Fix #15308 by suppressing invisble args more rigorously

Summary:
There was a buglet in `stripInvisArgs` (which is part of the
pretty-printing pipeline for types) in which only invisble arguments
which came before any visible arguments would be suppressed, but any
invisble arguments that came //after// visible ones would still be
printed, even if `-fprint-explicit-kinds`  wasn't enabled.
The fix is simple: make `stripInvisArgs` recursively process the
remaining types even after a visible argument is encountered.

Test Plan: make test TEST=T15308

Reviewers: goldfire, bgamari

Reviewed By: bgamari

Subscribers: simonpj, rwbarton, thomie, carter

GHC Trac Issues: #15308

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

14 months agoFix #15307 by making nlHsFunTy parenthesize more
Ryan Scott [Thu, 5 Jul 2018 12:29:59 +0000 (08:29 -0400)] 
Fix #15307 by making nlHsFunTy parenthesize more

Summary:
`nlHsFunTy` wasn't parenthesizing its arguments at all,
which led to `-ddump-deriv` producing incorrectly parenthesized
types (since it uses `nlHsFunTy` to construct those types), as
demonstrated in #15307. Fix this by changing `nlHsFunTy` to add
parentheses à la `ppr_ty`: always parenthesizing the argument type
with function precedence, and recursively processing the result type,
adding parentheses for each function type it encounters.

Test Plan: make test TEST=T14578

Reviewers: bgamari

Reviewed By: bgamari

Subscribers: rwbarton, thomie, carter

GHC Trac Issues: #15307

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

14 months agoRefactor validity checking for constraints
Simon Peyton Jones [Wed, 4 Jul 2018 14:17:54 +0000 (15:17 +0100)] 
Refactor validity checking for constraints

There are several changes here.

* TcInteract has gotten too big, so I moved all the class-instance
  matching out of TcInteract into a new module ClsInst. It parallels
  the FamInst module.

  The main export of ClsInst is matchGlobalInst.
  This now works in TcM not TcS.

* A big reason to make matchGlobalInst work in TcM is that we can
  then use it from TcValidity.checkSimplifiableClassConstraint.
  That extends checkSimplifiableClassConstraint to work uniformly
  for built-in instances, which means that we now get a warning
  if we have givens (Typeable x, KnownNat n); see Trac #15322.

* This change also made me refactor LookupInstResult, in particular
  by adding the InstanceWhat field.  I also changed the name of the
  type to ClsInstResult.

  Then instead of matchGlobalInst reporting a staging error (which is
  inappropriate for the call from TcValidity), we can do so in
  TcInteract.checkInstanceOK.

* In TcValidity, we now check quantified constraints for termination.
  For example, this signature should be rejected:
     f :: (forall a. Eq (m a) => Eq (m a)) => blah
  as discussed in Trac #15316.   The main change here is that
  TcValidity.check_pred_help now uses classifyPredType, and has a
  case for ForAllPred which it didn't before.

  This had knock-on refactoring effects in TcValidity.

14 months agoFix comment
Simon Peyton Jones [Tue, 3 Jul 2018 07:51:21 +0000 (08:51 +0100)] 
Fix comment

14 months agoAdd comments on Typeable (n :: Nat)
Simon Peyton Jones [Tue, 3 Jul 2018 07:50:19 +0000 (08:50 +0100)] 
Add comments on Typeable (n :: Nat)

See Note [Typeable for Nat and Symbol] in TcInteract,
which I added after discussion on Trac #15322

14 months agoRevert "Don't lock the MVar closure on tryReadMVar"
Ömer Sinan Ağacan [Wed, 4 Jul 2018 14:05:56 +0000 (17:05 +0300)] 
Revert "Don't lock the MVar closure on tryReadMVar"

This reverts commit 6bb0c5db818c1ba9cd5fe1785a3020cfddf0c223.

See discussion in D4905.

14 months agoAdd regression test for #15007
Ömer Sinan Ağacan [Wed, 4 Jul 2018 13:49:19 +0000 (16:49 +0300)] 
Add regression test for #15007

14 months agoAdd regression test for #15321
Ömer Sinan Ağacan [Wed, 4 Jul 2018 13:43:13 +0000 (16:43 +0300)] 
Add regression test for #15321

14 months agoFix errors caused by invalid candidates leaking from hole fits
Matthías Páll Gissurarson [Wed, 4 Jul 2018 11:54:54 +0000 (14:54 +0300)] 
Fix errors caused by invalid candidates leaking from hole fits

This is a one line fix (and a note) that fixes four tickets, #15007,
 #15321 and #15202, #15314

The issue was that errors caused by illegal candidates (according to GHC
stage or being internal names) were leaking to the user, causing
bewildering error messages. If a candidate causes the type checker to
error, it is not a valid hole fit, and should be discarded.

As mentioned in #15321, this can cause a pattern of omissions, which
might be hard to discover. A better approach would be to gather the
error messages, and ask users to report them as GHC bugs. This will be
implemented in a subsequent change.

Reviewers: bgamari, simonpj

Reviewed By: simonpj

Subscribers: simonpj, rwbarton, thomie, carter

GHC Trac Issues: #15007, #15321, #15202, #15314

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

14 months agoFix nptr field alignment in RtClosureInspect
Ömer Sinan Ağacan [Wed, 4 Jul 2018 06:12:01 +0000 (09:12 +0300)] 
Fix nptr field alignment in RtClosureInspect

`extractSubTerms` (which is extracting pointer and non-pointer fields of a
closure) was computing the alignment incorrectly when aligning a 64-bit value
(e.g. a Double) on i386 by aligning it to 64-bits instead of to word size
(32-bits). This is documented in `mkVirtHeapOffsetsWithPadding`:

> Align the start offset (eg, 2-byte value should be 2-byte aligned).
> But not more than to a word.

Fixes #15061

Test Plan:
Validated on both 32-bit and 64-bit. 32-bit fails with various unrelated stat
failures, but no actual test failures.

Reviewers: hvr, bgamari

Reviewed By: bgamari

Subscribers: simonpj, rwbarton, thomie, carter

GHC Trac Issues: #15061

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

14 months agoRtClosureInspect: add some docs, remove unused stuff
Ömer Sinan Ağacan [Wed, 4 Jul 2018 06:08:16 +0000 (09:08 +0300)] 
RtClosureInspect: add some docs, remove unused stuff

Details are not documented, only the high-level functions

Reviewers: simonpj, hvr, bgamari

Reviewed By: bgamari

Subscribers: rwbarton, thomie, carter

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

14 months agotestsuite: remove unused scc001 target
Ömer Sinan Ağacan [Sun, 1 Jul 2018 11:31:27 +0000 (14:31 +0300)] 
testsuite: remove unused scc001 target

14 months agoFix mkGadtDecl does not set con_forall correctly
Alan Zimmerman [Fri, 29 Jun 2018 18:58:21 +0000 (20:58 +0200)] 
Fix mkGadtDecl does not set con_forall correctly

A GADT declaration surrounded in parens does not det the con_forall
field correctly.

e.g.

data MaybeDefault v where
    TestParens  :: (forall v . (Eq v) => MaybeDefault v)

Closes #15323

14 months agoDon't lock the MVar closure on tryReadMVar
David Feuer [Fri, 29 Jun 2018 18:31:33 +0000 (14:31 -0400)] 
Don't lock the MVar closure on tryReadMVar

It shouldn't be necessary to lock the `MVar` closure on `tryReadMVar`, since it
just reads one field of the structure and doesn't make any modifications. So
let's not.

Reviewers: bgamari, erikd, simonmar, fryguybob, osa1

Reviewed By: osa1

Subscribers: osa1, rwbarton, thomie, carter

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

14 months agoA few typofixes in comments
Gabor Greif [Fri, 29 Jun 2018 12:50:12 +0000 (14:50 +0200)] 
A few typofixes in comments

14 months agoAdd -ddump-rtti to user's guide and man page
Ömer Sinan Ağacan [Fri, 29 Jun 2018 06:46:24 +0000 (09:46 +0300)] 
Add -ddump-rtti to user's guide and man page

Reviewers: bgamari

Subscribers: rwbarton, thomie, carter

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

14 months agoDocument SRT scavenging behavior of scavenge_block() and scavenge_one()
Ömer Sinan Ağacan [Thu, 28 Jun 2018 05:44:15 +0000 (08:44 +0300)] 
Document SRT scavenging behavior of scavenge_block() and scavenge_one()

Reviewers: simonmar, bgamari, erikd

Reviewed By: simonmar

Subscribers: rwbarton, thomie, carter

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

14 months agoClarify role of coercion in flattening function
Richard Eisenberg [Thu, 28 Jun 2018 04:08:58 +0000 (00:08 -0400)] 
Clarify role of coercion in flattening function

Comments only: [ci skip]

14 months agoAdd ghc-prim as dependency to ghc-bin
Ömer Sinan Ağacan [Wed, 27 Jun 2018 10:04:47 +0000 (13:04 +0300)] 
Add ghc-prim as dependency to ghc-bin

Remove unsafeCoerce introduced by a54c94f08b

Reviewers: simonmar, bgamari

Reviewed By: simonmar

Subscribers: rwbarton, thomie, carter

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

14 months agoShow addresses of live objects in GHCi leak check
Ömer Sinan Ağacan [Wed, 27 Jun 2018 07:32:31 +0000 (10:32 +0300)] 
Show addresses of live objects in GHCi leak check

Reviewers: simonmar, bgamari

Subscribers: rwbarton, thomie, carter

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

14 months agorts: Update some comments, minor refactoring
Ömer Sinan Ağacan [Wed, 27 Jun 2018 07:31:29 +0000 (10:31 +0300)] 
rts: Update some comments, minor refactoring

14 months agoAdd commnent about binder order
Simon Peyton Jones [Tue, 26 Jun 2018 14:44:12 +0000 (15:44 +0100)] 
Add commnent about binder order

...provoked by Trac #15308

14 months agoTypo fix in rts [skip ci]
Ömer Sinan Ağacan [Tue, 26 Jun 2018 14:13:17 +0000 (17:13 +0300)] 
Typo fix in rts [skip ci]

14 months agoTypofixes in comments and whitespace only [ci skip]
Gabor Greif [Tue, 26 Jun 2018 13:29:14 +0000 (15:29 +0200)] 
Typofixes in comments and whitespace only [ci skip]

14 months agoRemove dead code
Simon Peyton Jones [Tue, 26 Jun 2018 11:07:27 +0000 (12:07 +0100)] 
Remove dead code

14 months agoA bit more tc-tracking in TcUnify.uUnfilledVar
Simon Peyton Jones [Tue, 26 Jun 2018 11:07:08 +0000 (12:07 +0100)] 
A bit more tc-tracking in TcUnify.uUnfilledVar

14 months agoFix TcLevel manipulation in TcDerivInfer.simplifyDeriv
Simon Peyton Jones [Mon, 25 Jun 2018 16:42:57 +0000 (17:42 +0100)] 
Fix TcLevel manipulation in TcDerivInfer.simplifyDeriv

The level numbers we were getting simply didn't obey the
invariant (ImplicInv) in TcType
   Note [TcLevel and untouchable type variables]

That leads to chaos. Easy to fix.  I improved the documentation.

I also added an assertion in TcSimplify that checks that
level numbers go up by 1 as we dive inside implications, so
that we catch the problem at source rather than than through
its obscure consequences.

That in turn showed up that TcRules was also generating
constraints that didn't obey (ImplicInv), so I fixed that too.
I have no idea what consequences were lurking behing that
bug, but anyway now it's fixed.  Hooray.

14 months agoAPI Annotations when parsing typapp
Alan Zimmerman [Tue, 26 Jun 2018 09:07:07 +0000 (11:07 +0200)] 
API Annotations when parsing typapp

Make sure the original annotations are still accessible for a promoted
type.

Closes #15303

14 months agoRecord some notes about "innocuous" transformations
Simon Peyton Jones [Thu, 7 Jun 2018 08:25:33 +0000 (09:25 +0100)] 
Record some notes about "innocuous" transformations

I wondered if some transformations (ticks) might be "innocuous",
in the sense that they do not unlock a later transformation that
does not occur in the same pass.  If so, we could refrain from
bumping the overall tick-count for such innocuous transformations,
and perhaps terminate the simplifier one pass earlier.

BUt alas I found that virtually nothing was innocuous!  This
commit just adds a Note to record what I learned, in case
anyone wants to try again.

14 months agoRemove unused BottomFound from Tick
Simon Peyton Jones [Thu, 7 Jun 2018 08:19:36 +0000 (09:19 +0100)] 
Remove unused BottomFound from Tick

14 months agoMore misc comments
Simon Peyton Jones [Thu, 7 Jun 2018 08:17:22 +0000 (09:17 +0100)] 
More misc comments

... plus, reorder equations in toIfaceVar to improve
legibility.  No change in behaviour.

14 months agoComents and debug tracing only
Simon Peyton Jones [Thu, 31 May 2018 11:50:36 +0000 (12:50 +0100)] 
Coments and debug tracing only

See Trac #15205

14 months agoRefactor the kind-checking of tyvar binders
Simon Peyton Jones [Mon, 25 Jun 2018 12:20:59 +0000 (13:20 +0100)] 
Refactor the kind-checking of tyvar binders

The refactoring here is driven by the ghastly mess described in
comment:24 of Trac #1520.  The overall goal is to simplify the
kind-checking of typev-variable binders, and in particular to narrow
the use of the "in-scope tyvar binder" stuff,
which is needed only for associated types: see the new
Note [Kind-checking tyvar binders for associated types] in TcHsType.

Now

* The "in-scope tyvar binder" stuff is done only in
     - kcLHsQTyVars, which is used for the LHsQTyVars of a
       data/newtype, or type family declaration.

     - tcFamTyPats, which is used for associated family instances;
       it now calls tcImplicitQTKBndrs, which in turn usese
       newFlexiKindedQTyVar

* tcExpicitTKBndrs (which is used only for function signatures,
  data con signatures, pattern synonym signatures, and expression
  type signatures) now does not go via the "in-scope tyvar binder"
  stuff at all.

While I'm still not happy with all this code, the code is generally
simpler, and I think this is a useful step forward. It does cure
the problem too.

(It's hard to trigger the problem in vanilla Haskell code, because
the renamer would normally use different names for nested binders,
so I can't offer a test.)

14 months agoImprove tc-tracing a bit
Simon Peyton Jones [Mon, 25 Jun 2018 10:46:29 +0000 (11:46 +0100)] 
Improve tc-tracing a bit

14 months agoFix error recovery for pattern synonyms
Simon Peyton Jones [Mon, 25 Jun 2018 10:42:46 +0000 (11:42 +0100)] 
Fix error recovery for pattern synonyms

As Trac #15289 showed, we were carrying on after a type error
in a pattern synonym, and then crashing.  This patch improves
error handling for pattern synonyms.

I also moved a bit of code from TcBinds into TcPatSyn, which
helpfully narrows the API.

14 months agoTweak API Annotations for ConDeclGADT
Alan Zimmerman [Sun, 24 Jun 2018 20:00:22 +0000 (22:00 +0200)] 
Tweak API Annotations for ConDeclGADT

14 months agoRemove -Wamp flag
roland [Thu, 21 Jun 2018 21:01:39 +0000 (17:01 -0400)] 
Remove -Wamp flag

Test Plan: "ghc -Wamp XXX.hs"  should give "unrecognised warning flag"

Reviewers: bgamari

Reviewed By: bgamari

Subscribers: rwbarton, thomie, carter

GHC Trac Issues: #11477

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

14 months agorts/linker/{SymbolExtras,elf_got}.c: map code as read-only
Santiago Munín [Thu, 21 Jun 2018 21:00:58 +0000 (17:00 -0400)] 
rts/linker/{SymbolExtras,elf_got}.c: map code as read-only

protect mmaped addresses from writes after being initially manipulated

Test Plan: ./validate

Reviewers: bgamari, erikd, simonmar

Reviewed By: bgamari

Subscribers: angerman, carlostome, rwbarton, thomie, carter

GHC Trac Issues: #14069

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

14 months agorts: Abort if timerfd read fails
Ben Gamari [Thu, 21 Jun 2018 21:00:32 +0000 (17:00 -0400)] 
rts: Abort if timerfd read fails

Currently we belch some output to stderr but fail to abort, resulting in
a busy loop. Fixes #15292.

Test Plan:
 * Validate
 * try running program under environment without timerfd capabilities;
ensure we don't busy-loop

Reviewers: simonmar, erikd

Reviewed By: simonmar

Subscribers: rwbarton, thomie, carter

GHC Trac Issues: #15929

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

14 months agoInclude ghc-heap and libiserv in the "package" file.
HE, Tao [Thu, 21 Jun 2018 21:00:17 +0000 (17:00 -0400)] 
Include ghc-heap and libiserv in the "package" file.

Previously, the `make clean` (as well as `make dist-clean`) doesn't work
for ghc-heap and libiserv, due to these two libraries are not presented
in the "packages" file.

Test Plan: [skip ci]

Reviewers: bgamari

Reviewed By: bgamari

Subscribers: rwbarton, thomie, carter

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

14 months agoExplain why opt-cmm is not dumped by ddump-cmm-verbose.
klebinger.andreas@gmx.at [Thu, 21 Jun 2018 20:59:46 +0000 (16:59 -0400)] 
Explain why opt-cmm is not dumped by ddump-cmm-verbose.

We just update the docs to reflect the state of affairs.

opt-cmm is run by the NCG backend so not always run.
ddump-cmm-verbose only dumps passes of the cmm
pipeline so it's not included there. [skip-ci]

Test Plan: doc change

Reviewers: bgamari

Reviewed By: bgamari

Subscribers: rwbarton, thomie, carter

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

14 months agoTTG for IPBind had wrong extension name
Alan Zimmerman [Fri, 22 Jun 2018 19:32:19 +0000 (21:32 +0200)] 
TTG for IPBind had wrong extension name

The standard[1] for extension naming is to use the XC prefix for the
internal extension points, rather than for a new constructor.

This is violated for IPBind, having

    data IPBind id
      = IPBind
            (XIPBind id)
            (Either (Located HsIPName) (IdP id))
            (LHsExpr id)
      | XCIPBind (XXIPBind id)

Swap the usage of XIPBind and XCIPBind

[1] https://ghc.haskell.org/trac/ghc/wiki/ImplementingTreesThatGrow#Namingconventions

Closes #15302

14 months agoMove a Note to the module that refers to it
Simon Peyton Jones [Fri, 22 Jun 2018 12:10:48 +0000 (13:10 +0100)] 
Move a Note to the module that refers to it

14 months agoRemove unnecessary call to checkReductionDepth
Simon Peyton Jones [Fri, 22 Jun 2018 10:30:10 +0000 (11:30 +0100)] 
Remove unnecessary call to checkReductionDepth

We call checkReductionDepth in chooseInstance, so there's no
need to call it in selectNextWorkItem too

14 months agoRefactor try_solve_fromInstance in shortCutSolver
Simon Peyton Jones [Fri, 22 Jun 2018 10:28:37 +0000 (11:28 +0100)] 
Refactor try_solve_fromInstance in shortCutSolver

This patch just removes the CtLoc parameter from trySolveFromInstance,
since it can just as easily (and more uniformly) be gotten from the
CtEvidence it is trying to solve.

14 months agoInstances in no-evidence implications
Simon Peyton Jones [Fri, 22 Jun 2018 10:27:47 +0000 (11:27 +0100)] 
Instances in no-evidence implications

Trac #15290 showed that it's possible that we might attempt to use a
quantified constraint to solve an equality in a situation where we
don't have anywhere to put the evidence bindings.  This made GHC crash.

This patch stops the crash, but still rejects the pogram.  See
Note [Instances in no-evidence implications] in TcInteract.

Finding this bug revealed another lurking bug:

* An infelicity in the treatment of superclasses -- we were expanding
  them locally at the leaves, rather than at their binding site; see
  (3a) in Note [The superclass story].

  As a consequence, TcRnTypes.superclassesMightHelp must look inside
  implications.

In more detail:

* Stop the crash, by making TcInteract.chooseInstance test for
  the no-evidence-bindings case.  In that case we simply don't
  use the instance.  This entailed a slight change to the type
  of chooseInstance.

* Make TcSMonad.getPendingScDicts (now renamed getPendingGivenScs)
  return only Givens from the /current level/; and make
  TcRnTypes.superClassesMightHelp look inside implications.

* Refactor the simpl_loop and superclass-expansion stuff in
  TcSimplify.  The logic is much easier to understand now, and
  has less duplication.

14 months agoDrop redundant Note
Ryan Scott [Thu, 21 Jun 2018 15:29:53 +0000 (11:29 -0400)] 
Drop redundant Note

Richard added a much better version of this Note in commit
26e9806ada8823160dd63ca2c34556e5848b2f45, so I've decided to point
to that instead.

14 months agoFix incorrect GHC versioning
Herbert Valerio Riedel [Thu, 21 Jun 2018 07:54:50 +0000 (09:54 +0200)] 
Fix incorrect GHC versioning

This is an unstable release, hence it must be x.y.$DATE, rather than x.y.0.$DATE
which would denote a stable pre-release snapshot.

15 months agoconfigure: Set version to 8.7 ghc-8.7-start
Ben Gamari [Wed, 20 Jun 2018 21:11:20 +0000 (17:11 -0400)] 
configure: Set version to 8.7

Bumps haddock submodule.

15 months agocontainers: Bump to 0.6.0.1
Ben Gamari [Mon, 18 Jun 2018 15:58:43 +0000 (11:58 -0400)] 
containers: Bump to 0.6.0.1

Bumps containers submodule, among others.

15 months agoFix gcc.exe: error: CreateProcess: No such file or directory
Moritz Angermann [Wed, 20 Jun 2018 03:27:53 +0000 (23:27 -0400)] 
Fix gcc.exe: error: CreateProcess: No such file or directory

When GHC links binaries on windows, we pass a -L and -l flag
to gcc for each dependency in the transitive dependency
closure.  As this will usually overflow the command argument
limit on windows, we use response files to pass all arguments
to gcc.  gcc however internally passes only the -l flags via
a response file to the collect2 command, but puts the -L flags
on the command line. As such if we pass enough -L flags to
gcc--even via a response file--we will eventually overflow the
command line argument length limit due to gcc passing them
to collect2 without resorting to a response file.

To prevent this from happening we move all lirbaries into a
shared temporary folder, and only need to pass a single -L
flag to gcc.  Ideally however this was fixed in gcc.

Reviewers: bgamari, Phyx

Reviewed By: bgamari

Subscribers: erikd, rwbarton, thomie, carter

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

15 months agorts: A bit of cleanup of posix itimer implementation
Ben Gamari [Wed, 20 Jun 2018 03:18:12 +0000 (23:18 -0400)] 
rts: A bit of cleanup of posix itimer implementation

* Use bool instead of HsBool
* Use barf instead of sysErrorBelch; stg_exit

Test Plan: Validate

Reviewers: erikd, simonmar

Subscribers: rwbarton, thomie, carter

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

15 months agoRemove HsEqTy and XEqTy
Ryan Scott [Wed, 20 Jun 2018 03:17:02 +0000 (23:17 -0400)] 
Remove HsEqTy and XEqTy

After commit d650729f9a0f3b6aa5e6ef2d5fba337f6f70fa60, the
`HsEqTy` constructor of `HsType` is essentially dead code. Given that
we want to remove `HsEqTy` anyway as a part of #10056 (comment:27),
let's just rip it out.

Bumps the haddock submodule.

Test Plan: ./validate

Reviewers: goldfire, bgamari

Reviewed By: bgamari

Subscribers: rwbarton, thomie, carter

GHC Trac Issues: #10056

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

15 months agoAllow :info for (~) in GHCi
Ryan Scott [Wed, 20 Jun 2018 03:16:39 +0000 (23:16 -0400)] 
Allow :info for (~) in GHCi

`(~)` is not an identifier according to GHC's parser, which
is why GHCi's `:info` command wouldn't work on it. To rectify this,
we apply the same fix that was put in place for `(->)`: add `(~)` to
GHC's `identifier` parser production.

Test Plan: make test TEST=T10059

Reviewers: bgamari

Reviewed By: bgamari

Subscribers: rwbarton, thomie, mpickering, carter

GHC Trac Issues: #10059

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

15 months agoconfigure: Fix libnuma detection logic
Ben Gamari [Wed, 20 Jun 2018 03:16:26 +0000 (23:16 -0400)] 
configure: Fix libnuma detection logic

Test Plan: Validate with numa support

Subscribers: rwbarton, thomie, erikd, carter

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

15 months agoA few more typofixes in docs/comments [ci skip]
Gabor Greif [Wed, 20 Jun 2018 14:00:50 +0000 (16:00 +0200)] 
A few more typofixes in docs/comments [ci skip]

15 months agoRevert "containers: Bump to 0.6.0.1"
Ben Gamari [Wed, 20 Jun 2018 01:40:55 +0000 (21:40 -0400)] 
Revert "containers: Bump to 0.6.0.1"

This reverts commit 50e7bff7514ebbd74976c1a9fa0db7a8275178ae.

Reverts submodule changes.

Sigh, the haskeline commit isn't quite upstream yet.

15 months agobase: Add missing instances for Data.Ord.Down
Ben Gamari [Tue, 19 Jun 2018 21:11:05 +0000 (17:11 -0400)] 
base: Add missing instances for Data.Ord.Down

Specifically:

 * MonadFix
 * MonadZip
 * Data
 * Foldable
 * Traversable
 * Eq1
 * Ord1
 * Read1
 * Show1
 * Generic
 * Generic1

Fixes #15098.

Reviewers: RyanGlScott, hvr

Reviewed By: RyanGlScott

Subscribers: sjakobi, rwbarton, thomie, ekmett, carter

GHC Trac Issues: #15098

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

15 months agofindPtr: don't search the nursery
Simon Marlow [Tue, 19 Jun 2018 21:10:55 +0000 (17:10 -0400)] 
findPtr: don't search the nursery

Test Plan: Used it in anger

Reviewers: bgamari, erikd

Reviewed By: bgamari

Subscribers: rwbarton, thomie, carter

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

15 months agoTweak wording in documentation
Victor Nawothnig [Tue, 19 Jun 2018 21:10:28 +0000 (17:10 -0400)] 
Tweak wording in documentation

Reviewers: hvr, bgamari

Subscribers: rwbarton, thomie, carter

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

15 months agotestsuite: Add broken test for #15289
Ben Gamari [Mon, 18 Jun 2018 23:10:10 +0000 (19:10 -0400)] 
testsuite: Add broken test for #15289

The stderr output is merely a guess at what we should expect, but currently this
is certainly broken.

15 months agotestsuite: Skip T11627a and T11627b on Darwin
Ben Gamari [Mon, 18 Jun 2018 22:34:07 +0000 (18:34 -0400)] 
testsuite: Skip T11627a and T11627b on Darwin

Darwin tends to give us a very small stack which the retainer profiler tends to
overflow. Strangely, this manifested on CircleCI yet not Harbormaster.

See #15287 and #11627.

15 months agocontainers: Bump to 0.6.0.1
Ben Gamari [Mon, 18 Jun 2018 15:58:43 +0000 (11:58 -0400)] 
containers: Bump to 0.6.0.1

Bumps containers submodule, among others.

15 months agotestsuite: Bump metrics for T5631 and T6048
Ben Gamari [Mon, 18 Jun 2018 16:08:15 +0000 (12:08 -0400)] 
testsuite: Bump metrics for T5631 and T6048

It's unclear what these are due to but they are causing the Darwin builds to
fail.

15 months agoconfigure: Bump version to 8.6.0
Richard Eisenberg [Tue, 19 Jun 2018 02:36:08 +0000 (22:36 -0400)] 
configure: Bump version to 8.6.0

Bumps haddock submodule.

15 months agoDocument and simplify tcInstTyBinders
Richard Eisenberg [Tue, 19 Jun 2018 02:36:08 +0000 (22:36 -0400)] 
Document and simplify tcInstTyBinders

This fixes #15282.

15 months agoFix API Annotations for GADT constructors
Alan Zimmerman [Mon, 18 Jun 2018 08:18:21 +0000 (10:18 +0200)] 
Fix API Annotations for GADT constructors

Summary:
This patch completes the work for #14529 by making sure that all API
Annotations end up attached to a SrcSpan that appears in the final
ParsedSource.

Updates Haddock submodule

Test Plan: ./validate

Reviewers: goldfire, bgamari

Subscribers: rwbarton, thomie, mpickering, carter

GHC Trac Issues: #14529

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

15 months agoAdjust comments (Trac #14164)
Simon Peyton Jones [Tue, 19 Jun 2018 09:43:01 +0000 (10:43 +0100)] 
Adjust comments (Trac #14164)

15 months agoMark some TH tests as req_interp
Ömer Sinan Ağacan [Tue, 19 Jun 2018 07:16:54 +0000 (10:16 +0300)] 
Mark some TH tests as req_interp

- dataToExpQUnit
- qq005
- qq006
- qq007
- qq008
- qq009
- T13949
- T8025

15 months agoFix typo in comment only
Richard Eisenberg [Mon, 18 Jun 2018 15:18:15 +0000 (11:18 -0400)] 
Fix typo in comment only

[skip ci]

15 months agoTypofixes in docs and comments [ci skip]
Gabor Greif [Mon, 18 Jun 2018 12:22:54 +0000 (14:22 +0200)] 
Typofixes in docs and comments [ci skip]

15 months agoFix typechecking of kind signatures
Simon Peyton Jones [Sat, 16 Jun 2018 22:50:02 +0000 (23:50 +0100)] 
Fix typechecking of kind signatures

When typechecking a type like
   Maybe (a :: <kind-sig>)
with a kind signature, we were using tc_lhs_kind to
typecheck the signature.  But that's utterly wrong; we
need the signature to be fully solid (non unresolved
equalities) before using it.  In the case of Trac #14904
we went on to instantiate the kind signature, when it
still had embedded unsolved constraints.  This tripped
the level-checking assertion when unifying a variable.

The fix looks pretty easy to me: just call tcLHsKind
instead.  I had to add KindSigCtxt to

15 months agoTwo small refactorings
Simon Peyton Jones [Sat, 16 Jun 2018 22:30:26 +0000 (23:30 +0100)] 
Two small refactorings

* Define Type.substTyVarBndrs, and use it

* Rename substTyVarBndrCallback to substTyVarBndrUsing,
  and other analogous higher order functions.  I kept
  stumbling over the name.

15 months agoFix an infinite loop in niFixTCvSubst
Simon Peyton Jones [Sat, 16 Jun 2018 22:25:53 +0000 (23:25 +0100)] 
Fix an infinite loop in niFixTCvSubst

Trac #14164 made GHC loop, a pretty serious error. It turned
out that Unify.niFixTCvSubst was looping forever, because we
had a substitution like
    a :-> ....(b :: (c :: d))....
    d :-> ...
We correctly recognised that d was free in the range of the
substitution, but then failed to apply it "deeeply enough"
to the range of the substiuttion, so d was /still/ free in
the range, and we kept on going.

Trac #9106 was caused by a similar problem, but alas my
fix to Trac #9106 was inadequate when the offending type
variable is more deeply buried.  Urk.

This time I think I've fixed it!  It's much more subtle
than I though, and it took most of a long train journey
to figure it out.  I wrote a long note to explain:
Note [Finding the substitution fixpoint]

15 months agoRemove accidentally checked-in T14845.stderr
Ryan Scott [Sun, 17 Jun 2018 19:31:14 +0000 (15:31 -0400)] 
Remove accidentally checked-in T14845.stderr

This was a stderr file for a WIP test in D4728. I ended up removing
the test, but forgot to remove the stderr file.

15 months agoAdd -Werror=compat
Vladislav Zavialov [Sun, 17 Jun 2018 16:51:06 +0000 (12:51 -0400)] 
Add -Werror=compat

Add a flag `-Werror=compat` to GHC which has the effect of `-Werror=x
-Werror=y ...`, where `x, y, ...` are warnings from the `-Wcompat`
option group.

Test Plan: ./validate

Reviewers: bgamari

Reviewed By: bgamari

Subscribers: rwbarton, thomie, carter

GHC Trac Issues: #15278

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

15 months agoUse __FILE__ for Cmm assertion locations, fix #8619
Ömer Sinan Ağacan [Sun, 17 Jun 2018 16:50:18 +0000 (12:50 -0400)] 
Use __FILE__ for Cmm assertion locations, fix #8619

It seems like we currently support string literals in Cmm, so we can use
__LINE__ CPP macro in assertion macros. This improves error messages
that previously looked like

    ASSERTION FAILED: file (null), line 1302

(null) part now shows the actual file name.

Also inline some single-use string literals in PrimOps.cmm.

Reviewers: bgamari, simonmar, erikd

Reviewed By: bgamari

Subscribers: rwbarton, thomie, carter

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

15 months agoUNREG: fix CmmRegOff large offset handling on W64 platforms
Sergei Trofimovich [Sun, 17 Jun 2018 16:49:51 +0000 (12:49 -0400)] 
UNREG: fix CmmRegOff large offset handling on W64 platforms

Gabor noticed C warning when building unregisterised
64-bit compiler on GHC.Integer.Types (from integer-simple).

Minimised example with a warning:

```haskell
{-# LANGUAGE MagicHash #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -Wall #-}

module M (bug) where

import GHC.Prim (Word#, minusWord#, ltWord#)
import GHC.Types (isTrue#)

-- assume Word = Word64
bug :: Word# -> Word#
bug x = if isTrue# (x `ltWord#` 0x8000000000000000##) then 0##
        else x `minusWord#` 0x8000000000000000##
```

```
$ LANG=C x86_64-UNREG-linux-gnu-ghc -O1 -c M.hs -fforce-recomp
/tmp/ghc30219_0/ghc_1.hc: In function 'M_bug_entry':

/tmp/ghc30219_0/ghc_1.hc:20:14: error:
     warning: integer constant is so large that it is unsigned
```

It's caused by limited handling of integer literals in CmmRegOff.
This change switches to use standard integer literal pretty-printer.

C code before the change:

```c
FN_(M_bug_entry) {
W_ _sAg;
_cAr:
_sAg = *Sp;
switch ((W_)(_sAg < 0x8000000000000000UL)) {
case 0x1UL: goto _cAq;
default: goto _cAp;
}
_cAp:
R1.w = _sAg+-9223372036854775808;
// ...
```

C code after the change:

```c
FN_(M_bug_entry) {
W_ _sAg;
_cAr:
_sAg = *Sp;
switch ((W_)(_sAg < 0x8000000000000000UL)) {
case 0x1UL: goto _cAq;
default: goto _cAp;
}
_cAp:
R1.w = _sAg+(-0x8000000000000000UL);
```

URL: https://mail.haskell.org/pipermail/ghc-devs/2018-June/015875.html
Reported-by: Gabor Greif
Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
Test Plan: test generated code on unregisterised mips64 and amd64

Reviewers: simonmar, ggreif, bgamari

Reviewed By: ggreif, bgamari

Subscribers: rwbarton, thomie, carter

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

15 months agoProvide a better error message for unpromotable data constructor contexts
Ryan Scott [Sun, 17 Jun 2018 16:28:23 +0000 (12:28 -0400)] 
Provide a better error message for unpromotable data constructor contexts

Trac #14845 brought to light a corner case where a data
constructor could not be promoted (even with `-XTypeInType`) due to
an unpromotable constraint in its context. However, the error message
was less than helpful, so this patch adds an additional check to
`tcTyVar` catch unpromotable data constructors like these //before//
they're promoted, and to give a sensible error message in such cases.

Test Plan: make test TEST="T13895 T14845"

Reviewers: simonpj, goldfire, bgamari

Reviewed By: bgamari

Subscribers: rwbarton, thomie, carter

GHC Trac Issues: #13895, #14845

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

15 months agoImprove documentation of Eq, Ord instances for Float and Double
ARJANEN Loïc Jean David [Sun, 17 Jun 2018 15:30:28 +0000 (11:30 -0400)] 
Improve documentation of Eq, Ord instances for Float and Double

Reviewers: sjakobi, dfeuer, bgamari, hvr

Reviewed By: sjakobi, bgamari

Subscribers: rwbarton, thomie, carter

GHC Trac Issues: #15078

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

15 months agoImprove error message when importing an unusable package
Sean D Gillespie [Sun, 17 Jun 2018 15:22:20 +0000 (11:22 -0400)] 
Improve error message when importing an unusable package

If a module cannot be found because it is ignored or from an unusable
package, report this to the user and the reason it is unusable.

Currently, GHC displays the standard "Cannot find module error". For
example:

```
<no location info>: error:
    Could not find module ‘Control.Monad.Random’
    Perhaps you meant
      Control.Monad.Reader (from mtl-2.2.2)
      Control.Monad.Cont (from mtl-2.2.2)
      Control.Monad.Error (from mtl-2.2.2)
```

GHC does, however, indicate unusable/ignored packages with the -v flag:

```
package MonadRandom-0.5.1-1421RgpXdhC8e8UI7D3emA is unusable due to
missing dependencies:
  fail-4.9.0.0-BAHmj60kS5K7NVhhKpm9J5
```

With this change, I took that message and added it to the output of the
"Cannot find module" message.

Reviewers: bgamari, dfeuer

Reviewed By: bgamari

Subscribers: Phyx, dfeuer, rwbarton, thomie, carter

GHC Trac Issues: #4806

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

15 months agoHandle DuplicateRecordFields correctly in filterImports (fixes #14487)
Adam Gundry [Sun, 17 Jun 2018 14:47:57 +0000 (10:47 -0400)] 
Handle DuplicateRecordFields correctly in filterImports (fixes #14487)

filterImports needed a small adjustment to correctly handle record field
definitions arising from modules with DuplicateRecordFields enabled.

Previously hiding fields was not possible with DuplicateRecordFields enabled.

Test Plan: new test rename/should_compile/T14487

Reviewers: bgamari

Subscribers: simonpj, rwbarton, thomie, carter

GHC Trac Issues: #14487

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

15 months agotestsuite: Mark print022 as broken on 32-bit platforms
Ben Gamari [Sun, 17 Jun 2018 14:33:00 +0000 (10:33 -0400)] 
testsuite: Mark print022 as broken on 32-bit platforms

Due to #15061.

15 months agotestsuite: Mark T3001-2 as broken on 32-bit platforms
Ben Gamari [Sun, 17 Jun 2018 14:31:34 +0000 (10:31 -0400)] 
testsuite: Mark T3001-2 as broken on 32-bit platforms

Due to #15063.

15 months agoconfigure: Fail when bootstrapping with GHC 8.2.1
Ben Gamari [Sun, 17 Jun 2018 13:54:18 +0000 (09:54 -0400)] 
configure: Fail when bootstrapping with GHC 8.2.1

See #15281

15 months agoBump process submodule
Ben Gamari [Sun, 17 Jun 2018 12:44:25 +0000 (08:44 -0400)] 
Bump process submodule

15 months agoRevert "rts: Use .cfi_{start|end}proc directives"
Ben Gamari [Sun, 17 Jun 2018 13:41:46 +0000 (09:41 -0400)] 
Revert "rts: Use .cfi_{start|end}proc directives"

This reverts commit 86210b238b86d810874a2315d1715546a4006cea.

15 months agoWarn about implicit kind variables with -Wcompat
Vladislav Zavialov [Sun, 17 Jun 2018 03:44:39 +0000 (23:44 -0400)] 
Warn about implicit kind variables with -Wcompat

According to an accepted proposal
https://github.com/ghc-proposals/ghc-proposals/blob/master/proposals/002
4-no-kind-vars.rst

    With -Wcompat, warn if a kind variable is brought into scope
    implicitly in a type with an explicit forall. This applies to type
    signatures and to other contexts that allow a forall with the
    forall-or-nothing rule in effect (for example, class instances).

Test Plan: Validate

Reviewers: goldfire, hvr, bgamari, RyanGlScott

Reviewed By: goldfire

Subscribers: RyanGlScott, rwbarton, thomie, carter

GHC Trac Issues: #15264

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