ghc.git
3 years agoTestsuite: update expected output for T8832 on 32-bit systems (#8832)
Thomas Miedema [Thu, 24 Sep 2015 10:04:33 +0000 (12:04 +0200)] 
Testsuite: update expected output for T8832 on 32-bit systems (#8832)

3 years agoFix DeriveGeneric for types with same OccName (#10487)
Ömer Sinan Ağacan [Thu, 24 Sep 2015 07:51:19 +0000 (00:51 -0700)] 
Fix DeriveGeneric for types with same OccName (#10487)

Summary:
DeriveGeneric generates some data types (for data type constructors and for
selectors of those constructors) and instances for those types. This patch
changes name generation for these new types to make it working with data types
with same names imported from different modules and with data types with same
names imported from same modules(using module imports).

Bonus content:

- Some refactoring in `TcGenGenerics.metaTyConsToDerivStuff` to remove some
  redundant partial function applications and to remove a duplicated function.
- Remove some unused names from `OccName`. (those were used for an old
  implementation of `DeriveGeneric`)

Reviewers: kosmikus, simonpj, dreixel, ezyang, bgamari, austin

Reviewed By: bgamari, austin

Subscribers: ezyang, thomie

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

GHC Trac Issues: #10487

3 years agoFix a bug with mallocForeignPtr and finalizers (#10904)
Simon Marlow [Wed, 23 Sep 2015 09:01:23 +0000 (10:01 +0100)] 
Fix a bug with mallocForeignPtr and finalizers (#10904)

Summary: See Note [MallocPtr finalizers]

Test Plan: validate; new test T10904

Reviewers: ezyang, bgamari, austin, hvr, rwbarton

Subscribers: thomie

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

3 years agoRevert "reify associated types when reifying typeclasses"
Austin Seipp [Wed, 23 Sep 2015 23:12:14 +0000 (18:12 -0500)] 
Revert "reify associated types when reifying typeclasses"

This caused the build to fail, due to some type checking errors. Whoops.

This reverts commit 5c115236fe795aa01f0c10106f1b1c959486a739.

3 years agoreify associated types when reifying typeclasses
Ömer Sinan Ağacan [Wed, 23 Sep 2015 18:19:58 +0000 (13:19 -0500)] 
reify associated types when reifying typeclasses

As reported in Trac #10891, Template Haskell's `reify` was not generating Decls
for associated types. This patch fixes that.

Note that even though `reifyTyCon` function used in this patch returns some
type instances, I'm ignoring that.

Here's an example of how associated types are encoded with this patch:

(Simplified representation)

    class C a where
      type F a :: *

    -->

    OpenTypeFamilyD "F" ["a"]

With default type instances:

    class C a where
      type F a :: *
      type F a = a

    -->

    OpenTypeFamilyD "F" ["a"]
    TySynInstD "F" (TySynEqn [VarT "a"] "a")

Reviewed By: goldfire

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

GHC Trac Issues: #10891

3 years agobase: export allocation counter/limit API from System.Mem
Simon Marlow [Wed, 23 Sep 2015 18:13:28 +0000 (13:13 -0500)] 
base: export allocation counter/limit API from System.Mem

Previously it was only available from GHC.Conc, but it makes sense for it to be
available from a more official place where people might find it.

While I was here, I improved the docs a little.

Reviewed By: austin

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

3 years agoUpdate Cabal to recognize DeriveLift
RyanGlScott [Wed, 23 Sep 2015 18:10:42 +0000 (13:10 -0500)] 
Update Cabal to recognize DeriveLift

This should (1) fix the ./validate build, which I accidentally broke in D1168,
and (2) update the Cabal submodule so that it recognizes `DeriveLift` as a GHC
extension.

Reviewed By: adamse, austin

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

GHC Trac Issues: #1830

3 years agoAdd constant-folding rule for Data.Bits.bit
Ben Gamari [Wed, 23 Sep 2015 18:10:13 +0000 (13:10 -0500)] 
Add constant-folding rule for Data.Bits.bit

This adds a constant-folding rule for `Integer`'s implementation of `bit` and
fixes the `T8832` testcase. Fixes #8832.

Reviewed By: simonpj, austin

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

GHC Trac Issues: #8832

3 years agoAnnotate CmmBranch with an optional likely target
Simon Marlow [Mon, 21 Sep 2015 08:14:33 +0000 (09:14 +0100)] 
Annotate CmmBranch with an optional likely target

Summary:
This allows the code generator to give hints to later code generation
steps about which branch is most likely to be taken.  Right now it
is only taken into account in one place: a special case in
CmmContFlowOpt that swapped branches over to maximise the chance of
fallthrough, which is now disabled when there is a likelihood setting.

Test Plan: validate

Reviewers: austin, simonpj, bgamari, ezyang, tibbe

Subscribers: thomie

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

3 years agoDsBinds: Avoid using String when desugaring CallStack construction
Ben Gamari [Tue, 22 Sep 2015 22:56:03 +0000 (00:56 +0200)] 
DsBinds: Avoid using String when desugaring CallStack construction

Previously CallStacks would be built using String, which would pull in
GHC.Base while compiling GHC.Err. Use [Char] instead.

3 years agoRemove references to () from types of mkWeak# and friends
Ben Gamari [Fri, 18 Sep 2015 15:54:22 +0000 (17:54 +0200)] 
Remove references to () from types of mkWeak# and friends

Previously the types needlessly used (), which is defined ghc-prim,
leading to unfortunate import cycles. See #10867 for details.

Updates stm submodule.

3 years agotestsuite: attempt fixing fallout from 089b72f52
Austin Seipp [Wed, 23 Sep 2015 08:35:05 +0000 (03:35 -0500)] 
testsuite: attempt fixing fallout from 089b72f52

A few tests had the same name which is a big no-no, so I reorganized them a
little. The naming is somewhat haphazard, though...

Signed-off-by: Austin Seipp <austin@well-typed.com>
3 years agoHscMain: Place CPP macro invocation on one line
Ben Gamari [Tue, 22 Sep 2015 12:14:32 +0000 (14:14 +0200)] 
HscMain: Place CPP macro invocation on one line

Clang's CPP implementation seems to barf otherwise

3 years agoDeriveLift extension (#1830)
RyanGlScott [Tue, 22 Sep 2015 02:50:55 +0000 (21:50 -0500)] 
DeriveLift extension (#1830)

Summary:
This implements -XDeriveLift, which allows for automatic derivation
of the Lift class from template-haskell. The implementation is based
off of Ian Lynagh's th-lift library
(http://hackage.haskell.org/package/th-lift).

Test Plan: ./validate

Reviewers: hvr, simonpj, bgamari, goldfire, austin

Reviewed By: goldfire, austin

Subscribers: osa1, thomie

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

GHC Trac Issues: #1830

3 years agoMake derived names deterministic
Bartosz Nitka [Tue, 22 Sep 2015 00:30:41 +0000 (19:30 -0500)] 
Make derived names deterministic

The names of auxiliary bindings end up in the interface file, and since uniques
are nondeterministic, we end up with nondeterministic interface files.

This uses the package and module name in the generated name, so I believe it
should avoid problems from #7947 and be deterministic as well.

The generated names look like this now:

  `$cLrlbmVwI3gpI8G2E6Hg3mO`

and with `-ppr-debug`:

  `$c$aeson_70dylHtv1FFGeai1IoxcQr$Data.Aeson.Types.Internal$String`.

Reviewed By: simonmar, austin, ezyang

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

GHC Trac Issues: #4012

3 years agobase: use Show for ErrorCall in uncaughtExceptionHandler
Eric Seidel [Tue, 22 Sep 2015 00:18:56 +0000 (19:18 -0500)] 
base: use Show for ErrorCall in uncaughtExceptionHandler

The default top-level exception handler now uses the `Show` instance for
`ErrorCall` when printing exceptions, so it will actually print the out-of-band
data (e.g. `CallStack`s) in compiled binaries, instead of just printing the
error message.

This also updates the hpc submodule to fix the test output.

Reviewed By: austin, thomie

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

3 years agoRemove (now bogus) assert.
Edward Z. Yang [Mon, 21 Sep 2015 22:46:09 +0000 (15:46 -0700)] 
Remove (now bogus) assert.

Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
3 years agoTcDeriv: Use a NameEnv instead of association list
Ben Gamari [Mon, 21 Sep 2015 21:52:23 +0000 (16:52 -0500)] 
TcDeriv: Use a NameEnv instead of association list

It's unlikely that these lists would have become very large but
nevertheless this is an easy and worthwhile change.

Reviewed By: austin

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

3 years agoRemove graphFromVerticesAndAdjacency
Bartosz Nitka [Mon, 21 Sep 2015 21:52:10 +0000 (16:52 -0500)] 
Remove graphFromVerticesAndAdjacency

It's not used anywhere.

Reviewed By: austin

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

3 years agoFix build failure, I think.
Edward Z. Yang [Mon, 21 Sep 2015 20:20:07 +0000 (13:20 -0700)] 
Fix build failure, I think.

Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
3 years agoUnify hsig and hs-boot; add preliminary "hs-boot" merging.
Edward Z. Yang [Fri, 24 Jul 2015 22:13:49 +0000 (15:13 -0700)] 
Unify hsig and hs-boot; add preliminary "hs-boot" merging.

This patch drops the file level distinction between hs-boot and hsig;
we figure out which one we are compiling based on whether or not there
is a corresponding hs file lying around.

To make the "import A" syntax continue to work for bare hs-boot
files, we also introduce hs-boot merging, which takes an A.hi-boot
and converts it to an A.hi when there is no A.hs file in scope.
This will be generalized in Backpack to merge multiple A.hi files together;
which means we can jettison the "load multiple interface files" functionality.

This works automatically for --make, but for one-shot compilation
we need a new mode: ghc --merge-requirements A will generate an A.hi/A.o
from a local A.hi-boot file; Backpack will extend this mechanism further.

Has Haddock submodule update to deal with change in msHsFilePath behavior.

    - This commit drops support for the hsig extension. Can
      we support it?  It's annoying because the finder code is
      written with the assumption that where there's an hs-boot
      file, there's always an hs file too.  To support hsig, you'd
      have to probe two locations.  Easier to just not support it.

    - #10333 affects us, modifying an hs-boot still doesn't trigger
      recomp.

    - See compiler/main/Finder.hs: this diff is very skeevy, but
      it seems to work.

    - This code cunningly doesn't drop hs-boot files from the
      "drop hs-boot files" module graph, if they don't have a
      corresponding hs file.  I have no idea if this actually is useful.

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

Reviewers: simonpj, austin, bgamari, spinda

Subscribers: thomie

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

3 years agoRevert "Revert "Revert "Change loadSrcInterface to return a list of ModIface"""
Edward Z. Yang [Sat, 12 Sep 2015 00:15:52 +0000 (17:15 -0700)] 
Revert "Revert "Revert "Change loadSrcInterface to return a list of ModIface"""

This reverts commit 0c6c015d42c2bd0ee008f790c7c0cb4c5b78ca6b.

3 years agoRevert "Revert "Revert "Support for multiple signature files in scope."""
Edward Z. Yang [Sat, 12 Sep 2015 00:13:30 +0000 (17:13 -0700)] 
Revert "Revert "Revert "Support for multiple signature files in scope."""

This reverts commit 214596de224afa576a9c295bcf53c6941d6892e0.

3 years ago`_ <- mapM` --> `mapM_`
Richard Eisenberg [Mon, 21 Sep 2015 16:25:37 +0000 (12:25 -0400)] 
`_ <- mapM` --> `mapM_`

Thanks for the suggestion, Austin. Just missed that while making
a bunch of similar changes.

3 years agoRefactor BranchLists.
Richard Eisenberg [Sun, 20 Sep 2015 03:59:22 +0000 (23:59 -0400)] 
Refactor BranchLists.

Now we use Array to store branches. This makes sense because we often
have to do random access (once inference is done). This also vastly
simplifies the awkward BranchList type.

This fixes #10837 and updates submodule utils/haddock.

3 years agoRun simplifier only when the env is clean.
Richard Eisenberg [Sun, 20 Sep 2015 20:15:13 +0000 (16:15 -0400)] 
Run simplifier only when the env is clean.

This fixes #10896. In the indexed-types/should_fail/BadSock test,
there is a bad type definition. This gets type-checked, an error
gets reported, but then **GHC keeps going**. Later, when
running the simplifier to do an ambiguity check, the bad type
environment causes GHC to fall over. My solution: only run the
simplifier in a clean, error-free type environment.

A downside of this is that fewer error messages are reported.
This makes me a bit sad, but I'm not sure how to avoid the problem.
Suggestions welcome.

3 years agoPerform a validity check on assoc type defaults.
Richard Eisenberg [Sat, 19 Sep 2015 18:32:44 +0000 (14:32 -0400)] 
Perform a validity check on assoc type defaults.

This fixes #10817 and #10899. A knock-on effect is that we must
now remember locations of associated type defaults for error
messages during validity checking. This isn't too bad, but it
increases the size of the diff somewhat.

Test cases: indexed-types/should_fail/T108{17,99}

3 years agoSlightly better `Coercible` errors.
Richard Eisenberg [Sun, 20 Sep 2015 21:39:17 +0000 (17:39 -0400)] 
Slightly better `Coercible` errors.

This makes two real changes:
 - Equalities like (a ~R [a]) really *are* insoluble. Previously,
   GHC refused to give up when an occurs check bit on a representational
   equality. But for datatypes, it really should bail.

 - Now, GHC will sometimes report an occurs check error (in cases above)
   for representational equalities. Previously, it never did.

This "fixes" #10715, where by "fix", I mean clarifies the error message.
It's unclear how to do more to fix that ticket.

Test cases: typecheck/should_fail/T10715{,b}

3 years agoFix typo in test for #10347.
Richard Eisenberg [Mon, 21 Sep 2015 13:40:02 +0000 (09:40 -0400)] 
Fix typo in test for #10347.

Thanks to Gabor Greif for spotting the mistake.

3 years agoSmall improvement in pretty-printing constructors.
Richard Eisenberg [Sun, 20 Sep 2015 20:03:07 +0000 (16:03 -0400)] 
Small improvement in pretty-printing constructors.

This fixes #10810 by cleaning up pretty-printing of constructor
declarations. This change also removes a (in my opinion) deeply
bogus orphan instance OutputableBndr [Located name], making
HsDecls now a non-orphan module. Yay all around.

Test case: th/T10810

3 years agoRe-polish error messages around injective TFs.
Richard Eisenberg [Sun, 20 Sep 2015 19:28:55 +0000 (15:28 -0400)] 
Re-polish error messages around injective TFs.

The previous message was wrong, as pointed out by Jan Stolarek.

3 years agoClarify parsing infelicity.
Richard Eisenberg [Sat, 19 Sep 2015 20:44:29 +0000 (16:44 -0400)] 
Clarify parsing infelicity.

This fixes #10855.

3 years agoAllow TH quoting of assoc type defaults.
Richard Eisenberg [Sat, 19 Sep 2015 19:43:15 +0000 (15:43 -0400)] 
Allow TH quoting of assoc type defaults.

This fixes #10811.

3 years agoPrint associated types a bit better.
Richard Eisenberg [Sat, 19 Sep 2015 19:18:40 +0000 (15:18 -0400)] 
Print associated types a bit better.

This is part of #10811. It removes the "family" keyword from
associated type family declarations, and it adds the "type"
keyword to associated type family defaults.

3 years agoTest #10770
Richard Eisenberg [Sat, 19 Sep 2015 19:04:49 +0000 (15:04 -0400)] 
Test #10770

3 years agoUpdate user guide, fixing #10772
Richard Eisenberg [Sat, 19 Sep 2015 18:45:28 +0000 (14:45 -0400)] 
Update user guide, fixing #10772

3 years agoTest #10347
Richard Eisenberg [Sat, 19 Sep 2015 18:37:54 +0000 (14:37 -0400)] 
Test #10347

3 years agoDriver: --make -o without Main should be an error (#10895)
Thomas Miedema [Sat, 19 Sep 2015 14:14:47 +0000 (16:14 +0200)] 
Driver: --make -o without Main should be an error (#10895)

Reviewed by: austin

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

3 years agoPut stable pointer names in the name cache.
Edward Z. Yang [Sun, 20 Sep 2015 10:19:17 +0000 (12:19 +0200)] 
Put stable pointer names in the name cache.

Test Plan: validate

Reviewers: simonpj, austin, bgamari

Reviewed By: austin, bgamari

Subscribers: thomie

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

3 years agoReplace [PostTc id Type] with PostTc id [Type]
Matthew Pickering [Sun, 20 Sep 2015 10:18:21 +0000 (12:18 +0200)] 
Replace [PostTc id Type] with PostTc id [Type]

This gives a clearer indication as to what gets filled in
when. It was suggested by Richard on D1152.

Test Plan: ./validate

Reviewers: austin, goldfire, bgamari

Reviewed By: goldfire, bgamari

Subscribers: thomie

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

3 years agoAlways run explicitly requested ways (extra_ways) for fast runs.
Edward Z. Yang [Sun, 20 Sep 2015 10:16:50 +0000 (12:16 +0200)] 
Always run explicitly requested ways (extra_ways) for fast runs.

To keep validates fast, we only one run one way.  But I think that
it's important for some tests to run them a few ways, just to
make sure functionality, e.g. the profiler, is working.  This commit
changes the logic so that any way specified in extra_ways is always
run for fast.  The big changes is now profiling tests are run on
validate.

I also made it so the G1 garbage collector tests only run on slow.

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

Reviewers: austin, thomie, bgamari

Reviewed By: austin, thomie, bgamari

Subscribers: thomie

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

3 years agoPolish some error messages.
Richard Eisenberg [Sat, 19 Sep 2015 13:56:03 +0000 (09:56 -0400)] 
Polish some error messages.

3 years agoFix #10815 by kind-checking type patterns against known kinds.
Richard Eisenberg [Mon, 31 Aug 2015 17:46:01 +0000 (10:46 -0700)] 
Fix #10815 by kind-checking type patterns against known kinds.

tcFamTyPats now must take information about the instantiation of any
class variables, when checking the instance of an associated type.

Getting this to work out required some unexpected refactoring in
TcDeriv. TcDeriv needs to look at class instances because of the
possibility of associated datatypes with `deriving` specs. TcDeriv
worked over the user-specified instances. But any data family instances
were already processed, and TcDeriv had no way of finding the rep
tycons. Indeed, TcDeriv *re-type-checked* any data family instances
in an attempt to rediscover what GHC already knew. So, this commit
introduces better tracking of compiled data families between TcInstDcls
and TcDeriv to streamline all of this.

3 years agoPass TEST_HC_OPTS in bug1465 and T5792.
Edward Z. Yang [Fri, 18 Sep 2015 02:52:01 +0000 (19:52 -0700)] 
Pass TEST_HC_OPTS in bug1465 and T5792.

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

Reviewers: austin, bgamari

Subscribers: thomie

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

3 years agoDocs: make sure all libs are included in index.html (#10879)
Thomas Miedema [Tue, 15 Sep 2015 19:37:38 +0000 (21:37 +0200)] 
Docs: make sure all libs are included in index.html (#10879)

During the build, when HADDOCK_DOCS=YES, the command 'cd libraries && sh
gen_contents_index --intree' is run, which calls haddock to generate the
haddock index at 'libraries/dist-haddock/index.html'.

What it did before was check the ./packages file for all libraries. The
problem is that 'base' and 'ghc-prim' were folded into the main repo
some time ago, hence don't have an entry in the ./packages file anymore.
As a result, 'base' and 'ghc-prim' were missing from the index.html
file.

It now simply runs haddock on all the all the `.haddock` files in the
libraries directory.

The only risk is that this could include the extra libraries in the
index.html, if you ever built them in the past (with
BUILD_EXTRA_PKGS=YES), even though now you want to exclude them (with
BUILD_EXTRA_PKGS=NO). gen_contents_index doesn't have access to build
system variables though (PACKAGES_STAGE1+PACKAGES_STAGE2), so fixing
this would be a little bit fiddly.

Test Plan:
'make libraries/dist-haddock/index.html && grep -q base
libraries/dist-haddock/index.html && echo ok'

Reviewed by: austin

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

3 years agoAdd namePackage function to template-haskell
RyanGlScott [Thu, 17 Sep 2015 21:15:26 +0000 (23:15 +0200)] 
Add namePackage function to template-haskell

Currently there exists a nameBase function (for retrieving a Name's OccName)
and a nameModule function (for retrieving a Name's ModName), but there is no
counterpart for PkgNames.

This would be useful for implementing Template Haskell features which need
to have easy access to a Name's package (e.g., automatically derived Lift
instances).

Reviewed By: goldfire, austin, thomie

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

3 years agoApplicativeDo transformation
Simon Marlow [Fri, 13 Mar 2015 16:39:58 +0000 (16:39 +0000)] 
ApplicativeDo transformation

Summary:
This is an implementation of the ApplicativeDo proposal.  See the Note
[ApplicativeDo] in RnExpr for details on the current implementation,
and the wiki page https://ghc.haskell.org/trac/ghc/wiki/ApplicativeDo
for design notes.

Test Plan: validate

Reviewers: simonpj, goldfire, austin

Subscribers: thomie

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

3 years agoShow minimal complete definitions in ghci (#10847)
Moritz Kiefer [Thu, 17 Sep 2015 14:02:06 +0000 (16:02 +0200)] 
Show minimal complete definitions in ghci (#10847)

Show the minimal complete definition on :info in ghci. They
are shown like MINIMAL pragmas in code. If the minimal complete
definition is empty or only a specific method from a class is
requested, nothing is shown.

Reviewed By: simonpj, austin, thomie

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

3 years agoTestsuite: add test for #10781
Thomas Miedema [Thu, 17 Sep 2015 01:25:11 +0000 (03:25 +0200)] 
Testsuite: add test for #10781

3 years agoDynFlags: remove unused sPgm_sysman (#8689)
Thomas Miedema [Wed, 16 Sep 2015 09:01:37 +0000 (11:01 +0200)] 
DynFlags: remove unused sPgm_sysman (#8689)

Something about a long deleted 'system manager' for the 'parallel
system'.

Also remove confusing comment in SysTools, that supposedly referred to
sPgm_sysman. See commit 16d5d1c75c999677783c9c1bda519540fa9a6e58.

3 years agoFix `hp2ps -i-`
Thomas Miedema [Tue, 15 Sep 2015 21:20:10 +0000 (23:20 +0200)] 
Fix `hp2ps -i-`

From the help text:
  -i[+|-] sort by identifier string (-i+ gives greatest on top)

Found by David Binderman.

3 years agoPretty: fix unicode arrow operators.
Sebastian Reuße [Tue, 15 Sep 2015 12:20:01 +0000 (14:20 +0200)] 
Pretty: fix unicode arrow operators.

As per issue #10509, the documentation gave the wrong glyphs for Unicode
alternatives to the -< and >- arrow operators (the codepoints were
correct, but the glyphs were not). The incorrect glyphs have also
made it into the error output. This replaces those characters with the
correct versions.

GHC Trac Issues: #10883

3 years agoAccount for stack allocation in the thread's allocation counter
Simon Marlow [Mon, 14 Sep 2015 12:37:38 +0000 (13:37 +0100)] 
Account for stack allocation in the thread's allocation counter

Summary: (see comment for details)

Test Plan: validate

Reviewers: bgamari, ezyang, austin

Subscribers: thomie

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

3 years agoTestsuite: mark T6037 expect_fail on Windows (#6037)
Thomas Miedema [Sat, 12 Sep 2015 21:34:12 +0000 (23:34 +0200)] 
Testsuite: mark T6037 expect_fail on Windows (#6037)

3 years agohpc: use `takeDirectory` instead of `dropWhileEnd (/= '/')`
Thomas Miedema [Sat, 12 Sep 2015 20:41:35 +0000 (22:41 +0200)] 
hpc: use `takeDirectory` instead of `dropWhileEnd (/= '/')`

This fixes some hpc tests on Windows. Update submodule hpc.

3 years agoCodeGen: fix typo in error message
Thomas Miedema [Sat, 12 Sep 2015 18:37:20 +0000 (20:37 +0200)] 
CodeGen: fix typo in error message

3 years agoTestsuite: mark enum01-enum03 expect_broken(#9399) on Windows
Thomas Miedema [Sat, 12 Sep 2015 17:34:16 +0000 (19:34 +0200)] 
Testsuite: mark enum01-enum03 expect_broken(#9399) on Windows

3 years agoTestsuite: normalise slashes in callstack output
Thomas Miedema [Sat, 12 Sep 2015 13:23:12 +0000 (15:23 +0200)] 
Testsuite: normalise slashes in callstack output

This fixes some tests on Windows, for example T2120.

3 years agos/StgArrWords/StgArrBytes/
Siddhanathan Shanmugam [Fri, 11 Sep 2015 21:10:41 +0000 (16:10 -0500)] 
s/StgArrWords/StgArrBytes/

Rename StgArrWords to StgArrBytes (see Trac #8552)

Reviewed By: austin

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

GHC Trac Issues: #8552

3 years agoCode movement
Jan Stolarek [Fri, 11 Sep 2015 22:07:17 +0000 (00:07 +0200)] 
Code movement

3 years agoDead code removal, export cleanup
Jan Stolarek [Fri, 11 Sep 2015 21:55:52 +0000 (23:55 +0200)] 
Dead code removal, export cleanup

3 years agoRemove redundant language extensions
Jan Stolarek [Fri, 11 Sep 2015 21:44:42 +0000 (23:44 +0200)] 
Remove redundant language extensions

3 years agoAdd assertions
Jan Stolarek [Fri, 11 Sep 2015 20:29:02 +0000 (22:29 +0200)] 
Add assertions

3 years agoTestsuite cleanup
Jan Stolarek [Fri, 11 Sep 2015 20:02:35 +0000 (22:02 +0200)] 
Testsuite cleanup

As a result of fixing #10836 it is now possible to merge 11 different
tests for #6018 into one

3 years agoImprove documentation of comprehensions
Simon Peyton Jones [Fri, 11 Sep 2015 16:02:58 +0000 (17:02 +0100)] 
Improve documentation of comprehensions

Suggestion from Jeremy Gibbons

3 years agoFix broken links in documentation
Simon Peyton Jones [Fri, 11 Sep 2015 16:01:33 +0000 (17:01 +0100)] 
Fix broken links in documentation

3 years agoImprove documentation for transform list-comps
Simon Peyton Jones [Fri, 11 Sep 2015 15:23:35 +0000 (16:23 +0100)] 
Improve documentation for transform list-comps

Thanks to Jeremy Gibbons for spotting the infelictity

3 years agoA CFunEqCan can be Derived
Simon Peyton Jones [Fri, 11 Sep 2015 15:23:06 +0000 (16:23 +0100)] 
A CFunEqCan can be Derived

This fixes the ASSERTION failures in
  indexed-types/should_fail/T5439
  typecheck/should_fail/T5490
when GHC is compiled with -DDEBUG

See Phab:D202 attached to Trac #6018

3 years agoAdd a test for Trac #10806
Simon Peyton Jones [Fri, 11 Sep 2015 14:55:29 +0000 (15:55 +0100)] 
Add a test for Trac #10806

3 years agoImprove rejigConRes (again)
Simon Peyton Jones [Fri, 11 Sep 2015 14:54:39 +0000 (15:54 +0100)] 
Improve rejigConRes (again)

I think this patch finally works around the delicacy in the strictness
of TcTyClsDecls.rejigConRes.   See the notes with that function and
Note [Checking GADT return types].

As a result, we fix Trac #10836, and improve Trac #7175

3 years agoComments on oneShot
Simon Peyton Jones [Thu, 27 Aug 2015 15:23:46 +0000 (16:23 +0100)] 
Comments on oneShot

3 years agoDon't check in autogenerated hs files for recomp013.
Edward Z. Yang [Thu, 10 Sep 2015 05:02:48 +0000 (22:02 -0700)] 
Don't check in autogenerated hs files for recomp013.

Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
3 years agoTestsuite: comment out `setnumcapabilities001` (#10860)
Thomas Miedema [Wed, 9 Sep 2015 11:56:53 +0000 (13:56 +0200)] 
Testsuite: comment out `setnumcapabilities001` (#10860)

Don't mark it expect_broken, because it fails only sometimes.

3 years agoForbid annotations when Safe Haskell safe mode is enabled.
David Kraeutmann [Tue, 8 Sep 2015 16:35:33 +0000 (11:35 -0500)] 
Forbid annotations when Safe Haskell safe mode is enabled.

For now, this fails compliation immediately with an error. If desired, this
can be a warning that annotations in Safe Haskell are ignored.

Signed-off-by: David Kraeutmann <kane@kane.cx>
Reviewed By: goldfire, austin

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

GHC Trac Issues: #10826

3 years agoHeapStackCheck: Small refactoring
Ben Gamari [Tue, 8 Sep 2015 16:30:43 +0000 (11:30 -0500)] 
HeapStackCheck: Small refactoring

Use modern Cmm argument syntax in stg_block_blackhole definition.

Reviewed By: simonmar, austin

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

3 years agoBuild system: check for inconsistent settings (#10157)
Thomas Miedema [Tue, 8 Sep 2015 11:51:44 +0000 (13:51 +0200)] 
Build system: check for inconsistent settings (#10157)

`configure` currently detects when the docbook and hscolour tools aren't
available, and instead of failing outright (as it does for missing alex
and happy), sets some variables in mk/config.mk to tell `make` not to
build the documentation.

Sometimes, however, you want to really make sure all documentation gets
built, fully colourized. For example when making a release. To do so,
you can override the mentioned variables from mk/config.mk in
mk/build.mk (e.g. set HSCOLOUR_SRCS=YES).

This patch adds some error checking to make sure that doing so will not
result in weird build failures when those tools are still missing.

Test Plan: ran `make` a couple of times, with different mk/config.mk settings.

Reviewed by: austin

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

3 years agoMove GeneralCategory et al to GHC.Unicode
Ben Gamari [Tue, 8 Sep 2015 13:38:40 +0000 (08:38 -0500)] 
Move GeneralCategory et al to GHC.Unicode

This allows these to be used from Text.Read.Lex import cycles.

Reviewed By: thomie, austin

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

GHC Trac Issues: #10444

3 years agoBuild system: cleanup BUILD_DIRS + add lots of Notes
Thomas Miedema [Fri, 10 Jul 2015 22:50:58 +0000 (00:50 +0200)] 
Build system: cleanup BUILD_DIRS + add lots of Notes

Summary:
See Note [CrossCompiling vs Stage1Only] in mk/config.mk.in.
See Note [Stage1Only vs stage=1] in mk/config.mk.in.
See Note [No stage2 packages when CrossCompiling or Stage1Only].

Also:
  * use stage2 to build mkUserGuidePart, as was probably intended.
    Now the following represent the same set of packages:
    - packages that we build with ghc-stage2
    - packages that depend on the ghc library
    Those packages are: haddock, mkUserGuidePart and ghctags.
  * don't let utils that don't depend on the ghc library depend on its
    package-data.mk file. Instead, let those utils directly depend on
    the package-data.mk files of the stage1 packages. Not sure if it
    improves anything, but I found it easier to explain what's going on
    this way.

(partially) reviewed by: austin

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

3 years agoBuild system: make *-cross BuildFlavours consistent (#10223)
Thomas Miedema [Tue, 25 Aug 2015 17:20:39 +0000 (19:20 +0200)] 
Build system: make *-cross BuildFlavours consistent (#10223)

This is a follow up to 841924c9587c10488a18e307b573720977bf4f13,
where `-fllvm` was explicitly removed from GhcStage1HcOpts for
perf-cross.

After removing -fllvm from GhcStage1HcOpts, it should be removed from
SRC_HC_OPTS as well, because SRC_HC_OPTS are added to every Haskell
compilation. That's what this patch does.

BuildFlavour bench-cross (added in ddf79ebf69fe4a6e69d69d451a6040a53b1ea12c),
is probably never used. But for consistency, also use -fllvm here, for
building stage2 and the libraries.

Reviewed by: austin

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

3 years agoBuild system: delete the InstallExtraPackages variable
Thomas Miedema [Tue, 25 Aug 2015 15:30:18 +0000 (17:30 +0200)] 
Build system: delete the InstallExtraPackages variable

Just install all packages that are built. Don't make an exception for
the dph and extra packages.

You can control whether the dph and extra packages should be build using
the variables BUILD_DPH and BUILD_EXTRA_PKGS. These variables didn't
exist before. But now that they do, InstallExtraPackages isn't really
needed anymore.

Reviewed by: austin

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

3 years agoBuild system: remove hack for Mac OSX in configure.ac (#10476)
Thomas Miedema [Mon, 7 Sep 2015 13:58:33 +0000 (15:58 +0200)] 
Build system: remove hack for Mac OSX in configure.ac (#10476)

Cross-compilation on Mac OSX currently doesn't work. While building
stage 1, the build system uses the `ar` for the target architecture
instead of the `ar` for build/host architecture.

The cause is a hack added in 24746fe78024a1edab843bc710c79c55998ab134
(2010), to supporting bootstrap compilers built with older versions of
Xcode. Xcode 4.3 started installing command line tools in a different
location. Assuming this all behind us now, and the paths didn't change
again (you never now), we can delete the hack.

Deleting the hack fixes the cross compilation issue. Tested by Trac user
jakzale.

Reviewed by: austin

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

3 years agoBuild system: detect when user cloned from GitHub
Thomas Miedema [Mon, 7 Sep 2015 13:28:30 +0000 (15:28 +0200)] 
Build system: detect when user cloned from GitHub

Cloning the ghc repository from GitHub doesn't work out of the box. It
requires installing some special url rewrites into ~/.gitconfig. The
build fails mysteriously if you forget. This patch tries to detect when
you cloned from GitHub, and warns you if you didn't set those url
rewrites.

This hopefully lowers to barrier to contribute to GHC by a tiny bit. At
least one /r/haskell user ran into this recently.

Test Plan:
cloned from github, ran ./boot, saw the message. Installed url
rewrites, and ran ./boot again, didn't see the message.

Reviewed by: austin

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

3 years agoFurther simplify the story around minimum/maximum
Joachim Breitner [Mon, 7 Sep 2015 11:48:10 +0000 (13:48 +0200)] 
Further simplify the story around minimum/maximum

After I have found out that I should look at -ddump-prep and not
-ddump-core, I noticed that these days, GHC is perfectly capeable of
turning (the equivalent) of foldl to (the equivalent) of foldl' if the
operation in question is strict. So instead of using rewrite rules to
rewrite maximum to a strictMaximum for certain types, we simply use
SPECIALIZE.

This also marks maximum/minimum as INLINEABLE, so that client code can
get similar specializations, hopefully even automatically. And inded,
minimum applied to [Double] produces good code (although due to
inlineing, not due to specialization, it seems).

I checked (by looking at the core) that this still fixes #10788.

Differential revision: https://phabricator.haskell.org/D1229

3 years agoSPECIALIZE strictMinimum for Int and Integer
Joachim Breitner [Mon, 7 Sep 2015 11:19:50 +0000 (13:19 +0200)] 
SPECIALIZE strictMinimum for Int and Integer

This fixes a regression reported in #10788, where due to less inlining
compared to earlier versions, we’d get worse code. With the SPECIALIZE,
we get the good code, and moreover, the good code is in List.hs and
_not_ inlined to the use site, so smaller code size and less compilation
time.

3 years agoBuild system: cleanup utils/ghc-pkg/ghc.mk
Thomas Miedema [Thu, 9 Jul 2015 23:02:31 +0000 (01:02 +0200)] 
Build system: cleanup utils/ghc-pkg/ghc.mk

There used to be a lot of custom make code to build ghc-pkg with the
stage0 compiler. Commit ac5a314504554ddef0e855ef9e2fcf51e961f4a6
thankfully cleaned this up, by using the build settings from the
ghc-pkg.cabal file.

This commit removes some remains of the old way of installing ghc-pkg
when Stage1Only=YES. Notably, we called both `build-prog` as
`shell-wrapper`. This is surely wrong, because `build-prog` already
calls `shell-wrapper`. It isn't needed to set WANT_INSTALLED_WRAPPER
either; build-prog does that for us.

This prevents the following warnings when Stage1Only=YES:
  utils/ghc-pkg/ghc.mk:46: warning:
    overriding commands for target `install_utils/ghc-pkg_dist_wrapper'
  utils/ghc-pkg/ghc.mk:37: warning:
    ignoring old commands for target `install_utils/ghc-pkg_dist_wrapper'

Also add more comments and restructure a bit.

Reviewed by: austin

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

3 years agoBuild system: simplify *-llvm BuildFlavours (#10223)
Thomas Miedema [Tue, 25 Aug 2015 15:49:32 +0000 (17:49 +0200)] 
Build system: simplify *-llvm BuildFlavours (#10223)

Note that SRC_HC_OPTS are added to every Haskell compilation. So
there isn't any need to also add `-fllvm` to GhcStage1HcOpts,
GhcStage2HcOpts and GhcLibHcOpts.

Small bug fix: make sure we test for -fllvm in SRC_HC_OPTS, to check
whether the bootstrap compiler is affected by bug #9439.

Reviewed by: austin

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

3 years agoBuild system: put each BuildFlavour in a separate file (#10223)
Thomas Miedema [Mon, 31 Aug 2015 12:39:47 +0000 (14:39 +0200)] 
Build system: put each BuildFlavour in a separate file (#10223)

This allows easier diffing of different BuildFlavours, including
`mk/flavours/validate.mk`.

Reviewed By: bgamari, austin

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

3 years agotracing: Kill EVENT_STARTUP
Ben Gamari [Mon, 31 Aug 2015 20:39:13 +0000 (22:39 +0200)] 
tracing: Kill EVENT_STARTUP

This has been unnecessary for quite some time due to the create/delete
capability events.

3 years agoEventLog: Factor out ensureRoomFor*Event
Ben Gamari [Mon, 31 Aug 2015 20:00:10 +0000 (22:00 +0200)] 
EventLog: Factor out ensureRoomFor*Event

3 years agouser-guide: Add missing <para> tags around <listitem> body
Ben Gamari [Fri, 4 Sep 2015 16:49:23 +0000 (18:49 +0200)] 
user-guide: Add missing <para> tags around <listitem> body

Otherwise this is ill-formed DocBook

3 years agoghc-pkg: don't print ignored errors when verbosity=0
Thomas Miedema [Fri, 4 Sep 2015 14:59:44 +0000 (16:59 +0200)] 
ghc-pkg: don't print ignored errors when verbosity=0

Lines like the following are filling up the build logs:

  binary-0.7.5.0: cannot find any of
  ["Data/Binary.hi","Data/Binary.p_hi","Data/Binary.dyn_hi"] (ignoring)

3 years agoBuild system: implement `make install-strip` (#1851)
Thomas Miedema [Sat, 15 Aug 2015 15:45:57 +0000 (17:45 +0200)] 
Build system: implement `make install-strip` (#1851)

Reviewed by: bgamari

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

3 years agoFix T6018th test failure
Jan Stolarek [Fri, 4 Sep 2015 03:15:06 +0000 (05:15 +0200)] 
Fix T6018th test failure

3 years agoMake Data.List.foldr1 inline
Joachim Breitner [Wed, 2 Sep 2015 22:58:38 +0000 (15:58 -0700)] 
Make Data.List.foldr1 inline

Previously, foldr1 would be defiend recursively and thus not inline.
This is bad, for example, when maximumBy has a strict comparison
function: Before the BBP, it was implemented via foldl1, which inlined
and yielded good code. With BBP, it goes via foldr1, so we better inline
this as well. Fixes #10830.

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

3 years agoTestsuite: ignore line number differences in call stacks (#10834)
Thomas Miedema [Thu, 3 Sep 2015 12:56:50 +0000 (14:56 +0200)] 
Testsuite: ignore line number differences in call stacks (#10834)

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

3 years agoTestsuite: only print msg when timeout kills process unexpectedly
Thomas Miedema [Thu, 3 Sep 2015 14:13:42 +0000 (16:13 +0200)] 
Testsuite: only print msg when timeout kills process unexpectedly

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

3 years agoTestsuite: fix tcfail220 - Maybe is wired-in now
Thomas Miedema [Thu, 3 Sep 2015 15:01:10 +0000 (17:01 +0200)] 
Testsuite: fix tcfail220 - Maybe is wired-in now

This fixes validate.

374457809de343f409fbeea0a885877947a133a2 (D202) mentions: "This patch
also wires-in Maybe data type".

A conflicting definition of a wired-in type in a .hsig file doesn't seem
to cause compilation to fail. This is probably a bug, but a small one.
Since SPJ in ffc21506894c7887d3620423aaf86bc6113a1071 swept this under
the rug, by removing `data Bool a b c d = False` from tcfail220.hsig,
I'm going to do the same here.

D1098 touches these files, so ezyang can decide whether this problem
warrants fixing when doing a rebase.

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

3 years agoAccept underscores in the module parser. (Thanks spinda for the fix.)
Edward Z. Yang [Thu, 3 Sep 2015 21:16:03 +0000 (14:16 -0700)] 
Accept underscores in the module parser. (Thanks spinda for the fix.)

Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
3 years agoAdd test for T10836 (expected broken)
Jan Stolarek [Thu, 3 Sep 2015 17:28:44 +0000 (19:28 +0200)] 
Add test for T10836 (expected broken)

3 years agoInjective type families
Jan Stolarek [Fri, 11 Jul 2014 11:54:45 +0000 (13:54 +0200)] 
Injective type families

For details see #6018, Phab:D202 and the wiki page:

https://ghc.haskell.org/trac/ghc/wiki/InjectiveTypeFamilies

This patch also wires-in Maybe data type and updates haddock submodule.

Test Plan: ./validate

Reviewers: simonpj, goldfire, austin, bgamari

Subscribers: mpickering, bgamari, alanz, thomie, goldfire, simonmar,
             carter

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

GHC Trac Issues: #6018