| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
TcSimplify.decideQuantification was doing the Wrong Thing when
"growing" the type variables to quantify over. We were trying to do
this on a tyvar set where we'd split off the dependent type varaibles;
and we just got it wrong. A kind variable wasn't being generalised
properly, with confusing knock on consequences.
All this led to Trac #13371 and Trac #13393.
This commit tidies it all up:
* The type TcDepVars is renamed as CandidateQTvs;
and splitDepVarsOfType to candidateQTyVarsOfType
* The code in TcSimplify.decideQuantification is simpler.
It no longer does the tricky "grow" stuff over TcDepVars.
Instead it use ordinary VarSets (thereby eliminating the
nasty growThetaTyVarsDSet) and uses that to filter the
result of candidateQTyVarsOfType.
* I documented that candidateQTyVarsOfType returns the type
variables in a good order in which to quantify, and rewrote
it to use an accumulator pattern, so that we would predicatably
get left-to-right ordering.
In doing all this I also made UniqDFM behave a little more nicely:
* When inserting an element that is there already, keep the old tag,
while still overwriting with the new value.
* This means that when doing udfmToList we get back elements in the
order they were originally inserted, rather than in reverse order.
It's not a big deal, but in a subsequent commit I use it to improve
the order of type variables in inferred types.
All this led to a lot of error message wibbles:
- changing the order of quantified variables
- changing the order in which instances are listed in GHCi
- changing the tidying of variables in typechecker erors
There's a submodule update for 'array' because one of its tests
has an error-message change.
I may not have associated all of them with the correct commit.
|
| |
|
|
|
|
|
|
|
|
|
| |
TcErrors has a system for suppressing some type errors if a more
serious one occurs. But there was a crucial missing case, which
sometimes resulted in a cascade of irrelevant errors overwhelming
the actual cause. This was Trac #11541.
The fix is simple. Worth merging to 8.0
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This puts the "Relevant bindings" section at the end.
It uses a TcErrors.Report Monoid to divide messages by importance and
then mappends them together. This is not the most efficient way since
there are various intermediate Reports and list appends, but it probably
doesn't matter since error messages shouldn't get that large, and are
usually prepended. In practice, everything is `important` except
`relevantBindings`, which is `supplementary`.
ErrMsg's errMsgShortDoc and errMsgExtraInfo were extracted into ErrDoc,
which has important, context, and suppelementary fields. Each of those
three sections is marked with a bullet character, '•' on unicode
terminals and '*' on ascii terminals. Since this breaks tons of tests,
I also modified testlib.normalise_errmsg to strip out '•'s.
--- Additional notes:
To avoid prepending * to an empty doc, I needed to filter empty docs.
This seemed less error-prone than trying to modify everyone who produces
SDoc to instead produce Maybe SDoc. So I added `Outputable.isEmpty`.
Unfortunately it needs a DynFlags, which is kind of bogus, but otherwise
I think I'd need another Empty case for SDoc, and then it couldn't be a
newtype any more.
ErrMsg's errMsgShortString is only used by the Show instance, which is
in turn only used by Show HscTypes.SourceError, which is in turn only
needed for the Exception instance. So it's probably possible to get rid
of errMsgShortString, but that would a be an unrelated cleanup.
Fixes #11014.
Test Plan: see above
Reviewers: austin, simonpj, thomie, bgamari
Reviewed By: thomie, bgamari
Subscribers: simonpj, nomeata, thomie
Differential Revision: https://phabricator.haskell.org/D1427
GHC Trac Issues: #11014
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This regrettably-big patch substantially improves the way in which
"improvement" happens in the constraint solver. It was triggered by
trying to crack Trac #10009, but it turned out to solve #10340 as
well.
The big picture, with several of the trickiest examples, is described
in Note [The improvement story] in TcInteract.
The major change is this:
* After solving we explicitly try "improvement", by
- making the unsolved Wanteds into Deriveds
- allowing Deriveds to rewrite Deriveds
This more aggressive rewriting "unlocks" some extra
guess-free unifications.
* The main loop is in TcInteract.solveSimpleWanteds, but I also ended
up refactoring TcSimplify.simpl_loop, and its surrounding code.
Notably, any insolubles from the Givens are pulled out
and treated separately, rather than staying in the inert set
during the solveSimpleWanteds loop.
There are a lot of follow-on changes
* Do not emit generate Derived improvements from Wanteds.
This saves work in the common case where they aren't needed.
* For improvement we should really do type-class reduction on Derived
constraints in doTopReactDict. That entailed changing the GenInst
constructor a bit; a local and minor change
* Some annoying faffing about with dropping derived constraints;
see dropDerivedWC, dropDerivedSimples, dropDerivedInsols,
and their Notes.
* Some substantial refactoring in TcErrors.reportWanteds.
This work wasn't strictly forced, but I got sucked into it.
All the changes are in TcErrors.
* Use TcS.unifyTyVar consistently, rather than setWantedTyBind,
so that unifications are properly tracked.
* Refactoring around solveWantedsTcM, solveWantedsAndDrop.
They previously guaranteed a zonked result, but it's more
straightforward for clients to zonk.
|
|
|
|
|
|
|
|
|
|
| |
This diff depends on D803.
Reviewed By: austin
Differential Revision: https://phabricator.haskell.org/D806
GHC Trac Issues: #10214
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This is preparing for a fix to Trac #9612. The idea is that insoluble
constraints are nice solid errors that we should not discard before
we have a chance to report them. So TcRnTypes.dropDerivedWC now
keeps insoluble Derived constrains, and instead TcSimplify.solve_wanteds
filters them out
We get somewhat better error message for kind-equality failures too.
A slight downside is that to avoid *duplicate* kind-equality failures
when we float a kind-incompatible equality (e.g. alpha:* ~ Int#),
I've disabled constraint-floating when there are insolubles. But that
in turn makes a handful of error messages a little less informative;
good examples are mc21, mc22, mc25. But I am re-jigging the
constraint floating machinery in another branch, which will make this
go back to the way it was before.
|
|
|
|
|
|
|
| |
This matches GCC's choice of Unicode quotation marks (i.e. U+2018 and U+2019)
and therefore looks more familiar on the console. This addresses #2507.
Signed-off-by: Herbert Valerio Riedel <hvr@gnu.org>
|
|
|
|
|
|
|
|
| |
In effect, the error context for naked variables now takes up
a "slot" in the context stack; but it is often empty. So the
context stack becomes one shorter in those cases. I don't think
this matters; indeed, it's aguably an improvement. Anyway that's
why so many tests are affected.
|
| |
|
| |
|
|
|
|
|
|
| |
Notably
* Showing relevant bindings
* Not suggesting add instance (Num T); see Trac #7222
|
| |
|
| |
|
|
|
|
| |
...in response to Trac #5858
|
|
|
|
| |
major TcErrors refactoring
|
|
|