3 years agoTypos in DmdAnal
Ömer Sinan Ağacan [Sun, 1 May 2016 07:14:29 +0000 (03:14 -0400)] 
Typos in DmdAnal

3 years agoComment typo: unambigious -> unambiguous
Ryan Scott [Sat, 30 Apr 2016 18:34:25 +0000 (14:34 -0400)] 
Comment typo: unambigious -> unambiguous

[ci skip]

3 years agoComment typos: Mkae -> Make, Hsakell -> Haskell
RyanGlScott [Sat, 30 Apr 2016 18:10:30 +0000 (14:10 -0400)] 
Comment typos: Mkae -> Make, Hsakell -> Haskell

[ci skip]

3 years agoFix reference to Note in TcCanonical
RyanGlScott [Sat, 30 Apr 2016 18:06:31 +0000 (14:06 -0400)] 
Fix reference to Note in TcCanonical

Previously, it was referring to Note [Decomposing equalities],
but the name of it is actually  Note [Decomposing equality].

[ci skip]

3 years agoTestsuite: accept new output for 2 partial-sigs tests
Thomas Miedema [Thu, 28 Apr 2016 13:49:24 +0000 (15:49 +0200)] 
Testsuite: accept new output for 2 partial-sigs tests

Test Plan: make TEST='ExtraNumAMROn TidyClash2'

Differential Revision:

GHC Trac Issues: #9478

3 years agoTestsuite: make CLEANUP=1 the default (#9758)
Thomas Miedema [Tue, 26 Apr 2016 13:12:05 +0000 (15:12 +0200)] 
Testsuite: make CLEANUP=1 the default (#9758)

Also move the `cleanup` setting from `default_testopts` to `config`. The
`cleanup` setting is the same for all tests, hence it belongs in

Reviewed by: austin

Differential Revision:

3 years agoPPC NCG: Improve pointer de-tagging code
Peter Trommler [Fri, 29 Apr 2016 17:45:10 +0000 (17:45 +0000)] 
PPC NCG: Improve pointer de-tagging code

Generate a clrr[wd]i instruction to clear the tag bits in a pointer.
This saves one instruction and one temporary register.

Optimize signed comparison with zero after andi. operation This saves
one instruction when comparing a pointer tag with zero.

This reduces code size by 0.6 % in all nofib benchmarks.

Test Plan: validate on AIX and 32-bit Linux

Reviewed By: erikd, hvr

Differential Revision:

3 years agoFix typo: Superclases -> Superclasses
Bartosz Nitka [Fri, 29 Apr 2016 14:46:24 +0000 (07:46 -0700)] 
Fix typo: Superclases -> Superclasses

3 years agoTest #11484 in th/T11484
Richard Eisenberg [Tue, 26 Apr 2016 18:07:08 +0000 (14:07 -0400)] 
Test #11484 in th/T11484

3 years agoRemove the incredibly hairy splitTelescopeTvs.
Richard Eisenberg [Tue, 26 Apr 2016 14:50:33 +0000 (10:50 -0400)] 
Remove the incredibly hairy splitTelescopeTvs.

This patch removes splitTelescopeTvs by adding information about
scoped type variables to TcTyCon. Vast simplification!

This also fixes #11821 by bringing only unzonked vars into scope.

Test case: polykinds/T11821

3 years agoRTS: delete BlockedOnGA* + dead code
Thomas Miedema [Sat, 27 Feb 2016 21:02:22 +0000 (22:02 +0100)] 
RTS: delete BlockedOnGA* + dead code

Some old stuff related to the PAR way.

Reviewed by: austin, simonmar

Differential Revision:

3 years agotestsuite: fix up T11223's Makefile
Austin Seipp [Thu, 28 Apr 2016 23:42:55 +0000 (23:42 +0000)] 
testsuite: fix up T11223's Makefile

As reported by Simon on ghc-devs, this causes the build on Windows
to fail because it cannot find the `cc` command. The Makefile here
actually already sets `GCC=gcc`, but for some reason then uses both
`$(GCC)` and `$(CC)` to refer to C compilation.

Signed-off-by: Austin Seipp <>
Reviewed By: thomie

Differential Revision:

3 years agoFix path to the new build system, now called Hadrian.
Andrey Mokhov [Thu, 28 Apr 2016 22:32:14 +0000 (23:32 +0100)] 
Fix path to the new build system, now called Hadrian.

The new Shake-based build system has been given a name -- Hadrian,
and now lives in /hadrian directory.

This fixes the path to the configuration file to be populated by
the configure script.

Test Plan: Run Hadrian build.

Reviewers: thomie, bgamari, hvr, austin

Reviewed By: austin

Subscribers: erikd

Differential Revision:

3 years agoRemove unused foldNameEnv
Bartosz Nitka [Thu, 28 Apr 2016 22:27:17 +0000 (15:27 -0700)] 
Remove unused foldNameEnv

foldNameEnv is nondeterministic in the general case and it's
currently unused so we can remove it.

3 years agoRemove unused foldFsEnv
Bartosz Nitka [Thu, 28 Apr 2016 21:56:28 +0000 (14:56 -0700)] 
Remove unused foldFsEnv

foldFsEnv is nondeterministic in the general case and since it's
unused we can just remove it.

3 years agoLinker: Fix implicit function declaration warning on OS X
Erik de Castro Lopo [Tue, 26 Apr 2016 21:01:26 +0000 (07:01 +1000)] 
Linker: Fix implicit function declaration warning on OS X

Introduced in commit 177aec697b3.

Test Plan: Validate on OSX and Linux.

Reviewers: austin, bgamari, hvr

Subscribers: goldfire, thomie

Differential Revision:

3 years agorts/LdvProfile.c: Fix NULL dereference on shutdown
Erik de Castro Lopo [Thu, 28 Apr 2016 21:15:53 +0000 (07:15 +1000)] 
rts/LdvProfile.c: Fix NULL dereference on shutdown

Test Plan: validate

Reviewers: carter, austin, simonmar, bgamari

Reviewed By: simonmar, bgamari

Subscribers: thomie

Differential Revision:

GHC Trac Issues: #11978

3 years agoTestsuite: delete T5054 and T5054_2 (#5054)
Thomas Miedema [Mon, 25 Apr 2016 15:22:55 +0000 (17:22 +0200)] 
Testsuite: delete T5054 and T5054_2 (#5054)

These tests no longer compile, because the hmatrix api has completely
changed. Even if we managed to fix the tests, I don't think they would
provided much value, since the ghc/llvm bug from #5054 was not
reproducible in the first place.

Reviewed by: bgamari

Differential Revision:

3 years agoTestsuite: delete -fesc tests
Thomas Miedema [Mon, 25 Apr 2016 18:28:23 +0000 (20:28 +0200)] 
Testsuite: delete -fesc tests

The -fesc flag does not exist, and has never existed.

Also delete now unused config.compiler_tags, and 'Project version' never
contains a '-'.

Reviewed by: bgamari

Differential Revision:

3 years agoKill mapUniqSet
Bartosz Nitka [Thu, 28 Apr 2016 20:35:14 +0000 (13:35 -0700)] 
Kill mapUniqSet

Note [Unsound mapUniqSet] explains why it got removed.

Test Plan: build ghc

Reviewers: simonpj, austin, bgamari

Reviewed By: bgamari

Subscribers: thomie, simonmar

Differential Revision:

3 years agoAdd uniqSetAny and uniqSetAll and use them
Bartosz Nitka [Thu, 28 Apr 2016 20:32:39 +0000 (13:32 -0700)] 
Add uniqSetAny and uniqSetAll and use them

There are couple of places where we do `foldUniqSet` just to
compute `any` or `all`. `foldUniqSet` is non-deterministic in the
general case and `any` and `all` also read nicer.

Test Plan: ./validate

Reviewers: simonmar, goldfire, simonpj, bgamari, austin

Reviewed By: simonpj

Subscribers: thomie

Differential Revision:

GHC Trac Issues: #4012

3 years agoTestsuite: benign test fixes
Thomas Miedema [Thu, 28 Apr 2016 15:08:53 +0000 (17:08 +0200)] 
Testsuite: benign test fixes

3 years agoTestsuite: fix T11223_simple_(unused_)duplicate_lib
Thomas Miedema [Thu, 28 Apr 2016 09:55:40 +0000 (11:55 +0200)] 
Testsuite: fix T11223_simple_(unused_)duplicate_lib

These tests were failing on Travis when run independently from

3 years agoTestsuite: add -ignore-dot-ghci to some ghci tests [skip ci]
Thomas Miedema [Thu, 28 Apr 2016 09:49:02 +0000 (11:49 +0200)] 
Testsuite: add -ignore-dot-ghci to some ghci tests [skip ci]

3 years agoTestsuite: delete accidentally committed .stderr.normalised file
Thomas Miedema [Wed, 27 Apr 2016 15:11:31 +0000 (17:11 +0200)] 
Testsuite: delete accidentally committed .stderr.normalised file

[skip ci]

3 years agoKill unused foldOccSet
Bartosz Nitka [Thu, 28 Apr 2016 16:51:56 +0000 (09:51 -0700)] 
Kill unused foldOccSet

foldOccSet if used would be a potential source of nondeterminism.
Since it's not used we can just remove it.

3 years agoRevert "Use __builtin_clz() to implement log_2()"
Simon Peyton Jones [Thu, 28 Apr 2016 14:20:43 +0000 (15:20 +0100)] 
Revert "Use __builtin_clz() to implement log_2()"

This reverts commit 24864ba5587c1a0447beabae90529e8bb4fa117a.

3 years agoFix debug-only check in CoreLint
Simon Peyton Jones [Thu, 28 Apr 2016 16:27:02 +0000 (17:27 +0100)] 
Fix debug-only check in CoreLint

3 years agoBetter documentation of -XConstrainedClassMethods
Simon Peyton Jones [Thu, 28 Apr 2016 14:56:09 +0000 (15:56 +0100)] 
Better documentation of -XConstrainedClassMethods

3 years agoRefactor RecordPatSynField, FieldLabel
Simon Peyton Jones [Thu, 28 Apr 2016 14:52:29 +0000 (15:52 +0100)] 
Refactor RecordPatSynField, FieldLabel

This patch uses the named fields of
 * FieldLabel
 * RecordPatSynField
in construction and pattern matching. The fields
existed before, but we were often using positional notation.

Also a minor refactor of the API of mkPatSynRecSelBinds

No change in functionality

3 years agoAdd missing solveEqualities
Simon Peyton Jones [Mon, 25 Apr 2016 15:17:34 +0000 (16:17 +0100)] 
Add missing solveEqualities

I'd missed a call to solveEqualities in the partial-type-sig case
of TcBinds.tcUserTypeSig.

Also the checkValidType test done there best done after inference,
in checkInferredPolyId (and is already done there).

Fixes Trac #11976

3 years agoRemove unused unifyType_
Simon Peyton Jones [Mon, 25 Apr 2016 15:17:07 +0000 (16:17 +0100)] 
Remove unused unifyType_

3 years agoComments only
Simon Peyton Jones [Mon, 25 Apr 2016 15:16:49 +0000 (16:16 +0100)] 
Comments only

3 years agoMinor improvement to error message
Simon Peyton Jones [Mon, 25 Apr 2016 15:16:04 +0000 (16:16 +0100)] 
Minor improvement to error message

"One fewer arguments to ..." rather than
"One fewer argument to ..."

3 years agoComments only
Simon Peyton Jones [Mon, 25 Apr 2016 15:13:38 +0000 (16:13 +0100)] 
Comments only

3 years agoKill varSetElems in injImproveEqns
Bartosz Nitka [Thu, 28 Apr 2016 12:40:39 +0000 (05:40 -0700)] 
Kill varSetElems in injImproveEqns

We want to remove varSetElems at the source level because it
might be a source of nondeterminism. I don't think it introduces
nondeterminism here, but it's easy to do the same thing
deterministically for the same price.

instFlexiTcS :: [TKVar] -> TcS (TCvSubst, [TcType])
instFlexiTcS currently gives the range of the produced substitution
as the second element of the tuple, but it's not used anywhere
right now. If it started to be used in the code I'm modifying
it would cause nondeterminism problems.

Test Plan: ./validate

Reviewers: austin, goldfire, bgamari, simonmar, simonpj

Reviewed By: simonpj

Subscribers: thomie

Differential Revision:

GHC Trac Issues: #4012

3 years agoExpand the comment on pprVarSet
Bartosz Nitka [Thu, 28 Apr 2016 12:35:31 +0000 (05:35 -0700)] 
Expand the comment on pprVarSet

3 years agoUpdate nofib submodule to nofib master
Joachim Breitner [Thu, 28 Apr 2016 10:59:12 +0000 (12:59 +0200)] 
Update nofib submodule to nofib master

with changes to nofib-analyse:
 * up-to-date parsing of output lines with recent GHC under
 * a few reporting improvements.

3 years agoRecommend more reliable recourse for broken nm
Ben Gamari [Thu, 28 Apr 2016 08:11:13 +0000 (10:11 +0200)] 
Recommend more reliable recourse for broken nm

xcrun --find seems like the appropriate choice here. Thanks to Brandon
Allbery for suggesting this.

3 years agoDocument -fmax-pmcheck-iterations a bit better
Ben Gamari [Wed, 27 Apr 2016 07:57:41 +0000 (09:57 +0200)] 
Document -fmax-pmcheck-iterations a bit better

3 years agoImplement the state hack without modifiyng OneShotInfo
Joachim Breitner [Wed, 20 Apr 2016 08:46:41 +0000 (10:46 +0200)] 
Implement the state hack without modifiyng OneShotInfo

Previously, the state hack would be implemented in mkLocalId, by looking
at the type, and setting the OneShot flag accordingly.

This patch changes this so that the OneShot flag faithfully represents
what our various analyses found out, and the State Hack is implemented
by adjusting the accessors, in particular isOneShotBndr and
idStateHackOneShotInfo. This makes it easier to understand what's going
on in the analyses, and de-clutters core dumps and interface files.

I don’t expect any change in behaviour, at least not in non-fringe

3 years agoKill varSetElems in markNominal
Bartosz Nitka [Tue, 26 Apr 2016 20:04:08 +0000 (13:04 -0700)] 
Kill varSetElems in markNominal

varSetElems introduces unnecessary nondeterminism and it was
straighforward to just get a deterministic list.

Test Plan: ./validate

Reviewers: austin, goldfire, bgamari, simonmar, simonpj

Reviewed By: simonpj

Subscribers: thomie

Differential Revision:

GHC Trac Issues: #4012

3 years agoKill varSetElems try_tyvar_defaulting
Bartosz Nitka [Tue, 26 Apr 2016 16:51:26 +0000 (09:51 -0700)] 
Kill varSetElems try_tyvar_defaulting

`varSetElems` introduces unnecessary nondeterminism and we can do
the same thing deterministically for the same price.

Test Plan: ./validate

Reviewers: goldfire, austin, simonmar, bgamari, simonpj

Reviewed By: simonpj

Subscribers: thomie

Differential Revision:

GHC Trac Issues: #4012

3 years agoKill varSetElems in TcErrors
Bartosz Nitka [Tue, 26 Apr 2016 15:47:21 +0000 (08:47 -0700)] 
Kill varSetElems in TcErrors

The uses of varSetElems in these places are unnecessary and while it
doesn't intruduce non-determinism in the ABI the plan is to get
rid of all varSetElems to get some compile time guarantees.

Test Plan: ./validate

Reviewers: austin, simonmar, bgamari, goldfire, simonpj

Reviewed By: simonpj

Subscribers: thomie

Differential Revision:

GHC Trac Issues: #4012

3 years agoJust comments & reformatting
Simon Marlow [Sun, 24 Apr 2016 20:14:43 +0000 (21:14 +0100)] 
Just comments & reformatting

3 years agoUse __builtin_clz() to implement log_2()
Simon Marlow [Sat, 23 Apr 2016 21:14:43 +0000 (22:14 +0100)] 
Use __builtin_clz() to implement log_2()

A microoptimisation in the block allocator.

3 years agoDoc improvement for ApplicativeDo
Simon Marlow [Fri, 15 Apr 2016 23:24:59 +0000 (16:24 -0700)] 
Doc improvement for ApplicativeDo

Make it clearer that the final statement should be exactly
"(return|pure) E".

3 years agoGHCi: use real time instead of CPU time for :set -s
Simon Marlow [Fri, 15 Apr 2016 23:21:56 +0000 (16:21 -0700)] 
GHCi: use real time instead of CPU time for :set -s

CPU time is never very accurate, and it broke completely with
-fexternal-interpreter which runs the interpreted computations in a
separate process.

3 years agoRTS: Add setInCallCapability()
Simon Marlow [Tue, 18 Nov 2014 15:44:14 +0000 (15:44 +0000)] 
RTS: Add setInCallCapability()

This allows an OS thread to specify which capability it should run on
when it makes a call into Haskell.  It is intended for a fairly
specialised use case, when the client wants to have tighter control over
the mapping between OS threads and Capabilities - perhaps 1:1
correspondence, for example.

3 years agoKill varSetElemsWellScoped in quantifyTyVars
Bartosz Nitka [Tue, 26 Apr 2016 12:58:24 +0000 (05:58 -0700)] 
Kill varSetElemsWellScoped in quantifyTyVars

varSetElemsWellScoped introduces unnecessary non-determinism in
inferred type signatures.
Removing this instance required changing the representation of
TcDepVars to use deterministic sets.
This is the last occurence of varSetElemsWellScoped, allowing me to
finally remove it.

Test Plan:
I will update the expected outputs when commiting, some reordering
of type variables in types is expected.

Reviewers: goldfire, simonpj, austin, bgamari

Reviewed By: simonpj

Subscribers: thomie, simonmar

Differential Revision:

GHC Trac Issues: #4012

3 years agoTestsuite: delete unused concurrent/prog002/FileIO.hs
Thomas Miedema [Mon, 25 Apr 2016 15:54:51 +0000 (17:54 +0200)] 
Testsuite: delete unused concurrent/prog002/FileIO.hs

3 years agoTestsuite: delete Roles9.stderr
Thomas Miedema [Mon, 25 Apr 2016 15:03:20 +0000 (17:03 +0200)] 
Testsuite: delete Roles9.stderr

In 99cd277c181dfb346d5f2d5fc9475379229037d0, goldfire deleted the Roles9
test, but not its stderr file.

3 years agoTestsuite: fixup lots of tests
Thomas Miedema [Mon, 25 Apr 2016 14:58:34 +0000 (16:58 +0200)] 
Testsuite: fixup lots of tests

These aren't run very often, because they require external libraries.

maessen-hashtab still doesn't compile, QuickCheck api changed.

Update submodule hpc.

3 years agoTestsuite: Delete test for deprecated "packedstring"
Thomas Miedema [Mon, 25 Apr 2016 12:55:38 +0000 (14:55 +0200)] 
Testsuite: Delete test for deprecated "packedstring"

3 years agoderiveConstants: Fix nm-classic error message
Ben Gamari [Sun, 24 Apr 2016 09:31:51 +0000 (11:31 +0200)] 
deriveConstants: Fix nm-classic error message

Thanks to George Colpitts for the suggestion.

3 years agoGet rid of varSetElemsWellScoped in abstractFloats
Bartosz Nitka [Fri, 22 Apr 2016 16:47:30 +0000 (09:47 -0700)] 
Get rid of varSetElemsWellScoped in abstractFloats

It's possible to get rid of this use site in a local way
and it introduces unneccessary nondeterminism.

Test Plan: ./validate

Reviewers: simonmar, goldfire, austin, bgamari, simonpj

Reviewed By: simonpj

Subscribers: thomie

Differential Revision:

GHC Trac Issues: #4012

3 years agoMake benign non-determinism in pretty-printing more obvious
Bartosz Nitka [Mon, 18 Apr 2016 14:32:03 +0000 (07:32 -0700)] 
Make benign non-determinism in pretty-printing more obvious

This change takes us one step closer to being able to remove
`varSetElemsWellScoped`. The end goal is to make every source
of non-determinism obvious at the source level, so that when
we achieve determinism it doesn't get broken accidentally.

Test Plan: compile GHC

Reviewers: simonmar, goldfire, simonpj, austin, bgamari

Reviewed By: simonpj

Subscribers: thomie

Differential Revision:

GHC Trac Issues: #4012

3 years agoRemove unused tyCoVarsOfTelescope
Bartosz Nitka [Fri, 22 Apr 2016 12:51:36 +0000 (05:51 -0700)] 
Remove unused tyCoVarsOfTelescope

Grepping reveals that it's not used. I suspect that it isn't useful

Test Plan: grep

Reviewers: goldfire, austin, bgamari, simonpj

Reviewed By: simonpj

Subscribers: thomie, simonmar

Differential Revision:

3 years agoTypo: veraibles -> variables
Bartosz Nitka [Fri, 22 Apr 2016 12:20:54 +0000 (05:20 -0700)] 
Typo: veraibles -> variables

3 years agoFix typos: alpah -> alpha
Bartosz Nitka [Fri, 22 Apr 2016 11:02:08 +0000 (04:02 -0700)] 
Fix typos: alpah -> alpha

3 years agoRefactor free tyvars on LHS of rules
Simon Peyton Jones [Fri, 22 Apr 2016 09:47:14 +0000 (10:47 +0100)] 
Refactor free tyvars on LHS of rules

A RULE can have unbound meta-tyvars on the LHS.  Consider
  data T a = C

  foo :: T a -> Int
  foo C = 1

  {-# RULES "myrule"  foo C = 1 #-}

After type checking the LHS becomes (foo alpha (C alpah)) and we do
not want to zap the unbound meta-tyvar 'alpha' to Any, because that
limits the applicability of the rule.  Instead, we want to quantify
over it!

Previously there was a rather clunky implementation of this
quantification, buried in the zonker in TcHsSyn (zonkTvCollecting).

This patch refactors it so that the zonker just turns the meta-tyvar
into a skolem, and the desugarer adds the quantification.  See DsBinds
Note [Free tyvars on rule LHS]. As it happened, the desugarer was
already doing something similar for dictionaries. See DsBinds
Note [Free dictionaries on rule LHS]

No change in functionality, but less cruft.

3 years agoSimplify defaultKindVar and friends
Simon Peyton Jones [Thu, 21 Apr 2016 13:52:16 +0000 (14:52 +0100)] 
Simplify defaultKindVar and friends

I found zonkQuantifiedTyVar rather complicated, especially the two
places where we defaulted RuntimeRep variables. This simplifies and
modularises the story.

Refactoring only.

3 years agoAvoid double error on out-of-scope identifier
Simon Peyton Jones [Thu, 21 Apr 2016 13:34:07 +0000 (14:34 +0100)] 
Avoid double error on out-of-scope identifier

Trac #11941 demonstrated a case where an out-of-scope error also
gave rise to a (bogus and confusing) stage restriction message.

It's caused by the fact that out-of-scope errors do not stop
renaming, but rather return an "unbound name".  We need to
detect this in the stage-restriction test to avoid the double
error.  Easy fix.

3 years agoA little more debug tracing
Simon Peyton Jones [Thu, 21 Apr 2016 13:30:36 +0000 (14:30 +0100)] 
A little more debug tracing

3 years agowibble to simplifiable
Simon Peyton Jones [Thu, 21 Apr 2016 13:29:39 +0000 (14:29 +0100)] 
wibble to simplifiable

3 years agoTest Trac #3990
Simon Peyton Jones [Thu, 21 Apr 2016 12:29:37 +0000 (13:29 +0100)] 
Test Trac #3990

3 years agoWarn about simplifiable class constraints
Simon Peyton Jones [Thu, 21 Apr 2016 12:06:54 +0000 (13:06 +0100)] 
Warn about simplifiable class constraints

Provoked by Trac #11948, this patch adds a new warning to GHC


It warns if you write a class constraint in a type signature that
can be simplified by an existing instance declaration.  Almost always
this means you should simplify it right now; type inference is very
fragile without it, as #11948 shows.

I've put the warning as on-by-default, but I suppose that if there are
howls of protest we can move it out (as happened for -Wredundant-constraints.

It actually found an example of an over-complicated context in CmmNode.

Quite a few tests use these weird contexts to trigger something else,
so I had to suppress the warning in those.

The 'haskeline' library has a few occurrences of the warning (which
I think should be fixed), so I switched it off for that library in

The warning itself is done in TcValidity.check_class_pred.

HOWEVER, when type inference fails we get a type error; and the error
suppresses the (informative) warning.  So as things stand, the warning
only happens when it doesn't cause a problem.  Not sure what to do
about this, but this patch takes us forward, I think.

3 years agoDo not use defaulting in ambiguity check
Simon Peyton Jones [Thu, 21 Apr 2016 12:03:29 +0000 (13:03 +0100)] 
Do not use defaulting in ambiguity check

This fixes Trac #11947.  See TcSimplify
Note [No defaulting in the ambiguity check]

3 years agoImprove the behaviour of warnIf
Simon Peyton Jones [Thu, 21 Apr 2016 11:58:52 +0000 (12:58 +0100)] 
Improve the behaviour of warnIf

Now that warnIf takes a "reason", we can test the reason
in warnIf rather than in the caller.  Less code, and less
risk of getting the test and the reason out of sync.

3 years agotestsuite: Bump max bytes used of T4029
Ben Gamari [Thu, 21 Apr 2016 15:07:20 +0000 (17:07 +0200)] 
testsuite: Bump max bytes used of T4029

3 years agoRemove mysterious varSetElemsWellScoped in tidyFreeTyCoVars
Bartosz Nitka [Thu, 21 Apr 2016 10:49:30 +0000 (03:49 -0700)] 
Remove mysterious varSetElemsWellScoped in tidyFreeTyCoVars

Richard isn't sure why it's there and removing it didn't change

3 years agoPoint to note about FV eta-expansion performance
Bartosz Nitka [Wed, 20 Apr 2016 22:31:14 +0000 (15:31 -0700)] 
Point to note about FV eta-expansion performance

3 years agoRename FV related functions
Bartosz Nitka [Wed, 20 Apr 2016 16:51:05 +0000 (09:51 -0700)] 
Rename FV related functions

This is from Simon's suggestion:

* `tyCoVarsOfTypesAcc` is a terrible name for a function with a
  perfectly decent type `[Type] -> FV`. Maybe `tyCoFVsOfTypes`?
  Similarly others

* `runFVList` is also terrible, but also has a decent type.
  Maybe just `fvVarList` (and `fvVarSet` for `runFVSet`).

* `someVars` could be `mkFVs :: [Var] -> FV`.

3 years agoAccept tcrun045 output
Simon Peyton Jones [Wed, 20 Apr 2016 15:22:30 +0000 (16:22 +0100)] 
Accept tcrun045 output

My validate didn't catch this one; it is fallout
(actually an improvement) from
  353d8a SCC analysis for instances as well as types/classes

3 years agoBuild a correct substitution in dataConInstPat
Bartosz Nitka [Wed, 20 Apr 2016 16:35:47 +0000 (09:35 -0700)] 
Build a correct substitution in dataConInstPat

This adds the tyvars of the domain of the substitution into the in-scope
set as well.
What I'm not sure here is if the kinds can have any free vars that
should be in the in-scope set as well.

Test Plan: ./validate

Reviewers: goldfire, austin, bgamari, simonpj

Reviewed By: simonpj

Subscribers: thomie, simonmar

Differential Revision:

GHC Trac Issues: #11371

3 years agoKill unnecessary varSetElemsWellScoped in deriveTyData
Bartosz Nitka [Wed, 20 Apr 2016 15:54:10 +0000 (08:54 -0700)] 
Kill unnecessary varSetElemsWellScoped in deriveTyData

varSetElemsWellScoped introduces unnecessary non-determinism and it's possible
to do the same thing deterministically for the same price.

Test Plan: ./validate

Reviewers: austin, simonmar, bgamari, simonpj

Reviewed By: simonpj

Subscribers: thomie

Differential Revision:

GHC Trac Issues: #4012

3 years agoTighten up imports on TcTyClsDecls
Simon Peyton Jones [Wed, 20 Apr 2016 15:02:10 +0000 (16:02 +0100)] 
Tighten up imports on TcTyClsDecls

3 years agoFix two buglets in 17eb241 noticed by Richard
Simon Peyton Jones [Wed, 20 Apr 2016 14:56:44 +0000 (15:56 +0100)] 
Fix two buglets in 17eb241 noticed by Richard

These are corner cases in
   17eb241 Refactor computing dependent type vars
and I couldn't even come up with a test case

* In TcSimplify.simplifyInfer, in the promotion step, be sure
  to promote kind variables as well as type variables.

* In TcType.spiltDepVarsOfTypes, the CoercionTy case, be sure
  to get the free coercion variables too.

3 years agoSCC analysis for instances as well as types/classes
Simon Peyton Jones [Wed, 20 Apr 2016 11:56:40 +0000 (12:56 +0100)] 
SCC analysis for instances as well as types/classes

This big patch is in pursuit of Trac #11348.

It is largely the work of Alex Veith (thank you!), with some
follow-up simplification and refactoring from Simon PJ.

The main payload is described in RnSource
  Note [Dependency analysis of type, class, and instance decls]
which is pretty detailed.

* There is a new data type HsDecls.TyClGroup, for a strongly
  connected component of type/class/instance/role decls.

  The hs_instds field of HsGroup disappears, in consequence

  This forces some knock-on changes, including a minor
  haddock submodule update

Smaller, weakly-related things

* I found that both the renamer and typechecker were building an
  identical env for RoleAnnots, so I put common code for
  RoleAnnotEnv in RnEnv.

* I found that tcInstDecls1 had very clumsy error handling, so I
  put it together into TcInstDcls.doClsInstErrorChecks

3 years agoTighten up imports, white space
Simon Peyton Jones [Wed, 20 Apr 2016 11:39:19 +0000 (12:39 +0100)] 
Tighten up imports, white space

3 years agoDefine NameSet.intersectFVs
Simon Peyton Jones [Wed, 20 Apr 2016 11:31:01 +0000 (12:31 +0100)] 
Define NameSet.intersectFVs

I want it for subsequent commits

3 years agoReduce use of instances in hs-boot files
Simon Peyton Jones [Wed, 20 Apr 2016 11:26:03 +0000 (12:26 +0100)] 
Reduce use of instances in hs-boot files

Several things here

* GHC no longer allows user-written Typeable instances,
  so remove them from hs-boot files.

* Generally, reduce the use of instances in hs-boot files. They are
  hard to track.  Mainly this involves using pprType, pprKind etc
  instead of just ppr.  There were a lot of instances in hs-boot
  files that weren't needed at all.

* Take TyThing out of Eq; it was used in exactly one place (in
  InteractiveEval), and equality is too big a hammer for that.

3 years agoBump haddock submodule
Ben Gamari [Wed, 20 Apr 2016 08:59:32 +0000 (10:59 +0200)] 
Bump haddock submodule

Install files necessary for --hyperlinked-source. Fixes #11949.

3 years agoUpdate unix submodule to v2.7.2.0 release
Herbert Valerio Riedel [Tue, 19 Apr 2016 21:40:52 +0000 (23:40 +0200)] 
Update unix submodule to v2.7.2.0 release

3 years agoUpdate `pretty` submodule to v1.1.3.3 release
Herbert Valerio Riedel [Tue, 19 Apr 2016 21:09:15 +0000 (23:09 +0200)] 
Update `pretty` submodule to v1.1.3.3 release

3 years agoUpdate binary submodule to release
Herbert Valerio Riedel [Tue, 19 Apr 2016 20:33:58 +0000 (22:33 +0200)] 
Update binary submodule to release

3 years agoUpdate deepseq submodule to latest snapshot
Herbert Valerio Riedel [Tue, 19 Apr 2016 17:16:01 +0000 (19:16 +0200)] 
Update deepseq submodule to latest snapshot

NB: this needs 91ee5090f1e3f43e9e803cf7005a7f3357e58377

3 years agoMark GHC.Stack.Types Trustworthy
Herbert Valerio Riedel [Tue, 19 Apr 2016 16:32:29 +0000 (18:32 +0200)] 
Mark GHC.Stack.Types Trustworthy

GHC can't infer this module safe due to the `GHC.Types (Char, Int)`
and the  (dummy) `GHC.Integer ()` import.

If only `GHC.Types` was marked Trustworthy or Safe...

3 years agoUpdate hsc2hs submodule
Herbert Valerio Riedel [Tue, 19 Apr 2016 11:56:54 +0000 (13:56 +0200)] 
Update hsc2hs submodule

This bumps the hsc2hs version to 0.68

3 years agoKill dead TauTvFlavour, and move code around
Simon Peyton Jones [Mon, 18 Apr 2016 14:20:00 +0000 (15:20 +0100)] 
Kill dead TauTvFlavour, and move code around

This is just tidying up.

3 years agoTighten checking for associated type instances
Simon Peyton Jones [Mon, 18 Apr 2016 14:14:40 +0000 (15:14 +0100)] 
Tighten checking for associated type instances

This patch finishes off Trac #11450.  Following debate on that ticket,
the patch tightens up the rules for what the instances of an
associated type can look like.  Now they must match the instance
header exactly. Eg

   class C a b where
    type T a x b

With this class decl, if we have an instance decl
  instance C ty1 ty2 where ...
then the type instance must look like
     type T ty1 v ty2 = ...
with exactly
  - 'ty1' for 'a'
  -  'ty2' for 'b', and
  - a variable for 'x'

For example:

  instance C [p] Int
    type T [p] y Int = (p,y,y)

Previously we allowed multiple instance equations and now, in effect,
we don't since they would all overlap.  If you want multiple cases,
use an auxiliary type family.

This is consistent with the treatment of generic-default instances,
and the user manual always said "WARNING: this facility (multiple
instance equations may be withdrawn in the future".

I also improved error messages, and did other minor refactoring.

3 years agoRefactor computing dependent type vars
Simon Peyton Jones [Mon, 18 Apr 2016 14:01:13 +0000 (15:01 +0100)] 
Refactor computing dependent type vars

There should be no change in behaviour here

* Move splitDepVarsOfType(s) from Type to TcType

* Define data type TcType.TcDepVars, document what it means,
  and use it where appropriate, notably in splitDepVarsOfType(s)

* Use it in TcMType.quantifyTyVars and friends

3 years agoDefine TyCoRep.ppSuggestExplicitKinds, and use it
Simon Peyton Jones [Mon, 18 Apr 2016 13:54:03 +0000 (14:54 +0100)] 
Define TyCoRep.ppSuggestExplicitKinds, and use it

This just defines a useful helper function that was being
duplicated in several places

3 years agoRemove unused import of emptyNameEnv
Simon Peyton Jones [Mon, 18 Apr 2016 13:51:30 +0000 (14:51 +0100)] 
Remove unused import of emptyNameEnv

3 years agoUpdate `directory` submodule to v1.2.6.2 release
Herbert Valerio Riedel [Tue, 19 Apr 2016 07:00:54 +0000 (09:00 +0200)] 
Update `directory` submodule to v1.2.6.2 release

The v1.2.6.1 release uploaded to Hackage is broken, we don't
want to bundle a release that's non-installable from Hackage

3 years agorts: Don't use strndup
Ben Gamari [Mon, 18 Apr 2016 20:32:59 +0000 (22:32 +0200)] 
rts: Don't use strndup

Reviewers: austin

Subscribers: thomie

Differential Revision:

3 years agorts: Limit maximum backtrace depth
Ben Gamari [Sun, 10 Apr 2016 22:49:06 +0000 (00:49 +0200)] 
rts: Limit maximum backtrace depth

This prevents us from entering an infinite loop in the event of a
hitting bad unwinding information.

3 years agoRemove obsolete/redundant FLEXIBLE_ARRAY macro
Herbert Valerio Riedel [Mon, 18 Apr 2016 20:26:02 +0000 (22:26 +0200)] 
Remove obsolete/redundant FLEXIBLE_ARRAY macro

This macro is doubly redundant, first off all, ancient GCCs prior to
version 3.0 are not supported anymore, but more importantly, we require
a ISO C99 compliant compiler, so we can use the proper ISO C syntax
without worrying about compatibility.

Reviewers: austin, bgamari

Reviewed By: bgamari

Subscribers: carter, thomie

Differential Revision:

3 years agoUse stdint types to define SIZEOF and ALIGNMENT of INTx/WORDx
Tomas Carnecky [Mon, 18 Apr 2016 20:11:53 +0000 (22:11 +0200)] 
Use stdint types to define SIZEOF and ALIGNMENT of INTx/WORDx

Saves us a CPP #if in MachDeps.h since we now can always rely on a
64-bit type being available.

Reviewers: austin, bgamari

Reviewed By: bgamari

Subscribers: thomie, erikd

Differential Revision:

3 years agorelnotes: Add note about #11744 and workaround
Ben Gamari [Mon, 18 Apr 2016 13:13:41 +0000 (15:13 +0200)] 
relnotes: Add note about #11744 and workaround

Test Plan: Read it

Reviewers: hvr, austin

Subscribers: carter, thomie

Differential Revision:

GHC Trac Issues: #11744