ghc.git
11 months agoUpgrade haddock submodule to avoid bug wip/T14880-just-tvs
Tobias Dammers [Wed, 1 Aug 2018 14:59:44 +0000 (16:59 +0200)] 
Upgrade haddock submodule to avoid bug

11 months agoImplement tyCoVarsOfCo(s) in terms of VarSet
Tobias Dammers [Wed, 1 Aug 2018 09:59:52 +0000 (11:59 +0200)] 
Implement tyCoVarsOfCo(s) in terms of VarSet

11 months agoRewrite tyCoVarsOfType in terms of TypeSet
Tobias Dammers [Tue, 31 Jul 2018 20:32:34 +0000 (22:32 +0200)] 
Rewrite tyCoVarsOfType in terms of TypeSet

14 months agoTest #14904 in dependent/should_compile/T14904
Richard Eisenberg [Mon, 2 Apr 2018 19:53:42 +0000 (15:53 -0400)] 
Test #14904 in dependent/should_compile/T14904

14 months agoTypo fix in scavenge_one comment [skip ci]
Ömer Sinan Ağacan [Sun, 22 Apr 2018 07:27:17 +0000 (10:27 +0300)] 
Typo fix in scavenge_one comment [skip ci]

14 months agoRemove a outdated comment [skip ci]
Ömer Sinan Ağacan [Sat, 21 Apr 2018 19:21:29 +0000 (22:21 +0300)] 
Remove a outdated comment [skip ci]

14 months agorts: Use g0 for &generations[0]
Ömer Sinan Ağacan [Sat, 21 Apr 2018 16:09:15 +0000 (19:09 +0300)] 
rts: Use g0 for &generations[0]

[skip ci]

14 months agos/traverse_weak_ptr_list/traverseWeakPtrList in comments [skip ci]
Ömer Sinan Ağacan [Sat, 21 Apr 2018 11:26:34 +0000 (14:26 +0300)] 
s/traverse_weak_ptr_list/traverseWeakPtrList in comments [skip ci]

14 months agoRemove unnecessary check in simplCast
Tobias Dammers [Fri, 20 Apr 2018 20:38:34 +0000 (16:38 -0400)] 
Remove unnecessary check in simplCast

The coercion optimizer will take care of it anyway, and the check is
prohibitively expensive.

See Trac #14737.

Reviewers: bgamari

Subscribers: simonpj, thomie, carter

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

14 months agobase: Add a test for T10412
Ben Gamari [Fri, 20 Apr 2018 17:54:04 +0000 (13:54 -0400)] 
base: Add a test for T10412

Expects the current behavior, will be updated by D4593 to reflect
desired behavior.

Reviewers: hvr

Subscribers: thomie, carter

GHC Trac Issues: #10412

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

14 months agoFix implementation of rnIfaceBndr
Matthew Pickering [Fri, 20 Apr 2018 17:32:30 +0000 (13:32 -0400)] 
Fix implementation of rnIfaceBndr

Reviewers: ezyang, bgamari

Reviewed By: bgamari

Subscribers: thomie, carter

GHC Trac Issues: #15041

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

14 months agoRemove broken top-level shell.nix
Matthew Pickering [Fri, 20 Apr 2018 17:31:49 +0000 (13:31 -0400)] 
Remove broken top-level shell.nix

There is a maintained shell.nix file in the hadrian submodule. This
has long since been broken anyway.

Reviewers: bgamari

Reviewed By: bgamari

Subscribers: thomie, carter

GHC Trac Issues: #15045

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

14 months agocomments only
Simon Peyton Jones [Fri, 20 Apr 2018 12:58:38 +0000 (13:58 +0100)] 
comments only

14 months agoInline wrappers earlier
Simon Peyton Jones [Fri, 20 Apr 2018 12:57:16 +0000 (13:57 +0100)] 
Inline wrappers earlier

This patch has a single significant change:

  strictness wrapper functions are inlined earlier,
  in phase 2 rather than phase 0.

As shown by Trac #15056, this gives a better chance for RULEs to fire.
Before this change, a function that would have inlined early without
strictness analyss was instead inlining late. Result: applying
"optimisation" made the program worse.

This does not make too much difference in nofib, but I've stumbled
over the problem more than once, so even a "no-change" result would be
quite acceptable.  Here are the headlines:

--------------------------------------------------------------------------------
        Program           Size    Allocs   Runtime   Elapsed  TotalMem
--------------------------------------------------------------------------------
      cacheprof          -0.5%     -0.5%     +2.5%     +2.5%      0.0%
         fulsom          -1.0%     +2.6%     -0.1%     -0.1%      0.0%
           mate          -0.6%     +2.4%     -0.9%     -0.9%      0.0%
        veritas          -0.7%    -23.2%     0.002     0.002      0.0%
--------------------------------------------------------------------------------
            Min          -1.4%    -23.2%    -12.5%    -15.3%      0.0%
            Max          +0.6%     +2.6%     +4.4%     +4.3%    +19.0%
 Geometric Mean          -0.7%     -0.2%     -1.4%     -1.7%     +0.2%

* A worthwhile reduction in binary size.

* Runtimes are not to be trusted much but look as if they
  are moving the right way.

* A really big win in veritas, described in comment:1 of
  Trac #15056; more fusion rules fired.

* I investigated the losses in 'mate' and 'fulsom'; see #15056.

14 months agoCaching coercion roles in NthCo and coercionKindsRole refactoring
Tobias Dammers [Fri, 20 Apr 2018 13:11:14 +0000 (09:11 -0400)] 
Caching coercion roles in NthCo and coercionKindsRole refactoring

While addressing nonlinear behavior related to coercion roles,
particularly `NthCo`, we noticed that coercion roles are recalculated
often even though they should be readily at hand already in most cases.
This patch adds a `Role` to the `NthCo` constructor so that we can cache
them rather than having to recalculate them on the fly.
https://ghc.haskell.org/trac/ghc/ticket/11735#comment:23 explains the
approach.

Performance improvement over GHC HEAD, when compiling Grammar.hs (see below):

GHC 8.2.1:
```
ghc Grammar.hs  176.27s user 0.23s system 99% cpu 2:56.81 total
```

before patch (but with other optimizations applied):
```
ghc Grammar.hs -fforce-recomp  175.77s user 0.19s system 100% cpu 2:55.78 total
```

after:
```
../../ghc/inplace/bin/ghc-stage2 Grammar.hs  10.32s user 0.17s system 98% cpu 10.678 total
```

Introduces the following regressions:

- perf/compiler/parsing001 (possibly false positive)
- perf/compiler/T9872
- perf/compiler/haddock.base

Reviewers: goldfire, bgamari, simonpj

Reviewed By: simonpj

Subscribers: rwbarton, thomie, carter

GHC Trac Issues: #11735

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

14 months agoBump transformers submodule
Ryan Scott [Fri, 20 Apr 2018 14:14:31 +0000 (10:14 -0400)] 
Bump transformers submodule

This brings in a commit which migrates Contravariant instances from
base to transformers.

14 months agoFixes isAlphaNum re. isAlpha/isNumber and doc fix (trac issue #10412)
ARJANEN Loïc Jean David [Fri, 20 Apr 2018 00:48:28 +0000 (20:48 -0400)] 
Fixes isAlphaNum re. isAlpha/isNumber and doc fix (trac issue #10412)

Corrects the inconsistency between Data.Char.isAlphaNum,
Data.Char.isAlpha and Data.Char.isNumber. Indeed, isAlphaNum was
returning True not only when isAlpha or isNumber returned True but
also when isMark did. The selectors for the Mn, Mc and Me general
categories where removed from the macro generating u_iswalnum in
ubconfc.

Also, Data.Char.isAlphaNum's documentation was changed to state that
isAlphaNum returns true not only for Unicode number digits but for
Unicode numbers in general in Unicode.hs.

Signed-off-by: ARJANEN Loïc Jean David <arjanen.loic@gmail.com>
Reviewers: hvr, ekmett, lelf, bgamari

Reviewed By: bgamari

Subscribers: thomie, carter

GHC Trac Issues: #10412

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

14 months agoLint types in newFamInst
Ryan Scott [Fri, 20 Apr 2018 00:47:48 +0000 (20:47 -0400)] 
Lint types in newFamInst

We weren't linting the types used in `newFamInst`, which
might have been why #15012 went undiscovered for so long. Let's fix
that.

One has to be surprisingly careful with expanding type synonyms in
`lintType`, since in the offending program (simplified):

```lang=haskell
type FakeOut a = Int

type family TF a
type instance TF Int = FakeOut a
```

If one expands type synonyms, then `FakeOut a` will expand to
`Int`, which masks the issue (that `a` is unbound). I added an
extra Lint flag to configure whether type synonyms should be
expanded or not in Lint, and disabled this when calling `lintTypes`
from `newFamInst`.

As evidence that this works, I ran it on the offending program
from #15012, and voilà:

```
$ ghc3/inplace/bin/ghc-stage2 Bug.hs -dcore-lint
[1 of 1] Compiling Foo              ( Bug.hs, Bug.o )
ghc-stage2: panic! (the 'impossible' happened)
  (GHC version 8.5.20180417 for x86_64-unknown-linux):
        Core Lint error
  <no location info>: warning:
      In the type ‘... (Rec0 (FakeOut b_a1Qt))))’
      @ b_a1Qt is out of scope
```

Test Plan: make test TEST=T15057

Reviewers: simonpj, goldfire, bgamari

Reviewed By: bgamari

Subscribers: thomie, carter

GHC Trac Issues: #15057

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

14 months agoboot: Fix computation of TOP
Ben Gamari [Thu, 19 Apr 2018 19:07:57 +0000 (15:07 -0400)] 
boot: Fix computation of TOP

Test Plan: Run `./boot`, check to make sure that
`libraries/ghc-prim/GNUmakefile` is sane

Subscribers: thomie, carter, sjakobi

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

14 months agoconfigure: Use -Werror to check for existence of -no-pie
Ben Gamari [Thu, 19 Apr 2018 19:05:50 +0000 (15:05 -0400)] 
configure: Use -Werror to check for existence of -no-pie

Clang throws a warning instead of an error when it is passed -no-pie,

    clang: warning: argument unused during compilation: '-nopie'
    [-Wunused-command-line-argument]

Consequently configure concludes that it supports -no-pie. However, this
will fail when used with -Werror. The solution is to simply use -Werror
in the configure check.

Thanks to @goldfire for reporting this.

Reviewers: hvr

Subscribers: thomie, carter, goldfire

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

14 months agoparsec: Make version hack compatible with Windows
Ben Gamari [Thu, 19 Apr 2018 19:42:26 +0000 (15:42 -0400)] 
parsec: Make version hack compatible with Windows

Fixes D4609 on Windows by bumping parsec submodule.

14 months agotestsuite: Fix `./validate --slow`
Alp Mestanogullari [Thu, 19 Apr 2018 16:40:21 +0000 (12:40 -0400)] 
testsuite: Fix `./validate --slow`

This fixes all unexpected passes and unexpected failures from a
`./validate --slow` run I did last week. I commented on many
tickets and created a few more as I was going through the failing
tests. A summary of the entire process is available at:

  https://gist.github.com/alpmestan/c371840968f086c8dc5b56af8325f0a9

This is part of an attempt to have `./validate --slow` pass,
tracked in #14890. Another patch will be necessary for the unexpected
stats failures.

Test Plan: ./validate --slow (not green yet)

Reviewers: bgamari, simonmar

Subscribers: thomie, carter

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

14 months agoBump base to version 4.12.0.0
Ryan Scott [Thu, 19 Apr 2018 16:38:17 +0000 (12:38 -0400)] 
Bump base to version 4.12.0.0

Summary: Bumps several submodules.

Test Plan: ./validate

Reviewers: hvr, bgamari

Reviewed By: bgamari

Subscribers: thomie, carter

GHC Trac Issues: #15018

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

14 months agoFix #15012 with a well-placed use of Any
Ryan Scott [Thu, 19 Apr 2018 16:36:42 +0000 (12:36 -0400)] 
Fix #15012 with a well-placed use of Any

Previously, derived `Generic1` instances could have associated `Rep1`
type family instances with unbound variables, such as in the following
example:

```lang=haskell
data T a = MkT (FakeOut a) deriving Generic1
type FakeOut a = Int

==>

instance Generic1 T where
  type Rep1 T = ... (Rec0 (FakeOut a))
```

Yikes! To avoid this, we simply map the last type variable in a
derived `Generic1` instance to `Any`.

Test Plan: make test TEST=T15012

Reviewers: bgamari

Reviewed By: bgamari

Subscribers: simonpj, thomie, carter

GHC Trac Issues: #15012

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

14 months agoBetter error message for empty character literal, for Trac #13450.
HE, Tao [Thu, 19 Apr 2018 16:31:09 +0000 (12:31 -0400)] 
Better error message for empty character literal, for Trac #13450.

For empty character literal, the `''`, report error message properly
rather than just throw a "parser error" with wrong error location.

Test Plan: make test TEST="T13450 T13450TH"

Reviewers: goldfire, bgamari

Reviewed By: bgamari

Subscribers: thomie, mpickering, carter

GHC Trac Issues: #13450

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

14 months agoAdd a test for #14815:
Ömer Sinan Ağacan [Thu, 19 Apr 2018 15:32:26 +0000 (11:32 -0400)] 
Add a test for #14815:

Because the program doesn't have any binders that -XStrict can make
strict, the desugarer output should be identical when it's compiled with
and without -XStrict. This wasn't the case with GHC 8.2.2, but
apparently it was fixed some time between 8.2.2 and 8.4.1. We now add a
test case to make sure it stays fixed.

Reviewers: bgamari

Reviewed By: bgamari

Subscribers: simonpj, rwbarton, thomie, carter

GHC Trac Issues: #14815

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

14 months agorts: fix format arguments for debugBelch calls on 32-bit systems
Sergei Trofimovich [Thu, 19 Apr 2018 15:28:46 +0000 (11:28 -0400)] 
rts: fix format arguments for debugBelch calls on 32-bit systems

This change fixes build failure like this:
```
  rts/Stats.c:1467:14: error:
     error: format '%u' expects argument of type 'unsigned int',
         but argument 4 has type 'long unsigned int' [-Werror=format=]
       debugBelch("%51s%9" FMT_Word " %9" FMT_Word "\n",
                  ^~~~~~~~
                  "",tot_live*sizeof(W_),tot_slop*sizeof(W_));
                                         ~~~~~~~~~~~~~~~~~~~
```

The fix is to cast sizeof() result to Word (W_).

Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
Test Plan: build for 32-bit target

Reviewers: bgamari, erikd, simonmar

Reviewed By: simonmar

Subscribers: thomie, carter

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

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

The Mathjax CDN no longer exists. Use CDNJS instead.

See #15006.

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

Reviewers: alpmestan

Reviewed By: alpmestan

Subscribers: thomie, carter

GHC Trac Issues: #15006

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

14 months agoAdd a test case from the nested CPR work
Ben Gamari [Tue, 17 Apr 2018 16:46:13 +0000 (12:46 -0400)] 
Add a test case from the nested CPR work

Reviewers: bgamari

Reviewed By: bgamari

Subscribers: thomie, carter

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

14 months agoBump unix submodule to version 2.8.0.0
Ryan Scott [Thu, 19 Apr 2018 12:31:08 +0000 (08:31 -0400)] 
Bump unix submodule to version 2.8.0.0

Summary: Requires bumping several submodules.

Test Plan: ./validate

Reviewers: hvr, bgamari

Subscribers: thomie, carter

GHC Trac Issues: #15042

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

14 months agoFix #14710 with more validity checks during renaming
Ryan Scott [Thu, 19 Apr 2018 12:30:53 +0000 (08:30 -0400)] 
Fix #14710 with more validity checks during renaming

Summary:
#14710 revealed two unfortunate regressions related to kind
polymorphism that had crept in in recent GHC releases:

1. While GHC was able to catch illegal uses of kind polymorphism
   (i.e., if `PolyKinds` wasn't enabled) in limited situations, it
   wasn't able to catch kind polymorphism of the following form:

```lang=haskell
f :: forall a. a -> a
f x = const x g
  where
    g :: Proxy (x :: a)
    g = Proxy
```

Note that the variable `a` is being used as a kind variable in the
type signature of `g`, but GHC happily accepts it, even without
the use of `PolyKinds`.

2. If you have `PolyKinds` (but not `TypeInType`) enabled, then GHC
   incorrectly accepts the following definition:

```lang=haskell
f :: forall k (a :: k). Proxy a
f = Proxy
```

Even though `k` is explicitly bound and then later used as a kind
variable within the same telescope.

This patch fixes these two bugs as follows:

1. Whenever we rename any `HsTyVar`, we check if the following three
   criteria are met:

   (a) It's a type variable
   (b) It's used at the kind level
   (c) `PolyKinds` is not enabled

   If so, then we have found an illegal use of kind polymorphism, so
   throw an error.

   This check replaces the `checkBadKindBndrs` function, which could
   only catch illegal uses of kind polymorphism in very limited
   situations (when the bad kind variable happened to be implicitly
   quantified in the same type signature).

2. In `extract_hs_tv_bndrs`, we must error if `TypeInType` is not
   enabled and either of the following criteria are met:

   (a) An explicitly bound type variable is used in kind position
       in the body of a `forall` type.
   (b) An explicitly bound type variable is used in kind position
       in the kind of a bound type variable in a `forall` type.

   `extract_hs_tv_bndrs` was checking (a), but not (b). Easily fixed.

Test Plan: ./validate

Reviewers: goldfire, simonpj, bgamari, hvr

Reviewed By: simonpj

Subscribers: thomie, carter

GHC Trac Issues: #14710

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

15 months agoIntroduce a $tooldir variable for nicer toolchain detection on Windows
Alp Mestanogullari [Tue, 17 Apr 2018 22:04:11 +0000 (23:04 +0100)] 
Introduce a $tooldir variable for nicer toolchain detection on Windows

Summary:
This patch affects several files that affect how we detect mingw and perl
on Windows. The initial motivation is:

    https://github.com/snowleopard/hadrian/issues/564

where, with Hadrian building relocatable (non-inplace) GHCs, the current
detection mechanism falls short by e.g only trying $topdir/../mingw. But
in Hadrian, for reasons given in that issue, we would need to store e.g mingw
under $topdir/../../mingw except for binary distributions, where we want
to follow the existing structure, in which case $topdir/../mingw is correct. So
we need to support both, which is what this patch hopefully implements.

Test Plan: ./validate

Reviewers: Phyx, hvr, bgamari, erikd

Reviewed By: Phyx

Subscribers: snowleopard, thomie, carter

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

15 months agoProper safe coercions paper link
Kirill Zaborsky [Tue, 17 Apr 2018 07:29:19 +0000 (10:29 +0300)] 
Proper safe coercions paper link

15 months agoFix markup in the UNPACK pragma section of the user's guide.
theindigamer [Sat, 14 Apr 2018 23:17:04 +0000 (19:17 -0400)] 
Fix markup in the UNPACK pragma section of the user's guide.

The ticket 5252 wasn't linked earlier.

15 months agoComments only
Simon Peyton Jones [Tue, 17 Apr 2018 12:19:40 +0000 (13:19 +0100)] 
Comments only

Deleting misleading comments, to fix Trac #15047

15 months agoMinor comments in CSE
Simon Peyton Jones [Mon, 16 Apr 2018 12:56:08 +0000 (13:56 +0100)] 
Minor comments in CSE

15 months agoRemove markSignalHandlers
Ömer Sinan Ağacan [Mon, 16 Apr 2018 18:58:21 +0000 (21:58 +0300)] 
Remove markSignalHandlers

It's no-op on all platforms

Reviewers: bgamari, simonmar, erikd, dfeuer

Reviewed By: dfeuer

Subscribers: dfeuer, thomie, carter

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

15 months agorts: Comment wibbles
Ben Gamari [Mon, 16 Apr 2018 18:35:41 +0000 (14:35 -0400)] 
rts: Comment wibbles

15 months agoRevert "Enhanced constant folding"
Ben Gamari [Mon, 16 Apr 2018 18:36:11 +0000 (14:36 -0400)] 
Revert "Enhanced constant folding"

I need to upgrade GHC on the CI builders before landing this due to a
bug in 8.2.1 triggered by this patch.

This reverts commit fea04defa64871caab6339ff3fc5511a272f37c7.

15 months agousers guide: Note improved constant folding in 8.6 release notes
Ben Gamari [Fri, 13 Apr 2018 22:10:39 +0000 (18:10 -0400)] 
users guide: Note improved constant folding in 8.6 release notes

15 months agoEnhanced constant folding
Sylvain Henry [Fri, 13 Apr 2018 17:29:07 +0000 (13:29 -0400)] 
Enhanced constant folding

Until now GHC only supported basic constant folding (lit op lit, expr op
0, etc.).

This patch uses laws of +/-/* (associativity, commutativity,
distributivity) to support some constant folding into nested
expressions.

Examples of new transformations:

   - simple nesting: (10 + x) + 10 becomes 20 + x
   - deep nesting: 5 + x + (y + (z + (t + 5))) becomes 10 + (x + (y + (z + t)))
   - distribution: (5 + x) * 6 becomes 30 + 6*x
   - simple factorization: 5 + x + (x + (x + (x + 5))) becomes 10 + (4 *x)
   - siblings: (5 + 4*x) - (3*x + 2) becomes 3 + x

Test Plan: validate

Reviewers: simonpj, austin, bgamari

Reviewed By: bgamari

Subscribers: thomie

GHC Trac Issues: #9136

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

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

Reviewers: hvr, bgamari

Subscribers: lelf, thomie, carter

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

15 months agoOmit ways depending on rts flags for #12870 related tests.
Andreas Klebinger [Fri, 13 Apr 2018 17:27:36 +0000 (13:27 -0400)] 
Omit ways depending on rts flags for #12870 related tests.

Some of these tests instruct the RTS to ignore all RTS flags being
passed.  While this is intended it causes test failures for some ways
like profiling which depend on passing RTS flags. So we skip these ways.

Test Plan: testsuite/tests/rts/flags$ make slow

Reviewers: bgamari, simonmar, alpmestan

Reviewed By: alpmestan

Subscribers: alpmestan, thomie, carter

GHC Trac Issues: #12870

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

15 months agoMake shortcutting at the asm stage toggleable and default for O2.
Andreas Klebinger [Fri, 13 Apr 2018 17:23:13 +0000 (13:23 -0400)] 
Make shortcutting at the asm stage toggleable and default for O2.

Shortcutting during the asm stage of codegen is often redundant as most
cases get caught during the Cmm passes.  For example during compilation
of all of nofib only 508 jumps are eleminated.

For this reason I moved the pass from -O1 to -O2. I also made it
toggleable with -fasm-shortcutting.

Test Plan: ci

Reviewers: bgamari

Reviewed By: bgamari

Subscribers: thomie, carter

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

15 months agoDeclare `catchRetry#` lazy in its first argument
Ben Gamari [Fri, 13 Apr 2018 17:22:55 +0000 (13:22 -0400)] 
Declare `catchRetry#` lazy in its first argument

As per the results on item 1 in T14998, declaring `catchRetry#` lazy in
its first argument opens the possibility to remove `ExnStr` complexity
from strictness demands at virtually no regressions in NoFib.

This brings `catchRetry#` in line with other primops from the `catch*`
family.

Reviewers: bgamari, simonpj, nomeata

Reviewed By: bgamari

Subscribers: thomie, carter

GHC Trac Issues: #14998, #11222

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

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

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

Test Plan: Read it

Reviewers: dfeuer, hvr, bgamari

Reviewed By: dfeuer

Subscribers: thomie, carter

GHC Trac Issues: #14356, #15025

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

15 months agoRevert "Fix processHeapClosureForDead CONSTR_NOCAF case:"
Ben Gamari [Fri, 13 Apr 2018 16:10:45 +0000 (12:10 -0400)] 
Revert "Fix processHeapClosureForDead CONSTR_NOCAF case:"

This reverts commit a303584e58b3f4791bc5881cb722e7f498e14554.

15 months agoUse newtype deriving for Hoopl code
U-Maokai\andi [Fri, 13 Apr 2018 15:34:03 +0000 (11:34 -0400)] 
Use newtype deriving for Hoopl code

Hoopl.Collections/.Label has newtype containers which derive
Functor/Traversable.
Enabling GeneralizedNewtypeDeriving improves allocation count and
compile time when building these files for GHC.

```
Vanilla, O1
<<ghc: 378555664 bytes, 76 GCs, 8663140/18535016 avg/max bytes
residency (5 samples), 63M in use, 0.000 INIT (0.000 elapsed), 0.219
MUT (0.354 elapsed), 0.141 GC (0.138 elapsed) :ghc>>

GeneralizedNewtypeDeriving , O1
<<ghc: 301026536 bytes, 78 GCs, 8392886/17181088 avg/max bytes
residency (5 samples), 63M in use, 0.000 INIT (0.000 elapsed), 0.156
MUT (0.230 elapsed), 0.094 GC (0.106 elapsed) :ghc>>
```

Test Plan: ci

Reviewers: bgamari, simonmar, RyanGlScott

Reviewed By: RyanGlScott

Subscribers: mpickering, RyanGlScott, thomie, carter

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

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

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

Test Plan: make test TEST=T14708

Reviewers: Phyx, hvr, bgamari

Reviewed By: Phyx

Subscribers: thomie, carter

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

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

15 months agoRemove unused function: mkFunCos
Matthew Pickering [Fri, 13 Apr 2018 15:33:40 +0000 (11:33 -0400)] 
Remove unused function: mkFunCos

Reviewers: goldfire, bgamari, dfeuer

Reviewed By: dfeuer

Subscribers: dfeuer, thomie, carter

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

15 months agoFix rts.cabal.in
Andrey Mokhov [Fri, 13 Apr 2018 15:33:30 +0000 (11:33 -0400)] 
Fix rts.cabal.in

On Windows the FFI library is called `libCffi-6` instead of `libCffi`.
This needs to be reflected in `rts.cabal.in` as otherwise we cannot
properly `copy` and `register` the RTS package on Windows.

See https://github.com/snowleopard/hadrian/issues/567

Test Plan: Build GHC using Hadrian. Make build system does not use
`rts.cabal.in`.

Reviewers: bgamari, erikd, simonmar, Phyx

Reviewed By: Phyx

Subscribers: thomie, carter

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

15 months agoUpdate JMP_TBL targets during shortcutting in X86 NCG.
Andreas Klebinger [Fri, 13 Apr 2018 15:32:23 +0000 (11:32 -0400)] 
Update JMP_TBL targets during shortcutting in X86 NCG.

Without updating the JMP_TBL information the block list in
JMP_TBL contained blocks which were eliminated in some circumstances.

The actual assembly generation doesn't look at these fields so this
didn't cause any bugs yet. However as long as we carry this information
around we should make an effort to keep it correct.

Especially since it's useful for debugging purposes and can be used
for passes near the end of the codegen pipeline.
In particular it's used by jumpDestsOfInstr which without these changes
returns the wrong destinations.

Test Plan: ci

Reviewers: bgamari

Subscribers: thomie, carter

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

15 months agoFix processHeapClosureForDead CONSTR_NOCAF case:
Ömer Sinan Ağacan [Fri, 13 Apr 2018 15:31:56 +0000 (11:31 -0400)] 
Fix processHeapClosureForDead CONSTR_NOCAF case:

CONSTR_NOCAF was introduced with 55d535da10d as a replacement for
CONSTR_STATIC and CONSTR_NOCAF_STATIC, however, as explained in Note
[static constructors], we copy CONSTR_NOCAFs (which can also be seen in
evacuate) during GC, and they can become dead, like other CONSTR_X_Ys.
processHeapClosureForDead is updated to reflect this.

Reviewers: bgamari, simonmar, erikd

Subscribers: thomie, carter

GHC Trac Issues: #7836

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

15 months agoRevert "CmmPipeline: add a second pass of CmmCommonBlockElim"
Michal Terepeta [Fri, 13 Apr 2018 15:31:38 +0000 (11:31 -0400)] 
Revert "CmmPipeline: add a second pass of CmmCommonBlockElim"

This reverts commit d5c4d46a62ce6a0cfa6440344f707136eff18119.

Please see #14989 for details.

Test Plan: ./validate

Reviewers: bgamari, simonmar

Subscribers: thomie, carter

GHC Trac Issues: #14989

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

15 months agousers-guide: Update release notes and language extensions
Takenobu Tani [Fri, 13 Apr 2018 15:31:23 +0000 (11:31 -0400)] 
users-guide: Update release notes and language extensions

Update release notes and language extensions for GHC 8.6.1.

* Add `BlockArguments` and `NumericUndescores` in release note
* Fix directive for `HexFloatLiterals` and `NumericUndescores`

Test Plan: build

Reviewers: bgamari

Reviewed By: bgamari

Subscribers: thomie, carter

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

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

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

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

Test Plan: ./validate

Reviewers: hvr, goldfire, bgamari

Reviewed By: bgamari

Subscribers: thomie, carter

GHC Trac Issues: #15025

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

15 months agoTTG for HsBinds and Data instances Plan B
Alan Zimmerman [Sun, 1 Apr 2018 19:33:53 +0000 (21:33 +0200)] 
TTG for HsBinds and Data instances Plan B

Summary:
- Add the balance of the TTG extensions for hsSyn/HsBinds

- Move all the (now orphan) data instances into hsSyn/HsInstances and
use TTG Data instances Plan B
https://ghc.haskell.org/trac/ghc/wiki/ImplementingTreesThatGrow/Instances#PLANB

Updates haddock submodule.

Illustrative numbers

Compiling HsInstances before using Plan B.

Max residency ~ 5G
<<ghc: 629,864,691,176 bytes, 5300 GCs,
       321075437/1087762592 avg/max bytes residency (23 samples),
       2953M in use, 0.000 INIT (0.000 elapsed),
       383.511 MUT (384.986 elapsed), 37.426 GC (37.444 elapsed) :ghc>>

Using Plan B

Max residency 1.1G

<<ghc: 78,832,782,968 bytes, 2884 GCs,
       222140352/386470152 avg/max bytes residency (34 samples),
       1062M in use, 0.001 INIT (0.001 elapsed),
       56.612 MUT (62.917 elapsed), 32.974 GC (32.923 elapsed) :ghc>>

Test Plan: ./validate

Reviewers: shayan-najd, goldfire, bgamari

Subscribers: goldfire, thomie, mpickering, carter

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

15 months agoRemove fs files from rts install-includes.
Tamar Christina [Thu, 12 Apr 2018 20:40:43 +0000 (21:40 +0100)] 
Remove fs files from rts install-includes.

Summary:
They don't really need to be installed and will fix Hadrian installs.
Skipping review because change is trivial.

THis should be safe, but running it through CI to be sure.

Test Plan: ./validate

Reviewers: bgamari, erikd, simonmar

Subscribers: thomie, carter

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

15 months agoRevert "Remove fs files from rts install-includes."
Tamar Christina [Thu, 12 Apr 2018 06:50:28 +0000 (07:50 +0100)] 
Revert "Remove fs files from rts install-includes."

This reverts commit 111556f9e809962a91666c99d96cf80db361ee32.

There is a mismatch between Hadrian and Make on these install-includes.
but the reachability analysis forces these headers to be exported even
through they can't vven be used.

15 months agoRemove fs files from rts install-includes.
Tamar Christina [Thu, 12 Apr 2018 03:06:11 +0000 (04:06 +0100)] 
Remove fs files from rts install-includes.

They don't really need to be installed and will fix Hadrian installs.
Skipping review because change is trivial.

15 months agoNo need for sortQuantVars in Exitify after all
Joachim Breitner [Wed, 11 Apr 2018 15:24:01 +0000 (11:24 -0400)] 
No need for sortQuantVars in Exitify after all

because `captured :: [Var]` is always in dependency order.

I added a comment in the crucial point so that this does not trip us up
again.

15 months agoSchedule.c: remove some unused parameters
Ömer Sinan Ağacan [Wed, 11 Apr 2018 08:35:43 +0000 (11:35 +0300)] 
Schedule.c: remove some unused parameters

15 months agoSchedule.c: remove unused code
Ömer Sinan Ağacan [Wed, 11 Apr 2018 07:50:11 +0000 (10:50 +0300)] 
Schedule.c: remove unused code

15 months agoMove T14925.stdout to its correct location, remove expect_broken
Ömer Sinan Ağacan [Wed, 11 Apr 2018 07:44:00 +0000 (10:44 +0300)] 
Move T14925.stdout to its correct location, remove expect_broken

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

as helpfully outlined by SPJ.

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

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

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

15 months agoDiscard reflexive casts during Simplify
Richard Eisenberg [Tue, 10 Apr 2018 14:23:42 +0000 (10:23 -0400)] 
Discard reflexive casts during Simplify

Trac #14735 (derived from Trac #11735) found that 75% of compile
time was being spent in simplCast. This patch is the first in a series
to deal with that problem.

This particular patch actually has very little effect on performance; it
just refactors simplCast so that it builds Refl coercions less often.
Refl coercions require us to compute the type to put inside them, and
even if that's done lazily it is still work and code. Instead we use
Maybe Coercion with Nothing for Refl. This change also percolates to
pushCoTyArg and pushValArg.

Reviewers: goldfire, bgamari, simonpj

Reviewed By: simonpj

Subscribers: rwbarton, thomie, carter

GHC Trac Issues: #14737

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

15 months agoRevert "Fix #14838 by marking TH-spliced code as FromSource"
Ben Gamari [Sat, 7 Apr 2018 17:32:58 +0000 (13:32 -0400)] 
Revert "Fix #14838 by marking TH-spliced code as FromSource"

This reverts commit ffb2738f86c4e4c3f0eaacf0a95d7326fdd2e383.

Due to #14987.

Reviewers: goldfire, RyanGlScott

Reviewed By: RyanGlScott

Subscribers: RyanGlScott, thomie, carter

GHC Trac Issues: #14987, #14838

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

15 months agoMove gmp/config.mk.in to config.mk.in, fix #14972
Edward Z. Yang [Sat, 7 Apr 2018 17:32:47 +0000 (13:32 -0400)] 
Move gmp/config.mk.in to config.mk.in, fix #14972

Here's how the rube goldberg machine triggered the old bug:

1. If you have a file gmp/config.mk.in, then Cabal will
create a generated file in $DIST/build/gmp/config.mk

2. When you attempt to load inplace integer-gmp via GHCi, it will
ask gcc (aka clang on OS X) for the file name of 'gmp', with
base directory set to $DIST/build

3. There is a folder named 'gmp', and so this folder is returned
as the 'library' for gmp

4. GHCi loadArchive chokes to death trying to open a library
that is actually a folder

This patch solves the problem by breaking the chain at (1): if we
don't put config.mk in a folder named gmp, NO PROBLEM.

Signed-off-by: Edward Z. Yang <ezyang@fb.com>
Test Plan: validate

Reviewers: angerman, hvr, bgamari

Reviewed By: angerman

Subscribers: erikd, thomie, carter

GHC Trac Issues: #14972

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

15 months agoMinor typofix in LoadArchive.c
Edward Z. Yang [Sat, 7 Apr 2018 17:32:31 +0000 (13:32 -0400)] 
Minor typofix in LoadArchive.c

Test Plan: none

Reviewers: bgamari, erikd, simonmar

Reviewed By: bgamari

Subscribers: thomie, carter

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

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

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

Test Plan: Validate

Reviewers: simonmar, erikd

Reviewed By: simonmar

Subscribers: thomie, carter, RyanGlScott

GHC Trac Issues: #14947

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

15 months agotestsuite: Add test for negative sqrts (#10010)
Ben Gamari [Sat, 7 Apr 2018 17:31:42 +0000 (13:31 -0400)] 
testsuite: Add test for negative sqrts (#10010)

Reviewers: hvr, alpmestan

Reviewed By: alpmestan

Subscribers: thomie, carter

GHC Trac Issues: #10010

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

15 months agoRemove PARALLEL_HASKELL comments
Ömer Sinan Ağacan [Tue, 10 Apr 2018 14:06:27 +0000 (17:06 +0300)] 
Remove PARALLEL_HASKELL comments

PARALLEL_HASKELL was long gone, remove references

[skip ci]

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

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

15 months agoFix GHC collector flavor for Fedora job (Circle CI)
mrkkrp [Tue, 10 Apr 2018 10:50:39 +0000 (17:50 +0700)] 
Fix GHC collector flavor for Fedora job (Circle CI)

15 months agoAdd a forgotten newline in a debug print
Ömer Sinan Ağacan [Tue, 10 Apr 2018 08:40:59 +0000 (11:40 +0300)] 
Add a forgotten newline in a debug print

[skip ci]

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

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

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

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

15 months agoRestore Trees That Grow reverted commits
Alan Zimmerman [Sun, 1 Apr 2018 19:33:53 +0000 (21:33 +0200)] 
Restore Trees That Grow reverted commits

The following commits were reverted prior to the release of GHC 8.4.1,
because the time to derive Data instances was too long [1].

 438dd1cbba13d35f3452b4dcef3f94ce9a216905 Phab:D4147
 e3ec2e7ae94524ebd111963faf34b84d942265b4 Phab:D4177
 47ad6578ea460999b53eb4293c3a3b3017a56d65 Phab:D4186

The work is continuing, as the minimum bootstrap compiler is now
GHC 8.2.1, and this allows Plan B[2] for instances to be used.  This
will land in a following commit.

Updates Haddock submodule

[1] https://ghc.haskell.org/trac/ghc/wiki/ImplementingTreesThatGrow/Instances
[2] https://ghc.haskell.org/trac/ghc/wiki/ImplementingTreesThatGrow/Instances#PLANB

15 months agoBump template-haskell to 2.14.0.0
Ryan Scott [Mon, 9 Apr 2018 16:56:51 +0000 (12:56 -0400)] 
Bump template-haskell to 2.14.0.0

Summary:
There has been at least one breaking change to
`template-haskell` (the removal of `qAddForeignFile`) which is
causing packages like `th-orphans` and `singletons` to fail to build
with GHC HEAD. Let's bump `template-haskell`'s major version number
so that these packages can properly guard against these changes.

While I was in town, I also started a `changelog` section for
the next major version of `template-haskell`, and copied over
finishing touches for `template-haskell-2.13.0.0`.

Test Plan: ./validate

Reviewers: bgamari

Reviewed By: bgamari

Subscribers: thomie, carter

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

15 months agoSome cleanup of the Exitification code
Joachim Breitner [Fri, 6 Apr 2018 21:26:45 +0000 (17:26 -0400)] 
Some cleanup of the Exitification code

based on a thorough review by Simon in comments
https://ghc.haskell.org/trac/ghc/ticket/14152#comment:33
through 37.

The changes are:

 * `isExitJoinId` is moved to `SimplUtils`, because
   it is only valid when occurrence information is up-to-date.
 * Abstracted variables are properly sorted using `sortQuantVars`
 * Exitification does not set occ info.

 And then minor quibles to notes and avoiding some unhelpful shadowing
 of local names.

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

15 months agodocs(Data.Function): fix and augment `on` annotation
Gabriel Lebec [Sat, 7 Apr 2018 16:57:36 +0000 (12:57 -0400)] 
docs(Data.Function): fix and augment `on` annotation

15 months agoCoreUtils.filterAlts: Correct docs
Simon Jakobi [Wed, 4 Apr 2018 22:00:25 +0000 (00:00 +0200)] 
CoreUtils.filterAlts: Correct docs

`refineDefaultAlt` takes care of refining the default alt these days.

15 months agoRun tests after artifact collection
mrkkrp [Wed, 4 Apr 2018 13:38:54 +0000 (20:38 +0700)] 
Run tests after artifact collection

Since for every job there are failing tests, if we try to upload artifacts
after tests, we won't get any. As a temporary measure I suggest uploading
artifacts before running tests. Once tests are fixed, we should peform
artifact uploading after tests again.

15 months agoImprove documentation for refineDefaultAlt
Simon Jakobi [Mon, 2 Apr 2018 20:27:44 +0000 (22:27 +0200)] 
Improve documentation for refineDefaultAlt

15 months agoDocument SumTyCon
Simon Jakobi [Mon, 2 Apr 2018 19:29:02 +0000 (21:29 +0200)] 
Document SumTyCon

15 months agoCollect build artifacts with S3
mrkkrp [Fri, 30 Mar 2018 10:18:16 +0000 (17:18 +0700)] 
Collect build artifacts with S3

15 months agoRemove HasSourceText and SourceTextX classes
Alan Zimmerman [Wed, 28 Mar 2018 21:35:43 +0000 (23:35 +0200)] 
Remove HasSourceText and SourceTextX classes

Updates haddock submodule to match.

Test Plan : Validate

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

15 months agoFix #14238 by always pretty-printing visible tyvars
Ryan Scott [Sat, 7 Apr 2018 11:30:42 +0000 (07:30 -0400)] 
Fix #14238 by always pretty-printing visible tyvars

Summary:
Before, GHC would never print visible tyvars in the absence
of `-fprint-explicit-foralls`, which led to `:kind` displaying
incorrect kinds in GHCi. The fix is simple—simply check beforehand
if any of the type variable binders are required when deciding when
to pretty-print them.

Test Plan: make test TEST=T14238

Reviewers: simonpj, goldfire, bgamari

Subscribers: thomie, carter

GHC Trac Issues: #14238

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

15 months agotestsuite: Accept output for T12593
Ben Gamari [Fri, 6 Apr 2018 15:10:25 +0000 (11:10 -0400)] 
testsuite: Accept output for T12593

Summary: This seems to have changed recently but the new output looks plausible.

Reviewers: RyanGlScott

Reviewed By: RyanGlScott

Subscribers: RyanGlScott, thomie, carter

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

15 months agobase: Add dependency on GHC.Integer in a few boot files
Ben Gamari [Fri, 6 Apr 2018 15:10:07 +0000 (11:10 -0400)] 
base: Add dependency on GHC.Integer in a few boot files

Summary:
The typechecker started trying to pull in GHC.Integer.Type's interface file
due to the change made in d8d4266bf73790f65b223ec16f645763eaed8be3. It's unclear
why the patch in question changed this behavior, but these typechecker-induced
dependencies are known to be a bit fragile and adding these imports ensures
that the build order is correct.

Test Plan: Validate

Reviewers: goldfire, hvr

Subscribers: thomie, carter

GHC Trac Issues: #15004

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

15 months agoComments only, about exitifcation
Simon Peyton Jones [Fri, 6 Apr 2018 08:46:29 +0000 (09:46 +0100)] 
Comments only, about exitifcation

15 months agoRemove unused bdescr flag BF_FREE
Ömer Sinan Ağacan [Thu, 5 Apr 2018 15:41:02 +0000 (18:41 +0300)] 
Remove unused bdescr flag BF_FREE

Reviewers: bgamari, simonmar, erikd

Reviewed By: bgamari, simonmar

Subscribers: thomie, carter

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

15 months agoFix accidental breakage in T7050
Simon Peyton Jones [Tue, 3 Apr 2018 08:06:49 +0000 (09:06 +0100)] 
Fix accidental breakage in T7050

I introduced a silly bug in

  commit 9187d5fb1d3d38a4e607b0d61784c21447c8195b
  Date:   Mon Apr 2 14:55:43 2018 +0100

  Allow unpacking of single-data-con GADTs

that made test T7050 diverge.  This patch fixes it.

15 months agoFix #14991.
Richard Eisenberg [Mon, 2 Apr 2018 19:32:04 +0000 (15:32 -0400)] 
Fix #14991.

It turns out that solveEqualities really does need to use simpl_top.
I thought that solveWanteds would be enough, and no existing test
case showed up the different. #14991 shows that we need simpl_top.
Easy enough to fix.

test case: dependent/should_compile/T14991

15 months agoMark test as expected to pass.
Richard Eisenberg [Mon, 2 Apr 2018 18:43:09 +0000 (14:43 -0400)] 
Mark test as expected to pass.

This fixes the SplitWD "unexpected pass". This test was fixed
by ef443820b71f5c9c2dca362217f1a9fbab6dd736 and somehow fell
through my validation cracks.

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

This commit:

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

  Do not bind coercion variables in SpecConstr rules

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

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

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

15 months agoAllow unpacking of single-data-con GADTs
Simon Peyton Jones [Mon, 2 Apr 2018 13:55:43 +0000 (14:55 +0100)] 
Allow unpacking of single-data-con GADTs

Trac #14978 pointed out that single-constructor GADTs should be
unpackable without trouble.

Acutally I realise that even existentials should be unpackable
too, but that's a bit more work, so it's not part of this patch.

See Note [Unpacking GADTs and existentials] in MkId.

15 months agoTest #14884, #14969
Richard Eisenberg [Mon, 2 Apr 2018 13:39:19 +0000 (09:39 -0400)] 
Test #14884, #14969

These were fixed by faec8d358985e5d0bf363bd96f23fe76c9e281f7

test cases: typecheck/should_fail/T14884
            ghci/scripts/T14969

15 months agoClarify comments around dropping Derived constraints
Richard Eisenberg [Sat, 17 Mar 2018 05:57:28 +0000 (01:57 -0400)] 
Clarify comments around dropping Derived constraints

[skip ci]

15 months agoApply Note [EtaAppCo] in OptCoercion to another case
Richard Eisenberg [Sun, 11 Mar 2018 13:45:31 +0000 (09:45 -0400)] 
Apply Note [EtaAppCo] in OptCoercion to another case

15 months agoApply the interim fix for #14119 to liftCoMatch
Richard Eisenberg [Sat, 24 Feb 2018 16:49:15 +0000 (11:49 -0500)] 
Apply the interim fix for #14119 to liftCoMatch

Matching in the presence of casts can happen in liftCoMatch, too.