ghc.git
3 years agoUser manual wibbles wip/type-app
Richard Eisenberg [Sat, 8 Aug 2015 18:26:50 +0000 (14:26 -0400)] 
User manual wibbles

3 years agoVisible type application
Richard Eisenberg [Fri, 7 Aug 2015 12:13:54 +0000 (08:13 -0400)] 
Visible type application

Summary:
This implements visible type application into GHC, as described in
http://www.seas.upenn.edu/~sweirich/papers/type-app-extended.pdf

Very briefly, this means (with new extension `TypeApplications`
enabled) that you can say `show (read @Int "5")` and get the
behavior that you want.

This is a sizable change to the type-checker, because it means that
`tcExpr` does //not// instantiate types it infers. Instead, types
are instantiated only when required. The details are in the paper.

* At this point, kind variables may not be visibly instantiated. I
expect to fix this deficiency in the merging type/kind work.

* Visible type application is not yet available in patterns, only
expressions. I expect to fix this, also.

* This patch also adds some more tidying to TcValidity, necessary
for good error messages. This actually fixes a bug unrelated to
visible type application.

* There are some open design questions. I will post to #5296, as
Trac seems a better forum for design issues.

There is one part of this patch which is atrociously ugly. As
described in the paper, we must keep track of the difference between
specified type variables (as given by the user) and inferred type
variables (as generated by GHC). There is not a convenient place to
mark this distinction. BUT, there //is// a convenient place in my
merging types/kinds patch, which should land for 7.12. So I did
an ugly thing: I put the bit in the `Name` of the type variable,
using `System` names for inferred variables and `Internal` names for
specified ones. This was actually only a small change from existing
practice, but I well know that having type-checking depend on a
variable's `Name` is terrible. However, I think it's better for this
patch to land separate from my types/kinds patch, and changing
`ForAllTy` to note the specified/inferred distinction would duplicate
a bunch of effort in my other patch. Thus the compromise seen here.
This behavior will be removed when this patch is merged into my
other one.

If this is just too ugly, I can accept that and merge this with
my other patch internally, without going via `master`.

Test Plan: ./validate

Reviewers: simonpj, bgamari, austin, hvr

Subscribers: thomie, mpickering

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

GHC Trac Issues: #5296, #10619, #10589, #10709.

3 years agoRevert "*** Use global url for .gitmodules"
Richard Eisenberg [Fri, 7 Aug 2015 12:11:51 +0000 (08:11 -0400)] 
Revert "*** Use global url for .gitmodules"

This reverts commit d2228af2b996dba11437975ea570b2b6fb60a62c.

3 years agoTestsuite wibbles
Richard Eisenberg [Fri, 7 Aug 2015 12:03:02 +0000 (08:03 -0400)] 
Testsuite wibbles

3 years agoTidy in checkValidType.
Richard Eisenberg [Fri, 7 Aug 2015 12:00:34 +0000 (08:00 -0400)] 
Tidy in checkValidType.

This is necessary in testcase typecheck/should_fail/T10351, for
example.

3 years agoTidy classes before printing during validity checks
Richard Eisenberg [Fri, 7 Aug 2015 01:08:32 +0000 (21:08 -0400)] 
Tidy classes before printing during validity checks

3 years agoTestsuite wibbles
Richard Eisenberg [Fri, 7 Aug 2015 00:15:07 +0000 (20:15 -0400)] 
Testsuite wibbles

3 years agoFix compiler errors from merging
Richard Eisenberg [Thu, 6 Aug 2015 20:25:57 +0000 (16:25 -0400)] 
Fix compiler errors from merging

3 years agoMerge remote-tracking branch 'origin/master' into wip/type-app
Richard Eisenberg [Thu, 6 Aug 2015 20:02:31 +0000 (16:02 -0400)] 
Merge remote-tracking branch 'origin/master' into wip/type-app

3 years agoRejigger OSMem.my_mmap to allow building on Mac
Richard Eisenberg [Thu, 6 Aug 2015 18:37:53 +0000 (14:37 -0400)] 
Rejigger OSMem.my_mmap to allow building on Mac

Previously, the prot and flags variables were set but never used
on Mac (darwin). This caused a warning, and the build setup stopped
compilation. This commit is intended simply to omit these variables
when building with darwin_HOST_OS set. No change in behavior on any
platform is intended.

3 years agoAdd test for #10600 (exhaustiveness check with --make and -fno-code)
Reid Barton [Thu, 6 Aug 2015 18:12:38 +0000 (14:12 -0400)] 
Add test for #10600 (exhaustiveness check with --make and -fno-code)

3 years agoMerge remote-tracking branch 'origin/master' into wip/type-app
Richard Eisenberg [Thu, 6 Aug 2015 16:55:12 +0000 (12:55 -0400)] 
Merge remote-tracking branch 'origin/master' into wip/type-app

Conflicts:
compiler/iface/TcIface.hs
compiler/main/DynFlags.hs
compiler/typecheck/TcBinds.hs
compiler/typecheck/TcClassDcl.hs
compiler/typecheck/TcErrors.hs
compiler/typecheck/TcExpr.hs
compiler/typecheck/TcMType.hs
compiler/typecheck/TcPat.hs
compiler/typecheck/TcSMonad.hs
compiler/typecheck/TcType.hs
compiler/typecheck/TcValidity.hs
libraries/Cabal
testsuite/tests/ghci.debugger/scripts/break003.stderr
testsuite/tests/ghci.debugger/scripts/break006.stderr
testsuite/tests/ghci/scripts/Defer02.stderr
testsuite/tests/ghci/scripts/T2182ghci.stderr
testsuite/tests/ghci/scripts/T7730.stdout
testsuite/tests/ghci/scripts/ghci047.stderr
testsuite/tests/numeric/should_compile/T7116.stdout
testsuite/tests/parser/should_compile/all.T
testsuite/tests/partial-sigs/should_compile/T10403.stderr
testsuite/tests/partial-sigs/should_compile/T10438.stderr
testsuite/tests/partial-sigs/should_compile/WarningWildcardInstantiations.stderr
testsuite/tests/partial-sigs/should_fail/Defaulting1MROff.stderr
testsuite/tests/partial-sigs/should_fail/TidyClash.stderr
testsuite/tests/partial-sigs/should_fail/Trac10045.stderr
testsuite/tests/partial-sigs/should_fail/WildcardInstantiations.stderr
testsuite/tests/partial-sigs/should_fail/WildcardsInPatternAndExprSig.stderr
testsuite/tests/patsyn/should_run/ghci.stdout
testsuite/tests/safeHaskell/ghci/p16.stderr
testsuite/tests/safeHaskell/ghci/p4.stderr
testsuite/tests/safeHaskell/ghci/p6.stderr
testsuite/tests/typecheck/should_compile/T10072.stderr
testsuite/tests/typecheck/should_compile/all.T
testsuite/tests/typecheck/should_fail/T10351.stderr
testsuite/tests/typecheck/should_fail/T6022.stderr
testsuite/tests/typecheck/should_fail/T8883.stderr
testsuite/tests/typecheck/should_fail/all.T
testsuite/tests/typecheck/should_fail/tcfail198.stderr

3 years agoUpdate user manual re @_.
Richard Eisenberg [Thu, 6 Aug 2015 15:43:44 +0000 (11:43 -0400)] 
Update user manual re @_.

3 years agoAllow @_ to be used without fuss
Richard Eisenberg [Thu, 6 Aug 2015 15:39:57 +0000 (11:39 -0400)] 
Allow @_ to be used without fuss

3 years agollvmGen: Rework LLVM mangler
Ben Gamari [Thu, 6 Aug 2015 15:30:19 +0000 (17:30 +0200)] 
llvmGen: Rework LLVM mangler

The LLVM mangler does not currently transform AVX instructions on x86-64
platforms, due to a missing #include. Also, it is significantly more
complicated than necessary, due to the file into sections (not needed
anymore), and is sensitive to the details of the whitespace in the
assembly.

Author: dobenour

Test Plan: Validation on x86-64, x86-32, and ARM

Reviewers: austin

Subscribers: thomie, bgamari, rwbarton

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

GHC Trac Issues: #10394

3 years agoUser manual
Richard Eisenberg [Thu, 6 Aug 2015 15:30:16 +0000 (11:30 -0400)] 
User manual

3 years agobase: Add instances
fumieval [Thu, 6 Aug 2015 15:28:04 +0000 (17:28 +0200)] 
base: Add instances

This patch adds following instances:

* Foldable ZipList
* Traversable ZipList
* Functor Complex
* Applicative Complex
* Monad Complex
* Foldable Complex
* Traversable Complex
* Generic1 Complex
* Monoid a => Monoid (Identity a)
* Storable ()

Reviewers: ekmett, fumieval, hvr, austin

Subscribers: thomie, #core_libraries_committee

Projects: #core_libraries_committee

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

GHC Trac Issues: #10609

3 years agoEnsure DynFlags are consistent
Ben Gamari [Thu, 6 Aug 2015 15:25:46 +0000 (17:25 +0200)] 
Ensure DynFlags are consistent

While we have always had makeDynFlagsConsistent to enforce a variety of
consistency invariants on DynFlags, it hasn't been widely used.
GHC.Main, for instance, ignored it entirely. This leads to issues like
Trac #10549, where an OPTIONS_GHC pragma introduced an inconsistency,
leading to a perplexing crash later in compilation.

Here I add consistency checks in GHC.Main.set{Session,Program}DynFlags,
closing this hole.

Fixes #10549.

Test Plan: Validate with T10549

Reviewers: austin

Subscribers: thomie

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

GHC Trac Issues: #10549

3 years agoTestsuite wibbles
Richard Eisenberg [Thu, 6 Aug 2015 15:25:17 +0000 (11:25 -0400)] 
Testsuite wibbles

3 years agoRemove spurious test
Richard Eisenberg [Thu, 6 Aug 2015 14:53:55 +0000 (10:53 -0400)] 
Remove spurious test

3 years agoTestsuite wibbles
Richard Eisenberg [Thu, 6 Aug 2015 14:50:19 +0000 (10:50 -0400)] 
Testsuite wibbles

3 years agoTestsuite wibbles
Richard Eisenberg [Thu, 6 Aug 2015 14:46:27 +0000 (10:46 -0400)] 
Testsuite wibbles

3 years agoUse ExprSigOrigin where appropriate
Richard Eisenberg [Thu, 6 Aug 2015 14:40:02 +0000 (10:40 -0400)] 
Use ExprSigOrigin where appropriate

3 years agoTestsuite wibbles
Richard Eisenberg [Thu, 6 Aug 2015 14:35:35 +0000 (10:35 -0400)] 
Testsuite wibbles

3 years agoBump submodule libraries/Cabal for new extension
Richard Eisenberg [Thu, 6 Aug 2015 13:56:07 +0000 (09:56 -0400)] 
Bump submodule libraries/Cabal for new extension

3 years agoStub for manual entry
Richard Eisenberg [Thu, 6 Aug 2015 13:55:53 +0000 (09:55 -0400)] 
Stub for manual entry

3 years agoTest Trac #10742
Simon Peyton Jones [Thu, 6 Aug 2015 13:50:35 +0000 (14:50 +0100)] 
Test Trac #10742

3 years agoT8968-1 and -3 should pass
Simon Peyton Jones [Thu, 6 Aug 2015 13:50:12 +0000 (14:50 +0100)] 
T8968-1 and -3 should pass

See Trac #9953, comment:22.

3 years agoComments only
Simon Peyton Jones [Thu, 6 Aug 2015 13:46:48 +0000 (14:46 +0100)] 
Comments only

3 years agoTestsuite wibbles
Richard Eisenberg [Thu, 6 Aug 2015 13:42:02 +0000 (09:42 -0400)] 
Testsuite wibbles

3 years agoComents only
Simon Peyton Jones [Thu, 6 Aug 2015 12:40:07 +0000 (13:40 +0100)] 
Coments only

3 years agoComments only
Richard Eisenberg [Wed, 5 Aug 2015 17:27:48 +0000 (13:27 -0400)] 
Comments only

3 years agoMove Note [Visible type application]
Richard Eisenberg [Wed, 5 Aug 2015 17:20:30 +0000 (13:20 -0400)] 
Move Note [Visible type application]

3 years agoTest pushing into conditionals
Richard Eisenberg [Wed, 5 Aug 2015 17:17:38 +0000 (13:17 -0400)] 
Test pushing into conditionals

3 years agoComments only
Richard Eisenberg [Wed, 5 Aug 2015 17:10:52 +0000 (13:10 -0400)] 
Comments only

3 years agoRefactor overloaded literals back to Inst
Richard Eisenberg [Wed, 5 Aug 2015 16:47:27 +0000 (12:47 -0400)] 
Refactor overloaded literals back to Inst

3 years agoTestsuite wibbles
Richard Eisenberg [Wed, 5 Aug 2015 16:31:47 +0000 (12:31 -0400)] 
Testsuite wibbles

3 years agoWorkin' the testsuite
Richard Eisenberg [Wed, 5 Aug 2015 16:28:19 +0000 (12:28 -0400)] 
Workin' the testsuite

3 years agoTestsuite wibbles
Richard Eisenberg [Wed, 5 Aug 2015 15:54:18 +0000 (11:54 -0400)] 
Testsuite wibbles

3 years agoArgument types *can* get instantiated.
Richard Eisenberg [Wed, 5 Aug 2015 15:52:23 +0000 (11:52 -0400)] 
Argument types *can* get instantiated.

3 years agoFix quantification for inference with sigs
Simon Peyton Jones [Wed, 5 Aug 2015 15:46:16 +0000 (16:46 +0100)] 
Fix quantification for inference with sigs

When we are *inferring* the type of a let-bound function,
we might still have a type signature.  And we must be sure
to quantify over its type variables, else you get the crash
in Trac #10615.

See Note [Which type variables to quantify] in TcSimplify

3 years agoTidy up and refactor wildcard handling
Simon Peyton Jones [Wed, 5 Aug 2015 13:24:54 +0000 (14:24 +0100)] 
Tidy up and refactor wildcard handling

When examining #10615, I found the wildcard handling hard
to understand.  This patch refactors quite a bit, but with
no real change in behaviour.

 * Split out TcIdSigInfo from TcSigInfo, as a separate type,
   like TcPatSynInfo.

 * Make TcIdSigInfo express more invariants by pushing the
   wildard info into TcIdSigBndr

 * Remove all special treatment of unification variables that arise
   from wildcards; so the TauTv of TcType.MetaInfo loses its Bool
   argument.

A ton of konck on changes.  The result is significantly simpler, I think.

3 years agoMinor refactor to use filterInScope
Simon Peyton Jones [Wed, 5 Aug 2015 13:03:34 +0000 (14:03 +0100)] 
Minor refactor to use filterInScope

3 years agoMore info with Shouldn'tHappenOrigin
Richard Eisenberg [Wed, 5 Aug 2015 15:37:09 +0000 (11:37 -0400)] 
More info with Shouldn'tHappenOrigin

3 years agoTestsuite wibbles
Richard Eisenberg [Wed, 5 Aug 2015 15:36:54 +0000 (11:36 -0400)] 
Testsuite wibbles

3 years agoRemove the abominable matchExpectedFunTys_Args
Richard Eisenberg [Wed, 5 Aug 2015 15:10:46 +0000 (11:10 -0400)] 
Remove the abominable matchExpectedFunTys_Args

3 years agoMove visible type app stuff from TcUnify to TcExpr
Richard Eisenberg [Wed, 5 Aug 2015 14:49:29 +0000 (10:49 -0400)] 
Move visible type app stuff from TcUnify to TcExpr

3 years agoRemove unused def'n in hs-boot file
Richard Eisenberg [Wed, 5 Aug 2015 14:39:33 +0000 (10:39 -0400)] 
Remove unused def'n in hs-boot file

3 years agoTestsuite wibbles
Richard Eisenberg [Wed, 5 Aug 2015 13:28:20 +0000 (09:28 -0400)] 
Testsuite wibbles

3 years agoError message tweak
Richard Eisenberg [Wed, 5 Aug 2015 13:25:34 +0000 (09:25 -0400)] 
Error message tweak

3 years agoComments only
Simon Peyton Jones [Wed, 5 Aug 2015 12:56:48 +0000 (13:56 +0100)] 
Comments only

3 years agoWarn about missed specialisations for imports
Simon Peyton Jones [Wed, 5 Aug 2015 12:37:18 +0000 (13:37 +0100)] 
Warn about missed specialisations for imports

This change was provoked by Trac #10720, where a missing
INLINEABLE pragma gave very poor performance.

The change is to warn when an imported function is not specialised
in a situation where the user expects it to be.

New flags
  -fwarn-missed-specialisations
  -fwarn-all-missed-specialisations

Documented in user manual.
See Note [Warning about missed specialisations]

3 years agoDo not complain about SPECIALISE for INLINE
Simon Peyton Jones [Wed, 5 Aug 2015 12:38:20 +0000 (13:38 +0100)] 
Do not complain about SPECIALISE for INLINE

Fixes Trac #10721.
See Note [SPECIALISE on INLINE functions]

3 years agoAllow proper errors/warnings in core2core passes
Simon Peyton Jones [Wed, 5 Aug 2015 12:31:48 +0000 (13:31 +0100)] 
Allow proper errors/warnings in core2core passes

This patch makes it possible for core-to-core passes to emit
proper error messages and warnings.

  * New function CoreMonad.warnMsg

  * CoreMonad.warnMsg and errorMsg now print a proper warning/error
    message heading.

  * CoreMonad carries a SrcSpan, which is used in warning/error
    messages.  It is initialised to be the source file name, but
    a core-to-core pass could set it more specifically if it had
    better location information.

There was a bit of plumbing needed to get the filename to the
right place.

3 years agoAdd Fixity info for infix types
RyanGlScott [Wed, 5 Aug 2015 12:24:08 +0000 (14:24 +0200)] 
Add Fixity info for infix types

Template Haskell allows reification of fixity for infix functions and
data constructors, and not for infix types. This adds a `Fixity` field
to the relevant `Info` constructors that can have infix types (`ClassI`,
`TyConI`, and `FamilyI`).

I don't think that `VarI` or `PrimTyConI` can be infix, but I could be
wrong.

Test Plan: ./validate

Reviewers: austin, goldfire, bgamari

Reviewed By: goldfire, bgamari

Subscribers: thomie

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

GHC Trac Issues: #10704

3 years agoAdditions to users' guide and release notes
RyanGlScott [Wed, 5 Aug 2015 12:23:32 +0000 (14:23 +0200)] 
Additions to users' guide and release notes

This makes two changes to the documentation:

* Adds a comment in the release notes about the ability to
  quote primitive chars and strings in TH (see D1054)
* Removes an outdated comment in the users' guide about TH not
  being able to handle `PartialTypeSignatures` (which was fixed in
  D1048)

Reviewers: goldfire, austin, simonpj, bgamari

Reviewed By: simonpj, bgamari

Subscribers: thomie

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

3 years agoMake sure that `all`, `any`, `and`, and `or` fuse (#9848)
Takano Akio [Wed, 5 Aug 2015 12:23:22 +0000 (14:23 +0200)] 
Make sure that `all`, `any`, `and`, and `or` fuse (#9848)

Test Plan: validate

Reviewers: hvr, austin, bgamari, simonpj

Reviewed By: simonpj

Subscribers: simonpj, thomie

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

GHC Trac Issues: #9848

3 years agoMake Exception datatypes into newtypes
RyanGlScott [Wed, 5 Aug 2015 12:23:12 +0000 (14:23 +0200)] 
Make Exception datatypes into newtypes

Certain instances of `Exception` are simply datatypes with only one
argument, which should be `newtype`s.

Reviewers: ekmett, hvr, austin, bgamari

Reviewed By: bgamari

Subscribers: thomie

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

GHC Trac Issues: #10738

3 years agoMake -fcpr-off a dynamic flag
Christiaan Baaij [Wed, 5 Aug 2015 12:22:14 +0000 (14:22 +0200)] 
Make -fcpr-off a dynamic flag

Test Plan: validate

Reviewers: austin, goldfire, simonpj, bgamari

Reviewed By: bgamari

Subscribers: rwbarton, thomie

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

GHC Trac Issues: #10706

3 years agoDrop custom mapM impl for []
Ben Gamari [Wed, 5 Aug 2015 12:21:47 +0000 (14:21 +0200)] 
Drop custom mapM impl for []

See https://mail.haskell.org/pipermail/libraries/2015-May/025708.html
for motivation.

This fixes #10457

Test Plan: Validate

Reviewers: hvr, austin

Subscribers: simonmar, thomie, dolio

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

GHC Trac Issues: #10457

3 years agousers_guide: Add note about #367 to Bugs section
Ben Gamari [Wed, 5 Aug 2015 12:21:28 +0000 (14:21 +0200)] 
users_guide: Add note about #367 to Bugs section

This is a long-standing bug and should be mentioned in the users guide,
as noted in #10639.

Test Plan: Carefully check language.

Reviewers: simonpj, rwbarton, austin

Subscribers: rwbarton, thomie

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

GHC Trac Issues: #10639, #367

3 years agoAdd framework flags when linking a dynamic library
Christiaan Baaij [Wed, 5 Aug 2015 12:20:56 +0000 (14:20 +0200)] 
Add framework flags when linking a dynamic library

This fixes the GHC side of trac #10568. So `cabal install
--ghc-options="-framework GLUT" GLUT` creates a correctly linked
GLUT.dylib. We still need to explictly pass `--ghc-options="-framework
GLUT"` because the Cabal side #10568 is not fixed.

Update: the Cabal side of #10568 is fixed by
[Cabal#2747](https://github.com/haskell/cabal/pull/2747)

Test Plan: validate

Reviewers: austin, rwbarton, bgamari

Reviewed By: bgamari

Subscribers: rwbarton, thomie

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

GHC Trac Issues: #10568

3 years agoTestsuite wibbles
Richard Eisenberg [Wed, 5 Aug 2015 12:40:49 +0000 (08:40 -0400)] 
Testsuite wibbles

3 years agoTestsuite wibbles
Richard Eisenberg [Wed, 5 Aug 2015 12:36:20 +0000 (08:36 -0400)] 
Testsuite wibbles

3 years agoWibble to TypeEqOrigin for better errors
Richard Eisenberg [Wed, 5 Aug 2015 12:36:00 +0000 (08:36 -0400)] 
Wibble to TypeEqOrigin for better errors

3 years agoTestsuite wibbles
Richard Eisenberg [Wed, 5 Aug 2015 12:31:09 +0000 (08:31 -0400)] 
Testsuite wibbles

3 years agoPreserve yet more synonyms
Richard Eisenberg [Wed, 5 Aug 2015 12:16:58 +0000 (08:16 -0400)] 
Preserve yet more synonyms

3 years agoTestsuite wibbles
Richard Eisenberg [Wed, 5 Aug 2015 12:03:18 +0000 (08:03 -0400)] 
Testsuite wibbles

3 years agoPretty: use replicate for spaces and multi_ch (#10735)
Thomas Miedema [Tue, 4 Aug 2015 16:32:09 +0000 (18:32 +0200)] 
Pretty: use replicate for spaces and multi_ch (#10735)

Similar changes were made to pretty in commit
7575ab16430c876eaa1451b02465b6b103b3a519.

3 years agoPretty: mimic pretty API more closely (#10735)
Thomas Miedema [Tue, 4 Aug 2015 14:20:08 +0000 (16:20 +0200)] 
Pretty: mimic pretty API more closely (#10735)

Refactoring only. Nothing much to see here.

3 years agoPretty: use BangPatterns instead of manual unboxing Ints (#10735)
Thomas Miedema [Mon, 3 Aug 2015 18:16:58 +0000 (20:16 +0200)] 
Pretty: use BangPatterns instead of manual unboxing Ints (#10735)

Follow same style as libraries/pretty, although some of it is pretty
archaic, and could be improved with BangPatterns:
   * `get w _ | w == 0 && False = undefined`
   * `mkNest k _ | k `seq` False = undefined`

3 years agoPretty: Args of NilAbove/TextBeside/Nest/Union are always RDocs (#10735)
Thomas Miedema [Mon, 3 Aug 2015 17:34:36 +0000 (19:34 +0200)] 
Pretty: Args of NilAbove/TextBeside/Nest/Union are always RDocs (#10735)

Just following libraries/pretty.

3 years agoPretty: kill code that has been dead since 1997 (#10735)
Thomas Miedema [Mon, 3 Aug 2015 17:23:21 +0000 (19:23 +0200)] 
Pretty: kill code that has been dead since 1997 (#10735)

3 years agoPretty: remove superfluous parenthesis (#10735)
Thomas Miedema [Mon, 3 Aug 2015 16:57:06 +0000 (18:57 +0200)] 
Pretty: remove superfluous parenthesis (#10735)

3 years agoPretty: improve error messages (#10735)
Thomas Miedema [Mon, 3 Aug 2015 16:27:07 +0000 (18:27 +0200)] 
Pretty: improve error messages (#10735)

Again, following libraries/pretty.

3 years agoPretty: rename variables to the ones used by libraries/pretty (#10735)
Thomas Miedema [Mon, 3 Aug 2015 16:05:28 +0000 (18:05 +0200)] 
Pretty: rename variables to the ones used by libraries/pretty (#10735)

3 years agoPretty: reformat using style from libraries/pretty (#10735)
Thomas Miedema [Mon, 3 Aug 2015 14:36:42 +0000 (16:36 +0200)] 
Pretty: reformat using style from libraries/pretty (#10735)

This commit copies the code structure (what goes where), whitespace layout
and comments from libraries/pretty/src/Text/PrettyPrint/HughesPJ.hs,
with the intention to be able to later more easily compare the two
files, and port bug fixes.

I'm sorry this messes up git blame history, but there's no other way.

3 years agoAvoid expanding synonyms in tcSubType
Richard Eisenberg [Wed, 5 Aug 2015 03:14:35 +0000 (23:14 -0400)] 
Avoid expanding synonyms in tcSubType

3 years agoTestsuite wibble
Richard Eisenberg [Wed, 5 Aug 2015 03:04:20 +0000 (23:04 -0400)] 
Testsuite wibble

3 years agoTrack full type better in matchExpectedFunTys
Richard Eisenberg [Wed, 5 Aug 2015 02:59:09 +0000 (22:59 -0400)] 
Track full type better in matchExpectedFunTys

3 years agoTestsuite wibbles
Richard Eisenberg [Wed, 5 Aug 2015 02:38:11 +0000 (22:38 -0400)] 
Testsuite wibbles

3 years agoMore error improving
Richard Eisenberg [Wed, 5 Aug 2015 02:23:30 +0000 (22:23 -0400)] 
More error improving

3 years agoTestsuite wibbles
Richard Eisenberg [Wed, 5 Aug 2015 02:18:15 +0000 (22:18 -0400)] 
Testsuite wibbles

3 years agoCleverly use a *landmark* context when it might be empty
Richard Eisenberg [Wed, 5 Aug 2015 02:04:45 +0000 (22:04 -0400)] 
Cleverly use a *landmark* context when it might be empty

3 years agoImprove ddump-tc-trace in TcErrors
Richard Eisenberg [Wed, 5 Aug 2015 01:36:45 +0000 (21:36 -0400)] 
Improve ddump-tc-trace in TcErrors

3 years agoImprove error messages
Richard Eisenberg [Wed, 5 Aug 2015 01:34:41 +0000 (21:34 -0400)] 
Improve error messages

3 years agoPropagate CtOrigins for better errors
Richard Eisenberg [Tue, 4 Aug 2015 15:47:18 +0000 (11:47 -0400)] 
Propagate CtOrigins for better errors

3 years agoTest #9233 in perf/compiler/T9233
Richard Eisenberg [Mon, 3 Aug 2015 15:11:04 +0000 (11:11 -0400)] 
Test #9233 in perf/compiler/T9233

Summary:
Ideally, we could use Phab's numbers to set the perf
test correctly. But even if that's not possible, then I need help
writing my `all.T`. With the version you see here, I get the following

```
Traceback (most recent call last):
  File "/Users/rae/Documents/ghc-valid/testsuite/driver/testlib.py", line 801, in do_test
    result = func(*[name,way] + args)
TypeError: multimod_compile() takes exactly 4 arguments (6 given)
```

I don't know how to fix this.

Test Plan: validate

Reviewers: austin, bgamari, thomie

Subscribers: thomie

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

GHC Trac Issues: #9233

3 years agoFix #10713.
Richard Eisenberg [Mon, 3 Aug 2015 12:53:03 +0000 (08:53 -0400)] 
Fix #10713.

When doing the apartness/flattening thing, we really only need to
eliminate non-generative tycons, not *all* families. (Data families
are indeed generative!)

3 years agoRemoved deprecated syntax for GADT constuctors.
Ulya Trofimovich [Mon, 3 Aug 2015 15:45:56 +0000 (17:45 +0200)] 
Removed deprecated syntax for GADT constuctors.

Old syntax was deprecated 6 years ago in this commit
432b9c9322181a3644083e3c19b7e240d90659e7 by simonpj:"New syntax for
GADT-style record declarations, and associated refactoring" discussed
in Trac #3306.

This patch removes 2 reduce/reduce conflicts in parser. Conflicting
productions were:

```
    gadt_constr -> con_list '::' sigtype
    gadt_constr -> oqtycon '{' fielddecls '}' '::' sigtype
```

Recursive inlining of `con_list` and `oqtycon` helped reveal the
conflict:

```
    gadt_constr -> '(' CONSYM ')' '::' sigtype
    gadt_constr -> '(' CONSYM ')' '{' fielddecls '}' '::' sigtype
```

between two types of GADT constructors (second form stands for
deprecated syntax).

Test Plan: `make fasttest`, one breakage TEST="records-fail" (parse
error instead of typecheck error due to removal of deprecated syntax).
Updated test.

Reviewers: simonmar, bgamari, austin, simonpj

Reviewed By: simonpj

Subscribers: thomie, mpickering, trofi

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

GHC Trac Issues: #3306

3 years agoCmmParse: Don't force alignment in memcpy-ish operations
Ben Gamari [Mon, 3 Aug 2015 13:31:03 +0000 (15:31 +0200)] 
CmmParse: Don't force alignment in memcpy-ish operations

This was initially made in 681973c31c614185229bdae4f6b7ab4f6e64753d.
Here I wanted to enforce that the alignment passed to %memcpy was a
constant expression, as this is required by LLVM. However, this breaks
the knot-tying done in `loopDecls`, causing T8131 to hang.

Here I remove the `seq` and mark T8131 as `expect_broken` in the case
of the NCG, which doesn't force the alignment in this case.

Fixes #10664.

3 years agoTypos in comments [skip ci]
Gabor Greif [Mon, 3 Aug 2015 11:38:48 +0000 (13:38 +0200)] 
Typos in comments [skip ci]

3 years agoSupport wild cards in data/type family instances
Thomas Winant [Mon, 3 Aug 2015 12:57:40 +0000 (14:57 +0200)] 
Support wild cards in data/type family instances

Handle anonymous wild cards in type or data family instance
declarations like
unnamed type variables. For instance (pun intented):

    type family F (a :: *) (b :: *) :: *
    type instance F Int _ = Int

Is now the same as:

    type family F (a :: *) (b :: *) :: *
    type instance F Int x = Int

Note that unlike wild cards in partial type signatures, no errors (or
warnings
with -XPartialTypeSignatures) are generated for these wild cards, as
there is
nothing interesting to report to the user, i.e. the inferred kind.

Only anonymous wild cards are supported here, named and
extra-constraints wild
card are not.

Test Plan: pass new tests

Reviewers: goldfire, austin, simonpj, bgamari

Reviewed By: simonpj, bgamari

Subscribers: goldfire, thomie

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

GHC Trac Issues: #3699, #10586

3 years ago4 reduce/reduce parser conflicts resolved
Ulya Trofimovich [Mon, 3 Aug 2015 12:56:16 +0000 (14:56 +0200)] 
4 reduce/reduce parser conflicts resolved

As GHC documentation (section 7.4.4, Type operators) says:
> "There is now some potential ambiguity in import and export lists;
for example if you write import M( (+) ) do you mean the function (+)
or the type constructor (+)? The default is the former, but with
-XExplicitNamespaces (which is implied by -XExplicitTypeOperators) GHC
allows you to specify the latter by preceding it with the keyword type"

Turns out this ambiguity causes 4 of 6 reduce/reduce conflicts in GHC
parser.  All 4 conflicts arise from a single production:

    qcname
        :  qvar
        |  oqtycon

Recursive inlining of 'qvar' and 'oqtycon' helps reveal the faulty
productions:

    qcname
        :
    ...
        | '(' QVARSYM ')'
        | '(' VARSYM ')'
        | '(' '*'    ')'
        | '(' '-'    ')'

These productions can either be parsed as variable or type constructor,
but variable constuctor is always preferred. My patch removes ambiguity
while preserving the existing behaviour:

  - all unambigous productions are left as-is
  - ambigous productions for variable constuctors are left
  - ambigous productions for type constructors are removed (there's no
    way they could be triggered)

Updated comment.

Test Plan: Tested with 'make fasttest'

Reviewers: austin, simonpj, trofi, bgamari, simonmar

Reviewed By: trofi, bgamari, simonmar

Subscribers: thomie, mpickering

Projects: #ghc

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

3 years agoTest Trac #10134
Simon Peyton Jones [Mon, 3 Aug 2015 12:39:56 +0000 (13:39 +0100)] 
Test Trac #10134

3 years agoMinor improvement to user guide
Simon Peyton Jones [Mon, 3 Aug 2015 10:07:08 +0000 (11:07 +0100)] 
Minor improvement to user guide

Specify that the type variables for a class/instance decl scope
over the body even without a 'forall'.

Provoked by Trac #10722.

3 years agoTypos in comments
Simon Peyton Jones [Mon, 3 Aug 2015 10:04:22 +0000 (11:04 +0100)] 
Typos in comments

3 years agoFix incorrect stack pointer usage in StgRun() on x86_64
Ben Gamari [Mon, 3 Aug 2015 06:42:00 +0000 (08:42 +0200)] 
Fix incorrect stack pointer usage in StgRun() on x86_64

The STG_RETURN code from StgCRun.c is incorrect for x86_64 variants
where the ABI doesn't impose a mandatory red zone for the stack, like on
Windows or Xen/HaLVM. The current implementation restores the stack
pointer first, which effectively marks the area with the saved registers
as reusable. Later, the CPU registers are restored from this "free"
area.

This ordering happens to work by accident on operating systems that
strictly adhere to the System V ABI, because any interrupt/signal
delivery is guaranteed to leave the first 128 bytes past the stack
pointer untouched (red zone). On other systems this might result in
corrupted CPU registers if an interruption happens just after restoring
the stack pointer.

The red zone is usually only used by small leaf functions to avoid
updates to the stack pointer and exploiting it doesn't give us any
advantage in this case.

Reviewers: austin, rwbarton

Reviewed By: rwbarton

Subscribers: thomie, simonmar

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

GHC Trac Issues: #10155

3 years agoUpdate parallel submodule, and re-enable warnings
Simon Marlow [Mon, 3 Aug 2015 06:41:45 +0000 (08:41 +0200)] 
Update parallel submodule, and re-enable warnings

Test Plan: using remote validate

Reviewers: austin, hvr, simonpj, bgamari

Reviewed By: bgamari

Subscribers: thomie

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

3 years agoSupport MO_U_QuotRem2 in LLVM backend
Michal Terepeta [Mon, 3 Aug 2015 06:41:13 +0000 (08:41 +0200)] 
Support MO_U_QuotRem2 in LLVM backend

This adds support for MO_U_QuotRem2 in LLVM backend.  Similarly to
MO_U_Mul2 we use the standard LLVM instructions (in this case 'udiv'
and 'urem') but do the computation on double the word width (e.g., for
64-bit we will do them on 128 registers).

Test Plan: validate

Reviewers: rwbarton, austin, bgamari

Reviewed By: bgamari

Subscribers: thomie

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

GHC Trac Issues: #9430