| 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
|
|
|
|
|
|
|
|
|
|
| |
Make the TcLevel of a flatten-meta-var be always zero.
See TcType.fmvTcLevel.
This allows the levels of implication constraints to to
up by 1 each time instead of 2, which is less confusing.
This change has no effect on type checking.
|
|
|
|
|
|
| |
This is now working apparently. It relates to when a
polymorphic function gets instantiated, under some
implicit paramter bindings.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This patch fixes a regression introduced, post 8.0.1, by
this major commit:
commit 15b9bf4ba4ab47e6809bf2b3b36ec16e502aea72
Author: Simon Peyton Jones <simonpj@microsoft.com>
Date: Sat Jun 11 23:49:27 2016 +0100
Improve typechecking of let-bindings
This major commit was initially triggered by #11339, but it
spiraled into a major review of the way in which type
signatures for bindings are handled, especially partial type
signatures.
I didn't get the typechecking of pattern bindings right, leading
to Trac #12427.
In fixing this I found that this program doesn't work:
data T where
T :: a -> ((forall b. [b]->[b]) -> Int) -> T
h1 y = case y of T _ v -> v
Works in 7.10, but not in 8.0.1.
There's a happy ending. I found a way to fix this, and improve
pattern bindings too. Not only does this fix #12427, but it also
allows
In particular,we now can accept
data T where MkT :: a -> Int -> T
... let { MkT _ q = t } in ...
Previously this elicited "my head exploded" but it's really
fine since q::Int.
The approach is described in detail in TcBinds
Note [Typechecking pattern bindings]
Super cool. And not even a big patch!
|
| |
|
|
|
|
| |
Catch more than one space
|
|
|
|
| |
Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
|
|
|
|
| |
Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary:
Previously, we deleted if the heads matched, which meant that
we effectively were picking an arbitrary instance if there
were incompatible instances. The new behavior makes more sense,
although without incoherent instances you are unlikely to
be able to do anything useful with the instances.
Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
Test Plan: validate
Reviewers: austin, bgamari
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D2596
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary:
Test Plan: validate
Reviewers: goldfire, simonpj, austin, bgamari
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D2595
GHC Trac Issues: #12679
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary:
In the old implementation of hsig files, we directly
reused the implementation of abstract data types from
hs-boot files. However, this was WRONG. Consider the
following program (an abridged version of bkpfail24):
{-# LANGUAGE GADTs #-}
unit p where
signature H1 where
data T
signature H2 where
data T
module M where
import qualified H1
import qualified H2
f :: H1.T ~ H2.T => a -> b
f x = x
Prior to this patch, M was accepted, because the type
inference engine concluded that H1.T ~ H2.T does not
hold (indeed, *presently*, it does not). However, if
we subsequently instantiate p with the same module for
H1 and H2, H1.T ~ H2.T does hold! Unsound.
The key is that abstract types from signatures need to
be treated like *skolem variables*, since you can interpret
a Backpack unit as a record which is universally quantified
over all of its abstract types, as such (with some fake
syntax for structural records):
p :: forall t1 t2. { f :: t1 ~ t2 => a -> b }
p = { f = \x -> x } -- ill-typed
Clearly t1 ~ t2 is not solvable inside p, and also clearly
it could be true at some point in the future, so we better
not treat the lambda expression after f as inaccessible.
The fix seems to be simple: do NOT eagerly fail when trying
to simplify the given constraints. Instead, treat H1.T ~ H2.T
as an irreducible constraint (rather than an insoluble
one); this causes GHC to treat f as accessible--now we will
typecheck the rest of the function (and correctly fail).
Per the OutsideIn(X) paper, it's always sound to fail less
when simplifying givens.
We do NOT apply this fix to hs-boot files, where abstract
data is also guaranteed to be nominally distinct (since
it can't be implemented via a reexport or a type synonym.)
This is a somewhat unnatural state of affairs (there's
no way to really interpret this in Haskell land) but
no reason to change behavior.
I deleted "representationally distinct abstract data",
which is never used anywhere in GHC.
In the process of constructing this fix, I also realized
our implementation of type synonym matching against abstract
data was not sufficiently restrictive. In order for
a type synonym T to be well-formed type, it must be a
nullary synonym (i.e., type T :: * -> *, not type T a = ...).
Furthermore, since we use abstract data when defining
instances, they must not have any type family applications.
More details in #12680. This probably deserves some sort
of short paper report.
Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
Test Plan: validate
Reviewers: goldfire, simonpj, austin, bgamari
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D2594
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Showing the value of this configure option in the configure output
can help debugging issues in build bots etc.
Test Plan: N/A
Reviewers: hvr, austin, bgamari
Reviewed By: bgamari
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D2616
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
On architectures with weak memory consistency a write barrier
is needed before the write to the pointer array.
Fixes #12469
Test Plan: rebuilt Stackage nightly twice on powerpc64le
Reviewers: hvr, rrnewton, erikd, austin, simonmar, bgamari
Reviewed By: erikd, bgamari
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D2525
GHC Trac Issues: #12469
|
|
|
|
|
|
|
|
|
| |
Newtypes cannot (currently) have an unboxed argument type.
But Trac #12729 showed that this was only being checked for
newtypes in H98 syntax; in GADT snytax they were let through.
This patch moves the test to checkValidDataCon, where it properly
belongs.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
We had *a lot* of code copied from Hoopl that is for rewriting. But GHC
doesn't use it (it only uses some forked Hoopl code for analysis).
So we can safely kill all this code and make it much easier to refactor
and improve the parts that we do use.
Signed-off-by: Michal Terepeta <michal.terepeta@gmail.com>
Test Plan: ./validate
Reviewers: austin, simonmar, bgamari
Reviewed By: bgamari
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D2612
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Previously we pruned out orphan modules from external packages but this
was wrong. Fixes #12733 (which has more discussion.)
Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
Test Plan: validate
Reviewers: simonpj, bgamari, austin
Reviewed By: simonpj
Subscribers: simonpj, thomie
Differential Revision: https://phabricator.haskell.org/D2610
GHC Trac Issues: #12733
|
|
|
|
|
|
|
|
|
|
|
|
| |
Test Plan: validate
Reviewers: austin, bgamari, erikd
Reviewed By: bgamari, erikd
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D2589
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary:
This patch fixes build failure on Solaris which is caused
by usage --export-dynamic linker parameter. This parameter is not
supported by Solaris linker. The param itself was added by D2590
Reviewers: bgamari, simonmar, austin
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D2606
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary:
I also added some more comments about the orphan and family instance
hashing business.
Fixes #12723.
Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
Test Plan: validate
Reviewers: bgamari, austin
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D2607
GHC Trac Issues: #12723
|
|
|
|
| |
Includes testsuite fix for Python 3.
|
|
|
|
| |
Due to #12725.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
It seems that threading now works fine. The only caveat here is that it
makes some race conditions more likely (e.g. #12554), although these
also appear to affect single-threaded runs.
Test Plan: Validate on Windows
Reviewers: austin, Phyx
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D2600
GHC Trac Issues: #10510
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
tc266 was failing intermittently on Windows due to a very small
compile_timeout_multiplier. This test was added in
e907e1f12f4dedc0ec13c7a501c8810bcfc03583 which doesn't appear to have
any timng dependence, so I see no reason to retain the multiplier at
all.
Test Plan: Validate
Reviewers: ezyang, austin
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D2601
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Explicitly specify utf8 encoding in a few spots which were failing on
Windows with Python 3.
Test Plan: Validate
Reviewers: austin, thomie
Differential Revision: https://phabricator.haskell.org/D2602
GHC Trac Issues: #9184
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Due to #12554 and #12661 we must be quite picky about our choice of
Python interpreter on Windows. Allow the user to override it.
Test Plan: `PYTHON=/usr/bin/python2 ./validate` on Windows
Reviewers: austin, Phyx
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D2603
GHC Trac Issues: #12554, #12661
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Previously if the test is interrupted (e.g. with Ctrl-C) any processes
which it spawned may not be properly terminated. Here we catch any
exception and ensure that we job is terminated.
Test Plan: Validate on Windows
Reviewers: Phyx, austin
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D2599
|
|
|
|
|
|
|
|
|
|
|
|
| |
While msys' mingw Python 3 does indeed export `os.symlink`, it is
unusable since creating symbolic links on Windows requires permissions
that essentially no one has.
Test Plan: Validate on Windows
Reviewers: austin, Phyx, thomie
Differential Revision: https://phabricator.haskell.org/D2604
|
|
|
|
| |
There seems to be a runtime system bug here, as described in #12714.
|
|
|
|
|
|
|
|
| |
Strangely the allocation numbers on Windows differ significantly from
those on Linux. Usually I would just update the number, but I would
really like to understand why this is the case. This is a rather large
deviation in the compilation of a program which really shouldn't have
any appreciable platform dependence.
|
|
|
|
| |
See #12712.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
It seems that Python 2.7.11 and "recent" msys2 releases are broken,
holding open file locks unexpected. This causes rmtree to intermittently
fail. Even worse, it would fail silently (since we pass
ignore_errors=True), causing makedirs to fail later.
We now explicitly check for the existence of the test directory before
attempting to delete it and disable ignore_errors. Moreover, on Windows
we now try multiple times to rmtree the testdir, working around the
apparently msys bug.
This is all just terrible, but Phyx and I spent several hours trying to
track down the issue to no available. The workaround is better than
nothing.
|
|
|
|
|
|
|
|
|
|
|
|
| |
This adds a line I deleted by mistake in
commit db71d971379c74dd1d2b958c11dc6c9e718a3e61
Author: Simon Peyton Jones <simonpj@microsoft.com>
Date: Fri Oct 14 17:40:51 2016 +0100
Reduce trace output slightly
Sorry about that!
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
| |
The wrappers in matchExpectedConTy were being composed back
to front, resulting in a Core Lint error. Yikes! This has
been here a long time.
Fixes Trac #12676.
|
|
|
|
|
|
|
|
|
| |
Trac #12698 exposed a nasty bug in the typechecking for
pattern synonmys: the existential type variables weren't
being put in properly-scoped order.
For some reason TcPatSyn.tcCollectEx was colleting them as a
set, not as a list! Easily fixed.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This bug, exposed by Trac #12562 was very obscure, and has been
lurking for a long time. What happened was that, in the
worker/wrapper split
a tyvar binder for a worker function
accidentally shadowed an in-scope term variable
that was mentioned in the body of the function
It's jolly hard to provoke, so I have not even attempted to make
a test case. There's a Note [Freshen WW arguments] to explain.
Interestingly, fixing the bug (which meant fresher type variables)
revealed a second lurking bug: I'd failed to apply the substitution to
the coercion in the second last case of mkWWArgs, which introduces a
Cast.
|
| |
|
| |
|
| |
|