| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This patch does a raft of useful tidy-ups in the type checker.
I've been meaning to do this for some time, and finally made
time to do it en route to ICFP.
1. Modify TcType.ExpType to make a distinct data type,
InferResult for the Infer case, and consequential
refactoring.
2. Define a new function TcUnify.fillInferResult, to fill in
an InferResult. It uses TcMType.promoteTcType to promote
the type to the level of the InferResult.
See TcMType Note [Promoting a type]
This refactoring is in preparation for an improvement
to typechecking pattern bindings, coming next.
I flirted with an elaborate scheme to give better
higher rank inference, but it was just too complicated.
See TcMType Note [Promotion and higher rank types]
3. Add to InferResult a new field ir_inst :: Bool to say
whether or not the type used to fill in the
InferResult should be deeply instantiated. See
TcUnify Note [Deep instantiation of InferResult].
4. Add a TcLevel to SkolemTvs. This will be useful generally
- it's a fast way to see if the type
variable escapes when floating (not used yet)
- it provides a good consistency check when updating a
unification variable (TcMType.writeMetaTyVarRef, the
level_check_ok check)
I originally had another reason (related to the flirting
in (2), but I left it in because it seems like a step in
the right direction.
5. Reduce and simplify the plethora of uExpType,
tcSubType and related functions in TcUnify. It was
such an opaque mess and it's still not great, but it's
better.
6. Simplify the uo_expected field of TypeEqOrigin. Richard
had generatlised it to a ExpType, but it was almost always
a Check type. Now it's back to being a plain TcType which
is much, much easier.
7. Improve error messages by refraining from skolemisation when
it's clear that there's an error: see
TcUnify Note [Don't skolemise unnecessarily]
8. Type.isPiTy and isForAllTy seem to be missing a coreView check,
so I added it
9. Kill off tcs_used_tcvs. Its purpose is to track the
givens used by wanted constraints. For dictionaries etc
we do that via the free vars of the /bindings/ in the
implication constraint ic_binds. But for coercions we
just do update-in-place in the type, rather than
generating a binding. So we need something analogous to
bindings, to track what coercions we have added.
That was the purpose of tcs_used_tcvs. But it only
worked for a /single/ iteration, whereas we may have
multiple iterations of solving an implication. Look
at (the old) 'setImplicationStatus'. If the constraint
is unsolved, it just drops the used_tvs on the floor.
If it becomes solved next time round, we'll pick up
coercions used in that round, but ignore ones used in
the first round.
There was an outright bug. Result = (potentialy) bogus
unused-constraint errors. Constructing a case where this
actually happens seems quite trick so I did not do so.
Solution: expand EvBindsVar to include the (free vars of
the) coercions, so that the coercions are tracked in
essentially the same way as the bindings.
This turned out to be much simpler. Less code, more
correct.
10. Make the ic_binds field in an implication have type
ic_binds :: EvBindsVar
instead of (as previously)
ic_binds :: Maybe EvBindsVar
This is notably simpler, and faster to use -- less
testing of the Maybe. But in the occaional situation
where we don't have anywhere to put the bindings, the
belt-and-braces error check is lost. So I put it back
as an ASSERT in 'setImplicationStatus' (see the use of
'termEvidenceAllowed')
All these changes led to quite bit of error message wibbling
|
|
|
|
|
|
|
|
| |
A rule with a phase specification trying to match on a constructor with
a wrapper will fail to match, as the wrapper will be inlined by then.
The fact that it works in the other case is also mostly by accident.
(Split into two test cases so that regressions with regard what works so
far are caught.)
|
|
|
|
|
|
|
|
|
| |
which test a few variants of rules involving constructors, including
nullary constructors, constructors with wrappers, and unsaturated of
constructors.
At the moment, all the rules work as expected, despite GHC’s compile
time warnings when called with -Wall.
|
|
|
|
| |
basically using the machinery from the test case of #2110.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This implements #5615 for divInt# and modInt#.
I also included rules to do constant-folding when the both arguments
are known.
Test Plan: validate
Reviewers: austin, simonmar, bgamari
Reviewed By: bgamari
Subscribers: hvr, thomie
Differential Revision: https://phabricator.haskell.org/D2486
GHC Trac Issues: #5615
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
In the previous patch, I handled lazy @(Int -> Int) f x
correctly, but failed to handle lazy @Int (f x) (we need
to collect arguments in f x).
Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
Test Plan: validate
Reviewers: simonpj, austin, bgamari, nomeata
Reviewed By: nomeata
Subscribers: simonmar, thomie
Differential Revision: https://phabricator.haskell.org/D2471
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
Test Plan: validate
Reviewers: simonpj, austin, bgamari
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D2444
GHC Trac Issues: #12472
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary:
This also drops the parked fix from
efa7b3a474bc373201ab145c129262a73c86f959
(though I didn't revert the refactoring).
Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
Test Plan: validate
Reviewers: simonpj, austin, bgamari
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D2211
GHC Trac Issues: #10083
|
|
|
|
|
|
|
|
|
|
|
|
| |
Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
Test Plan: validate
Reviewers: simonpj, austin, bgamari
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D2209
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This makes the implementation match the description in the paper more
closely: There, a let binding that is not a function has first its body
analised, and then the binding’s RHS. This way, the demand on the bound
variable by the body can be fed into the RHS, yielding more precise
results.
Performance measurements do unfortunately not show significant
improvements or regessions.
Differential Revision: https://phabricator.haskell.org/D2395
|
|
|
|
|
|
|
| |
This fixes Trac #12212. It's quite hard to provoke, but I've
added a standalone test case that does so.
The issue is explained in Note [Evidence foralls] in Specialise.
|
|
|
|
|
|
|
|
|
| |
* CgStaticPointers, GcStaticPointers, ListStaticPointers,
TcStaticPointers01, TcStaticPointers02: #12207
* T11535: #12210
* ffi017/ffi021: #12209
* T11108: #11108
* T9646: #9646
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary:
This mostly follows the plan detailed by the discussion
Simon and I had, with one difference: instead of grabbing
the free variables of the trivial expressions to get the
embedded Ids, we just use getIdFromTrivialExpr_maybe to extract
out the Id. If there is no Id, the expression cannot
refer to a function (as there are no literal functions)
and thus we do not need to saturate.
Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
Test Plan: validate
Reviewers: simonpj, austin, bgamari
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D2309
GHC Trac Issues: #12076
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
Test Plan: validate
Reviewers: austin, bgamari
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D2229
GHC Trac Issues: #12076
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Major change to the testsuite driver.
For each TEST:
* create a directory `<testdir>` inside `/tmp`.
* link/copy all source files that the test needs into `<testdir>`.
* run the test inside `<testdir>`.
* delete `<testdir>`
Extra files are (temporarily) tracked in
`testsuite/driver/extra_files.py`, but can also be specified using the
`extra_files` setup function.
Differential Revision: https://phabricator.haskell.org/D1187
Reviewed by: Rufflewind, bgamari
Trac: #11980
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Provoked by Trac #11948, this patch adds a new warning to GHC
-Wsimplifiable-class-constraints
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
warnings.mk.
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
in order to have precise used-once information in the exported
strictness signatures, as well as precise used-once information on
thunks. This avoids the bad effects of #11731.
The subsequent worker-wrapper pass is responsible for removing the
demand environment part of the strictness signature. It does not run
after the final demand analyzer pass, so remove this also in CoreTidy.
The subsequent worker-wrapper pass is also responsible for removing
used-once-information from the demands and strictness signatures, as
these might not be preserved by the simplifier. This is _not_ done by
CoreTidy, because we _do_ want this information, as produced by the last
round of the demand analyzer, to be available to the code generator.
Differential Revision: https://phabricator.haskell.org/D2073
|
| |
|
|
|
|
|
|
|
| |
as they (especially their id info with absence information) clutter the
output too much. They come back with debug_on.
Differential Revision: https://phabricator.haskell.org/D2072
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This turns `Any` into a standard wired-in type family defined in
`GHC.Types`, instead its current incarnation as a magical creature
provided by the `GHC.Prim`. Also kill `AnyK`.
See #10886.
Test Plan: Validate
Reviewers: simonpj, goldfire, austin, hvr
Reviewed By: simonpj
Subscribers: goldfire, thomie
Differential Revision: https://phabricator.haskell.org/D2049
GHC Trac Issues: #10886
|
|
|
|
| |
too verbose, and usualy preceded by Str= anyways.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Comments to explain that a CoVar, whose IdInfo is CoVarId,
is always unlifted (but may be nominal or representational role)
And TyCoRep.isCoercionType picks out only those unlifted
types, NOT the lifted versions
* Introduce Var.NcId for non-co-var Ids
with predicate isNonCoVarId
* Add assertions in CoreSubst that the Id env is only
used for NcIds
* Fix lurking bug in CSE which extended the
CoreSubst Id env with a CoVar
* Fix two bugs in Specialise.spec_call, which wrongly treated
CoVars like NcIds
- needed a varToCoreExpr in one place
- needed extendSubst not extendIdSubst in another
This was the root cause of Trac #11644
Minor refactoring
* Eliminate unused mkDerivedLocalCoVarM, mkUserLocalCoVar
* Small refactor in mkSysLocalOrCoVar
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Previously we would try to break explicit lists into a dynamic prefix
and static tail and desugar the former into a `build` expression.
Unfortunately, this heuristic resulted in surprising behavior
(see #11710) and wasn't pulling its weight. Here we drop it (along with
the `-fsimple-list-literals` flag), leaving only the list length
heuristic to determine whether `build` or cons list desugaring should be
used.
Test Plan: Validate
Reviewers: simonpj, austin
Reviewed By: simonpj
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D2023
GHC Trac Issues: #11710
|
| |
|
|
|
|
|
|
|
|
| |
The desugarer had a fragile case to generate the Unfolding for a
DFun. This patch moves the unfolding generation to TcInstDcls, where
all the pieces are to hand.
Fixes Trac #11742
|
|
|
|
| |
For #9646.
|
|
|
|
|
|
|
|
|
|
| |
Test Plan: Test that it passes git HEAD and fails with GHC 7.8.
Reviewers: bgamari, hvr, austin, goldfire, thomie
Differential Revision: https://phabricator.haskell.org/D2009
GHC Trac Issues: #9646
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
makeTrivial is responsible for concocting names during simplification.
Previously, however, it would make no attempt to generate a name that
might be useful to later readers of the resulting Core. Here we add a
bit of state to SimplEnv: a finite depth stack of binders within which
we are currently simplifying. We then derive generated binders from this
context.
See #11676.
Open questions:
* Is there a better way to accomplish this?
* Is `maxContextDepth` too large/small?
Test Plan: Validate, look at Core.
Reviewers: austin, simonpj
Reviewed By: simonpj
Subscribers: thomie, simonpj
Differential Revision: https://phabricator.haskell.org/D1970
GHC Trac Issues: #11676
|
|
|
|
|
|
|
|
|
|
|
| |
This is extends bb5afd3c274011c5ea302210b4c290ec1f83209c to cover
warnings emitted during the desugaring phase.
This implements another part of #10752
Reviewed-by: quchen, bgamari
Differential Revision: https://phabricator.haskell.org/D1954
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Both gcc and clang tell which warning flag a reported warning can be
controlled with, this patch makes ghc do the same. More generally, this
allows for annotated compiler output, where an optional annotation is
displayed in brackets after the severity.
This also adds a new flag `-f(no-)show-warning-groups` to control
whether to show which warning-group (such as `-Wall` or `-Wcompat`)
a warning belongs to. This flag is on by default.
This implements #10752
Reviewed By: quchen, bgamari, hvr
Differential Revision: https://phabricator.haskell.org/D1943
|
| |
|
|
|
|
|
|
|
|
|
| |
Instead of just profasm and profthreaded. And at least until
-fexternal-interpreter is the default.
Also:
* WAY=profc doesn't exist anymore.
* Omit all threaded_ways for conc039, not just a few.
|
|
|
|
| |
Refactoring only.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
See Note [TYPE] in TysPrim. There are still some outstanding
pieces in #11471 though, so this doesn't actually nail the bug.
This commit also contains a few performance improvements:
* Short-cut equality checking of nullary type syns
* Compare types before kinds in eqType
* INLINE coreViewOneStarKind
* Store tycon binders separately from kinds.
This resulted in a ~10% performance improvement in compiling
the Cabal package. No change in functionality other than
performance. (This affects the interface file format, though.)
This commit updates the haddock submodule.
|
| |
|
| |
|
| |
|
|
|
|
| |
This seems necessary after 9634e24 (#11569).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
In order to make this work I needed to shuffle around typechecking a bit
such that `TyCon` and friends are available during compilation of
GHC.Types. I also did a bit of refactoring of `TcTypeable`.
Test Plan: Validate
Reviewers: simonpj, austin
Subscribers: simonpj, thomie
Differential Revision: https://phabricator.haskell.org/D1906
GHC Trac Issues: #11120
|
|
|
|
|
|
|
|
| |
Since we're not consisently keeping track of which tests should pass
with which compiler versions, there is no point in keeping these
functions.
Update submodules containers, hpc and stm.
|
|
|
|
|
|
|
| |
See Note [Eta-reduction in -O0] in DynFlags.
Bottom line: doing eta reduction unconditionally is benign, and
removes an ASSERT failure (Trac #11562).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary:
Previously, `-Wunused-matches` would fire whenever it detected unused type
variables in a type family or data family instance. This can be annoying for
users who wish to use type variable names as documentation, as being
`-Wall`-compliant would mean that they'd have to prefix many of their type
variable names with underscores, making the documentation harder to read.
To avoid this, a new warning `-Wunused-type-variables` was created that only
encompasses unused variables in family instances. `-Wunused-matches` reverts
back to its role of only warning on unused term-level pattern names. Unlike
`-Wunused-matches`, `-Wunused-type-variables` is not implied by `-Wall`.
Fixes #11451.
Test Plan: ./validate
Reviewers: goldfire, ekmett, austin, hvr, simonpj, bgamari
Reviewed By: simonpj, bgamari
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D1825
GHC Trac Issues: #11451
|
|
|
|
|
|
|
|
|
|
|
|
| |
This long-standing bug in CoreUtils.combineIdenticalAlts
was shown up by Trac #11172. The effect was that it returned
a correct set of alternatives, but a bogus set of "impossible
default constructors". That meant that we subsequently
removed all the alternatives from a case, and hence ended
up with a bogusly empty case that should not have been empty.
See Note [Care with impossible-constructors when
combining alternatives] in CoreUtils.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Some modest refactoring, triggered in part by Trac #11051
* Kill off PatSynId, ReflectionId in IdDetails
They were barely used, and only for pretty-printing
* Add helper function Id.mkExportedVanillaId, and use it
* Polish up OccName.isDerivedOccName, as a predicate for
definitions generated internally by GHC, which we
might not want to show to the user.
* Kill off unused OccName.mkDerivedTyConOcc
* Shorten the derived OccNames for newtype and data
instance axioms
* A bit of related refactoring around newFamInstAxiomName
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
As Trac #11222, and #10712 note, the strictness analyser
needs to be rather careful about exceptions. Previously
it treated them as identical to divergence, but that
won't quite do.
See Note [Exceptions and strictness] in Demand, which
explains the deal.
Getting more strictness in 'catch' and friends is a
very good thing. Here is the nofib summary, keeping
only the big ones.
--------------------------------------------------------------------------------
Program Size Allocs Runtime Elapsed TotalMem
--------------------------------------------------------------------------------
fasta -0.1% -6.9% -3.0% -3.0% +0.0%
hpg -0.1% -2.0% -6.2% -6.2% +0.0%
maillist -0.1% -0.3% 0.08 0.09 +1.2%
reverse-complem -0.1% -10.9% -6.0% -5.9% +0.0%
sphere -0.1% -4.3% 0.08 0.08 +0.0%
x2n1 -0.1% -0.0% 0.00 0.00 +0.0%
--------------------------------------------------------------------------------
Min -0.2% -10.9% -17.4% -17.3% +0.0%
Max -0.0% +0.0% +4.3% +4.4% +1.2%
Geometric Mean -0.1% -0.3% -2.9% -3.0% +0.0%
On the way I did quite a bit of refactoring in Demand.hs
|
|
|
|
|
|
| |
It appears that this was only necessary on account of the varying types
of type representation fingerprints, which has been resolved in
Phab:D1529.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This re-working of the typechecker algorithm is based on
the paper "Visible type application", by Richard Eisenberg,
Stephanie Weirich, and Hamidhasan Ahmed, to be published at
ESOP'16.
This patch introduces -XTypeApplications, which allows users
to say, for example `id @Int`, which has type `Int -> Int`. See
the changes to the user manual for details.
This patch addresses tickets #10619, #5296, #10589.
|