ghc.git
3 years agoMerge remote-tracking branch 'origin/master' into wip/spj-wildcard-refactor wip/spj-wildcard-refactor
Simon Peyton Jones [Tue, 1 Dec 2015 12:48:32 +0000 (12:48 +0000)] 
Merge remote-tracking branch 'origin/master' into wip/spj-wildcard-refactor

3 years agoWibbles
Simon Peyton Jones [Tue, 1 Dec 2015 12:47:13 +0000 (12:47 +0000)] 
Wibbles

3 years agoFix grammar and typo in TcTyDecls
Bartosz Nitka [Mon, 30 Nov 2015 16:44:27 +0000 (08:44 -0800)] 
Fix grammar and typo in TcTyDecls

Summary: It's just a docufix.

Test Plan: just a docufix

Reviewers: austin, bgamari

Reviewed By: bgamari

Subscribers: thomie

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

3 years agoBuild system: Add stage specific SRC_HC_(WARNING_)OPTS
Thomas Miedema [Mon, 30 Nov 2015 11:35:58 +0000 (12:35 +0100)] 
Build system: Add stage specific SRC_HC_(WARNING_)OPTS

* Add stage specific versions of SRC_HC_OPTS. These are currently only
  used for -Werror. The previous combination of GhcStage2HcOpts and
  GhcLibHcOpts didn't apply to utils/*.

* Add stage specific versions of SRC_HC_WARNING_OPTS. These will later be
  used for new warning supression flags that should not be passed to the
  bootstrap compiler.

* Move -Wall (and -Werror) related code back to mk/warnings.mk, where it
  was before 987d54274. Now all warning related code is nicely together.
  Include mk/warnings.mk after mk/custom-settings.mk to make this work.

Reviewed By: bgamari, hvr

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

3 years agoMkId: Typos in comments
Ömer Sinan Ağacan [Tue, 1 Dec 2015 02:07:24 +0000 (21:07 -0500)] 
MkId: Typos in comments

3 years agoMerge remote-tracking branch 'origin/master' into wip/spj-wildcard-refactor
Simon Peyton Jones [Mon, 30 Nov 2015 14:10:58 +0000 (14:10 +0000)] 
Merge remote-tracking branch 'origin/master' into wip/spj-wildcard-refactor

Conflicts:
compiler/hsSyn/HsTypes.hs
compiler/rename/RnSplice.hs
testsuite/tests/ghci/scripts/T10248.stderr
testsuite/tests/typecheck/should_fail/CustomTypeErrors02.stderr
testsuite/tests/wcompat-warnings/WCompatWarningsOn.stderr

3 years agoImplement warnings for Semigroups as parent of Monoid
David Luposchainsky [Sun, 29 Nov 2015 21:59:57 +0000 (22:59 +0100)] 
Implement warnings for Semigroups as parent of Monoid

This patch is similar to the AMP patch (#8004), which offered two
functions:

  1. Warn when an instance of a class has been given, but the type does
     not have a certain superclass instance
  2. Warn when top-level definitions conflict with future Prelude names

These warnings are issued as part of the new `-Wcompat` warning group.

Reviewers: hvr, ekmett, austin, bgamari

Reviewed By: hvr, ekmett, bgamari

Subscribers: ekmett, thomie

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

GHC Trac Issues: #11139

3 years agoSome improvements on CoreToDos passed to plugins
Ömer Sinan Ağacan [Sun, 29 Nov 2015 21:49:46 +0000 (22:49 +0100)] 
Some improvements on CoreToDos passed to plugins

This patch does two improvements:

- We now show ToDos in `CoreDoPasses`. This is pretty important,
  otherwise `CoreDoPasses` makes debugging impossible in some cases.

- Before running ToDos we run a cleanup pass on ToDos to remove
  `CoreDoNothing`s and flatten `CoreDoPasses`. This removes a lot of
  noise from `[CoreToDo]` argument passed to plugins.

Reviewers: simonpj, bgamari, austin

Reviewed By: bgamari, austin

Subscribers: thomie

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

3 years agoghci: Refactor handling of :show
Ben Gamari [Sun, 29 Nov 2015 21:49:04 +0000 (22:49 +0100)] 
ghci: Refactor handling of :show

In so doing ensure that the help text can't fall out of sync with the
implementation.

Test Plan: Validate and play in ghci

Reviewers: austin, thomie

Reviewed By: austin, thomie

Subscribers: thomie

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

GHC Trac Issues: #11111

3 years agoRemove redundant `#if`s
Herbert Valerio Riedel [Sun, 29 Nov 2015 16:53:56 +0000 (17:53 +0100)] 
Remove redundant `#if`s

`#if __GLASGOW_HASKELL__ > xxx` macros make little sense inside `base`
currently.

Reviewed By: austin

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

3 years agoUpdate deepseq submodule
Herbert Valerio Riedel [Sun, 29 Nov 2015 16:52:31 +0000 (17:52 +0100)] 
Update deepseq submodule

This pulls in new NFData instances for NonEmpty and Semigroup newtype wrappers

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

3 years agoUpdate containers submodule
Herbert Valerio Riedel [Sun, 29 Nov 2015 15:42:30 +0000 (16:42 +0100)] 
Update containers submodule

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

3 years agoGHCi should not defer typed holes
Thomas Miedema [Fri, 27 Nov 2015 15:19:24 +0000 (16:19 +0100)] 
GHCi should not defer typed holes

In the function `tcUserStmt` in compiler/typecheck/TcRnDriver.hs, before
going over the different ways ('plans') to lift an expression typed at
the prompt into the GHCi monad, `Opt_DeferTypeErrors` is disabled. Here is
the accompanying comment:

```
-- Ensure that type errors don't get deferred when type checking the
-- naked expression. Deferring type errors here is unhelpful because the
-- expression gets evaluated right away anyway. It also would potentially
-- emit redundant type-error warnings, one from each plan.
; plan <- unsetGOptM Opt_DeferTypeErrors $
```

Since `Opt_DeferTypeErrors` implies `Opt_DeferTypedHoles`,
`Opt_DeferTypedHoles` should be disabled here as well. This improves
the error message for T10248 (it doesn't mention ghciStepIO anymore).
This is a partial fix for #10249, and a complete fix for #11130.

Depends on D1526

Reviewers: simonpj, austin, bgamari

Reviewed By: simonpj

Subscribers: simonpj

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

GHC Trac Issues: #10249, #11130

3 years agoRemove deprecated quasiquoter syntax.
Matthew Pickering [Fri, 27 Nov 2015 15:16:39 +0000 (16:16 +0100)] 
Remove deprecated quasiquoter syntax.

In spirit, this reverts 9ba922ee06b048774d7a82964867ff768a78126e

The syntax has been deprecated with a warning since 2010.

Reviewers: austin, bgamari

Reviewed By: bgamari

Subscribers: thomie

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

3 years agoghc-pkg: print version when verbose
Adam Sandberg Eriksson [Fri, 27 Nov 2015 15:16:23 +0000 (16:16 +0100)] 
ghc-pkg: print version when verbose

Reviewers: austin, bgamari

Reviewed By: bgamari

Subscribers: thomie

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

3 years agoghci: Add support for prompt functions
Ben Gamari [Fri, 27 Nov 2015 13:26:32 +0000 (14:26 +0100)] 
ghci: Add support for prompt functions

This is an updated version of @jlengyel's original patch adding support
for prompt functions.

3 years agoImplement new -XTemplateHaskellQuotes pragma
Herbert Valerio Riedel [Fri, 27 Nov 2015 12:39:18 +0000 (13:39 +0100)] 
Implement new -XTemplateHaskellQuotes pragma

Since f16ddcee0c64a92ab911a7841a8cf64e3ac671fd / D876, `ghc-stage1`
supports a subset of `-XTemplateHaskell`, but since we need Cabal to be
able detect (so `.cabal` files can be specified accordingly, see also
GHC #11102 which omits `TemplateHaskell` from `--supported-extensions`)
whether GHC provides full or only partial `-XTemplateHaskell` support,
the proper way to accomplish this is to split off the
quotation/non-splicing `TemplateHaskell` feature-subset into a new
language pragma `TemplateHaskellQuotes`.

Moreover, `-XTemplateHaskellQuotes` is considered safe under SafeHaskell

This addresses #11121

Reviewers: goldfire, ezyang, dterei, austin, bgamari

Reviewed By: bgamari

Subscribers: thomie

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

GHC Trac Issues: #11121

3 years agoUpdate haskeline & terminfo submodules
Herbert Valerio Riedel [Sat, 28 Nov 2015 17:40:44 +0000 (18:40 +0100)] 
Update haskeline & terminfo submodules

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

3 years agoCheck arity on default decl for assoc types
Simon Peyton Jones [Fri, 27 Nov 2015 15:16:17 +0000 (15:16 +0000)] 
Check arity on default decl for assoc types

Fixes Trac #11136.  We should check arity before
doing tcTyClTyVars, because the latter crahes if
the arity isn't right.

3 years agoUpdate transformers submodule
Herbert Valerio Riedel [Fri, 27 Nov 2015 11:12:59 +0000 (12:12 +0100)] 
Update transformers submodule

Most notably this pulls in `MonadFail` instances
(see also #10751)

- add MonadFail instance for ContT
- re-order methods for consistency
- Add `MonadFail` instances
- Canonicalise Monad instances
- instance Bifunctor Constant

3 years agoMerge remote-tracking branch 'origin/master' into wip/spj-wildcard-refactor
Simon Peyton Jones [Thu, 26 Nov 2015 15:36:07 +0000 (15:36 +0000)] 
Merge remote-tracking branch 'origin/master' into wip/spj-wildcard-refactor

Conflicts:
compiler/typecheck/TcClassDcl.hs
compiler/typecheck/TcTyClsDecls.hs
compiler/typecheck/TcTyDecls.hs
compiler/typecheck/TcTypeable.hs
compiler/typecheck/TcValidity.hs
testsuite/tests/typecheck/should_fail/T5300.stderr
testsuite/tests/typecheck/should_fail/T8030.stderr

3 years agoLibdw: Handle failure to grab session for location lookup
Ben Gamari [Thu, 26 Nov 2015 11:12:32 +0000 (12:12 +0100)] 
Libdw: Handle failure to grab session for location lookup

This one slipped through testing.

3 years agoLibdwPool: Use poolTryTake
Ben Gamari [Thu, 26 Nov 2015 11:02:47 +0000 (12:02 +0100)] 
LibdwPool: Use poolTryTake

3 years agorts/Pool: Add poolTryTake
Ben Gamari [Thu, 26 Nov 2015 11:02:33 +0000 (12:02 +0100)] 
rts/Pool: Add poolTryTake

3 years agoNote #11108 in the bugs section of users guide
Ben Gamari [Wed, 25 Nov 2015 23:32:21 +0000 (00:32 +0100)] 
Note #11108 in the bugs section of users guide

3 years agoUser documentation for DuplicateRecordFields
Adam Gundry [Wed, 25 Nov 2015 23:28:32 +0000 (00:28 +0100)] 
User documentation for DuplicateRecordFields

This is a first draft of the user manual documentation for
DuplicateRecordFields. Feedback welcome. I've intentionally made this a
minimal change, but I wonder if it might make sense to pull out all the
subsections on record system extensions ("Traditional record syntax",
and "Record field disambiguation" through to "Record wildcards") into a
new section? That is, is it worth breaking down the rather monolithic
"Syntactic extensions" section?

Test Plan: n/a

Reviewers: simonpj, bgamari, austin

Reviewed By: bgamari, austin

Subscribers: thomie

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

3 years agoUser's Guide: Add links to MFP wiki page
Herbert Valerio Riedel [Wed, 25 Nov 2015 23:26:23 +0000 (00:26 +0100)] 
User's Guide: Add links to MFP wiki page

Test Plan: IIAM

Reviewers: austin, bgamari, quchen

Reviewed By: bgamari, quchen

Subscribers: thomie

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

GHC Trac Issues: #10751

3 years agoNote STM's vulnerability to non-allocating loops
Ben Gamari [Wed, 25 Nov 2015 23:24:42 +0000 (00:24 +0100)] 
Note STM's vulnerability to non-allocating loops

Test Plan: Read it

Reviewers: austin, fryguybob

Reviewed By: austin

Subscribers: thomie, fryguybob

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

GHC Trac Issues: #10639, #367

3 years agoAdd a simplifier trace for eta-expansion
Simon Peyton Jones [Wed, 25 Nov 2015 16:27:45 +0000 (16:27 +0000)] 
Add a simplifier trace for eta-expansion

3 years agoComments only
Simon Peyton Jones [Wed, 25 Nov 2015 16:26:58 +0000 (16:26 +0000)] 
Comments only

3 years agoRefactor default methods (Trac #11105)
Simon Peyton Jones [Wed, 25 Nov 2015 16:26:23 +0000 (16:26 +0000)] 
Refactor default methods (Trac #11105)

This patch does some signficant refactoring to the treatment
of default methods in class declarations, and more generally
to the type checking of type/class decls.

Highlights:

* When the class has a generic-default method, such as
     class C a where
       op :: a -> a -> Bool
       default op :: Ord a => a -> a -> a
  the ClassOpItem records the type of the generic-default,
  in this case the type (Ord a => a -> a -> a)

* I killed off Class.DefMeth in favour of the very-similar
  BasicTypes.DefMethSpec.  However it turned out to be better
  to use a Maybe, thus
      Maybe (DefMethSpec Type)
  with Nothing meaning "no default method".

* In TcTyClsDecls.tcTyClGroup, we used to accumulate a [TyThing],
  but I found a way to make it much simpler, accumulating only
  a [TyCon].  Much less wrapping and unwrapping.

* On the way I also fixed Trac #10896 in a better way. Instead
  of killing off all ambiguity checks whenever there are any type
  errors (the fix in commit 8e8b9ed), I instead recover in
  TcTyClsDecls.checkValidTyCl.

There was a lot of associated simplification all round

3 years agoupdate link to MonadFail proposal
Herbert Valerio Riedel [Wed, 25 Nov 2015 12:22:47 +0000 (13:22 +0100)] 
update link to MonadFail proposal

[skip ci]

3 years agoMerge remote-tracking branch 'origin/master' into wip/spj-wildcard-refactor
Simon Peyton Jones [Tue, 24 Nov 2015 17:28:50 +0000 (17:28 +0000)] 
Merge remote-tracking branch 'origin/master' into wip/spj-wildcard-refactor

Conflicts:
compiler/hsSyn/HsExpr.hs
compiler/rename/RnSource.hs
testsuite/tests/arrows/should_fail/T5380.stderr
testsuite/tests/gadt/T3169.stderr
testsuite/tests/gadt/rw.stderr
testsuite/tests/ghci/scripts/Defer02.stderr
testsuite/tests/ghci/scripts/ghci050.stderr
testsuite/tests/indexed-types/should_compile/PushedInAsGivens.stderr
testsuite/tests/indexed-types/should_compile/T3208b.stderr
testsuite/tests/indexed-types/should_fail/GADTwrong1.stderr
testsuite/tests/indexed-types/should_fail/Overlap6.stderr
testsuite/tests/indexed-types/should_fail/SimpleFail5a.stderr
testsuite/tests/indexed-types/should_fail/T3330a.stderr
testsuite/tests/indexed-types/should_fail/T3440.stderr
testsuite/tests/indexed-types/should_fail/T4093a.stderr
testsuite/tests/indexed-types/should_fail/T4093b.stderr
testsuite/tests/indexed-types/should_fail/T4174.stderr
testsuite/tests/indexed-types/should_fail/T4272.stderr
testsuite/tests/indexed-types/should_fail/T7194.stderr
testsuite/tests/indexed-types/should_fail/T9662.stderr
testsuite/tests/monadfail/MonadFailErrors.stderr
testsuite/tests/parser/should_fail/T7848.stderr
testsuite/tests/partial-sigs/should_compile/SplicesUsed.stderr
testsuite/tests/partial-sigs/should_compile/T10438.stderr
testsuite/tests/partial-sigs/should_fail/NamedWildcardsNotEnabled.stderr
testsuite/tests/partial-sigs/should_fail/T10045.stderr
testsuite/tests/partial-sigs/should_fail/T10615.stderr
testsuite/tests/partial-sigs/should_fail/Trac10045.stderr
testsuite/tests/polykinds/T7230.stderr
testsuite/tests/polykinds/T7438.stderr
testsuite/tests/th/T10267.stderr
testsuite/tests/typecheck/should_compile/FD1.stderr
testsuite/tests/typecheck/should_compile/FD2.stderr
testsuite/tests/typecheck/should_compile/FD3.stderr
testsuite/tests/typecheck/should_compile/tc141.stderr
testsuite/tests/typecheck/should_fail/CustomTypeErrors02.stderr
testsuite/tests/typecheck/should_fail/T10285.stderr
testsuite/tests/typecheck/should_fail/T10534.stderr
testsuite/tests/typecheck/should_fail/T1899.stderr
testsuite/tests/typecheck/should_fail/T3540.stderr
testsuite/tests/typecheck/should_fail/T7453.stderr
testsuite/tests/typecheck/should_fail/T7696.stderr
testsuite/tests/typecheck/should_fail/T7748a.stderr
testsuite/tests/typecheck/should_fail/T7869.stderr
testsuite/tests/typecheck/should_fail/T8450.stderr
testsuite/tests/typecheck/should_fail/tcfail032.stderr
testsuite/tests/typecheck/should_fail/tcfail057.stderr
testsuite/tests/typecheck/should_fail/tcfail065.stderr
testsuite/tests/typecheck/should_fail/tcfail068.stderr
testsuite/tests/typecheck/should_fail/tcfail076.stderr
testsuite/tests/typecheck/should_fail/tcfail131.stderr
testsuite/tests/typecheck/should_fail/tcfail175.stderr
testsuite/tests/typecheck/should_fail/tcfail179.stderr
testsuite/tests/typecheck/should_fail/tcfail201.stderr

3 years agoDynFlags: Drop stale comment
Ben Gamari [Tue, 24 Nov 2015 15:55:48 +0000 (16:55 +0100)] 
DynFlags: Drop stale comment

3 years agoSimplify the MonadFail code
Simon Peyton Jones [Tue, 24 Nov 2015 15:07:08 +0000 (15:07 +0000)] 
Simplify the MonadFail code

Simplify and tidy up the MonadFail code.
See TcMatches.tcMonadFailOp

Less, code; and more robust.

This incidentally fixes a bug; see the change
to MonadFailErrors.stderr

3 years agoComments only
Simon Peyton Jones [Tue, 24 Nov 2015 13:25:51 +0000 (13:25 +0000)] 
Comments only

3 years agoDynFlags: Update comments to reflect new users guide
Ben Gamari [Tue, 24 Nov 2015 11:41:44 +0000 (12:41 +0100)] 
DynFlags: Update comments to reflect new users guide

3 years agoRewrite checkUniques and incorporate into validate
Ben Gamari [Tue, 24 Nov 2015 11:45:27 +0000 (12:45 +0100)] 
Rewrite checkUniques and incorporate into validate

This should catch duplicate uniques in the future before Bad Things
happen.

Test Plan: Introduce a duplicate unique and validate

Reviewers: austin, hvr, thomie

Reviewed By: hvr, thomie

Subscribers: thomie

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

3 years agoAdd -Wcompat warning flag group
David Luposchainsky [Tue, 24 Nov 2015 11:45:00 +0000 (12:45 +0100)] 
Add -Wcompat warning flag group

Reviewers: hvr, austin, thomie, bgamari

Reviewed By: hvr, austin, thomie, bgamari

Subscribers: thomie

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

GHC Trac Issues: #11000

3 years agoRearrange error msgs and add section markers (Trac #11014).
Evan Laforge [Tue, 24 Nov 2015 11:43:18 +0000 (12:43 +0100)] 
Rearrange error msgs and add section markers (Trac #11014).

This puts the "Relevant bindings" section at the end.

It uses a TcErrors.Report Monoid to divide messages by importance and
then mappends them together.  This is not the most efficient way since
there are various intermediate Reports and list appends, but it probably
doesn't matter since error messages shouldn't get that large, and are
usually prepended.  In practice, everything is `important` except
`relevantBindings`, which is `supplementary`.

ErrMsg's errMsgShortDoc and errMsgExtraInfo were extracted into ErrDoc,
which has important, context, and suppelementary fields.  Each of those
three sections is marked with a bullet character, '•' on unicode
terminals and '*' on ascii terminals.  Since this breaks tons of tests,
I also modified testlib.normalise_errmsg to strip out '•'s.

--- Additional notes:

To avoid prepending * to an empty doc, I needed to filter empty docs.
This seemed less error-prone than trying to modify everyone who produces
SDoc to instead produce Maybe SDoc.  So I added `Outputable.isEmpty`.
Unfortunately it needs a DynFlags, which is kind of bogus, but otherwise
I think I'd need another Empty case for SDoc, and then it couldn't be a
newtype any more.

ErrMsg's errMsgShortString is only used by the Show instance, which is
in turn only used by Show HscTypes.SourceError, which is in turn only
needed for the Exception instance.  So it's probably possible to get rid
of errMsgShortString, but that would a be an unrelated cleanup.

Fixes #11014.

Test Plan: see above

Reviewers: austin, simonpj, thomie, bgamari

Reviewed By: thomie, bgamari

Subscribers: simonpj, nomeata, thomie

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

GHC Trac Issues: #11014

3 years agoImplement new `-fwarn-noncanonical-monad-instances`
Herbert Valerio Riedel [Tue, 24 Nov 2015 11:46:33 +0000 (12:46 +0100)] 
Implement new `-fwarn-noncanonical-monad-instances`

Warn about incoherent/non-canonical 'Applicative'/'Monad' instance
declarations. Specifically the following invariants are checked:

In 'Monad' instances declarations warn if the any of the following
conditions does not hold:

 * If `return` is overridden it must be canonical (i.e. `return = pure`).
 * If `(>>)` is overridden it must be canonical (i.e. `(>>) = (*>)`).

In 'Applicative' instance declarations:

 * Warn if 'pure' is defined backwards (i.e. `pure = return`).
 * Warn if '(*>)' is defined backwards (i.e. `(*>) = (>>)`).

NB, this warning flag is not enabled via `-Wall` nor `-Wcompat`.

This addresses #11128

Reviewers: quchen, austin, bgamari

Reviewed By: bgamari

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

3 years agoAdd `PrelNames.thenAName` for `Applicative(*>)`
Herbert Valerio Riedel [Mon, 23 Nov 2015 21:25:38 +0000 (22:25 +0100)] 
Add `PrelNames.thenAName` for `Applicative(*>)`

This is needed to allow subsequent patches to refer to `*>`.

While at it, this commit also groups together the `Applicative` definitions
to reduce confusion.

Reviewed By: austin

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

3 years agorts: Always export Libdw* symbols
Ben Gamari [Mon, 23 Nov 2015 22:12:41 +0000 (23:12 +0100)] 
rts: Always export Libdw* symbols

Otherwise we'll get link time failures as `base` always builds
`GHC.ExecutionStack`.

Test Plan: Validate

Reviewers: austin

Subscribers: thomie

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

3 years agoAdd the rest of the notes for Located RdrName
Alan Zimmerman [Mon, 23 Nov 2015 17:33:34 +0000 (19:33 +0200)] 
Add the rest of the notes for Located RdrName

3 years agoAdd tests/monadfail/Makefile
Simon Peyton Jones [Mon, 23 Nov 2015 17:20:51 +0000 (17:20 +0000)] 
Add tests/monadfail/Makefile

3 years agoImprove constraint-used-as-type error msg
Simon Peyton Jones [Mon, 23 Nov 2015 08:35:44 +0000 (08:35 +0000)] 
Improve constraint-used-as-type error msg

This responds to Trac #11112 by improving the error message
when the kind checker discovers something of kind Constraint
used when a type is expected

3 years agoMore wibbles
Simon Peyton Jones [Mon, 23 Nov 2015 17:18:06 +0000 (17:18 +0000)] 
More wibbles

including haddock submodule update

3 years agoOutput source notes in extended DWARF DIEs
Ben Gamari [Fri, 23 Oct 2015 08:52:12 +0000 (10:52 +0200)] 
Output source notes in extended DWARF DIEs

In order to accomplish this we need to ensure that emit DIEs for all
DebugBlocks, even those that have been optimized out, lest we end up
with undefined symbols of parents at link time.

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

3 years agoDwarf: Ensure tick parentage is preserved
Ben Gamari [Fri, 30 Oct 2015 19:59:45 +0000 (20:59 +0100)] 
Dwarf: Ensure tick parentage is preserved

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

3 years agoSupport multiple debug output levels
Ben Gamari [Fri, 25 Sep 2015 16:00:19 +0000 (18:00 +0200)] 
Support multiple debug output levels

We now only strip block information from DebugBlocks when compiling with
`-g1`, intended to be used when only minimal debug information is
desired. `-g2` is assumed when `-g` is passed without any integer
argument.

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

3 years agobase: Add Haskell interface to ExecutionStack
Ben Gamari [Sun, 23 Aug 2015 09:48:51 +0000 (11:48 +0200)] 
base: Add Haskell interface to ExecutionStack

Differential Revision: https://phabricator.haskell.org/D1198#40948

3 years agorts: Add LibdwPool, a pool for libdw sessions
Ben Gamari [Thu, 22 Oct 2015 20:17:11 +0000 (22:17 +0200)] 
rts: Add LibdwPool, a pool for libdw sessions

Differential Revision: https://phabricator.haskell.org/D1198#40948

3 years agoUpdate submodule to origin/master
Simon Peyton Jones [Mon, 23 Nov 2015 16:13:58 +0000 (16:13 +0000)] 
Update submodule to origin/master

3 years agoWibbles to merge with master
Simon Peyton Jones [Mon, 23 Nov 2015 16:11:05 +0000 (16:11 +0000)] 
Wibbles to merge with master

3 years agorts: Add simple resource pool
Ben Gamari [Thu, 22 Oct 2015 20:16:46 +0000 (22:16 +0200)] 
rts: Add simple resource pool

3 years agorts: Expose more libdw symbols
Ben Gamari [Fri, 23 Oct 2015 07:15:20 +0000 (09:15 +0200)] 
rts: Expose more libdw symbols

3 years agoLibdw: Fix initial register collection on i386
Ben Gamari [Mon, 23 Nov 2015 11:45:47 +0000 (12:45 +0100)] 
Libdw: Fix initial register collection on i386

RIP-relative addressing isn't available on i386.

3 years agoLibdw: Fix build on 32-bit platforms
Ben Gamari [Mon, 23 Nov 2015 11:37:17 +0000 (12:37 +0100)] 
Libdw: Fix build on 32-bit platforms

The casting here is a bit tricky since Dwarf_Addr is always 64-bits.
This means we first need to narrow to uintptr_t before casting to/from a
pointer for compatibility on 32-bit architectures.

3 years agoMerge remote-tracking branch 'origin/master' into wip/spj-wildcard-refactor
Simon Peyton Jones [Mon, 23 Nov 2015 13:42:29 +0000 (13:42 +0000)] 
Merge remote-tracking branch 'origin/master' into wip/spj-wildcard-refactor

Conflicts:
compiler/deSugar/DsMeta.hs
compiler/hsSyn/Convert.hs
compiler/hsSyn/HsTypes.hs
compiler/parser/Parser.y
compiler/parser/RdrHsSyn.hs
compiler/rename/RnExpr.hs
compiler/rename/RnTypes.hs
compiler/typecheck/TcRnDriver.hs
compiler/typecheck/TcTyClsDecls.hs
testsuite/tests/ghc-api/landmines/landmines.stdout
testsuite/tests/partial-sigs/should_compile/T10403.stderr
testsuite/tests/partial-sigs/should_fail/Trac10045.stderr
testsuite/tests/polykinds/T9222.stderr
utils/haddock

3 years agoAdd a note explaining why every RdrName is Located
Alan Zimmerman [Mon, 23 Nov 2015 13:37:25 +0000 (15:37 +0200)] 
Add a note explaining why every RdrName is Located

3 years agoError message wibbles
Simon Peyton Jones [Mon, 23 Nov 2015 13:20:51 +0000 (13:20 +0000)] 
Error message wibbles

3 years agoMissing annotations: unicode foralls
Simon Peyton Jones [Mon, 23 Nov 2015 13:19:32 +0000 (13:19 +0000)] 
Missing annotations: unicode foralls

3 years agoComments
Simon Peyton Jones [Mon, 23 Nov 2015 13:19:04 +0000 (13:19 +0000)] 
Comments

3 years agoRip out Papi configure check
Ben Gamari [Mon, 23 Nov 2015 12:44:13 +0000 (13:44 +0100)] 
Rip out Papi configure check

3 years agobuild.mk.sample: Document meaning of WERROR
Ben Gamari [Mon, 23 Nov 2015 10:35:34 +0000 (11:35 +0100)] 
build.mk.sample: Document meaning of WERROR

31bcf9b62ceaed98bdd3b7605e68d315bcff0c8a changed the behavior of WERROR
such that it would only apply to the stage 2 build. The reason for this
was to avoid silly redundant imports and such breaking validation on
different bootstrap compiler versions.

Document the fact that WERROR now only applies to the stage 2 build.

3 years agoMake abstractVars deterministic in SetLevel
Bartosz Nitka [Sun, 22 Nov 2015 22:42:30 +0000 (23:42 +0100)] 
Make abstractVars deterministic in SetLevel

This fixes a non-determinism bug where depending on the order
of uniques allocated, the type variables would be in a different order
when abstracted for the purpose of lifting out an expression.

Test Plan:
I've added a new testcase that reproduces the problem
./validate

Reviewers: simonmar, austin, bgamari, simonpj

Reviewed By: simonpj

Subscribers: nomeata, thomie

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

GHC Trac Issues: #4012

3 years agoApiAnnotations: Make all RdrName occurences Located
Alan Zimmerman [Sun, 22 Nov 2015 22:41:57 +0000 (23:41 +0100)] 
ApiAnnotations: Make all RdrName occurences Located

At the moment the API Annotations can only be used on the ParsedSource,
as there are changes made to the RenamedSource that prevent it from
being used to round trip source code.

It is possible to build a map from every Located Name in the
RenamedSource from its location to the Name, which can then be used when
resolved names are required when changing the ParsedSource.

However, there are instances where the identifier is not located,
specifically

  (GHC.VarPat name)
  (GHC.HsVar name)
  (GHC.UserTyVar name)
  (GHC.HsTyVar name)

Replace each of the name types above with (Located name)

Updates the haddock submodule.

Test Plan: ./validate

Reviewers: austin, goldfire, bgamari

Reviewed By: bgamari

Subscribers: goldfire, thomie, mpickering

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

GHC Trac Issues: #11019

3 years agoNew expected test output for 32 bit platforms
Erik de Castro Lopo [Sun, 22 Nov 2015 22:32:33 +0000 (23:32 +0100)] 
New expected test output for 32 bit platforms

Test Plan: Test on Arm and PowerPc.

Reviewers: bgamari, thomie, austin

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

GHC Trac Issues: #11060

3 years agoAdd comment to Parser.y re extra API Annotation
Alan Zimmerman [Sun, 22 Nov 2015 19:18:24 +0000 (21:18 +0200)] 
Add comment to Parser.y re extra API Annotation

Document extra AnnRarrow annotation on a HsFunTy

3 years agoFollow-up fix to 3e2a4eefbed7002437c3f (re #11109)
Herbert Valerio Riedel [Sun, 22 Nov 2015 08:38:38 +0000 (09:38 +0100)] 
Follow-up fix to 3e2a4eefbed7002437c3f (re #11109)

Using `:` as sed-`s`-expr separator is not a good idea on windows, as
this can result in an expression like

   's:@INSTALL@:$(subst ../install-sh,E:/msys64/home/foo/ghc/install-sh,@INSTALL@):g'

(note the `E:/` drive component)

Using `|` instead of `:` has less risk of collision with the substitution expression

3 years agoRemove accidentally added T10359 blob
Herbert Valerio Riedel [Sun, 22 Nov 2015 08:09:06 +0000 (09:09 +0100)] 
Remove accidentally added T10359 blob

This sneaked in via 2325bd4e0fad0e5872556c5a78d1a6a1873e7201 / D1468 / #4012

This is frustrating... we've added a useless 2.4MiB binary blob to our
Git history which wastes *everyones* bandwidth for eternity
(unless we truncate or rewrite history).

We should add lint-checks and/or a pre-receive commit hook test to prevent
this in future.

3 years agoFunction definition in GHCi
Roman Shatsov [Sat, 21 Nov 2015 14:58:34 +0000 (15:58 +0100)] 
Function definition in GHCi

This patch allows define and re-define functions in ghci. `let` is not
required anymore (but can be used).

Idea: If ghci input string can be parsed as statement then run it as
statement else run it as declaration.

Reviewers: mpickering, bgamari, austin

Reviewed By: mpickering, bgamari, austin

Subscribers: hvr, mpickering, dterei, thomie

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

GHC Trac Issues: #7253

3 years agoCreate a deterministic version of tyVarsOfType
Bartosz Nitka [Sat, 21 Nov 2015 14:57:09 +0000 (15:57 +0100)] 
Create a deterministic version of tyVarsOfType

I've run into situations where I need deterministic `tyVarsOfType` and
this implementation achieves that and also brings an algorithmic
improvement.  Union of two `VarSet`s takes linear time the size of the
sets and in the worst case we can have `n` unions of sets of sizes
`(n-1, 1), (n-2, 1)...` making it quadratic.

One reason why we need deterministic `tyVarsOfType` is in `abstractVars`
in `SetLevels`. When we abstract type variables when floating we want
them to be abstracted in deterministic order.

Test Plan: harbormaster

Reviewers: simonpj, goldfire, austin, hvr, simonmar, bgamari

Reviewed By: simonmar

Subscribers: thomie

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

GHC Trac Issues: #4012

3 years agoAdd DVarSet - a deterministic set of Vars
Bartosz Nitka [Sat, 21 Nov 2015 14:49:14 +0000 (15:49 +0100)] 
Add DVarSet - a deterministic set of Vars

This implements `DVarSet`, a deterministic set of Vars, with an
interface very similar to `VarSet` with a couple of functions missing.

I will need this in changes that follow, one of them will be about
changing the type of the set of Vars that `RuleInfo` holds to make the
free variable computation deterministic.

Test Plan:
./validate
I can add new tests if anyone wants me to.

Reviewers: simonpj, simonmar, austin, bgamari

Reviewed By: simonmar, bgamari

Subscribers: thomie

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

GHC Trac Issues: #4012

3 years agoSuppress conflicting types for builtins warnings
Herbert Valerio Riedel [Sat, 21 Nov 2015 14:48:49 +0000 (15:48 +0100)] 
Suppress conflicting types for builtins warnings

GCC 4.0 and later warn about type-conflicting prototypes for built-in
functions such as `strlen`. This is a problem for the via-c backend as
it generates code such as

  typedef void *(*(*StgFunPtr)(void))(void);
  extern StgFunPtr strlen();

However, by using the `-fno-builtin` flag, GCC is told not to try to
auto-detect such built-in functions and instead treat them as ordinary
external functions.  This also suppresses this warning.

This address #7660

Test Plan: IIAM

Reviewers: bgamari, austin

Reviewed By: austin

Subscribers: thomie, erikd

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

GHC Trac Issues: #7660

3 years agoRtsFlags: Fix const warning
Ben Gamari [Sat, 21 Nov 2015 14:48:09 +0000 (15:48 +0100)] 
RtsFlags: Fix const warning

Reviewers: austin

Reviewed By: austin

Subscribers: thomie

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

3 years agoFix Windows builds after D1242
Tamar Christina [Sat, 21 Nov 2015 12:33:09 +0000 (13:33 +0100)] 
Fix Windows builds after D1242

Summary:
Only use the merge_sections.ld linker script if SplitSections is enabled.

I thought I had a way to make the linker script actually work on Windows
and produce object files instead of image files (by using the "INSERT AFTER"
linker script command to get the default script's output format setting),
but that fix caused ghci to crash with an illegal instruction on startup.

Gave up and made a simpler fix of just disabling this for normal builds,
as it's only really relevant with SplitSections enabled anyway.

Reviewers: austin, thomie, bgamari

Reviewed By: austin, thomie

Subscribers: Phyx, thomie

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

GHC Trac Issues: #8405

3 years agoMerge remote-tracking branch
Simon Peyton Jones [Fri, 20 Nov 2015 23:50:27 +0000 (23:50 +0000)] 
Merge remote-tracking branch

  'origin/master' into wip/spj-wildcard-refactor

Conflicts:
compiler/parser/Parser.y
compiler/rename/RnEnv.hs
compiler/rename/RnExpr.hs
compiler/typecheck/TcBinds.hs
compiler/typecheck/TcErrors.hs
compiler/typecheck/TcEvidence.hs
compiler/typecheck/TcExpr.hs
utils/haddock

3 years agoFollow-up fixup to c5d8162d230c373
Herbert Valerio Riedel [Fri, 20 Nov 2015 17:06:50 +0000 (18:06 +0100)] 
Follow-up fixup to c5d8162d230c373

This was missing from c5d8162d230c373b2b49ec94d3f9a027ff6e2dd6 / D1501
for some reason causing the AIX detection to result in `OSUnknown`
rather than `OSAIX`.

3 years agobase: Delete errant GHC/Stack.hsc
Ben Gamari [Thu, 19 Nov 2015 16:58:37 +0000 (17:58 +0100)] 
base: Delete errant GHC/Stack.hsc

This was added in 8988be8561ce0857f3befd6ab3b6c29060685c0a, probably due
to an incorrect merge resolution. The build system has been building
`Stack.hs`.

3 years agousers-guide: Fix version number
Ben Gamari [Thu, 19 Nov 2015 14:27:28 +0000 (15:27 +0100)] 
users-guide: Fix version number

Previously used GhcVersion, which is apparently the version of the
bootstrap compiler. ProjectVersion appears to be the thing to use here.

3 years agoMore wibbles
Simon Peyton Jones [Fri, 20 Nov 2015 15:46:04 +0000 (15:46 +0000)] 
More wibbles

3 years agouser's guide: Fix some accidental triple-` quote
Herbert Valerio Riedel [Fri, 20 Nov 2015 13:28:22 +0000 (07:28 -0600)] 
user's guide: Fix some accidental triple-` quote

Reviewed By: austin

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

3 years agoghci: don't let ctags/etags overwrite source files
Austin Seipp [Fri, 20 Nov 2015 13:26:42 +0000 (07:26 -0600)] 
ghci: don't let ctags/etags overwrite source files

A ource file which was accidently passed as parameter into `:ctags` or `:etags`
can be overwritten by tag data. This patch updates documentation to avoid
confusion in commands usage and prevents `collateAndWriteTags` from modifying
existing source files.

Reviewed By: thomie, bgamari, austin

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

GHC Trac Issues: #10989

3 years agoPattern Synonym Documentation
Matthew Pickering [Thu, 19 Nov 2015 13:50:01 +0000 (13:50 +0000)] 
Pattern Synonym Documentation

Summary:
This patch adds documentation for record pattern synonyms (D1258) and
bundling pattern synonyms with type constructors in export lists (D1152).

There are also other small improvements motivated by #10900.

Reviewers: goldfire, bgamari, austin

Reviewed By: bgamari

Subscribers: goldfire, thomie

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

GHC Trac Issues: #10900

3 years agoBump process submodule
Ben Gamari [Thu, 19 Nov 2015 13:05:27 +0000 (14:05 +0100)] 
Bump process submodule

3 years agoUnbreak Text.Read.Lex.lex on Unicode symbols
M Farkas-Dyck [Thu, 19 Nov 2015 11:19:30 +0000 (12:19 +0100)] 
Unbreak Text.Read.Lex.lex on Unicode symbols

Reviewers: thomie, hvr, austin, bgamari

Reviewed By: bgamari

Subscribers: bgamari, thomie

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

GHC Trac Issues: #10444

3 years agoSet AIX specific CFLAGS flags
Herbert Valerio Riedel [Thu, 19 Nov 2015 11:56:48 +0000 (12:56 +0100)] 
Set AIX specific CFLAGS flags

First of all, we need to use -mminimal-toc on IBM AIX

AIX's XCOFF is limited to 16k entries in its TOC for 32bit compilation,
which quickly overflows with GHC's code generation.

Otoh, the Parser.hs module contains more entries than fit into a
minimal-toc, so we need to switch back to `-mfull-toc` for that single
module again.

Then, we also need to set the `THREAD_SAFE` CPP #define in order to
unlock the thread-safe `errno` which is essential for the threaded
runtime.

Depends on D1501

Reviewers: austin, bgamari

Reviewed By: bgamari

Subscribers: thomie, erikd

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

3 years agoMake GHC aware of OSAIX and AixLD
Herbert Valerio Riedel [Thu, 19 Nov 2015 11:55:35 +0000 (12:55 +0100)] 
Make GHC aware of OSAIX and AixLD

GHC needs to be aware of targetting AIX because
AIX requires some special handling for the toolchain
(similiar to Solaris)

Reviewers: austin, bgamari

Reviewed By: bgamari

Subscribers: thomie, erikd

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

3 years agoderivedConstants: Add support for AIX
Herbert Valerio Riedel [Thu, 19 Nov 2015 11:55:26 +0000 (12:55 +0100)] 
derivedConstants: Add support for AIX

On IBM AIX `nm` doesn't support reporting symbol sizes, so we need to
resort to `objdump` instead, which has a peculiar output format on AIX.

depends on D1499

Reviewers: austin, bgamari

Reviewed By: bgamari

Subscribers: kgardas, thomie

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

3 years agoMake `derivedConstants` more crosscompile-friendly
Herbert Valerio Riedel [Thu, 19 Nov 2015 11:54:54 +0000 (12:54 +0100)] 
Make `derivedConstants` more crosscompile-friendly

`derivedConstants` currently uses `System.Info.os` for decisions (which
doesn't necessarily reflect the build-target), as well as hardcoding
"/usr/bin/objdump" for openbsd.

This patch auto-detects `objdump` similiar to how `nm` is detected via
Autoconf as well as passing the target-os into `derivedConstants` via
commandline.

Reviewers: austin, kgardas, erikd, bgamari

Reviewed By: kgardas, erikd, bgamari

Subscribers: kgardas, thomie, erikd

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

3 years agoFix broken build-system when libffi uses install-sh
Herbert Valerio Riedel [Thu, 19 Nov 2015 11:21:04 +0000 (12:21 +0100)] 
Fix broken build-system when libffi uses install-sh

Reviewers: austin, bgamari

Reviewed By: bgamari

Subscribers: thomie

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

GHC Trac Issues: #11109

3 years agoFix interaction of DuplicateRecordFields and GHC.Generics
Adam Gundry [Thu, 19 Nov 2015 11:53:46 +0000 (12:53 +0100)] 
Fix interaction of DuplicateRecordFields and GHC.Generics

This prevents GHC.Generics from exposing mangled selector names
when used on a datatype defined with DuplicateRecordFields enabled.

Test Plan:
New test overloadedrecflds_generics, which tests that both
GHC.Generics and Data.Data use the correct field labels, not mangled
names.

Reviewers: kosmikus, simonpj, austin, bgamari

Reviewed By: bgamari

Subscribers: thomie

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

3 years agoRelease Notes: Mention out-of-scope error message improvements
Joachim Breitner [Wed, 18 Nov 2015 23:05:50 +0000 (00:05 +0100)] 
Release Notes: Mention out-of-scope error message improvements

Summary: as implemented for #11071.

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

3 years agoMention "-XMonadFailDesugaring" in the docs
David Luposchainsky [Wed, 18 Nov 2015 22:12:47 +0000 (23:12 +0100)] 
Mention "-XMonadFailDesugaring" in the docs

Reviewers: austin, bgamari

Subscribers: thomie

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

3 years agoCorrect &gt; to > in user's guide
Reid Barton [Wed, 18 Nov 2015 22:12:05 +0000 (23:12 +0100)] 
Correct &gt; to > in user's guide

Reviewers: austin, bgamari

Reviewed By: bgamari

Subscribers: thomie

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

3 years agoWibbles
Simon Peyton Jones [Wed, 18 Nov 2015 17:44:22 +0000 (17:44 +0000)] 
Wibbles

3 years agousers-guide: Move <h1> outside of <a> tag
Ben Gamari [Wed, 18 Nov 2015 16:42:46 +0000 (17:42 +0100)] 
users-guide: Move <h1> outside of <a> tag

Otherwise the header extends across the entire body, increasing the
chance that the user hits it instead of the "next" link below it.

3 years agoFix inconsistent pretty-printing of type families
Michał Sośnicki [Wed, 18 Nov 2015 15:02:53 +0000 (16:02 +0100)] 
Fix inconsistent pretty-printing of type families

After the changes, the three functions used to print type families
were identical, so they are refactored into one.

Original RHSs of data instance declarations are recreated and
printed in user error messages.

RHSs containing representation TyCons are printed in the
Coercion Axioms section in a typechecker dump.

Add vbar to the list of SDocs exported by Outputable.
Replace all text "|" docs with it.

Fixes #10839

Reviewers: goldfire, jstolarek, austin, bgamari

Reviewed By: jstolarek

Subscribers: jstolarek, thomie

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

GHC Trac Issues: #10839

3 years agoRefactor HsExpr.RecordCon, RecordUpd
Simon Peyton Jones [Wed, 18 Nov 2015 15:57:13 +0000 (15:57 +0000)] 
Refactor HsExpr.RecordCon, RecordUpd

This follows Matthew's patch making pattern synoyms work
with records.

This patch
 - replaces the (PostTc id [FieldLabel]) field of
   RecordCon with (PostTc id ConLike)

 - record-ises both RecordCon and RecordUpd, which
   both have quite a lot of fields.

No change in behaviour