ghc.git
23 months agoFix #12176 by being a bit more careful instantiating.
Richard Eisenberg [Tue, 18 Jul 2017 23:44:17 +0000 (19:44 -0400)] 
Fix #12176 by being a bit more careful instantiating.

Previously, looking up a TyCon that said "no" to mightBeUnsaturated
would then instantiate all of its invisible binders. But this is
wrong for vanilla type synonyms, whose RHS kind might legitimately
start with invisible binders. So a little more care is taken now,
only to instantiate those invisible binders that need to be (so that
the TyCon isn't unsaturated).

23 months agoDocument that type holes kill polymorphic recursion
Richard Eisenberg [Tue, 18 Jul 2017 19:55:21 +0000 (15:55 -0400)] 
Document that type holes kill polymorphic recursion

This "fixes" #11995.

23 months agoFix #11963 by checking for more mixed type/kinds
Richard Eisenberg [Tue, 18 Jul 2017 19:49:38 +0000 (15:49 -0400)] 
Fix #11963 by checking for more mixed type/kinds

This is a straightforward fix -- there were just some omitted
checks.

test case: typecheck/should_fail/T11963

23 months agoTrack visibility in TypeEqOrigin
Richard Eisenberg [Tue, 18 Jul 2017 18:30:40 +0000 (14:30 -0400)] 
Track visibility in TypeEqOrigin

A type equality error can arise from a mismatch between
*invisible* arguments just as easily as from visible arguments.
But we should really prefer printing out errors from visible
arguments over invisible ones. Suppose we have a mismatch between
`Proxy Int` and `Proxy Maybe`. Would you rather get an error
between `Int` and `Maybe`? Or between `*` and `* -> *`? I thought
so, too.

There is a fair amount of plumbing with this one, but I think
it's worth it.

This commit introduces a performance regression in test
perf/compiler/T5631. The cause of the regression is not the
new visibility stuff, directly: it's due to a change from
zipWithM to zipWith3M in TcUnify. To my surprise, zipWithM
is nicely optimized (it fuses away), but zipWith3M is not.
There are other examples of functions that could be made faster,
so I've posted a separate ticket, #14037, to track these
improvements. For now, I've accepted the small (6.6%) regression.

23 months agoFix #13819 by refactoring TypeEqOrigin.uo_thing
Richard Eisenberg [Wed, 14 Jun 2017 20:35:18 +0000 (16:35 -0400)] 
Fix #13819 by refactoring TypeEqOrigin.uo_thing

The uo_thing field of TypeEqOrigin is used to track the
"thing" (either term or type) that has the type (kind) stored
in the TypeEqOrigin fields. Previously, this was sometimes a
proper Core Type, which needed zonking and tidying. Now, it
is only HsSyn: much simpler, and the error messages now use
the user-written syntax.

But this aspect of uo_thing didn't cause #13819; it was the
sibling field uo_arity that did. uo_arity stored the number
of arguments of uo_thing, useful when reporting something
like "should have written 2 fewer arguments". We wouldn't want
to say that if the thing didn't have two arguments. However,
in practice, GHC was getting this wrong, and this message
didn't seem all that helpful. Furthermore, the calculation
of the number of arguments is what caused #13819 to fall over.
This patch just removes uo_arity. In my opinion, the change
to error messages is a nudge in the right direction.

Test case: typecheck/should_fail/T13819

23 months agoRemove old coercion pretty-printer
Richard Eisenberg [Tue, 6 Jun 2017 15:01:14 +0000 (11:01 -0400)] 
Remove old coercion pretty-printer

Now, all coercions are printed from IfaceType, just like types.

This also changes the rendering of TransCo to use ; instead of
a prefix operator.

23 months agoPreserve CoVar uniques during pretty printing
Richard Eisenberg [Tue, 6 Jun 2017 14:07:16 +0000 (10:07 -0400)] 
Preserve CoVar uniques during pretty printing

Previously, we did this for Types, but not for Coercions.

23 months agoDon't tidy vars when dumping a type
Richard Eisenberg [Fri, 7 Apr 2017 15:13:32 +0000 (11:13 -0400)] 
Don't tidy vars when dumping a type

This makes variables print more consistenty in, say,
-ddump-tc-trace.

23 months agoTest #11672 in typecheck/should_fail/T11672.
Richard Eisenberg [Thu, 1 Jun 2017 22:28:57 +0000 (18:28 -0400)] 
Test #11672 in typecheck/should_fail/T11672.

I believe this was fixed with the fix for #11198.

23 months agoFix #11400, #11560 by documenting an infelicity.
Richard Eisenberg [Thu, 1 Jun 2017 22:09:05 +0000 (18:09 -0400)] 
Fix #11400, #11560 by documenting an infelicity.

Really, the fix for both of these is #11307.

23 months agoImprove error messages around kind mismatches.
Richard Eisenberg [Thu, 1 Jun 2017 21:27:14 +0000 (17:27 -0400)] 
Improve error messages around kind mismatches.

Previously, when canonicalizing (or unifying, in uType) a
heterogeneous equality, we emitted a kind equality and used the
resulting coercion to cast one side of the heterogeneous equality.

While sound, this led to terrible error messages. (See the bugs
listed below.) The problem is that using the coercion built from
the emitted kind equality is a bit like a wanted rewriting a wanted.
The solution is to keep heterogeneous equalities as irreducible.

See Note [Equalities with incompatible kinds] in TcCanonical.

This commit also removes a highly suspicious switch to FM_SubstOnly
when flattening in the kinds of a type variable. I have no idea
why this was there, other than as a holdover from pre-TypeInType.
I've not left a Note because there is simply no reason I can conceive
of that the FM_SubstOnly should be there.

One challenge with this patch is that the emitted derived equalities
might get emitted several times: when a heterogeneous equality is
in an implication and then gets floated out from the implication,
the Derived is present both in and out of the implication. This
causes a duplicate error message. (Test case:
typecheck/should_fail/T7368) Solution: track the provenance of
Derived constraints and refuse to float out a constraint that has
an insoluble Derived.

Lastly, this labels one test (dependent/should_fail/RAE_T32a)
as expect_broken, because the problem is really #12919. The
different handling of constraints in this patch exposes the error.

This fixes bugs #11198, #12373, #13530, and #13610.

test cases:
typecheck/should_fail/{T8262,T8603,tcail122,T12373,T13530,T13610}

23 months agoRemove unneeded import
Gabor Greif [Thu, 27 Jul 2017 11:04:21 +0000 (13:04 +0200)] 
Remove unneeded import

23 months agoFix #13968 by consulting isBuiltInOcc_maybe
Ryan Scott [Wed, 26 Jul 2017 21:13:57 +0000 (17:13 -0400)] 
Fix #13968 by consulting isBuiltInOcc_maybe

Summary:
We were unconditionally reporting `Illegal binding of built-in syntax`
in an error message, but this error doesn't make sense in certain Template
Haskell scenarios which can trigger it. Let's give a more sensible error
message by first checking if the name we're binding really is built-in syntax,
using the handy `isBuiltInOcc_maybe` function.

Test Plan: make test TEST=T13968

Reviewers: bgamari, austin, goldfire

Reviewed By: goldfire

Subscribers: goldfire, rwbarton, thomie

GHC Trac Issues: #13968

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

23 months agoFix note references and some typos
Gabor Greif [Wed, 26 Jul 2017 13:13:04 +0000 (15:13 +0200)] 
Fix note references and some typos

23 months agoTest Trac #14033
Simon Peyton Jones [Wed, 26 Jul 2017 10:30:55 +0000 (11:30 +0100)] 
Test Trac #14033

23 months agoComments only
Simon Peyton Jones [Wed, 26 Jul 2017 07:57:41 +0000 (08:57 +0100)] 
Comments only

23 months agoComments and tc-tracing only
Simon Peyton Jones [Wed, 26 Jul 2017 07:57:16 +0000 (08:57 +0100)] 
Comments and tc-tracing only

23 months agoFix binder visiblity for default methods
Simon Peyton Jones [Wed, 26 Jul 2017 07:51:47 +0000 (08:51 +0100)] 
Fix binder visiblity for default methods

Trac #13998 showed that default methods were getting bogus tyvar
binder visiblity info; and that it matters in the code genreated
by the default-method fill-in mechanism

* The actual fix: in TcTyDecls.mkDefaultMethodType, make TyVarBinders
  with the right visibility info by getting TyConBinders from the
  class TyCon.  (Previously we made up visiblity info, but that
  caused #13998.)

* Define TyCon.tyConTyVarBinders :: [TyConBinder] -> [TyVarBinder]
  which can build correct forall binders for
    a) default methods (Trac #13998)
    b) data constructors
  This was originally BuildTyCl.mkDataConUnivTyVarBinders

* Move mkTyVarBinder, mkTyVarBinders from Type to Var

23 months agoAdd an Outputable instance for ListMap
Simon Peyton Jones [Wed, 26 Jul 2017 07:31:47 +0000 (08:31 +0100)] 
Add an Outputable instance for ListMap

23 months agoFix #10684 by processing deriving clauses with finer grain
Ryan Scott [Tue, 25 Jul 2017 20:14:27 +0000 (16:14 -0400)] 
Fix #10684 by processing deriving clauses with finer grain

Summary:
Previously, one could experience error cascades with deriving clauses
when one class in a set of many failed to derive, causing the other derived
classes to be skipped entirely and resulting in other errors down the line.
The solution is to process each class in a data type's set of deriving clauses
individually, and engineer it so that failure to derive an individual class
within that set doesn't cancel out the others.

Test Plan: make test TEST="T10684 T12801"

Reviewers: austin, bgamari, simonpj

Reviewed By: simonpj

Subscribers: simonpj, rwbarton, thomie

GHC Trac Issues: #10684, #12801

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

23 months agoRevert "Remove unused language pragma"
Matthew Pickering [Tue, 25 Jul 2017 16:08:15 +0000 (17:08 +0100)] 
Revert "Remove unused language pragma"

This reverts commit 7d1909ad110f05c8cb2fb0689ee75857ceb945f6.

It is actually used for Callstacks, woops!

23 months agoRemove unused language pragma
Matthew Pickering [Tue, 25 Jul 2017 15:23:31 +0000 (16:23 +0100)] 
Remove unused language pragma

23 months agoExpose FrontendPluginAction
Matthew Pickering [Tue, 25 Jul 2017 15:22:39 +0000 (16:22 +0100)] 
Expose FrontendPluginAction

It is mentioned in the API but not exported.

23 months agobase: Introduce GHC.ByteOrder
Ben Gamari [Mon, 24 Jul 2017 23:54:37 +0000 (19:54 -0400)] 
base: Introduce GHC.ByteOrder

This provides a ByteOrder type as well as a targetByteOrder value, which
indicates the byte ordering used by the target machine. We might also
consider exposing this via Data.Bits if the CLC is so inclined.

Test Plan: Needs test

Reviewers: hvr, RyanGlScott, austin

Reviewed By: hvr, RyanGlScott

Subscribers: rwbarton, thomie

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

23 months agoFix import error with -XPackageImports when the module has a duplicate name
Eugene Akentyev [Mon, 24 Jul 2017 23:53:57 +0000 (19:53 -0400)] 
Fix import error with -XPackageImports when the module has a duplicate name

Reviewers: austin, bgamari, mpickering

Reviewed By: bgamari

Subscribers: mpickering, rwbarton, thomie

GHC Trac Issues: #13168

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

23 months agotestsuite: Add testcase for #13168
Ben Gamari [Sun, 23 Jul 2017 17:15:22 +0000 (13:15 -0400)] 
testsuite: Add testcase for #13168

Thanks to Ryan Scott for the testcase.

Currently broken.

23 months agoUse libpthread instead of libthr on FreeBSD
Ben Gamari [Mon, 24 Jul 2017 23:02:56 +0000 (19:02 -0400)] 
Use libpthread instead of libthr on FreeBSD

Since #847 we have used libthr due to reported hangs with FreeBSD's
KSE-based M:N pthread implementation. However, this was nearly 12 years
ago and today libpthread seems to work fine. Moreover, adding -lthr to
the linker flags break when used in conjunction with -r when gold is
used (since -l and -r are incompatible although BFD ld doesn't
complain).

Test Plan: Validate on FreeBSD

Reviewers: kgardas, austin

Subscribers: rwbarton, thomie

GHC Trac Issues: #847

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

23 months agoDynFlags: Drop rtsBuildTag field
Ben Gamari [Mon, 24 Jul 2017 23:02:20 +0000 (19:02 -0400)] 
DynFlags: Drop rtsBuildTag field

This wasn't used anywhere; the RTS build tag is now constructed in
Packages.packageHsLibs.

Test Plan: Validate

Reviewers: austin

Subscribers: rwbarton, thomie

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

23 months agoghc-prim: Don't allocate a thunk for each unpacked UTF-8 character
Ben Gamari [Mon, 24 Jul 2017 23:01:58 +0000 (19:01 -0400)] 
ghc-prim: Don't allocate a thunk for each unpacked UTF-8 character

While debugging #14005 I noticed that unpackCStringUtf8# was allocating
a thunk for each Unicode character that it unpacked. This seems hardly
worthwhile given that the thunk's closure will be at least three words,
whereas the Char itself will be only two and requires only a bit of bit
twiddling to construct.

Test Plan: Validate

Reviewers: simonmar, austin

Subscribers: dfeuer, rwbarton, thomie

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

23 months agousers-guide: Fix URL of deferred type errors paper
Ben Gamari [Mon, 24 Jul 2017 23:01:33 +0000 (19:01 -0400)] 
users-guide: Fix URL of deferred type errors paper

Reviewers: austin

Subscribers: rwbarton, thomie

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

23 months agousers-guide: Make it easier to reference haddocks
Ben Gamari [Mon, 24 Jul 2017 23:00:24 +0000 (19:00 -0400)] 
users-guide: Make it easier to reference haddocks

Previously you had to painstakingly construct the URI to the haddock
documentation. Now the Python bits have enough smarts to construct this
themselves.

Reviewers: austin, patrickdoc

Reviewed By: patrickdoc

Subscribers: rwbarton, thomie

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

23 months agousers-guide: Eliminate some redundant index entries
Ben Gamari [Mon, 24 Jul 2017 01:31:47 +0000 (21:31 -0400)] 
users-guide: Eliminate some redundant index entries

23 months agousers-guide: Cross-reference more flags
Ben Gamari [Mon, 24 Jul 2017 01:09:37 +0000 (21:09 -0400)] 
users-guide: Cross-reference more flags

23 months agousers-guides: Fix errant whitespace
Ben Gamari [Sun, 23 Jul 2017 19:48:56 +0000 (15:48 -0400)] 
users-guides: Fix errant whitespace

[skip-ci]

23 months agoAdd a caveat to the GHC.Generics examples about :+: nesting
Ryan Scott [Mon, 24 Jul 2017 15:54:37 +0000 (11:54 -0400)] 
Add a caveat to the GHC.Generics examples about :+: nesting

Summary:
GHC's choice in how it nests `:+:` can sometimes affect the
implementaiton of `GHC.Generics`-related code, so we should make a note of
this in the examples we provide. Fixes #9453.

Test Plan: Read it, like it, build it, ship it

Reviewers: bgamari, austin, hvr

Reviewed By: bgamari

Subscribers: rwbarton, thomie

GHC Trac Issues: #9453

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

23 months agoRemove 8.0.2 release notes file
Ryan Scott [Mon, 24 Jul 2017 15:54:28 +0000 (11:54 -0400)] 
Remove 8.0.2 release notes file

Summary: Some summer cleaning.

Reviewers: bgamari, austin

Reviewed By: bgamari

Subscribers: rwbarton, thomie

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

23 months agoFix more documentation wibbles
Ben Gamari [Sun, 23 Jul 2017 18:13:16 +0000 (14:13 -0400)] 
Fix more documentation wibbles

Fixes #14020, #14016, #14015, #14019

23 months agousers-guide: Fix various wibbles
Ben Gamari [Sun, 23 Jul 2017 16:59:49 +0000 (12:59 -0400)] 
users-guide: Fix various wibbles

23 months agousers-guide: Standardize and repair all flag references
Patrick Dougherty [Sun, 23 Jul 2017 16:55:37 +0000 (12:55 -0400)] 
users-guide: Standardize and repair all flag references

This patch does three things:

1.) It simplifies the flag parsing code in `conf.py` to properly display
flag definitions created by `.. (ghc|rts)-flag::`. Additionally, all flag
references must include the associated arguments. Documentation has been
added to `editing-guide.rst` to explain this.

2.) It normalizes all flag definitions to a similar format. Notably, all
instances of `<>` have been replaced with `⟨⟩`. All references across the
users guide have been updated to match.

3.) It fixes a couple issues with the flag reference table's generation code,
which did not handle comma separated flags in the same cell and did not
properly reference flags with arguments.

Test Plan:
`SPHINXOPTS = -n` to activate "nitpicky" mode, which reports all broken
references. All remaining errors are references to flags without any
documentation.

Reviewers: austin, bgamari

Reviewed By: bgamari

Subscribers: rwbarton, thomie

GHC Trac Issues: #13980

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

23 months agotestsuite: Fix cabal01 for real this time
Ben Gamari [Fri, 23 Jun 2017 18:47:06 +0000 (14:47 -0400)] 
testsuite: Fix cabal01 for real this time

Somehow the previous version passed on master but fails on ghc-8.2.
Will look deeper later.

(cherry picked from commit a6774e1d70f18f5c05279453d62fb3bcc7f07d7e)

23 months agoghc-prim: Bump version
Ben Gamari [Thu, 20 Jul 2017 15:27:45 +0000 (11:27 -0400)] 
ghc-prim: Bump version

(cherry picked from commit 8c5405f63c2de0c445ec171aab63c35786544b9e)

23 months agoBump integer-gmp version
Ben Gamari [Fri, 21 Jul 2017 21:31:03 +0000 (17:31 -0400)] 
Bump integer-gmp version

(cherry picked from commit 09396ec3bb672e761c3e627484dd02c5a3a76c77)

23 months agoUpdate release notes for 8.2.1
Ben Gamari [Mon, 10 Jul 2017 20:41:42 +0000 (16:41 -0400)] 
Update release notes for 8.2.1

This pulls over changes that were made in the ghc-8.2 branch.

23 months agoBump a bunch of submodules
Ben Gamari [Sun, 23 Jul 2017 15:21:41 +0000 (11:21 -0400)] 
Bump a bunch of submodules

23 months agoPreserve HaskellHaveRTSLinker in bindist
Ben Gamari [Sun, 23 Jul 2017 14:45:07 +0000 (10:45 -0400)] 
Preserve HaskellHaveRTSLinker in bindist

Otherwise you end up with ("target has RTS linker","@HaskellHaveRTSLinker@") in
the installed settings file.

23 months agousers-guide: Improve legibility of OverlappingInstances documentation
Ben Gamari [Sun, 23 Jul 2017 14:44:09 +0000 (10:44 -0400)] 
users-guide: Improve legibility of OverlappingInstances documentation

Reviewers: austin

Subscribers: rwbarton, thomie

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

23 months agodistrib/configure: Carry FFI include/lib paths from source distribution
Ben Gamari [Sun, 23 Jul 2017 14:43:52 +0000 (10:43 -0400)] 
distrib/configure: Carry FFI include/lib paths from source distribution

`FFILibDir` and `FFIIncludeDir` both show up in the `rts` library's
package registration file.  We therefore must define them or else we'll
end up with spurious `@FFILibDir@` strings in the package registration.

In principle I think we could also take these as arguments to the
bindist configure but this seems simpler and I don't want to verify this
at the moment.

Test Plan: Build bindist while passing `--with-ffi-libraries=...` to
source distribution configure then try to install and use bindist.

Reviewers: austin, hvr

Subscribers: rwbarton, thomie, erikd

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

23 months agoUpdate autoconf scripts
Ben Gamari [Fri, 21 Jul 2017 21:59:22 +0000 (17:59 -0400)] 
Update autoconf scripts

Scripts taken from autoconf 81497f5aaf50a12a9fe0cba30ef18bda46b62959

23 months agoAvoid linear lookup in unload_wkr in the Linker
Bartosz Nitka [Fri, 21 Jul 2017 18:41:41 +0000 (11:41 -0700)] 
Avoid linear lookup in unload_wkr in the Linker

I've encountered an issue with following
reproduction steps:
* `:load` a large number of modules (~2000)
* compile a BCO that depends on many other BCOs from many other modules
* `:reload`
* try to compile anything, even `1` works

Before this patch the last step takes ~5s.
It takes 80ms after.

Test Plan: harbormaster

Reviewers: simonmar, austin, hvr, bgamari

Subscribers: rwbarton, thomie

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

23 months agofix dllwrap issue.
Tamar Christina [Sat, 22 Jul 2017 13:11:07 +0000 (14:11 +0100)] 
fix dllwrap issue.

Summary: Always set dllwrap and windres values.

Reviewers: austin, hvr, bgamari, trofi

Reviewed By: trofi

Subscribers: rwbarton, thomie, erikd

GHC Trac Issues: #13792

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

23 months agoFix ungrammatical error message
Ryan Scott [Sat, 22 Jul 2017 03:08:24 +0000 (23:08 -0400)] 
Fix ungrammatical error message

Test Plan: If it builds, ship it

Reviewers: austin, bgamari

Reviewed By: bgamari

Subscribers: rwbarton, thomie

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

23 months agobuild system: Ensure there are no duplicate files in bindist list
Ben Gamari [Fri, 21 Jul 2017 01:39:27 +0000 (21:39 -0400)] 
build system: Ensure there are no duplicate files in bindist list

Several executables inexplicably appear twice in bindist.list, which
ends up producing multiple tar file entries, consequently breaking BSD
tar during extraction. I spent a fair amount of time trying to work out
where these duplicates were coming from to no avail. Since Hadrian is
right around the corner I'm satisfied with a terrible hack: just uniq
bindist.list before producing the bindist tarball.

Test Plan: Validate

Reviewers: austin

Subscribers: rwbarton, thomie

GHC Trac Issues: #13979, #13974

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

23 months agoHsPat: Assume that no spliced patterns are irrefutable
Ben Gamari [Thu, 20 Jul 2017 23:24:00 +0000 (19:24 -0400)] 
HsPat: Assume that no spliced patterns are irrefutable

This is a conservative assumption which will limit some uses of spliced
patterns, but it fixes #13984.

Test Plan: Validate

Reviewers: RyanGlScott, AaronFriel, austin

Reviewed By: RyanGlScott

Subscribers: rwbarton, thomie

GHC Trac Issues: #13984

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

23 months agoRevert "testsuite: Add test for #13916"
Ben Gamari [Thu, 20 Jul 2017 16:06:03 +0000 (12:06 -0400)] 
Revert "testsuite: Add test for #13916"

This reverts commit b2d3ec370b97fe5f448e8f1d4e0b7374c63c60a8. Didn't
mean to push this one.

23 months agotestsuite: Add test for #13916
Ben Gamari [Thu, 20 Jul 2017 15:43:06 +0000 (11:43 -0400)] 
testsuite: Add test for #13916

23 months agodistrib/configure: Canonicalize triples
Ben Gamari [Thu, 20 Jul 2017 15:34:00 +0000 (11:34 -0400)] 
distrib/configure: Canonicalize triples

Previously we failed to do this, which meant that the bindist's
configure would fail when passed --target (as you may need to do when
installing an armv7 bindist on an aarch64 machine, for instance).

Reviewers: hvr, erikd, austin

Reviewed By: hvr

Subscribers: rwbarton, thomie

GHC Trac Issues: #13934

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

23 months agorts: Claim AP_STACK before adjusting Sp
Ben Gamari [Thu, 20 Jul 2017 15:33:51 +0000 (11:33 -0400)] 
rts: Claim AP_STACK before adjusting Sp

In the fix to #13615 we introduced some logic to atomically blackhole
AP_STACKs closures upon entry. However, this logic was placed *after* a
stack pointer adjustment. This meant that if someone else beat us to
blackholing the AP_STACK we would suspend the thread with uninitialized
content on the stack.  This would then later blow up when threadPaused
attempted to walk the stack, hence #13970.

Silly bug but still cost lots of head-scratching to find.

Thanks to albertov for the great repro.

Fixes #13970. Bug originally introduced by the fix to #13615.

Reviewers: austin, erikd, simonmar

Reviewed By: erikd, simonmar

Subscribers: rwbarton, thomie

GHC Trac Issues: #13970, #13615

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

23 months agoInterpreter.c: use macros to access/modify Sp
Michal Terepeta [Thu, 20 Jul 2017 15:30:54 +0000 (11:30 -0400)] 
Interpreter.c: use macros to access/modify Sp

This is another step in fixing #13825 (based on D38 by Simon Marlow).

This commit adds a few macros for accessing and modifying `Sp`
(interpreter stack) and will be useful to allow sub-word
indexing/pushing. (but that will be a separate change, this commit
should introduce no changes in behavior)

Signed-off-by: Michal Terepeta <michal.terepeta@gmail.com>
Test Plan: ./validate

Reviewers: bgamari, simonmar, austin, erikd

Reviewed By: bgamari, erikd

Subscribers: rwbarton, thomie

GHC Trac Issues: #13825

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

23 months agoMake IfaceAxiom typechecking lazier.
Edward Z. Yang [Thu, 20 Jul 2017 15:30:46 +0000 (11:30 -0400)] 
Make IfaceAxiom typechecking lazier.

Fixes #13803, but adds a note about a yet to be fixed #13981.

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

Reviewers: bgamari, austin

Reviewed By: bgamari

Subscribers: simonpj, rwbarton, thomie

GHC Trac Issues: #13803

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

23 months agoFix busy-wait in SysTools.builderMainLoop
Douglas Wilson [Thu, 20 Jul 2017 12:48:12 +0000 (08:48 -0400)] 
Fix busy-wait in SysTools.builderMainLoop

Test T13701 was failing sporadically. The problem manifested while the
test was run on a system under load. Profiling showed the increased
allocations were in SysTools.builderMainLoop.loop, during calls to the
assembler. This was due to loop effectively busy-waiting from when both
stdin and stderr handles were closed, until getProcessExitCode
succeeded.

This is fixed by removing exit code handling from loop. We now wait for
loop to finish, then read the exit code with waitForProcess.

Some exception safety is added: the readerProc threads will now be
killed and the handles will be closed if an exception is thrown.

A TODO saying that threads dying is not accounted for is removed. I
believe that this case is handled by readerProc sending EOF in a finally
clause.

Test Plan:
Replicate test failures using procedure on the ticket, verify that they
do not occur with this patch.

Reviewers: austin, bgamari

Reviewed By: bgamari

Subscribers: rwbarton, thomie

GHC Trac Issues: #13987

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

23 months agoarcconfig: Set project ruleset to use master merge-base by default
Ben Gamari [Thu, 20 Jul 2017 12:41:09 +0000 (08:41 -0400)] 
arcconfig: Set project ruleset to use master merge-base by default

Reviewers: austin

Subscribers: rwbarton, thomie

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

23 months agotestsuite: Pipe stdin directly to process
Ben Gamari [Thu, 20 Jul 2017 12:40:49 +0000 (08:40 -0400)] 
testsuite: Pipe stdin directly to process

Previously the driver would read the stdin content from the source file
and then write it to the subprocess' stdin. We now simply open the stdin
file and provide that handle to the subprocess as its stdin

Test Plan: Validate

Reviewers: austin

Subscribers: rwbarton, thomie, goldfire

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

23 months agoIntroduce -fcatch-bottoms
Ben Gamari [Thu, 20 Jul 2017 02:31:16 +0000 (22:31 -0400)] 
Introduce -fcatch-bottoms

This flag instructs the simplifier to emit ``error`` expressions in the
continutation of empty case analyses (which should bottom and
consequently not return). This is helpful when debugging demand analysis
bugs which can sometimes manifest as segmentation faults.

Test Plan: Validate

Reviewers: simonpj, austin

Subscribers: niteria, rwbarton, thomie

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

23 months agoDemand: Improve comments
Ben Gamari [Thu, 20 Jul 2017 02:25:26 +0000 (22:25 -0400)] 
Demand: Improve comments

[skip-ci]

Reviewers: austin

Subscribers: rwbarton, thomie

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

23 months agoSpelling fixes
Gabor Greif [Thu, 20 Jul 2017 08:46:14 +0000 (10:46 +0200)] 
Spelling fixes

23 months agoTypeable: Ensure that promoted data family instance tycons get bindings
Ben Gamari [Wed, 19 Jul 2017 23:33:00 +0000 (19:33 -0400)] 
Typeable: Ensure that promoted data family instance tycons get bindings

This fixes #13915, where the promoted tycons belonging to data family
instances wouldn't get Typeable bindings, resulting in missing
declarations.

Test Plan: Validate with included testcases

Reviewers: austin, simonpj

Reviewed By: simonpj

Subscribers: simonpj, RyanGlScott, rwbarton, thomie

GHC Trac Issues: #13915

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

23 months agobase: Improve docs to clarify when finalizers may not be run
Andrew Martin [Thu, 13 Jul 2017 15:09:34 +0000 (11:09 -0400)] 
base: Improve docs to clarify when finalizers may not be run

23 months agotypo: -XUndeci[d]ableInstances
Chris Martin [Sun, 16 Jul 2017 00:23:50 +0000 (19:23 -0500)] 
typo: -XUndeci[d]ableInstances

23 months agoFix #13983 by creating a TyConFlavour type, and using it
Ryan Scott [Wed, 19 Jul 2017 19:07:01 +0000 (15:07 -0400)] 
Fix #13983 by creating a TyConFlavour type, and using it

An error message was referring to a type synonym as a datatype.
Annoyingly, learning that the TyCon over which the error message is
operating is actually a type synonym was previously impossible, since
that code only had access to a TcTyCon, which doesn't retain any
information about what sort of TyCon it is.

To rectify this, I created a new TyConFlavour datatype, intended to
capture roughly what sort of TyCon we're dealing with. I then performing
the necessary plumbing to ensure all TcTyCons have a TyConFlavour, and
propagated this information through to the relevant error message.

Test Plan: ./validate

Reviewers: goldfire, austin, bgamari, simonpj

Reviewed By: simonpj

Subscribers: simonpj, rwbarton, thomie

GHC Trac Issues: #13983

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

23 months agodmdAnal: Ensure that ExnStr flag isn't dropped inappropriately
Ben Gamari [Wed, 19 Jul 2017 19:07:52 +0000 (15:07 -0400)] 
dmdAnal: Ensure that ExnStr flag isn't dropped inappropriately

This fixes #13977 and consequently #13615. Here an optimization in the
demand analyser was too liberal, causing us to drop the ExnStr flag and
consequently resulting in incorrect demand signatures. This manifested
as a segmentation fault in #13615 as we incorrectly concluded that an
application of catchRetry# would bottom.

Specifically, we had

    orElse' :: STM a -> STM a -> STM a
    orElse' x = catchRetry# x y
      where y = {- some action -}

Where the catchRetry# primop places a demand of <xC(S),1*C1(U)> on its
first argument. However, due to #13977 the demand analyser would assign
a demand of <C(S),1*C1(U)> on the first argument of orElse'. Note the
missing `x`.

    case orElse' bottomingAction anotherAction of { x -> Just x }

being transformed to,

    case orElse' bottomingAction anotherAction of {}

by the simplifier. This would naturally blow up when orElse' returned at
runtime, causing the segmentation fault described in #13615.

Test Plan: Validate, perhaps add a testcase

Reviewers: austin, simonpj

Reviewed By: simonpj

Subscribers: rwbarton, thomie

GHC Trac Issues: #13977, #13615

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

23 months agoAdd Haddocks for Eq (STRef a) and Eq (IORef a)
Adam Sandberg Eriksson [Wed, 19 Jul 2017 19:07:44 +0000 (15:07 -0400)] 
Add Haddocks for Eq (STRef a) and Eq (IORef a)

Reviewers: austin, hvr, bgamari

Reviewed By: bgamari

Subscribers: RyanGlScott, rwbarton, thomie

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

23 months agoFix links to SPJ’s papers (fixes #12578)
Takenobu Tani [Wed, 19 Jul 2017 19:06:27 +0000 (15:06 -0400)] 
Fix links to SPJ’s papers (fixes #12578)

This fixes #12578.
Update links to SPJ's papers in following files:

  * compiler/coreSyn/CoreSyn.hs
  * docs/users_guide/using-optimisation.rst
  * docs/users_guide/parallel.rst
  * docs/users_guide/glasgow_exts.rst

This commit is for ghc-8.2 branch.

Test Plan: build

Reviewers: austin, bgamari

Reviewed By: bgamari

Subscribers: rwbarton, thomie

GHC Trac Issues: #12578

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

23 months agoAllow visible type application for []
Ryan Scott [Wed, 19 Jul 2017 19:06:12 +0000 (15:06 -0400)] 
Allow visible type application for []

This amounts to a one-line change in `tcExpr`. I've added a Note to
explain what is going on.

This requires a separate change in the pattern-match checker to
account for the fact that typechecked `[]` expressions become
`ConLikeOut`s, not `ExplicitList`s.

Test Plan: make test TEST=T13680

Reviewers: goldfire, mpickering, austin, bgamari

Reviewed By: mpickering, bgamari

Subscribers: rwbarton, thomie, goldfire

GHC Trac Issues: #13680

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

23 months agotestsuite: Ensure that hs_try_putmvar003 terminates
Ben Gamari [Wed, 19 Jul 2017 19:06:02 +0000 (15:06 -0400)] 
testsuite: Ensure that hs_try_putmvar003 terminates

Test Plan: Validate

Reviewers: austin, simonmar

Reviewed By: simonmar

Subscribers: simonmar, rwbarton, thomie

GHC Trac Issues: #13434

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

2 years agoconfigure: Cleanup ARM COPY bug test artifacts
Ben Gamari [Sat, 8 Jul 2017 03:16:47 +0000 (23:16 -0400)] 
configure: Cleanup ARM COPY bug test artifacts

2 years agoTypeable: Always use UTF-8 string unpacking primitive
Ben Gamari [Tue, 18 Jul 2017 21:50:07 +0000 (17:50 -0400)] 
Typeable: Always use UTF-8 string unpacking primitive

Reviewers: austin, hvr

Subscribers: Phyx, rwbarton, thomie

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

2 years agoMake module membership on ModuleGraph faster
Bartosz Nitka [Wed, 31 May 2017 17:47:03 +0000 (10:47 -0700)] 
Make module membership on ModuleGraph faster

When loading/reloading with a large number of modules
(>5000) the cost of linear lookups becomes significant.

The changes here made `:reload` go from 6s to 1s on my
test case.

The bottlenecks were `needsLinker` in `DriverPipeline` and
`getModLoop` in `GhcMake`.

Test Plan: ./validate

Reviewers: simonmar, austin, bgamari

Subscribers: thomie, rwbarton

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

2 years agoTypos in comments and explanation for unusused imports
Gabor Greif [Mon, 17 Jul 2017 13:35:59 +0000 (15:35 +0200)] 
Typos in comments and explanation for unusused imports

2 years agoFix a missing getNewNursery(), and related cleanup
Simon Marlow [Mon, 17 Jul 2017 16:32:44 +0000 (17:32 +0100)] 
Fix a missing getNewNursery(), and related cleanup

Summary:
When we use nursery chunks with +RTS -n<size>, when the current nursery
runs out we have to check whether there's another chunk available with
getNewNursery().  There was one place we weren't doing this: the ad-hoc
heap check in scheduleProcessInbox().

The impact of the bug was that we would GC too early when using nursery
chunks, especially in programs that used messages (throwTo between
capabilities could do this, also hs_try_putmvar()).

Test Plan: validate, also local testing in our application

Reviewers: bgamari, niteria, austin, erikd

Subscribers: rwbarton, thomie

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

2 years ago[skip ci] Temporarily disable split-sections on Windows.
Tamar Christina [Thu, 13 Jul 2017 20:06:49 +0000 (21:06 +0100)] 
[skip ci] Temporarily disable split-sections on Windows.

Summary:
This temporarily disabled split-sections again on Windows because
of the overhead in linking it introduces. Unfortunately because BFD
is so slow a testsuite run gets almost 2x slower. Simply linking
Hello World takes an unacceptable long time.

So for now, it'll be disabled as we look into different linkers such
as LLD.

Test Plan: ./validate

Reviewers: austin, bgamari

Subscribers: rwbarton, thomie

GHC Trac Issues: #12913

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

2 years agoFix some excessive spacing in error messages
Ryan Scott [Wed, 12 Jul 2017 23:26:37 +0000 (19:26 -0400)] 
Fix some excessive spacing in error messages

Test Plan: If it builds, ship it

Reviewers: austin, bgamari

Subscribers: rwbarton, thomie

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

2 years agotestsuite: Again update allocations of T13701
Ben Gamari [Wed, 12 Jul 2017 19:10:46 +0000 (15:10 -0400)] 
testsuite: Again update allocations of T13701

This test appears to be quite unstable.

2 years agotestsuite: Update haddock allocations
Ben Gamari [Wed, 12 Jul 2017 12:21:55 +0000 (08:21 -0400)] 
testsuite: Update haddock allocations

It seems to be the change to getNameToInstancesIndex that bumped these.

2 years ago[iserv] Fixing the word size for RemotePtr and toWordArray
Ben Gamari [Wed, 12 Jul 2017 00:50:38 +0000 (20:50 -0400)] 
[iserv] Fixing the word size for RemotePtr and toWordArray

When we load non absolute pathed .so's this usually implies that we
expect the system to have them in place already, and hence we should not
need to ship them.  Without the absolute path to the library, we are
also unable to open and send said library.  Thus we'll do library
shipping only for libraries with absolute paths.

When dealing with a host and target of different word size (say host
hast 64bit, target has 32bit), we need to fix the RemotePtr size and the
toWordArray function, as they are part of the iserv ResolvedBCO binary
protocol.  This needs to be word size independent.  The choice for
RemotePtr to 64bit was made to ensure we can store 64bit pointers when
targeting 64bit. The choice for 32bit word arrays was made wrt.
encoding/decoding on the potentially slower device.

The efficient serialization code has been graciously provided by
@bgamari.

Reviewers: bgamari, simonmar, austin, hvr

Reviewed By: bgamari

Subscribers: Ericson2314, rwbarton, thomie, ryantrinkle

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

2 years agodistrib/configure: Fail if we can't detect machine's word size
Ben Gamari [Tue, 11 Jul 2017 22:40:31 +0000 (18:40 -0400)] 
distrib/configure: Fail if we can't detect machine's word size

This is a sure sign that something is terribly wrong.

We also now verify that the word size that the binary distribution
expects matches the word size produced by the local target toolchain.

Finally we rename WordSize to TargetWordSize, since non-host/target
qualified quantities are terribly confusing.

Reviewers: austin, hvr, Phyx

Reviewed By: Phyx

Subscribers: Phyx, rwbarton, thomie, erikd

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

2 years agoFix missing escape in macro
Moritz Angermann [Wed, 12 Jul 2017 05:09:11 +0000 (01:09 -0400)] 
Fix missing escape in macro

Reviewers: angerman, austin, bgamari, erikd, simonmar

Reviewed By: angerman

Subscribers: rwbarton, thomie

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

2 years agoUse correct section types syntax for architecture
Ben Gamari [Tue, 11 Jul 2017 19:41:55 +0000 (15:41 -0400)] 
Use correct section types syntax for architecture

Previously GHC would always assume that section types began with `@` while
producing assembly, which is not true. For instance, in ARM assembly syntax
section types begin with `%`. This abstracts out section type pretty-printing
and adjusts it to correctly account for the target architectures assembly
flavor.

Reviewers: austin, hvr, Phyx

Reviewed By: Phyx

Subscribers: Phyx, rwbarton, thomie, erikd

GHC Trac Issues: #13937

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

2 years agoMention which -Werror promoted a warning to an error
Ömer Sinan Ağacan [Tue, 11 Jul 2017 19:41:20 +0000 (15:41 -0400)] 
Mention which -Werror promoted a warning to an error

Previously -Werror or -Werror=flag printed warnings as usual and then
printed
these two lines:

    <no location info>: error:
    Failing due to -Werror.

This is not ideal: first, it's not clear which flag made one of the
warnings an
error. Second, warning messages are not modified in any way, so there's
no way
to know which warnings caused this error.

With this patch we (1) promote warning messages to error messages if a
relevant
-Werror is enabled (2) mention which -Werror is used during this
promotion.

Previously:

    [1 of 1] Compiling Main             ( test.hs, test.o )

    test.hs:9:10: warning: [-Wincomplete-patterns]
        Pattern match(es) are non-exhaustive
        In a case alternative: Patterns not matched: (C2 _)
      |
    9 | sInt s = case s of
      |          ^^^^^^^^^...

    test.hs:12:14: warning: [-Wmissing-fields]
        • Fields of ‘Rec’ not initialised: f2
        • In the first argument of ‘print’, namely ‘Rec {f1 =
1}’
          In the expression: print Rec {f1 = 1}
          In an equation for ‘main’: main = print Rec {f1 = 1}
       |
    12 | main = print Rec{ f1 = 1 }
       |              ^^^^^^^^^^^^^

    <no location info>: error:
    Failing due to -Werror.

Now:

    [1 of 1] Compiling Main             ( test.hs, test.o )

    test.hs:9:10: error: [-Wincomplete-patterns,
-Werror=incomplete-patterns]
        Pattern match(es) are non-exhaustive
        In a case alternative: Patterns not matched: (C2 _)
      |
    9 | sInt s = case s of
      |          ^^^^^^^^^...

    test.hs:12:14: error: [-Wmissing-fields, -Werror=missing-fields]
        • Fields of ‘Rec’ not initialised: f2
        • In the first argument of ‘print’, namely ‘Rec {f1 =
1}’
          In the expression: print Rec {f1 = 1}
          In an equation for ‘main’: main = print Rec {f1 = 1}
       |
    12 | main = print Rec{ f1 = 1 }
       |              ^^^^^^^^^^^^^

Test Plan: - Update old tests, add new tests if there aren't any
relevant tests

Reviewers: austin, bgamari

Reviewed By: bgamari

Subscribers: rwbarton, thomie

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

2 years agoRemove redundant import; fix note
David Feuer [Tue, 11 Jul 2017 19:28:49 +0000 (15:28 -0400)] 
Remove redundant import; fix note

* Remove the redundant import of `Data.Maybe` from `GHC.Foreign`.

* Fix the note in `GHC.Stack.Types` to give a correct explanation
of the problematic cycle.

Reviewers: austin, hvr, bgamari

Reviewed By: bgamari

Subscribers: rwbarton, thomie

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

2 years agoFix minor typo
Ismail [Fri, 7 Jul 2017 16:19:33 +0000 (17:19 +0100)] 
Fix minor typo

2 years agotestsuite: Show stderr output on command failure
Ben Gamari [Tue, 11 Jul 2017 18:43:38 +0000 (14:43 -0400)] 
testsuite: Show stderr output on command failure

Reviewers: austin

Subscribers: rwbarton, thomie

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

2 years agoStgLint: Don't loop on tycons with runtime rep arguments
Ben Gamari [Tue, 11 Jul 2017 18:43:19 +0000 (14:43 -0400)] 
StgLint: Don't loop on tycons with runtime rep arguments

Test Plan: Validate

Reviewers: austin

Subscribers: rwbarton, thomie

GHC Trac Issues: #13941

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

2 years agoconfigure: Ensure that we don't set LD to unusable linker
Ben Gamari [Tue, 11 Jul 2017 18:42:04 +0000 (14:42 -0400)] 
configure: Ensure that we don't set LD to unusable linker

Previously if we found an unusable linker in PATH (e.g. ld.lld on OS X)
we would notice the -fuse-ld=... was broken, but neglected to reset LD
to a usable linker. This resulted in brokenness on OS X when lld is in
PATH.

Test Plan: Validate on OS X with lld in PATH

Reviewers: austin, hvr, angerman

Reviewed By: angerman

Subscribers: rwbarton, thomie, erikd, angerman

GHC Trac Issues: #13541

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

2 years agotestsuite: Fix T13701 allocations yet again
Ben Gamari [Tue, 11 Jul 2017 19:25:53 +0000 (15:25 -0400)] 
testsuite: Fix T13701 allocations yet again

2 years agoRemove unnecessarily returned res_ty from rejigConRes
Ryan Scott [Tue, 11 Jul 2017 18:03:13 +0000 (14:03 -0400)] 
Remove unnecessarily returned res_ty from rejigConRes

@goldfire noticed that we don't need to thread through `res_ty`
through to the return type of `rejigConRes`, as it never changes.

Reviewers: goldfire, austin, bgamari

Reviewed By: goldfire

Subscribers: rwbarton, thomie, goldfire

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

2 years agoAdd Template Haskell support for overloaded labels
Matthew Pickering [Tue, 11 Jul 2017 18:01:11 +0000 (14:01 -0400)] 
Add Template Haskell support for overloaded labels

Reviewers: RyanGlScott, austin, goldfire, bgamari

Reviewed By: RyanGlScott, goldfire, bgamari

Subscribers: rwbarton, thomie

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

2 years agoParenthesize infix type names in data declarations in TH printer
Eugene Akentyev [Tue, 11 Jul 2017 17:59:47 +0000 (13:59 -0400)] 
Parenthesize infix type names in data declarations in TH printer

Previously datatype names were not paraenthesized (#13887).

Reviewers: austin, bgamari, RyanGlScott

Reviewed By: RyanGlScott

Subscribers: RyanGlScott, rwbarton, thomie

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

2 years agoFix #13947 by checking for unbounded names more
Ryan Scott [Tue, 11 Jul 2017 17:59:29 +0000 (13:59 -0400)] 
Fix #13947 by checking for unbounded names more

Commit 2484d4dae65c81f218dcfe494b963b2630bb8fa6 accidentally dropped a
call to `isUnboundName` in an important location. This re-adds it.

Fixes #13947.

Test Plan: make test TEST=T13947

Reviewers: adamgundry, austin, bgamari

Reviewed By: adamgundry

Subscribers: rwbarton, thomie

GHC Trac Issues: #13947

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

2 years agoFix #13948 by being pickier about when to suggest DataKinds
Ryan Scott [Tue, 11 Jul 2017 17:59:07 +0000 (13:59 -0400)] 
Fix #13948 by being pickier about when to suggest DataKinds

Commit 343cb32d0983f576d344a2d04a35c3fd6eecf2c5 (#13568) made GHC a bit
too cavalier in suggesting when data constructors are in scope (and
suggesting the use of `DataKinds`). This tones down the suggestions so
that `DataKinds` is only suggested if a data constructor of that name is
actually in scope (previously, it would always suggest, even if it was
out of scope).

Fixes #13948.

Test Plan: ./validate

Reviewers: mpickering, austin, bgamari

Reviewed By: mpickering

Subscribers: rwbarton, thomie

GHC Trac Issues: #13948

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

2 years agoFix logic error in GhcMake.enableCodeGenForTH
Douglas Wilson [Tue, 11 Jul 2017 17:58:17 +0000 (13:58 -0400)] 
Fix logic error in GhcMake.enableCodeGenForTH

transitive_deps_set was incorrect, it was not considering the
dependencies of dependencies in some cases. I've corrected it and tidied
it up a little.

The test case from leftaroundabout, as linked to from the ticket, is
added with small modifications to flatten directory structure.

Test Plan: make test TEST=T13949

Reviewers: austin, bgamari, alexbiehl

Reviewed By: alexbiehl

Subscribers: rwbarton, thomie, alexbiehl

GHC Trac Issues: #13949

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