ghc.git
21 months agoSwitch VEH to VCH and allow disabling of SEH completely.
Tamar Christina [Tue, 26 Sep 2017 18:34:58 +0000 (14:34 -0400)] 
Switch VEH to VCH and allow disabling of SEH completely.

Exception handling on Windows is unfortunately a bit complicated.
But essentially the VEH Handlers we currently have are running too
early.

This was a problem as it ran so early it also swallowed C++ exceptions
and other software exceptions which the system could have very well
recovered from.

So instead we use a sequence of chains to for the exception handlers to
run as late as possible. You really can't get any later than this.

Please read the comment in the patch for more details.

I'm also providing a switch to allow people to turn off the exception
handling entirely. In case it does present a problem with their code.

(Reverted and recommitted to fix authorship information)

Test Plan: ./validate

Reviewers: austin, hvr, bgamari, erikd, simonmar

Reviewed By: bgamari

Subscribers: rwbarton, thomie

GHC Trac Issues: #13911, #12110

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

21 months agoRevert "Switch VEH to VCH and allow disabling of SEH completely."
Ben Gamari [Tue, 26 Sep 2017 19:43:47 +0000 (15:43 -0400)] 
Revert "Switch VEH to VCH and allow disabling of SEH completely."

Reverting to fix authorship of commit.

This reverts commit 1825cbdbdf08ed4bd6fd6794852596078953298a.

21 months agorts: Throw proper HeapOverflow exception on allocating large array
Ben Gamari [Tue, 26 Sep 2017 19:09:13 +0000 (15:09 -0400)] 
rts: Throw proper HeapOverflow exception on allocating large array

Test Plan: Validate, add tests

Reviewers: simonmar, austin, erikd

Reviewed By: simonmar

Subscribers: rwbarton, thomie

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

21 months agodesugar: Catch levity polymorphism in unboxed sum expressions
Ben Gamari [Tue, 26 Sep 2017 18:52:26 +0000 (14:52 -0400)] 
desugar: Catch levity polymorphism in unboxed sum expressions

Fixes #13929.

21 months agobase: fdReady(): Add note about O_NONBLOCK requirement
Niklas Hambüchen [Tue, 26 Sep 2017 18:41:50 +0000 (14:41 -0400)] 
base: fdReady(): Add note about O_NONBLOCK requirement

Reviewers: bgamari, austin, hvr

Reviewed By: bgamari

Subscribers: rwbarton, thomie

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

21 months agoSwitch VEH to VCH and allow disabling of SEH completely.
Ben Gamari [Tue, 26 Sep 2017 18:34:58 +0000 (14:34 -0400)] 
Switch VEH to VCH and allow disabling of SEH completely.

Exception handling on Windows is unfortunately a bit complicated.
But essentially the VEH Handlers we currently have are running too
early.

This was a problem as it ran so early it also swallowed C++ exceptions
and other software exceptions which the system could have very well
recovered from.

So instead we use a sequence of chains to for the exception handlers to
run as late as possible. You really can't get any later than this.

Please read the comment in the patch for more details.

I'm also providing a switch to allow people to turn off the exception
handling entirely. In case it does present a problem with their code.

Test Plan: ./validate

Reviewers: austin, hvr, bgamari, erikd, simonmar

Reviewed By: bgamari

Subscribers: rwbarton, thomie

GHC Trac Issues: #13911, #12110

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

21 months agorts: Silence missing __noreturn__ warning
Ben Gamari [Tue, 26 Sep 2017 18:34:58 +0000 (14:34 -0400)] 
rts: Silence missing __noreturn__ warning

Reviewers: angerman, austin, erikd, simonmar

Subscribers: rwbarton, thomie

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

21 months agoRules: Show the binder type in the unbound template binder error
Ben Gamari [Tue, 26 Sep 2017 18:32:02 +0000 (14:32 -0400)] 
Rules: Show the binder type in the unbound template binder error

Reviewers: austin

Subscribers: rwbarton, thomie

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

21 months agoRelease console for ghci wrapper
Tamar Christina [Tue, 26 Sep 2017 18:43:15 +0000 (19:43 +0100)] 
Release console for ghci wrapper

Summary:
It seems the call that caused issues with the gcc wrapper before
was needed for the ghci wrapper in order for the child process
to be the one handling console events.

This code slightly refactors the wrappers to make sure only ghci
calls FreeConsole and nothing else.

Test Plan: ./validate , open ghci.exe press ctrl+c

Reviewers: RyanGlScott, austin, hvr, bgamari

Reviewed By: bgamari

Subscribers: rwbarton, thomie, erikd

GHC Trac Issues: #14150

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

21 months agoTcInteract: Remove redundant import of Typeable
Ben Gamari [Tue, 26 Sep 2017 17:35:46 +0000 (13:35 -0400)] 
TcInteract: Remove redundant import of Typeable

21 months agotestsuite: Add test for #14272
Ben Gamari [Tue, 26 Sep 2017 16:02:27 +0000 (12:02 -0400)] 
testsuite: Add test for #14272

Reviewers: austin

Subscribers: rwbarton, thomie

GHC Trac Issues: #14272

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

21 months agoPrelRules: Handle Int left shifts of more than word-size bits
Ben Gamari [Tue, 26 Sep 2017 12:01:44 +0000 (08:01 -0400)] 
PrelRules: Handle Int left shifts of more than word-size bits

This should result in zero. Failing to realize this caused us to try
to constant-fold via the normal path, resulting in #14272.

Test Plan: Validate with coming tests

Reviewers: austin, simonpj

Subscribers: simonpj, rwbarton, thomie, hvr

GHC Trac Issues: #14272

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

21 months agorts: Inform kernel that we won't need reserved address space
Ben Gamari [Tue, 26 Sep 2017 14:09:06 +0000 (10:09 -0400)] 
rts: Inform kernel that we won't need reserved address space

Trac #14192 points out that currently GHC's two-step allocator results
in extremely large coredumps. It seems like WebKit may have encountered
similar issues and their apparent solution uses madvise(MADV_DONTNEED)
while reserving address space to inform the kernel that the address
space we just requested needs no backing. Perhaps this is used by the
core dump logic to trim out uncommitted pages.

Test Plan: Validate, try core-dumping a compiled executable

Reviewers: austin, erikd, simonmar

Reviewed By: simonmar

Subscribers: rwbarton, thomie

GHC Trac Issues: #14192, #14193

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

21 months agoprimops: Add some notes regarding the meaning of the "type" field
Ben Gamari [Tue, 26 Sep 2017 13:33:53 +0000 (09:33 -0400)] 
primops: Add some notes regarding the meaning of the "type" field

The overloading of "monadic" definitely deserved some explanation.

[skip ci]

21 months agoStgCmmMonad: Remove unnecessary use of unboxed tuples
Ben Gamari [Tue, 26 Sep 2017 12:33:34 +0000 (08:33 -0400)] 
StgCmmMonad: Remove unnecessary use of unboxed tuples

The simplifier can simplify this without any trouble. Moreover, the
unboxed tuples cause bootstrapping issues due #14123.

I also went ahead and inlined a few definitions into the Monad instance.

Test Plan: Validate

Reviewers: austin, simonmar

Subscribers: rwbarton, thomie

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

21 months agoOmit Typeable from the "naturally coherent" list
Simon Peyton Jones [Tue, 26 Sep 2017 14:02:09 +0000 (15:02 +0100)] 
Omit Typeable from the "naturally coherent" list

In doing something else (Trac #14218) I tripped over the
definition of "naturally coherent" classes.  This patch

- Cocuments properly what that means

- Removes Typeable from the list, because now we know what
  it meams, Typeable clearly doesn't belong.

No regressions.

(Actually the term "naturally coherent" seems a bit off.
More like "invertible" or something.  But I left it.)

21 months agoA bunch of typofixes
Gabor Greif [Mon, 25 Sep 2017 10:31:12 +0000 (12:31 +0200)] 
A bunch of typofixes

21 months agotestsuite: Expect T13168 to be broken on Windows
Ben Gamari [Tue, 26 Sep 2017 00:40:41 +0000 (20:40 -0400)] 
testsuite: Expect T13168 to be broken on Windows

Spurious output pertaining to dynamic linking causes it to fail. See #14276.

21 months agoconfigure: Don't hard-code strip tool
Ben Gamari [Mon, 25 Sep 2017 22:41:23 +0000 (18:41 -0400)] 
configure: Don't hard-code strip tool

For reasons that I don't entirely understand we didn't previously detect
`strip` using autoconf. This naturally broke during cross-compilation.
How did this ever work? I have no idea.

Test Plan: Try cross-compiling

Reviewers: austin, hvr, angerman

Subscribers: rwbarton, thomie, erikd

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

21 months agoconfigure: Catch case where LLVM tools can't be found
Ben Gamari [Mon, 25 Sep 2017 22:39:11 +0000 (18:39 -0400)] 
configure: Catch case where LLVM tools can't be found

Previously we didn't specify the prog-not-found value passed to
AC_CHECK_TOOLS.  Reported by @snowleopard in
https://github.com/snowleopard/hadrian/issues/415.

Test Plan: validate

Reviewers: austin, hvr

Subscribers: rwbarton, thomie, snowleopard, erikd

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

21 months agoUse SIGQUIT for DWARF backtraces instead of SIGUSR2
Ben Gamari [Mon, 25 Sep 2017 22:34:54 +0000 (18:34 -0400)] 
Use SIGQUIT for DWARF backtraces instead of SIGUSR2

Reviewers: austin, erikd, simonmar

Subscribers: NicolasT, rwbarton, thomie

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

21 months agoAdd NOINLINE pragma to builtinRules
Ben Gamari [Mon, 25 Sep 2017 22:34:21 +0000 (18:34 -0400)] 
Add NOINLINE pragma to builtinRules

As mentioned in #14275, GHC will otherwise decide to produce unfoldings
for this rather large binding, making recompilation more expensive than
necessary. Since inlining is almost certainly not fruitful mark it as
NOINLINE.

[skip ci]

Test Plan: Validate

Reviewers: austin

Subscribers: rwbarton, thomie

GHC Trac Issues: #14275

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

21 months agointeger-gmp: Fix style
Ben Gamari [Mon, 25 Sep 2017 22:34:13 +0000 (18:34 -0400)] 
integer-gmp: Fix style

Just fix a few inconsistencies that I encountered.

[skip ci]

Reviewers: austin, hvr, goldfire

Subscribers: rwbarton, thomie

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

21 months agoInclude original process name in worker thread name (#14153)
Echo Nolan [Mon, 25 Sep 2017 22:33:30 +0000 (18:33 -0400)] 
Include original process name in worker thread name (#14153)

Prior to this commit, worker OS thread were renamed to "ghc_worker" when
spawned. This was annoying when reading debugging messages that print
the process name because it doesn't tell you *which* Haskell program is
generating the message.

This commit changes it to "original_process_name:w", truncating the
original name to fit in the kernel buffer if neccesary.

Test Plan: ./validate

Reviewers: austin, bgamari, erikd, simonmar

Reviewed By: bgamari

Subscribers: Phyx, rwbarton, thomie

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

21 months agoDocument Typeable's treatment of kind polymorphic tycons
Ben Gamari [Mon, 25 Sep 2017 22:33:06 +0000 (18:33 -0400)] 
Document Typeable's treatment of kind polymorphic tycons

Test Plan: Read it

Reviewers: dfeuer, goldfire, austin, hvr

Reviewed By: dfeuer

Subscribers: rwbarton, thomie

GHC Trac Issues: #14199

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

21 months agoAdds mingw64 to the valid GHC OSs.
Moritz Angermann [Mon, 25 Sep 2017 23:19:06 +0000 (00:19 +0100)] 
Adds mingw64 to the valid GHC OSs.

Summary:
This fixes hadrian#420 (https://github.com/snowleopard/hadrian/issues/420)

specifically the "Unknown OS mingw64".

Reviewers: austin, hvr, bgamari, Phyx

Reviewed By: Phyx

Subscribers: rwbarton, thomie, erikd

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

21 months agoFix the searching of target AR tool
Tamar Christina [Mon, 25 Sep 2017 18:12:35 +0000 (19:12 +0100)] 
Fix the searching of target AR tool

Summary:
Ar was being checked twice prior to D3883 where I removed one of the checks
because the converted path was being overridden after the check because of
the second check for Ar. However the one in configure.ac was a target check
so I'm changing the path check to a target check now.

Test Plan: ./configure

Reviewers: angerman, austin, hvr, bgamari

Reviewed By: bgamari

Subscribers: rwbarton, thomie, erikd

GHC Trac Issues: #14274

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

21 months agoEnsure text mode when calling debug functions
Tamar Christina [Mon, 25 Sep 2017 19:21:39 +0000 (20:21 +0100)] 
Ensure text mode when calling debug functions

Summary:
Something seems to be changing stderr into binary mode,
so when the `traceIO` is called, the C code that ultimately
calls `vfprintf` is using a binary mode handle.

This causes newlines not to be encoded properly.

The patch ensures we're in text mode when writing the debug
messages (% interleaving as it's not thread safe at all) and restores
the previous mode when done.

I'm slightly concerned about the performance implications of writing
large dumps out in text mode, but I think the current behavior is not
intended as I cannot see any of the printing code setting the mode of
the std handles.

Test Plan: ./validate

Reviewers: austin, bgamari, erikd, simonmar

Reviewed By: bgamari

Subscribers: rwbarton, thomie

GHC Trac Issues: #14188

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

21 months agoBump template-haskell to 2.13.0.0
Ryan Scott [Mon, 25 Sep 2017 18:22:27 +0000 (14:22 -0400)] 
Bump template-haskell to 2.13.0.0

Summary:
Now that `MonadIO` is a superclass of `Quasi`, it's a good
time to bump the `template-haskell` version so that libraries can
accommodate the change using CPP.

Test Plan: ./validate

Reviewers: bgamari, austin

Subscribers: rwbarton, thomie

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

21 months agoDocument how GHC disambiguates between multiple COMPLETE sets
Ryan Scott [Mon, 25 Sep 2017 18:21:54 +0000 (14:21 -0400)] 
Document how GHC disambiguates between multiple COMPLETE sets

Summary:
Up until now, the knowledge of how GHC chooses which
`COMPLETE` set to use in the presence of multiple applicable
`COMPLETE` sets for a single data type constructor was only
documented in the GHC wiki. But this really should be advertised to
anyone who uses `COMPLETE` pragmas heavily, so per SPJ's advice in
https://ghc.haskell.org/trac/ghc/ticket/14253#comment:10, this adds
this wisdom to the GHC users' guide.

Test Plan: Read it

Reviewers: austin, bgamari

Subscribers: mpickering, rwbarton, thomie

GHC Trac Issues: #14253

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

21 months agoFix solving of implicit parameter constraints
Simon Peyton Jones [Mon, 25 Sep 2017 10:06:34 +0000 (11:06 +0100)] 
Fix solving of implicit parameter constraints

Trac #14218 showed that we were not solving implicit-parameter
constraints correctly.  In particular,

- A tuple constraint could "hide" an implicit-parameter wanted
  constraint, and that in turn could that we solved it from the
  wrong implicit-parameter binding.

- As a special case the HasCallStack constraint (which is just
  short for (IP "callStack" CallStack), was getting mis-solved.

The big change is to arrange that, in TcSMonad.findDict when looking
for a dictionary, either when looking for a matching inert or solved
dictionary, we fail for

  - Tuples that are hiding implicit parameters
    See Note [Tuples hiding implicit parameters]

  - HasCallStack constraints where we have not yet pushed
    on the call-site info
    See Note [Solving CallStack constraints]

I also did a little refactoring

* Move naturallyCoherentClass from Class to TcInteract, its sole
  use site.  Class.hs seems like the wrong place.  (And I also
  do not understand the reason that we need the eq/Coercible/
  Typable stuff in this predicate, but I'll tackle that separately.)

* Move the code that pushes call-site info onto a call stack
  from the "interact" part to the "canonicalise" part of the solver.

21 months agoImprove type-error reporting
Simon Peyton Jones [Thu, 21 Sep 2017 16:39:18 +0000 (17:39 +0100)] 
Improve type-error reporting

This patch does two things:

* When reporting a hole, we now include its kind if the
  kind is not just '*'.  This addresses Trac #14265

* When reporting things like "'a' is a rigid type varaible
  bound by ...", this patch arranges to group the type variables
  together, so we don't repeat the "bound by..." stuff endlessly

21 months agoComments only
Simon Peyton Jones [Thu, 21 Sep 2017 16:38:54 +0000 (17:38 +0100)] 
Comments only

21 months agoMake pprQuotedList use fsep not hsep
Simon Peyton Jones [Thu, 21 Sep 2017 16:38:08 +0000 (17:38 +0100)] 
Make pprQuotedList use fsep not hsep

This just does wrapping on very long lists

21 months agoDeal with large extra-contraints wildcards
Simon Peyton Jones [Thu, 21 Sep 2017 16:35:11 +0000 (17:35 +0100)] 
Deal with large extra-contraints wildcards

For reasons explained in TcHsType
Note [Extra-constraint holes in partial type signatures],
if we had
  f :: (_) => blahs
and the '_' was filled in by more than a 62-tuple of contraints,
GHC crashed.

The same Note explains the hacky solution I have adopted to
evade this.  Maybe there is some better way, but I couldn't
see one that didn't involve a great deal of work. And the problem
is a very narrow one!  If the hack bites us we'll need to think
again.

21 months agodon't allow AsmTempLabel in UNREG mode (Trac #14264)
Sergei Trofimovich [Sun, 24 Sep 2017 11:14:03 +0000 (12:14 +0100)] 
don't allow AsmTempLabel in UNREG mode (Trac #14264)

AsmTempLabel is really a label that describes
label in assembly output (or equivalent like LLVM IR).

Unregisterised build does not handle it correctly.

This change does not fix UNREG build failure in
Ticket #14264 but reverts back to panic:
    pprCLbl AsmTempLabel

Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
21 months agoRevert "Typeable: Allow App to match arrow types"
Herbert Valerio Riedel [Sun, 24 Sep 2017 06:54:28 +0000 (08:54 +0200)] 
Revert "Typeable: Allow App to match arrow types"

This reverts commit cc6be3a2f23c9b2e04f9f491099149e1e1d4d20b.
because it caused the regression #14270 which according to
Richard probably doesn't have an easy fix. So this one goes
back to the drawning board.

This reopens #14236

21 months ago[Semigroup] fix genapply
Moritz Angermann [Sat, 23 Sep 2017 13:21:45 +0000 (21:21 +0800)] 
[Semigroup] fix genapply

Summary:
The SMP causes <> to be exported from Prelude by
default.  When building HEAD with HEAD, genapply suffers from
<> being imported from Prelude.

Reviewers: hvr, bgamari, austin

Reviewed By: hvr

Subscribers: rwbarton, thomie

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

21 months agoFix AsmTempLabel
Moritz Angermann [Fri, 22 Sep 2017 08:17:30 +0000 (16:17 +0800)] 
Fix AsmTempLabel

Summary:
This is another fallout from 8b007abb
should fix Trac #14264. I am not sure if this is
complete. It does however allow me to build an iOS
LLVM cross compiler.

Reviewers: bgamari, trofi, austin, simonmar

Reviewed By: trofi

Subscribers: rwbarton, thomie

GHC Trac Issues: #14264

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

21 months agoAdditional LLVM_TARGET logic.
Moritz Angermann [Thu, 21 Sep 2017 13:28:29 +0000 (21:28 +0800)] 
Additional LLVM_TARGET logic.

Summary:
This should help resolve the
compilcation that came up in Trac #14261

Test Plan: validate on various platforms

Reviewers: trofi, bgamari, austin, hvr

Reviewed By: trofi

Subscribers: rwbarton, thomie, erikd

GHC Trac Issues: #14261

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

22 months agoBump haskeline submodule
Ben Gamari [Fri, 22 Sep 2017 20:55:54 +0000 (16:55 -0400)] 
Bump haskeline submodule

Should fix the win32 build.

22 months agoFix build with GhcWithInterpreter=NO
Herbert Valerio Riedel [Fri, 22 Sep 2017 11:03:49 +0000 (13:03 +0200)] 
Fix build with GhcWithInterpreter=NO

This is a consequence of NoImplicitPrelude which was introduced
in f63bc730c7ea42ca6882f8078eb86be8bf1cc6ad.

22 months agoRemove 'stm' from EXTRA_PACKAGES set
Herbert Valerio Riedel [Fri, 22 Sep 2017 08:35:02 +0000 (10:35 +0200)] 
Remove 'stm' from EXTRA_PACKAGES set

This effectively broke `make sdist`; the surprising thing is that
./validate didn't catch this (and thus the buildbots didn't either).

Also, I would have expected `EXTRA_PACKAGES` to be populated by the
data in `./packages` which already encodes that information...

This is a follow-up to 02ff70563e490d2a7f3141eab7229803c523da57

22 months agoFix broken LLVM code gen
Moritz Angermann [Thu, 21 Sep 2017 22:05:46 +0000 (18:05 -0400)] 
Fix broken LLVM code gen

In 8b007abbeb30 (nativeGen: Consistently use blockLbl to generate
CLabels from BlockIds) all blockLbls were changed. This interfered with
the `toInfoLbl` call in CmmProcPoint, and caused the LLVM backend to
fall over.

Reviewers: bgamari, austin, simonmar

Reviewed By: bgamari

Subscribers: rwbarton, thomie

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

22 months agoImplement TH addCorePlugin.
Facundo Domínguez [Thu, 21 Sep 2017 22:04:56 +0000 (18:04 -0400)] 
Implement TH addCorePlugin.

This allows template-haskell code to add plugins to the compilation
pipeline. Otherwise, the user would have to pass -fplugin=... to ghc.

For now, plugin modules in the current package can't be used. This is
because when TH runs, it is too late to let GHC know that the plugin
modules needed to be compiled first.

Test Plan: ./validate

Reviewers: simonpj, bgamari, austin, goldfire

Reviewed By: bgamari

Subscribers: angerman, rwbarton, mboes, thomie

GHC Trac Issues: #13608

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

22 months agorts: Set unwind information for catch_frame
Ben Gamari [Thu, 21 Sep 2017 22:04:24 +0000 (18:04 -0400)] 
rts: Set unwind information for catch_frame

Reviewers: austin, erikd, simonmar

Reviewed By: simonmar

Subscribers: rwbarton, thomie

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

22 months agorts: Set unwind information for remaining stack frames
Ben Gamari [Thu, 21 Sep 2017 22:04:03 +0000 (18:04 -0400)] 
rts: Set unwind information for remaining stack frames

Reviewers: austin, erikd, simonmar

Reviewed By: simonmar

Subscribers: rwbarton, thomie

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

22 months agoReexport Semigroup's <> operator from Prelude (#14191)
Herbert Valerio Riedel [Thu, 21 Sep 2017 21:30:05 +0000 (23:30 +0200)] 
Reexport Semigroup's <> operator from Prelude (#14191)

This completes the 2nd phase of the Semigroup=>Monoid Proposal (SMP)
initiated in 8ae263ceb3566a7c82336400b09cb8f381217405.

This updates a couple submodules to address <> naming clashes.

22 months agocmm/CBE: Use foldLocalRegsDefd
Ben Gamari [Thu, 21 Sep 2017 22:02:36 +0000 (18:02 -0400)] 
cmm/CBE: Use foldLocalRegsDefd

Simonpj suggested this as a follow-on to #14226 to avoid code
duplication. This also gives us the ability to CBE cases involving
foreign calls for free.

Test Plan: Validate

Reviewers: austin, simonmar, simonpj

Reviewed By: simonpj

Subscribers: michalt, simonpj, rwbarton, thomie

GHC Trac Issues: #14226

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

22 months agotestsuite: Bump allocations of T12150
Ben Gamari [Thu, 21 Sep 2017 21:23:34 +0000 (17:23 -0400)] 
testsuite: Bump allocations of T12150

It looks like this is probably just drift.

22 months agoAlso show types that subsume a hole as valid substitutions for that hole.
Matthías Páll Gissurarson [Thu, 21 Sep 2017 18:14:53 +0000 (14:14 -0400)] 
Also show types that subsume a hole as valid substitutions for that hole.

This builds on the previous "Valid substitutions include..." functionality,
but add subsumption checking as well, so that the suggested valid substitutions
show not only exact matches, but also identifiers that fit the hole by virtue of
subsuming the type of the hole (i.e. being more general than the type of the
hole).

Building on the previous example, in the given program

```
ps :: String -> IO ()
ps = putStrLn

ps2 :: a -> IO ()
ps2 _ = putStrLn "hello, world"

main :: IO ()
main = _ "hello, world"
```

The results would be something like

```
    • Found hole: _ :: [Char] -> IO ()
    • In the expression: _
      In the expression: _ "hello, world"
      In an equation for ‘main’: main = _ "hello, world"
    • Relevant bindings include main :: IO () (bound at t1.hs:8:1)
      Valid substitutions include
        ps :: String -> IO () (defined at t1.hs:2:1)
        ps2 :: forall a. a -> IO () (defined at t1.hs:5:1)
        putStrLn :: String -> IO ()
          (imported from ‘Prelude’ at t1.hs:1:1
           (and originally defined in ‘System.IO’))
        fail :: forall (m :: * -> *). Monad m => forall a. String -> m a
          (imported from ‘Prelude’ at t1.hs:1:1
           (and originally defined in ‘GHC.Base’))
        mempty :: forall a. Monoid a => a
          (imported from ‘Prelude’ at t1.hs:1:1
           (and originally defined in ‘GHC.Base’))
        print :: forall a. Show a => a -> IO ()
          (imported from ‘Prelude’ at t1.hs:1:1
           (and originally defined in ‘System.IO’))
        (Some substitutions suppressed;
         use -fmax-valid-substitutions=N or -fno-max-valid-substitutions)
```

Signed-off-by: Matthías Páll Gissurarson <mpg@mpg.is>
Modified according to suggestions from Simon PJ

Accept tests that match the expectations, still a few to look better at

Swithced to using tcLookup, after sit down with SPJ at ICFP. Implications are WIP.

Now works with polymorphism and constraints!

We still need to merge the latest master, before we can make a patch.

Wrap the type of the hole, instead of implication shenanigans,

As per SPJs suggestion, this is simpler and feels closer to
what we actually want to do.

Updated tests with the new implementation

Remove debugging trace and update documentation

Reviewers: austin, bgamari

Reviewed By: bgamari

Subscribers: RyanGlScott, rwbarton, thomie

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

22 months agoBump base to 4.11.0.0
Ben Gamari [Thu, 21 Sep 2017 16:50:47 +0000 (12:50 -0400)] 
Bump base to 4.11.0.0

Bumps numerous submodules.

Reviewers: austin, hvr

Subscribers: rwbarton, thomie

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

22 months agobase: Add changelog entry for withTypeable generalization
Ben Gamari [Thu, 21 Sep 2017 16:11:33 +0000 (12:11 -0400)] 
base: Add changelog entry for withTypeable generalization

22 months agotestsuite: Add unboxed sum to T13929
Ben Gamari [Tue, 19 Sep 2017 23:09:58 +0000 (19:09 -0400)] 
testsuite: Add unboxed sum to T13929

Test Plan: Validate

Reviewers: austin

Subscribers: rwbarton, thomie

GHC Trac Issues: #13929

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

22 months agotestsuite: Add testcase for #14253
Ben Gamari [Tue, 19 Sep 2017 23:03:33 +0000 (19:03 -0400)] 
testsuite: Add testcase for #14253

Reviewers: austin

Subscribers: rwbarton, thomie

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

22 months agoIdentify fields by selector when type-checking (fixes #13644)
Adam Gundry [Tue, 19 Sep 2017 23:03:16 +0000 (19:03 -0400)] 
Identify fields by selector when type-checking (fixes #13644)

Test Plan: new test for #13847, and the test for #13644 now passes

Reviewers: mpickering, austin, bgamari, simonpj

Reviewed By: mpickering, simonpj

Subscribers: simonpj, rwbarton, thomie

GHC Trac Issues: #13644, #13847

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

22 months agoTypeable: Generalize kind of represented type
Ben Gamari [Tue, 19 Sep 2017 22:59:18 +0000 (18:59 -0400)] 
Typeable: Generalize kind of represented type

This allows withTypeable to be used with things that are of kind other
than Type.

Test Plan: Validate

Reviewers: austin, hvr, dfeuer

Reviewed By: dfeuer

Subscribers: rwbarton, thomie, dfeuer

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

22 months agoTypeable: Allow App to match arrow types
Ben Gamari [Tue, 19 Sep 2017 22:57:38 +0000 (18:57 -0400)] 
Typeable: Allow App to match arrow types

Test Plan: T14236

Reviewers: austin, hvr, goldfire

Reviewed By: goldfire

Subscribers: RyanGlScott, simonpj, rwbarton, goldfire, thomie, dfeuer

GHC Trac Issues: #14236

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

22 months agoInitial CircleCI support.
Mathieu Boespflug [Sun, 3 Sep 2017 14:13:06 +0000 (16:13 +0200)] 
Initial CircleCI support.

22 months agoTypofixes (visiblity -> visibility)
Ryan Scott [Thu, 21 Sep 2017 13:08:15 +0000 (09:08 -0400)] 
Typofixes (visiblity -> visibility)

22 months agoaclocal.m4: call cygpath on mingw32 only
Sergei Trofimovich [Wed, 20 Sep 2017 22:18:22 +0000 (23:18 +0100)] 
aclocal.m4: call cygpath on mingw32 only

The only reason I noticed is warning these lines on linux:

```
$ ./configure --target=sparc-unknown-linux-gnu
...
./configure: line 9708: cygpath: command not found
./configure: line 9708: ArCmd: command not found
```

POSIX shell syntax requires no spaces in assignments.
Fixed guarding condition while at it.

Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
22 months agoAdd 'stm' package to the global package database
Herbert Valerio Riedel [Wed, 20 Sep 2017 13:16:24 +0000 (15:16 +0200)] 
Add 'stm' package to the global package database

This is a preparation for `haskeline` picking up a dependency on `stm`
real soon now. See https://github.com/judah/haskeline/pull/61 for details.

If we figure out a way to not bundle the libraries depended upon by the
GHCi executable in the global package database (see #8919 for the original
reason why we had to start bundling terminfo/haskeline in the first place)
we can get rid of `stm` again...

On the bright side, we were able to avoid uploading new `stm` releases for
over two years already, so it shouldn't cause too much trouble if GHC imposes
a strong preference on the `stm` package's version (this most likely will
mostly affect Linux distributions & similiar).

While at it, this also update the stm submodule to include relaxed
bounds to allow the upcoming base-4.11 version.

22 months agoMake zipWith and zipWith3 inlinable.
HE, Tao [Tue, 19 Sep 2017 20:58:19 +0000 (16:58 -0400)] 
Make zipWith and zipWith3 inlinable.

Reviewers: austin, hvr, bgamari, dfeuer

Reviewed By: dfeuer

Subscribers: rwbarton, thomie

GHC Trac Issues: #14224

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

22 months agoRestore function powModSecInteger
Olivier Chéron [Tue, 19 Sep 2017 20:58:01 +0000 (16:58 -0400)] 
Restore function powModSecInteger

The function existed in integer-gmp-0.5.1.0 but was removed as
part of integer-gmp2 rewrite in #9281.  This is to bring it back.

Test Plan: Case integerGmpInternals, with GMP 4.3.2 and GMP 6.1.2

Reviewers: austin, hvr, goldfire, bgamari

Reviewed By: bgamari

Subscribers: rwbarton, thomie

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

22 months agocmm/CBE: Collapse blocks equivalent up to alpha renaming of local registers
Ben Gamari [Tue, 19 Sep 2017 20:57:41 +0000 (16:57 -0400)] 
cmm/CBE: Collapse blocks equivalent up to alpha renaming of local registers

As noted in #14226, the common block elimination pass currently
implements an extremely strict equivalence relation, demanding that two
blocks are equivalent including the names of their local registers. This
is quite restrictive and severely hampers the effectiveness of the pass.

Here we allow the CBE pass to collapse blocks which are equivalent up to
alpha renaming of locally-bound local registers. This is completely safe
and catches many more duplicate blocks.

Test Plan: Validate

Reviewers: austin, simonmar, michalt

Reviewed By: michalt

Subscribers: rwbarton, thomie

GHC Trac Issues: #14226

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

22 months agoFactor mkCoreApp and mkCoreApps
Arnaud Spiwack [Tue, 19 Sep 2017 20:57:25 +0000 (16:57 -0400)] 
Factor mkCoreApp and mkCoreApps

`mkCoreApps` re-implemented `mkCoreApp` in a recursive function,
rather than using a simple `foldl'` in order to avoid repeatingly
computing the type of the function argument. I've factored the two
logic into a new (internal) function `mkCoreType` which assumes that
the type is known. `mkCoreApp` and `mkCoreApps` are thin wrappers
around it.

Differences
- The assertion failure message of `mkCoreApps` has more
  information in it.
- `mkCoreApps` now special-cases coercion argument like
  `mkCoreApp` (previously they were given to `mk_val_app` instead)

Reviewers: austin, bgamari

Reviewed By: bgamari

Subscribers: rwbarton, thomie

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

22 months agousers-guide: Mention changes necessary due to #13391
Ben Gamari [Tue, 19 Sep 2017 20:57:08 +0000 (16:57 -0400)] 
users-guide: Mention changes necessary due to #13391

Some variant of this should also be added to the migration guide.

[skip ci]

Test Plan: Read it

Reviewers: goldfire, austin

Reviewed By: goldfire

Subscribers: rwbarton, thomie

GHC Trac Issues: #13391

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

22 months agobase: Add more detail to FD_SETSIZE related error message
Niklas Hambüchen [Tue, 19 Sep 2017 19:14:27 +0000 (15:14 -0400)] 
base: Add more detail to FD_SETSIZE related error message

Reviewers: bgamari, austin, hvr

Reviewed By: bgamari

Subscribers: rwbarton, thomie

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

22 months agobase: Make it less likely for fdReady() to fail on Windows sockets.
Niklas Hambüchen [Tue, 19 Sep 2017 19:12:56 +0000 (15:12 -0400)] 
base: Make it less likely for fdReady() to fail on Windows sockets.

See the added comment for details.

It's "less likely" because it can still fail if the socket happens to
have an FD larger than 1023, which can happen if many files are opened.

Until now, basic socket programs that use `hWaitForInput` were broken on
Windows.

That is because on Windows `FD_SETSIZE` defaults to 64, but pretty much
all GHC programs seem to have > 64 FDs open, so you can't actually
create a socket on which you can `select()`.

It errors with `fdReady: fd is too big` even with an example as simple
as the following (in this case, on my machine the `fd` is `284`):

  {-# LANGUAGE OverloadedStrings #-}

  import Control.Monad (forever)
  import Network.Socket
  import System.IO

  -- Simple echo server: Reads up to 10 chars from network, echoes them back.
  -- Uses the Handle API so that `hWaitForInput` can be used.
  main :: IO ()
  main = do
    sock <- socket AF_INET Stream 0
    setSocketOption sock ReuseAddr 1
    bind sock (SockAddrInet 1234 0x0100007f)
      -- 0x0100007f == 127.0.0.1 localhost
    listen sock 2
    forever $ do
      (connSock, _connAddr) <- accept sock
      putStrLn "Got connection"

      h <- socketToHandle connSock ReadWriteMode
      hSetBuffering h NoBuffering

      ready <- hWaitForInput h (5 * 1000) -- 5 seconds
      putStrLn $ "Ready: " ++ show ready

      line <- hGetLine h
      putStrLn "Got line"
      hPutStrLn h ("Got: " ++ line)
      hClose h

I'm not sure how this was not discovered earlier; for #13525 (where
`fdReady()` breaking completely was also discovered late) at least it
failed only when the timeout was non-zero, which is not used in ghc
beyond in `hWaitForInput`, but in this Windows socket case it breaks
even on the 0-timeout.

Maybe there is not actually anybody who uses sockets as handles on
Windows?

The workaround for now is to increase `FD_SETSIZE` on Windows;
increasing it is possible on Windows and BSD, see

https://stackoverflow.com/questions/7976388/increasing-limit-of-fd-setsi
ze-and-select

A real fix would be to move to IO Completion Ports on Windows, and thus
get rid of the last uses of `select()` (the other platforms already use
`poll()` but Windows doesn't have that).

Reviewers: bgamari, austin, hvr, erikd, simonmar

Reviewed By: bgamari

Subscribers: rwbarton, thomie

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

22 months agorts: Fix typo in comment
Niklas Hambüchen [Tue, 19 Sep 2017 19:12:11 +0000 (15:12 -0400)] 
rts: Fix typo in comment

Reviewers: bgamari, austin, erikd, simonmar

Reviewed By: bgamari

Subscribers: rwbarton, thomie

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

22 months agorts: Update comment about FreeBSD's unsigned FD_SETSIZE
Niklas Hambüchen [Tue, 19 Sep 2017 19:11:38 +0000 (15:11 -0400)] 
rts: Update comment about FreeBSD's unsigned FD_SETSIZE

Reviewers: bgamari, austin, erikd, simonmar

Reviewed By: bgamari

Subscribers: rwbarton, thomie

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

22 months agobase: Fix fdReady() returning immediately for pipes on Windows.
Niklas Hambüchen [Tue, 19 Sep 2017 19:11:05 +0000 (15:11 -0400)] 
base: Fix fdReady() returning immediately for pipes on Windows.

See https://ghc.haskell.org/trac/ghc/ticket/13497#comment:17

Until now, the program

  import System.IO
  main = hWaitForInput stdin (5 * 1000)

didn't wait 5 seconds for input on Winodws, it terminated immediately.

This was because the `PeekNamedPipe()` function introduced in commit
94fee9e7 really only peeks, it doesn't block.  So if there's no data,
`fdReady(fd, msec)` would return immediately even when the given `msec`
timeout is not zero.

This commit fixes it by looping around `PeekNamedPipe()` with a `sleep(1
ms)`.

Apparently there's no better way to do this on Windows without switching
to IOCP.

In any case, this change should be strictly better than what was there
before.

Reviewers: bgamari, austin, hvr

Reviewed By: bgamari

Subscribers: Phyx, rwbarton, thomie

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

22 months agobase: Fix fdReady() potentially running forever for Windows Char devices.
Niklas Hambüchen [Tue, 19 Sep 2017 19:10:31 +0000 (15:10 -0400)] 
base: Fix fdReady() potentially running forever for Windows Char devices.

Reviewers: bgamari, austin, hvr

Reviewed By: bgamari

Subscribers: rwbarton, thomie

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

22 months agobase: Fix fdReady() potentially running forever on Windows.
Niklas Hambüchen [Tue, 19 Sep 2017 19:10:00 +0000 (15:10 -0400)] 
base: Fix fdReady() potentially running forever on Windows.

This fixes #13497 for Windows -- at least for the `if (isSock)` part; I
haven't investigated the case where it's not a socket yet.

Solved by copying the new current-time based waiting logic from the
non-Windows implementation above.

Reviewers: bgamari, austin, hvr

Reviewed By: bgamari

Subscribers: rwbarton, thomie

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

22 months agobase: fdReady(): Improve accuracy and simplify code.
Niklas Hambüchen [Tue, 19 Sep 2017 19:09:29 +0000 (15:09 -0400)] 
base: fdReady(): Improve accuracy and simplify code.

This is done by reusing the existing cross-platform
`getProcessElapsedTime()` function, which already provides nanosecond
monotonic clocks, and fallback for platforms that don't have those.

To do this, `getProcessElapsedTime()` had to be moved from a private RTS
symbol into the public interface.

Accuracy is improved in 2 ways:

* Use of the monotonic clock where available
* Measuring the total time spent waiting instead of a sum
  of intervals (between which there are small gaps)

Reviewers: bgamari, austin, hvr, erikd, simonmar

Reviewed By: bgamari

Subscribers: rwbarton, thomie

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

22 months agoFix Windows build regression due to GhcPrelude change
Ben Gamari [Tue, 19 Sep 2017 19:58:20 +0000 (15:58 -0400)] 
Fix Windows build regression due to GhcPrelude change

22 months agocompiler: introduce custom "GhcPrelude" Prelude
Herbert Valerio Riedel [Tue, 19 Sep 2017 18:35:36 +0000 (14:35 -0400)] 
compiler: introduce custom "GhcPrelude" Prelude

This switches the compiler/ component to get compiled with
-XNoImplicitPrelude and a `import GhcPrelude` is inserted in all
modules.

This is motivated by the upcoming "Prelude" re-export of
`Semigroup((<>))` which would cause lots of name clashes in every
modulewhich imports also `Outputable`

Reviewers: austin, goldfire, bgamari, alanz, simonmar

Reviewed By: bgamari

Subscribers: goldfire, rwbarton, thomie, mpickering, bgamari

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

22 months agoOccurAnal: Ensure SourceNotes don't interfere with join-point analysis
Ben Gamari [Tue, 19 Sep 2017 15:16:55 +0000 (11:16 -0400)] 
OccurAnal: Ensure SourceNotes don't interfere with join-point analysis

In general ticks are problematic for join point analysis as described
in #14242.  However, source notes are intended to be a best-effort
annotation which shouldn't interfere with optimization. Special-case
these to ensure that tail-call information is still correct, even in the
presence of source note
ticks.

Test Plan: Validate

Reviewers: simonpj, austin

Reviewed By: simonpj

Subscribers: rwbarton, thomie

GHC Trac Issues: #14242

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

22 months agonativeGen: Consistently use blockLbl to generate CLabels from BlockIds
Ben Gamari [Tue, 19 Sep 2017 14:58:36 +0000 (10:58 -0400)] 
nativeGen: Consistently use blockLbl to generate CLabels from BlockIds

This fixes #14221, where the NCG and the DWARF code were apparently
giving two different names to the same block.

Test Plan: Validate with DWARF support enabled.

Reviewers: simonmar, austin

Subscribers: rwbarton, thomie

GHC Trac Issues: #14221

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

22 months agorts/RetainerProfile: Adding missing closure types to isRetainer
Ben Gamari [Tue, 19 Sep 2017 13:51:01 +0000 (09:51 -0400)] 
rts/RetainerProfile: Adding missing closure types to isRetainer

orzo in `#ghc` reported seeing a crash due to the retainer profiler encountering
a BLOCKING_QUEUE closure, which isRetainer didn't know about. I performed an
audit to make sure that all of the valid closure types were listed; they
weren't. This is my guess of how they should appear.

Test Plan: Validate

Reviewers: simonmar, austin, erikd

Reviewed By: simonmar

Subscribers: rwbarton, thomie

GHC Trac Issues: #14235

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

22 months agoFix unused-given-constraint bug
Simon Peyton Jones [Tue, 19 Sep 2017 11:37:13 +0000 (12:37 +0100)] 
Fix unused-given-constraint bug

This bug was shown up by Trac #14237.  It turned out
to be an outright error in TcSimplify.neededEvVars,
easily fixed.

I improved the comments.

22 months agoRemove redundant/obsolete CPP usage
Herbert Valerio Riedel [Tue, 19 Sep 2017 06:11:50 +0000 (08:11 +0200)] 
Remove redundant/obsolete CPP usage

This `#if 0`/`#endif` block has been around for over 10 years and
it became truly redundant in 36104d7a0d66df895c8275e3aa7cfe35a322ff04

22 months agoGeneralise constraint on `instance Monoid (Maybe a)` to Semigroup
Herbert Valerio Riedel [Tue, 19 Sep 2017 05:54:40 +0000 (07:54 +0200)] 
Generalise constraint on `instance Monoid (Maybe a)` to Semigroup

This now becomes possible due to the introduction of the
Semigroup=>Monoid superclass relation (see #14191).

Reviewers: ekmett, RyanGlScott, austin, bgamari

Reviewed By: ekmett, RyanGlScott, bgamari

Subscribers: rwbarton, thomie

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

22 months agoAllow opt+llc from LLVM5
Moritz Angermann [Fri, 28 Jul 2017 06:04:22 +0000 (14:04 +0800)] 
Allow opt+llc from LLVM5

Summary:
This bumps our LLVM version requirement to LLVM5,
which will likely be released before GHC 8.4.

Test Plan: validate

Reviewers: austin, hvr, bgamari

Reviewed By: bgamari

Subscribers: rwbarton, thomie, erikd

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

22 months ago[RTS] Add getObjectLoadStatus
Bartosz Nitka [Mon, 18 Sep 2017 14:53:56 +0000 (07:53 -0700)] 
[RTS] Add getObjectLoadStatus

This adds a function to the RTS linker API which lets the
user check the status of dynamically linked objects.

It was initially proposed by @afarmer in D2068.
It's useful for testing the linker and also for detecting retention
problems in production.

It takes a path, because it's easier to use path as key instead of producing
some stable handle.

It returns an enum instead of bool, because I see no reason for destroying
information. All the complexity is already out in the open, so there's
nothing to save the users from.

Test Plan: ./validate

Reviewers: simonmar, Phyx, bgamari, austin, erikd

Reviewed By: Phyx, bgamari

Subscribers: rwbarton, afarmer, thomie

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

22 months agotestsuite: Fix MonadFail test output for new ST instance
Ben Gamari [Sun, 17 Sep 2017 11:59:41 +0000 (07:59 -0400)] 
testsuite: Fix MonadFail test output for new ST instance

22 months agobase: Fix missing import of Control.Monad.Fail
Ben Gamari [Sun, 17 Sep 2017 04:18:06 +0000 (00:18 -0400)] 
base: Fix missing import of Control.Monad.Fail

22 months agoFix pointer tagging mistake
David Feuer [Sun, 17 Sep 2017 04:21:03 +0000 (00:21 -0400)] 
Fix pointer tagging mistake

f9c6d53fe997f1c560cda6f346f4b201711df37c led to #14036. The
problem turned out to be rather simple: the `obj` pointer was
being tagged using `obj + arity`. Because this is C, that's done
with *pointer arithmetic*, which is not at all what we want. Add
appropriate casts.

Reviewers: austin, bgamari, erikd, simonmar

Reviewed By: bgamari

Subscribers: rwbarton, thomie

GHC Trac Issues: #14036

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

22 months agobase: Add missing MonadFail instance for strict ST
Ben Gamari [Sun, 17 Sep 2017 03:47:37 +0000 (23:47 -0400)] 
base: Add missing MonadFail instance for strict ST

Test Plan: Validate

Reviewers: hvr, RyanGlScott, austin

Reviewed By: RyanGlScott

Subscribers: rwbarton, thomie

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

22 months agobase: Enable TypeInType in Data.Type.Equality
Ben Gamari [Fri, 15 Sep 2017 22:57:43 +0000 (18:57 -0400)] 
base: Enable TypeInType in Data.Type.Equality

Otherwise compilation fails with,

    libraries/base/Data/Type/Equality.hs:145:4: error:
        • Data constructor ‘HRefl’ constrains the choice of kind parameter:
            k2 ~ k2
          Use TypeInType to allow this
        • In the definition of data constructor ‘HRefl’
          In the data type declaration for ‘:~~:’
        |
    145 |    HRefl :: a :~~: a
        |    ^

22 months agoRemove dead function TcUnify.wrapFunResCoercion
Arnaud Spiwack [Fri, 15 Sep 2017 18:36:39 +0000 (14:36 -0400)] 
Remove dead function TcUnify.wrapFunResCoercion

Reviewers: austin, bgamari

Reviewed By: bgamari

Subscribers: rwbarton, thomie

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

22 months agoRenamer now preserves location for IEThingWith list items
Alan Zimmerman [Fri, 15 Sep 2017 18:35:51 +0000 (14:35 -0400)] 
Renamer now preserves location for IEThingWith list items

Prior to this, in the RenamedSource for

    module Renaming.RenameInExportedType
      (
      MyType (NT)
      ) where

    data MyType = MT Int | NT

The (NT) was given the location of MyType earlier on the line in the
export list.

Also the location was discarded for any field labels, and replaced with
a `noLoc`.

Test Plan: ./validate

Reviewers: bgamari, austin

Reviewed By: bgamari

Subscribers: rwbarton, thomie

GHC Trac Issues: #14189

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

22 months agobase: Fix mixed tabs/spaces indentation in inputReady.c
Niklas Hambüchen [Fri, 15 Sep 2017 18:35:35 +0000 (14:35 -0400)] 
base: Fix mixed tabs/spaces indentation in inputReady.c

Reviewers: bgamari, austin, hvr

Reviewed By: bgamari

Subscribers: rwbarton, thomie

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

22 months agoFix #14228 by marking SumPats as non-irrefutable
Ryan Scott [Fri, 15 Sep 2017 18:34:58 +0000 (14:34 -0400)] 
Fix #14228 by marking SumPats as non-irrefutable

`isIrrefutableHsPat` should always return `False` for unboxed sum
patterns (`SumPat`s), since they always have at least one other
corresponding pattern of the same arity (since the minimum arity for a
`SumPat` is 2). Failure to do so causes incorrect code to be generated
for pattern synonyms that use unboxed sums, as shown in #14228.

Test Plan: make test TEST=T14228

Reviewers: austin, bgamari, simonpj

Reviewed By: simonpj

Subscribers: simonpj, rwbarton, thomie

GHC Trac Issues: #14228

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

22 months agoFix missing fields warnings in empty record construction, fix #13870
HE, Tao [Fri, 15 Sep 2017 18:34:42 +0000 (14:34 -0400)] 
Fix missing fields warnings in empty record construction, fix #13870

Test Plan: make test TEST=T13870

Reviewers: RyanGlScott, austin, bgamari, mpickering

Reviewed By: mpickering

Subscribers: mpickering, rwbarton, thomie, RyanGlScott

Tags: #ghc

GHC Trac Issues: #13870

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

22 months agoIgnore untracked in text, parsec and mtl submodules [skip ci]
Tamar Christina [Fri, 15 Sep 2017 18:34:26 +0000 (14:34 -0400)] 
Ignore untracked in text, parsec and mtl submodules [skip ci]

ignore all untracked changes in all submodules from the top level.
This matches the older settings for the other submodules and stops
litering `git status` output with files created by ./boot and make.

Reviewers: austin, bgamari

Reviewed By: bgamari

Subscribers: hvr, rwbarton, thomie

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

22 months agoFix name of note
Ben Gamari [Wed, 13 Sep 2017 17:13:02 +0000 (13:13 -0400)] 
Fix name of note

[skip ci]

22 months agoBump submodule nofib (Semigroup now required)
Joachim Breitner [Thu, 14 Sep 2017 20:42:53 +0000 (16:42 -0400)] 
Bump submodule nofib (Semigroup now required)

This will unblock perf.haskell.org, which got stuck after 8ae263c.

22 months agoFix #13963.
Richard Eisenberg [Wed, 16 Aug 2017 18:33:06 +0000 (14:33 -0400)] 
Fix #13963.

This commit fixes several things:

1. RuntimeRep arg suppression was overeager for *visibly*-quantified
RuntimeReps, which should remain.

2. The choice of whether to used a Named TyConBinder or an anonymous
was sometimes wrong. Now, we do an extra little pass right before
constructing the tycon to fix these.

3. TyCons that normally cannot appear unsaturated can appear unsaturated
in :kind. But this fact was not propagated into the type checker.
It now is.

22 months agoTest #13938, with expect_broken
Richard Eisenberg [Wed, 16 Aug 2017 15:49:49 +0000 (11:49 -0400)] 
Test #13938, with expect_broken

test case: dependent/should_compile/T13938