ghc.git
3 years agoEnable RemoteGHCi on Windows
Tamar Christina [Wed, 27 Jan 2016 09:20:11 +0000 (10:20 +0100)] 
Enable RemoteGHCi on Windows

Makes the needed changes to make RemoteGHCi work on Windows.
The approach passes OS Handles areound instead of the Posix Fd
as on Linux.

The reason is that I could not find any real documentation about
the behaviour of Windows w.r.t inheritance and Posix FDs.

The implementation with Fd did not seem to be able to find the Fd
in the child process. Instead I'm using the much better documented
approach of passing inheriting handles.

This requires a small modification to the `process` library.
https://github.com/haskell/process/pull/52

Test Plan: ./validate On Windows x86_64

Reviewers: thomie, erikd, bgamari, simonmar, austin, hvr

Reviewed By: simonmar

Subscribers: #ghc_windows_task_force

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

GHC Trac Issues: #11100

3 years agoBuild profiling libraries on `validate --slow` (#11496)
Thomas Miedema [Tue, 26 Jan 2016 23:08:53 +0000 (00:08 +0100)] 
Build profiling libraries on `validate --slow` (#11496)

3 years agoTestsuite: fixup req_profiling tests (#11496)
Thomas Miedema [Tue, 26 Jan 2016 12:07:38 +0000 (13:07 +0100)] 
Testsuite: fixup req_profiling tests (#11496)

* T2552 (#10037) is failng for all threaded opt_ways, not for WAY=prof.
* TH_spliceE5_prof (#11495) is failing when ghc_dynamic
* Rename ghci_dynamic to ghc_dynamic. It's the same thing.

3 years agoConstruct in_scope set in mkTopTCvSubst
Bartosz Nitka [Tue, 26 Jan 2016 19:26:06 +0000 (11:26 -0800)] 
Construct in_scope set in mkTopTCvSubst

The pre-condition on `mkTopTCvSubst` turned out to be wrong and
not satisfied by any of the callers. I've fixed it, so that it
constructs the in_scope set from the range of the substitution.
`mkTopTCvSubst` was also unnecessarily general it is never called
with `CoVars`, so I changed the type signature and added an assertion.

Test Plan: ./validate --slow

Reviewers: goldfire, simonpj, bgamari, austin

Reviewed By: simonpj

Subscribers: thomie

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

GHC Trac Issues: #11371

3 years agoSplit off -Wunused-type-variables from -Wunused-matches
RyanGlScott [Tue, 26 Jan 2016 17:33:19 +0000 (12:33 -0500)] 
Split off -Wunused-type-variables from -Wunused-matches

Summary:
Previously, `-Wunused-matches` would fire whenever it detected unused type
variables in a type family or data family instance. This can be annoying for
users who wish to use type variable names as documentation, as being
`-Wall`-compliant would mean that they'd have to prefix many of their type
variable names with underscores, making the documentation harder to read.

To avoid this, a new warning `-Wunused-type-variables` was created that only
encompasses unused variables in family instances. `-Wunused-matches` reverts
back to its role of only warning on unused term-level pattern names. Unlike
`-Wunused-matches`, `-Wunused-type-variables` is not implied by `-Wall`.

Fixes #11451.

Test Plan: ./validate

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

Reviewed By: simonpj, bgamari

Subscribers: thomie

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

GHC Trac Issues: #11451

3 years agoFix segmentation fault when .prof file not writeable
Thomas Miedema [Tue, 26 Jan 2016 00:11:49 +0000 (01:11 +0100)] 
Fix segmentation fault when .prof file not writeable

There are two ways to do retainer profiling. Quoting from the user's guide:
  1. `+RTS -hr` "Breaks down the graph by retainer set"
  2. `+RTS -hr<cc> -h<x>`, where `-h<x>` is one of normal heap profiling
     break-down options (e.g. `-hc`), and `-hr<cc> means "Restrict the
     profile to closures with retainer sets containing cost-centre
     stacks with one of the specified cost centres at the top."

Retainer profiling writes to a .hp file, like the other heap profiling
options, but also to a .prof file. Therefore, when the .prof file is not
writeable for whatever reason, retainer profiling should be turned off
completely.

This worked ok when running the program with `+RTS -hr` (option 1), but a
segfault would occur when using `+RTS -hr<cc> -h<x>`, with `x!=r` (option 2).

This commit fixes that.

Reviewed by: bgamari

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

GHC Trac Issues: #11489

3 years agoNicer error on +RTS -hc without -rtsopts or -prof
Thomas Miedema [Mon, 25 Jan 2016 19:07:31 +0000 (20:07 +0100)] 
Nicer error on +RTS -hc without -rtsopts or -prof

Before:
 * without -rtsopts: Most RTS options are disabled. Link with -rtsopts to enable them.
 * with -rtsopts: invalid heap profile option: -hc
After:
 * the flag -hc requires the program to be built with -prof

Copy `Note [OPTION_SAFE vs OPTION_UNSAFE]` from commit 8c7ad0bd.

Reviewed by: bgamari

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

3 years agoPass InScopeSet to substTy in lintTyApp
Bartosz Nitka [Thu, 21 Jan 2016 19:30:07 +0000 (11:30 -0800)] 
Pass InScopeSet to substTy in lintTyApp

This is the fix proposed in #11371:
```
In other cases, we already have the in-scope set in hand. Example: in
CoreLint.lintTyApp we find a call to substTyWith. But Lint carries an
in-scope set, so it would be easy to pass it to substTyWith.
```

Test Plan: ./validate --slow (only pre-existing problems)

Reviewers: simonpj, goldfire, austin, nomeata, bgamari

Subscribers: thomie

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

GHC Trac Issues: #11371

3 years agoFix three broken tests involving exceptions
Simon Peyton Jones [Tue, 26 Jan 2016 12:36:21 +0000 (12:36 +0000)] 
Fix three broken tests involving exceptions

See comment:16 in Trac #10712. The tests were wrong, not GHC!

3 years agoUpdate process submodule to 1.4.2.0 release
Herbert Valerio Riedel [Tue, 26 Jan 2016 11:41:23 +0000 (12:41 +0100)] 
Update process submodule to 1.4.2.0 release

Most notably, this pulls in a feature needed for #11100 (remote ghci)
windows-support

3 years agoUpdate transformers submodule to 0.5.1.0 release
Herbert Valerio Riedel [Tue, 26 Jan 2016 11:03:23 +0000 (12:03 +0100)] 
Update transformers submodule to 0.5.1.0 release

This shouldn't have any noticeable API changes for GHC

3 years agoMinor users-guide markup fixup [skip ci]
Herbert Valerio Riedel [Tue, 26 Jan 2016 11:00:58 +0000 (12:00 +0100)] 
Minor users-guide markup fixup [skip ci]

3 years agoMissed plural renaming in user's guide
Herbert Valerio Riedel [Tue, 26 Jan 2016 10:59:40 +0000 (11:59 +0100)] 
Missed plural renaming in user's guide

Follow-up to 132c20894d102558cc8f3aee5bc289425d0ddb24

[skip ci]

3 years agoFix two cloning-related bugs
Simon Peyton Jones [Tue, 26 Jan 2016 09:30:50 +0000 (09:30 +0000)] 
Fix two cloning-related bugs

Crikey!  Not just one but two bugs in type variable cloning,
both dating from the days before PolyKinds.  Both were shown up
by Trac #11330.

1. In SetLevels, when floating a case expression we must clone its
   binders, *and* do so in a telescope-aware way, because the
   constructor may bind a kind variable that appears in the kind
   of a type variable.

   Instead of doing this (wrongly) by steam, call CoreSubst.cloneBndrs.

   I added Notes and did other refactoring at the same time.

2. It turned out that CoreSubst.cloneBndrs calls TyCoRep.cloneTyVarBndr,
   and that too was bogus!  It didn't substitute in the kind of the
   TyVar being cloned.  There was even a comment to say "variables can't
   appear in kinds".  Thta hasn't been true for a long time now.

Easily fixed.

Interestingly, I then found that test
   dependent/should_compile/KindEqualities
was emitting a new inexhaustive-pattern-match warning.  Sure enough
it was valid!  So the lack of cloning in cloneTyVarBndr really was
causing an observable bug; just one that we had not observed.

3 years agoKill off zipTopTCvSubst in favour of zipOpenTCvSubst
Simon Peyton Jones [Tue, 26 Jan 2016 09:37:06 +0000 (09:37 +0000)] 
Kill off zipTopTCvSubst in favour of zipOpenTCvSubst

As Bartosz has discovered, the invariants for substitutions were
wrong, and in particular the "mkTop...Subst" and "zipTop..Subst"
functions were building substitutions that didn't obey even the
old invariants.

This patch kills of the bogus zipTopTCvSubst in favour of the
more robust zipOpenTCvSubst.

I tripped over this because my upcoming patch (concerning SetLevels,
Trac #11330) triggered an ASSERT failure in the substitution
well-formedness assertion in TyCoRep.

3 years agoAdd "ticks-exhausted" comment
Simon Peyton Jones [Tue, 26 Jan 2016 09:24:33 +0000 (09:24 +0000)] 
Add "ticks-exhausted" comment

This code deliberately builds a subtle negative-occurrence-of-data-type
example, described in the paper, so with -O it'll give "simplifier
ticks exhausted".

This patch just adds a comment to explain.

3 years agoWhite space only
Simon Peyton Jones [Tue, 26 Jan 2016 09:00:57 +0000 (09:00 +0000)] 
White space only

3 years agoLess verbose output for the in-scope set
Simon Peyton Jones [Mon, 25 Jan 2016 14:17:14 +0000 (14:17 +0000)] 
Less verbose output for the in-scope set

With -dppr-debug the output for the (ofen-large) InScope set
was overwhelming.  This makes it smaller.

Only affects debugging.

3 years agoEnsure that we don't produce code for pre-ARMv7 without barriers
Ben Gamari [Mon, 25 Jan 2016 20:19:04 +0000 (21:19 +0100)] 
Ensure that we don't produce code for pre-ARMv7 without barriers

We are unable to produce load/store barriers for pre-ARMv7 targets.
Phab:D894 added dummy cases to SMP.h for these barriers to prevent the
build from failing under the assumption that there are no SMP-capable
devices of this vintage. However, #10433 points out that it is more
correct to simply set NOSMP for such targets.

Tested By: rwbarton

Test Plan: Validate

Reviewers: erikd, rwbarton, austin

Reviewed By: rwbarton

Subscribers: thomie

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

GHC Trac Issues: #10433

3 years agoImplement -Wunrecognised-warning-flag
Ben Gamari [Mon, 25 Jan 2016 16:14:49 +0000 (17:14 +0100)] 
Implement -Wunrecognised-warning-flag

This allows the user to avoid warnings for warning flags that GHC
doesn't recognise. See #11429 for details..

Test Plan: Validate with T11429[abc] tests

Reviewers: austin, hvr

Reviewed By: hvr

Subscribers: thomie

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

GHC Trac Issues: #11429

3 years agouser-guide: Note order-dependence of flags
Ben Gamari [Mon, 25 Jan 2016 14:18:13 +0000 (15:18 +0100)] 
user-guide: Note order-dependence of flags

This supplements the description previously added in
6400c7687223c5b2141176aa92f7ff987f61aba6. See #10560 for details.

Test Plan: read it

Reviewers: austin

Subscribers: thomie, hvr

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

GHC Trac Issues: #10560

3 years agoBetter document behavior of -Wmissed-specialisations
Ben Gamari [Mon, 25 Jan 2016 14:18:04 +0000 (15:18 +0100)] 
Better document behavior of -Wmissed-specialisations

Test Plan: Read it

Reviewers: austin

Subscribers: thomie

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

3 years agoRename -Wmissing-monadfail-instance to plural-form
Herbert Valerio Riedel [Mon, 25 Jan 2016 13:51:50 +0000 (14:51 +0100)] 
Rename -Wmissing-monadfail-instance to plural-form

This warning flag was recently introduced as part of #10751. However,
it was missed during code-review that almost all existing warning
flags use a plural-form, so for consistency this commit renames
that warning flag to `-Wmissing-monadfail-instances`.

Test Plan: local validate (still running)

Reviewers: quchen, goldfire, austin, bgamari

Reviewed By: bgamari

Subscribers: thomie

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

GHC Trac Issues: #10751

3 years agoHscTypes: Fix typo in comment
Ben Gamari [Sat, 23 Jan 2016 21:51:51 +0000 (22:51 +0100)] 
HscTypes: Fix typo in comment

3 years agoComments only: more alternate names for ARM registers [skip ci]
Reid Barton [Mon, 25 Jan 2016 14:13:04 +0000 (09:13 -0500)] 
Comments only: more alternate names for ARM registers [skip ci]

Summary:
These are the names used by arm-linux-androideabi-objdump, so
it's helpful to have them here next to the Stg register mapping.

Reviewers: austin, erikd, bgamari

Reviewed By: erikd, bgamari

Subscribers: thomie

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

3 years agoShow error message for unknown symbol on Elf_Rel platforms
Reid Barton [Mon, 25 Jan 2016 14:12:40 +0000 (09:12 -0500)] 
Show error message for unknown symbol on Elf_Rel platforms

Summary: This is already the behavior on Elf_Rela platforms, and is helpful.

Reviewers: simonmar, austin, bgamari, erikd

Reviewed By: erikd

Subscribers: thomie

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

3 years agoFix exprIsHNF (Trac #11248)
Simon Peyton Jones [Mon, 25 Jan 2016 11:16:18 +0000 (11:16 +0000)] 
Fix exprIsHNF (Trac #11248)

Blimey!  CoreUtils.exprIsHNFlike had not one but two bugs.

 * is_hnf_like treated coercion args like type args
   (result: exprIsHNF might wrongly say True)

 * app_is_value treated type args like value args
   (result: exprIsHNF might wrongly say False)

Bizarre.  This goes back to at least 2012. It's amazing that it
hasn't caused more trouble.

It was discovered by a Lint error when compiling Trac #11248 with -O.

3 years agoImprove tracing in checkValidInstance
Simon Peyton Jones [Mon, 25 Jan 2016 08:31:51 +0000 (08:31 +0000)] 
Improve tracing in checkValidInstance

3 years agoAvoid recursive use of immSuperClasses
Simon Peyton Jones [Mon, 25 Jan 2016 08:29:12 +0000 (08:29 +0000)] 
Avoid recursive use of immSuperClasses

In fixing Trac #11480 I had omitted to deal with FunDeps.oclose,
which was making recursive use of immSuperClasses, and hence
going into a loop in the recursive case.

Solution: use transSuperClasses, which takes care not to.

3 years agoRefactor validity checking for type/data instances
Simon Peyton Jones [Fri, 22 Jan 2016 16:40:55 +0000 (16:40 +0000)] 
Refactor validity checking for type/data instances

I found that there was some code duplication going on,
so I've put more into the shared function checkValidFamPats.

I did some refactoring in checkConsistentFamInst too,
preparatory to #11450; the error messages change a little
but no change in behaviour.

3 years agoSpecial-case implicit params in superclass expansion
Simon Peyton Jones [Fri, 22 Jan 2016 16:34:18 +0000 (16:34 +0000)] 
Special-case implicit params in superclass expansion

This issue came up in Trac #11480, and is documented in
Note [When superclasses help] in TcRnTypes.

We were getting a spurious warning
  T11480.hs:1:1: warning:
     solveWanteds: too many iterations (limit = 4)

The fix is easy.  A bit of refactoring along the way.

The original bug report in Trac #11480 appears to work
fine in HEAD and the 8.0 branch but I added a regression
test in this commit as well.

3 years agoImplement `-Wnoncanonical-monadfail-instances` warning
Herbert Valerio Riedel [Sun, 24 Jan 2016 13:46:44 +0000 (14:46 +0100)] 
Implement `-Wnoncanonical-monadfail-instances` warning

The MonadFail proposal implemented so far via #10751 only warns about
missing `MonadFail` instances based on existence of failible pattern
matches in `do`-blocks.

However, based on the noncanonical Monad warnings implemented via #11150
we can provide a different mechanism for detecting missing `MonadFail`
instances quite cheaply. That is, by checking for canonical `fail` definitions.

In the case of `Monad`/`MonadFail`, we define the canonical implementation of
`fail` to be such that the soft-deprecated method shall (iff overridden) be
defined in terms of the non-deprecated method. Consequently, in case of
`MonadFail`, the `Monad(fail)` method shall be defined as alias of
the `MonadFail(fail)` method.

This allows us at some distant point in the future to remove `fail` from
the `Monad` class, while having GHC ignore/tolerate such literal canonical
method definitions.

Reviewed By: bgamari, RyanGlScott

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

3 years agoAdd -fwarn-redundant-constrains to test for #9708
Thomas Miedema [Sun, 24 Jan 2016 01:49:42 +0000 (02:49 +0100)] 
Add -fwarn-redundant-constrains to test for #9708

Fixes validate on Travis.

Reviewed by: bgamari

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

3 years agoRemove `replaceDynFlags` from `ContainsDynFlags`
Thomas Miedema [Tue, 19 Jan 2016 10:54:36 +0000 (11:54 +0100)] 
Remove `replaceDynFlags` from `ContainsDynFlags`

Refactoring only. It's shorter, and brings
`HasDynFlags/ContainsDynFLags` in line with `HasModule/ContainsModule`.
Introduce `updTopEnv`.

Reviewed by: bgamari

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

3 years agoDocs: delete section on Hierarchical Modules
Thomas Miedema [Sun, 24 Jan 2016 12:07:47 +0000 (13:07 +0100)] 
Docs: delete section on Hierarchical Modules

This information is mostly useless, since hierarchical modules are valid
Haskell2010 and everybody knows how to use them.

Reviewed by: bgamari

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

3 years agoUser's guide: fix singular/plural typo in flagnames
Herbert Valerio Riedel [Sun, 24 Jan 2016 14:33:48 +0000 (15:33 +0100)] 
User's guide: fix singular/plural typo in flagnames

3 years agoAdd test for #11473
Ben Gamari [Fri, 22 Jan 2016 12:33:36 +0000 (13:33 +0100)] 
Add test for #11473

3 years agouser-guide: Document -L RTS flag
Ben Gamari [Sat, 23 Jan 2016 21:03:04 +0000 (22:03 +0100)] 
user-guide: Document -L RTS flag

See #5641.

3 years agoDon't add ticks around type applications (#11329)
Reid Barton [Sat, 23 Jan 2016 20:30:04 +0000 (15:30 -0500)] 
Don't add ticks around type applications (#11329)

Test Plan: validate --slow

Reviewers: austin, bgamari, goldfire

Reviewed By: goldfire

Subscribers: thomie

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

3 years agouser-guide: Fix typos
Ben Gamari [Sat, 23 Jan 2016 20:12:24 +0000 (21:12 +0100)] 
user-guide: Fix typos

3 years agouser-guide: Reformat warning lists
Ben Gamari [Sat, 23 Jan 2016 18:17:45 +0000 (19:17 +0100)] 
user-guide: Reformat warning lists

3 years agomkUserGuidePart: Better flag cross-referencing
Ben Gamari [Sat, 23 Jan 2016 18:10:59 +0000 (19:10 +0100)] 
mkUserGuidePart: Better flag cross-referencing

3 years agoRemove -Wredundant-superclasses from standard warnings
Ben Gamari [Sat, 23 Jan 2016 17:40:33 +0000 (18:40 +0100)] 
Remove -Wredundant-superclasses from standard warnings

It is impossible to write warning-free code under the three-release
policy with this flag enabled by default. See #11370 for details.

3 years agoGive a more verbose error message when desugaring a HsTypeOut
Reid Barton [Sat, 23 Jan 2016 12:13:31 +0000 (13:13 +0100)] 
Give a more verbose error message when desugaring a HsTypeOut

Reviewers: austin, bgamari

Reviewed By: bgamari

Subscribers: thomie

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

3 years agoSmall doc fix
Adam Sandberg Eriksson [Sat, 23 Jan 2016 12:13:07 +0000 (13:13 +0100)] 
Small doc fix

Reviewers: austin, bgamari

Reviewed By: bgamari

Subscribers: thomie

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

3 years agoRemove unused IND_PERM
Joachim Breitner [Sat, 23 Jan 2016 12:12:10 +0000 (13:12 +0100)] 
Remove unused IND_PERM

it seems that this closure type has not been in use since 5d52d9, so all
this is dead and untested code. This removes it. Some of the code might
be useful for a counting indirection as described in #10613, so when
implementing that, have a look at what this commit removes.

Test Plan: validate on harbormaster

Reviewers: austin, bgamari, simonmar

Reviewed By: simonmar

Subscribers: thomie

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

3 years agoAdd test for Trac #11056
RyanGlScott [Sat, 23 Jan 2016 12:03:26 +0000 (13:03 +0100)] 
Add test for Trac #11056

Reviewers: thomie, austin, bgamari

Reviewed By: bgamari

Subscribers: rwbarton

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

GHC Trac Issues: #11056

3 years agorts: Disable tick timer unless really needed
Ben Gamari [Fri, 22 Jan 2016 15:22:13 +0000 (16:22 +0100)] 
rts: Disable tick timer unless really needed

Trac #9105 notes significant CPU usage by an otherwise idle process when
compiled with profiling. The reason for this is that we keep the tick
timer active in the profiling RTS even if profiling wasn't requested at
runtime.

If the user requests any sort of profiling then we need to keep the
timer active to ensure that samples are collected.

Test Plan: Validate, check CPU usage, ensure profiling still works

Reviewers: simonmar, austin

Reviewed By: simonmar, austin

Subscribers: thomie

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

GHC Trac Issues: #9105

3 years agoDo not count void arguments when considering a function for loopification.
Jonas Scholl [Fri, 22 Jan 2016 15:21:57 +0000 (16:21 +0100)] 
Do not count void arguments when considering a function for loopification.

This fixes #11372 by omitting arguments with a void-type when checking
whether a self-recursive tail call can be optimized to a local jump.
Previously, a function taking a real argument and a State# token
would report an arity of 1 in the SelfLoopInfo in getCallMethod,
but a self-recursive call would apply it to 2 arguments, one of them
being the State# token, thus no local jump would be generated.
As the State# token is not represented by anything at runtime, we can
ignore it and thus trigger the loopification optimization.

Test Plan: ./validate

Reviewers: austin, bgamari, simonmar

Reviewed By: bgamari

Subscribers: simonmar, thomie

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

GHC Trac Issues: #11372

3 years agoFix a formatting error in the user's guide
Eric Seidel [Fri, 22 Jan 2016 15:16:46 +0000 (16:16 +0100)] 
Fix a formatting error in the user's guide

```
``CallStack``s
```

seems to confuse ReST into producing an extended code-span

```
``CallStack``\s
```

fixes it, but there may be a better solution

Test Plan: build the user's guide and inspect the last paragraph of
"9.14.4.5. Implicit CallStacks"

Reviewers: bgamari

Reviewed By: bgamari

Projects: #ghc

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

3 years agoMark some ghci tests as req_interp
Reid Barton [Fri, 22 Jan 2016 15:00:27 +0000 (10:00 -0500)] 
Mark some ghci tests as req_interp

Test Plan: validate

Reviewers: bgamari, austin

Reviewed By: bgamari, austin

Subscribers: thomie

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

3 years agoDon't print "Loaded GHCi configuration" message in ghc -e (#11478)
Reid Barton [Fri, 22 Jan 2016 14:59:20 +0000 (09:59 -0500)] 
Don't print "Loaded GHCi configuration" message in ghc -e (#11478)

Summary:
Also don't print it if the user specifically requested
non-verbose output with -v0.

Since this means there is no longer any test that checks
for the message, add such a test.

Test Plan: validate

Reviewers: austin, bgamari

Reviewed By: bgamari

Subscribers: thomie

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

GHC Trac Issues: #11478

3 years agoAdd tests for #11465 and the kind invariant
Ben Gamari [Fri, 22 Jan 2016 12:01:55 +0000 (13:01 +0100)] 
Add tests for #11465 and the kind invariant

3 years agoDefault non-canonical CallStack constraints
Eric Seidel [Fri, 22 Jan 2016 11:45:53 +0000 (12:45 +0100)] 
Default non-canonical CallStack constraints

Test Plan: `make test TEST=T11462`

Reviewers: austin, bgamari, simonpj

Reviewed By: simonpj

Subscribers: thomie

Projects: #ghc

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

GHC Trac Issues: #11462

3 years agoMake a constraint synonym for repeated BinaryStringRep and use it.
Edward Z. Yang [Thu, 21 Jan 2016 18:27:58 +0000 (19:27 +0100)] 
Make a constraint synonym for repeated BinaryStringRep and use it.

Test Plan: validate

Reviewers: austin, thomie, bgamari

Reviewed By: thomie, bgamari

Subscribers: thomie

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

3 years agoAdd expected stderr for #11466 test case
Joachim Breitner [Fri, 22 Jan 2016 09:51:46 +0000 (10:51 +0100)] 
Add expected stderr for #11466 test case

3 years agoAlways run test T9407
Reid Barton [Fri, 22 Jan 2016 02:09:21 +0000 (21:09 -0500)] 
Always run test T9407

We don't know what the cause of the bug was, or what commit fixed it.
or why it was Windows only. So it seems prudent to run it in all
configurations, in case the bug should crop up again.

3 years agoImprove comments in CmmSwitch
Joachim Breitner [Thu, 21 Jan 2016 16:55:48 +0000 (17:55 +0100)] 
Improve comments in CmmSwitch

addressing some valuable feedback by thomie at
https://phabricator.haskell.org/rGHCde1160be0477

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

3 years agosphinx-build: fix python stack overflow (Trac #10950)
Sergei Trofimovich [Thu, 21 Jan 2016 21:43:37 +0000 (21:43 +0000)] 
sphinx-build: fix python stack overflow (Trac #10950)

Summary:
commit a034031a102bc08c76a6cdb104b72922ae22c96b did not
fix problem completely. Stack overflows still occasionally
happen.

Easy to test by the following Torture Test:

  while sphinx-build -T -N -E -a -b html \
        -d docs/users_guide/.doctrees-html \
        -D latex_paper_size=letter \
        docs/users_guide docs/users_guide/build-html/users_guide
  do
    echo again
  done

sphinx build large nested data structures when parses GHC manual
(docs/users_guide/glasgow_exts.rst is 455KB in size) which
can't be serialized useing default python call stack depth of 1000
calls.

The patch increases stack depth 10 times. Survived 2 hours of
Torture Test.

Signed-off-by: Sergei Trofimovich <siarheit@google.com>
Test Plan: ran Torture Test to make sure it is stable

Reviewers: austin, bgamari

Reviewed By: bgamari

Subscribers: thomie

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

GHC Trac Issues: #10950

3 years agoFix docstring GHC.IO.Handle.FD.openFileBLocking
Thomas Miedema [Thu, 21 Jan 2016 20:16:05 +0000 (21:16 +0100)] 
Fix docstring GHC.IO.Handle.FD.openFileBLocking

Fixes #4248.

3 years agoAdd -ignore-dot-ghci to tests that use --interactive
Reid Barton [Thu, 21 Jan 2016 18:50:00 +0000 (13:50 -0500)] 
Add -ignore-dot-ghci to tests that use --interactive

3 years agoAdd a missing .gitignore entry in annotations tests
Reid Barton [Thu, 21 Jan 2016 16:16:47 +0000 (11:16 -0500)] 
Add a missing .gitignore entry in annotations tests

3 years agoUpdate and improve documentation in Data.Foldable
Ben Gamari [Thu, 21 Jan 2016 13:51:01 +0000 (14:51 +0100)] 
Update and improve documentation in Data.Foldable

Previously there were a few obsolete references to `Data.List` and
the descriptions were lacking examples.

Fixes #11065.

Test Plan: Read it.

Reviewers: ekmett, goldfire, hvr, austin

Reviewed By: hvr

Subscribers: nomeata, thomie

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

GHC Trac Issues: #11065

3 years agorel-notes: Note the return of -Wmonomorphism-restriction
Ben Gamari [Thu, 21 Jan 2016 13:49:01 +0000 (14:49 +0100)] 
rel-notes: Note the return of -Wmonomorphism-restriction

3 years agouser-guide: Refer to MIN_VERSION_GLASGOW_HASKELL from intro
Ben Gamari [Thu, 21 Jan 2016 10:30:24 +0000 (11:30 +0100)] 
user-guide: Refer to MIN_VERSION_GLASGOW_HASKELL from intro

And fix markup.

3 years agouser-guide:: Improve -D description
Ben Gamari [Thu, 21 Jan 2016 10:36:00 +0000 (11:36 +0100)] 
user-guide:: Improve -D description

3 years agoTyCoRep: Restore compatibility with 7.10.1
Ben Gamari [Thu, 21 Jan 2016 10:19:23 +0000 (11:19 +0100)] 
TyCoRep: Restore compatibility with 7.10.1

Sadly CallStack wasn't present in 7.10.1, breaking the build when
bootstrapping from this version.

This patch essentially disables CallStack support for stage1 builds with
7.10.*. This doesn't seem so unreasonable though as stage2 will still
work.

Test Plan: Validate with 7.10.1

Reviewers: gridaphobe, jstolarek, austin

Reviewed By: jstolarek

Subscribers: thomie, jstolarek

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

GHC Trac Issues: #11472

3 years agoAllow implicit parameters in constraint synonyms
Simon Peyton Jones [Thu, 21 Jan 2016 12:26:50 +0000 (12:26 +0000)] 
Allow implicit parameters in constraint synonyms

This fixes Trac #11466.

It went bad by accident in
 commit ffc21506894c7887d3620423aaf86bc6113a1071
 Refactor tuple constraints

3 years agoStrip casts in checkValidInstHead
Simon Peyton Jones [Wed, 20 Jan 2016 16:04:20 +0000 (16:04 +0000)] 
Strip casts in checkValidInstHead

This patch addresses Trac #11464.

The fix is a bit crude (traverse the type to remove CastTys),
but it's also simple.

See Note [Casts during validity checking] in TcValidity

3 years agoRemove the check_lifted check in TcValidity
Simon Peyton Jones [Wed, 20 Jan 2016 16:02:22 +0000 (16:02 +0000)] 
Remove the check_lifted check in TcValidity

This patch fixes Trac #11465.  The check_unlifted check really isn't
necessary, as discussed in Trac #11120 comment:19.

Removing it made just one test-suite change,
in indexed-types/should_fail/T9357, by allowing

   type family F (a :: k1) :: k2
   type instance F Int# = Int

to be accepted.  And indeed that seems entirely reasonable.

3 years agoImprove pretty-printing of UnivCo
Simon Peyton Jones [Wed, 20 Jan 2016 14:10:08 +0000 (14:10 +0000)] 
Improve pretty-printing of UnivCo

We really need to know the UnivCoProvenance to make sense
of UnivCos in debug output

3 years agoComments only
Simon Peyton Jones [Wed, 20 Jan 2016 14:09:35 +0000 (14:09 +0000)] 
Comments only

3 years agoRe-add missing kind generalisation
Simon Peyton Jones [Tue, 19 Jan 2016 13:18:39 +0000 (13:18 +0000)] 
Re-add missing kind generalisation

When splitting H98/GADT syntax in ConDecl we lost a key
kind-generalisation step.

I also renamed tcHsTyVarBndrs to tcExplicitTKBnders, by analogy
with tcImplicitTkBndrs.

This fixes Trac #11459.

Merge to 8.0.

3 years agoComments only
Simon Peyton Jones [Tue, 19 Jan 2016 13:11:58 +0000 (13:11 +0000)] 
Comments only

Re Trac #11051

3 years agoAdd comments about tyCoVarsOfType
Simon Peyton Jones [Wed, 20 Jan 2016 22:13:39 +0000 (22:13 +0000)] 
Add comments about tyCoVarsOfType

See Note [Free variables of types].

Richard to check.

3 years agoMkId: Update OpenKind reference
Ben Gamari [Thu, 21 Jan 2016 09:35:19 +0000 (10:35 +0100)] 
MkId: Update OpenKind reference

3 years agosubstTy to substTyUnchecked to fix Travis build
Bartosz Nitka [Wed, 20 Jan 2016 16:58:52 +0000 (08:58 -0800)] 
substTy to substTyUnchecked to fix Travis build

This fixes the immediate problem from
https://s3.amazonaws.com/archive.travis-ci.org/jobs/103319396/log.txt

Test Plan: ./validate

Reviewers: bgamari, austin, thomie

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

GHC Trac Issues: #11371

3 years agoUpdate submodule stm + random
Thomas Miedema [Wed, 20 Jan 2016 16:41:53 +0000 (17:41 +0100)] 
Update submodule stm + random

Skip random tests when random is not built.
Skip stm tests when stm is not built.

3 years agoAdd test T9407 (Windows)
Rik Steenkamp [Wed, 20 Jan 2016 11:39:00 +0000 (12:39 +0100)] 
Add test T9407 (Windows)

Add test for #9407. The test is only run on Windows 64bit, as this is
where the problem occurred.

Reviewed by: thomie

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

3 years agoRework derivation of type representations for wired-in things
Ben Gamari [Wed, 20 Jan 2016 15:06:31 +0000 (16:06 +0100)] 
Rework derivation of type representations for wired-in things

Previously types defined by `GHC.Types` and `GHC.Prim` had their
`Typeable` representations manually defined in `GHC.Typeable.Internals`.
This was terrible, resulting in a great deal of boilerplate and a number
of bugs due to missing or inconsistent representations (see #11120).

Here we take a different tack, initially proposed by Richard Eisenberg:
We wire-in the `Module`, `TrName`, and `TyCon` types, allowing them to
be used in `GHC.Types`. We then allow the usual type representation
generation logic to handle this module.

`GHC.Prim`, on the other hand, is a bit tricky as it has no object code
of its own.  To handle this we instead place the type representations
for the types defined here in `GHC.Types`.

On the whole this eliminates several special-cases as well as a fair
amount of boilerplate from hand-written representations. Moreover, we
get full coverage of primitive types for free.

Test Plan: Validate

Reviewers: goldfire, simonpj, austin, hvr

Subscribers: goldfire, simonpj, thomie

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

GHC Trac Issues: #11120

3 years agoUse (&&) instead of `if` in Ix derivation
Ben Gamari [Tue, 19 Jan 2016 15:30:26 +0000 (16:30 +0100)] 
Use (&&) instead of `if` in Ix derivation

We were previously using `if` in the derivation of `Ix` instances. This
interacts badly with RebindableSyntax as the typechecker doesn't infer
the type of the argument we give to `tagToEnum#`.

Previously we produced, `if (ch >= ah) then (ch <= bh) else False`.

We now produce `(ch >= ah) && (ch <= bh)`

Fixes #11396.

Test Plan: Validate

Reviewers: austin, simonpj

Reviewed By: simonpj

Subscribers: thomie

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

GHC Trac Issues: #11396

3 years agoOops. Add missing close-comment
Simon Peyton Jones [Wed, 20 Jan 2016 09:27:31 +0000 (09:27 +0000)] 
Oops.  Add missing close-comment

This fixes 514bac2 for Trac #11172.  Sorry!

3 years agoFix combineIdenticalAlts
Simon Peyton Jones [Wed, 20 Jan 2016 08:07:43 +0000 (08:07 +0000)] 
Fix combineIdenticalAlts

This long-standing bug in CoreUtils.combineIdenticalAlts
was shown up by Trac #11172. The effect was that it returned
a correct set of alternatives, but a bogus set of "impossible
default constructors".  That meant that we subsequently
removed all the alternatives from a case, and hence ended
up with a bogusly empty case that should not have been empty.

See Note [Care with impossible-constructors when
combining alternatives] in CoreUtils.

3 years agoT11266: Improve the test by adding more of the other problematic modules
Ömer Sinan Ağacan [Tue, 19 Jan 2016 20:23:50 +0000 (15:23 -0500)] 
T11266: Improve the test by adding more of the other problematic modules

3 years agoFix IfaceType generation for TyCons without TyVars
Ömer Sinan Ağacan [Tue, 19 Jan 2016 19:56:59 +0000 (14:56 -0500)] 
Fix IfaceType generation for TyCons without TyVars

- This is only used for printing purposes (in :browse etc.).
- Fixes #11266.

Reviewers: goldfire, bgamari, austin

Subscribers: thomie

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

GHC Trac Issues: #11266

3 years agoRe-export ghc-boot:GHC.Serialized as Serialized
Simon Marlow [Tue, 19 Jan 2016 16:20:06 +0000 (08:20 -0800)] 
Re-export ghc-boot:GHC.Serialized as Serialized

For backwards-compat with GHC 7.10.

3 years agoCheck InScopeSet in substTy and provide substTyUnchecked
Bartosz Nitka [Tue, 19 Jan 2016 11:25:39 +0000 (03:25 -0800)] 
Check InScopeSet in substTy and provide substTyUnchecked

This adds sanity checks to `substTy` that implement:

> when calling substTy subst ty it should be the case that the in-scope
> set in the substitution is a superset of
> * The free vars of the range of the substitution
> * The free vars of ty minus the domain of the substitution

and replaces violators with unchecked version. The violators were found
by running the GHC test suite.

This ensures that I can work on this incrementally and that what I fix won't
be undone by some other change.

It also includes a couple of fixes that I've already done.

Test Plan: ./validate

Reviewers: simonmar, goldfire, simonpj, austin, bgamari

Reviewed By: simonpj, bgamari

Subscribers: thomie

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

GHC Trac Issues: #11371

3 years agoTypos in comments
Gabor Greif [Tue, 19 Jan 2016 11:10:13 +0000 (12:10 +0100)] 
Typos in comments

3 years agousers-guide: Begin documenting --frontend
Ben Gamari [Mon, 18 Jan 2016 23:07:47 +0000 (00:07 +0100)] 
users-guide: Begin documenting --frontend

Reviewers: austin

Subscribers: thomie, ezyang

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

GHC Trac Issues: #11448

3 years agouser-guide: Delete errant fragment
Ben Gamari [Mon, 18 Jan 2016 22:13:29 +0000 (23:13 +0100)] 
user-guide: Delete errant fragment

Reviewers: austin

Reviewed By: austin

Subscribers: thomie

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

3 years agoHide derived OccNames from user
Ben Gamari [Mon, 18 Jan 2016 22:12:51 +0000 (23:12 +0100)] 
Hide derived OccNames from user

This hides derived OccNames from the Names returned from
runDeclsWithLocation and clarifies the documentation. This is done to
ensure that these names (originating from, e.g., derived Generic
instances and type representation bindings) don't show up in ghci output
when run with `:set +t`. This fixes #11051.

Test Plan: Validate with included tests

Reviewers: austin

Reviewed By: austin

Subscribers: thomie, hvr

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

GHC Trac Issues: #11051

3 years agoghci: Kill global macros list
Ben Gamari [Mon, 18 Jan 2016 22:12:34 +0000 (23:12 +0100)] 
ghci: Kill global macros list

Test Plan: Validate

Reviewers: simonmar, thomie, austin

Reviewed By: austin

Subscribers: alanz

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

3 years agoSwitch from -this-package-key to -this-unit-id.
Edward Z. Yang [Mon, 18 Jan 2016 16:32:27 +0000 (17:32 +0100)] 
Switch from -this-package-key to -this-unit-id.

A small cosmetic change, but we have to do a bit of work to
actually support it:

    - Cabal submodule update, so that Cabal passes us
      -this-unit-id when we ask for it.  This includes
      a Cabal renaming to be consistent with Unit ID, which
      makes ghc-pkg a bit more scrutable.

    - Build system is updated to use -this-unit-id rather than
      -this-package-key, to avoid deprecation warnings.  Needs
      a version test so I resurrected the old test we had
      (sorry rwbarton!)

    - I've *undeprecated* -package-name, so that we are in the same
      state as GHC 7.10, since the "correct" flag will have only
      entered circulation in GHC 8.0.

    - I removed -package-key.  Since we didn't deprecate -package-id
      I think this should not cause any problems for users; they
      can just change their code to use -package-id.

    - The package database is indexed by UNIT IDs, not component IDs.
      I updated the naming here.

    - I dropped the signatures field from ExposedModule; nothing
      was using it, and instantiatedWith from the package database
      field.

    - ghc-pkg was updated to use unit ID nomenclature, I removed
      the -package-key flags but I decided not to add any new flags
      for now.

Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
Test Plan: validate

Reviewers: austin, hvr, bgamari

Reviewed By: bgamari

Subscribers: 23Skidoo, thomie, erikd

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

3 years agoReplace calls to `ptext . sLit` with `text`
Jan Stolarek [Fri, 15 Jan 2016 17:24:14 +0000 (18:24 +0100)] 
Replace calls to `ptext . sLit` with `text`

Summary:
In the past the canonical way for constructing an SDoc string literal was the
composition `ptext . sLit`.  But for some time now we have function `text` that
does the same.  Plus it has some rules that optimize its runtime behaviour.
This patch takes all uses of `ptext . sLit` in the compiler and replaces them
with calls to `text`.  The main benefits of this patch are clener (shorter) code
and less dependencies between module, because many modules now do not need to
import `FastString`.  I don't expect any performance benefits - we mostly use
SDocs to report errors and it seems there is little to be gained here.

Test Plan: ./validate

Reviewers: bgamari, austin, goldfire, hvr, alanz

Subscribers: goldfire, thomie, mpickering

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

3 years agoFixes to "make clean" for the iserv dir
Simon Marlow [Mon, 18 Jan 2016 14:41:19 +0000 (06:41 -0800)] 
Fixes to "make clean" for the iserv dir

3 years agoTypo in comment
Simon Peyton Jones [Mon, 18 Jan 2016 11:55:20 +0000 (11:55 +0000)] 
Typo in comment

3 years agoTest Trac #11379
Simon Peyton Jones [Mon, 18 Jan 2016 11:53:05 +0000 (11:53 +0000)] 
Test Trac #11379

3 years agoImplement scoped type variables in pattern synonyms
Simon Peyton Jones [Fri, 15 Jan 2016 17:45:02 +0000 (17:45 +0000)] 
Implement scoped type variables in pattern synonyms

This fixes Trac #11351.   The implementation is pretty
simple, happily.

I took the opportunity to re-order the prov/req context
in builder-ids, which was confusingly backwards.

3 years agoAdd Trac #11427 to Note [Recursive superclasses]
Simon Peyton Jones [Fri, 15 Jan 2016 17:33:35 +0000 (17:33 +0000)] 
Add Trac #11427 to Note [Recursive superclasses]

3 years agoRefactoring on IdInfo and system derived names
Simon Peyton Jones [Fri, 15 Jan 2016 17:30:30 +0000 (17:30 +0000)] 
Refactoring on IdInfo and system derived names

Some modest refactoring, triggered in part by Trac #11051

* Kill off PatSynId, ReflectionId in IdDetails
  They were barely used, and only for pretty-printing

* Add helper function Id.mkExportedVanillaId, and use it

* Polish up OccName.isDerivedOccName, as a predicate for
  definitions generated internally by GHC, which we
  might not want to show to the user.

* Kill off unused OccName.mkDerivedTyConOcc

* Shorten the derived OccNames for newtype and data
  instance axioms

* A bit of related refactoring around newFamInstAxiomName