| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
In order to avoid confusion as in #18932, we display the type of the
match variables in the non-exhaustiveness warning, e.g.
```
T18932.hs:14:1: warning: [-Wincomplete-patterns]
Pattern match(es) are non-exhaustive
In an equation for ‘g’:
Patterns of type ‘T a’, ‘T a’, ‘T a’ not matched:
(MkT2 _) (MkT1 _) (MkT1 _)
(MkT2 _) (MkT1 _) (MkT2 _)
(MkT2 _) (MkT2 _) (MkT1 _)
(MkT2 _) (MkT2 _) (MkT2 _)
...
|
14 | g (MkT1 x) (MkT1 _) (MkT1 _) = x
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
```
It also allows us to omit the type signature on wildcard matches which
we previously showed in only some situations, particularly
`-XEmptyCase`.
Fixes #18932.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This patch does two things:
* It refactors GHC.Tc.Errors a bit. In debugging Quick Look I was
forced to look in detail at error messages, and ended up doing a bit
of refactoring, esp in mkTyVarEqErr'. It's still quite a mess, but
a bit better, I think.
* It makes a significant improvement to the kind checking of type and
class declarations. Specifically, we now ensure that if kind
checking fails with an unsolved constraint, all the skolems are in
scope. That wasn't the case before, which led to some obscure error
messages; and occasional failures with "no skolem info" (eg #16245).
Both of these, and the main Quick Look patch itself, affect a /lot/ of
error messages, as you can see from the number of files changed. I've
checked them all; I think they are as good or better than before.
Smaller things
* I documented the various instances of VarBndr better.
See Note [The VarBndr tyep and its uses] in GHC.Types.Var
* Renamed GHC.Tc.Solver.simpl_top to simplifyTopWanteds
* A bit of refactoring in bindExplicitTKTele, to avoid the
footwork with Either. Simpler now.
* Move promoteTyVar from GHC.Tc.Solver to GHC.Tc.Utils.TcMType
Fixes #16245 (comment 211369), memorialised as
typecheck/polykinds/T16245a
Also fixes the three bugs in #18640
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Fix #18323 by adding a few lines of code to handle non-recursive
pattern bindings. see GHC.Tc.Gen.Bind
Note [Special case for non-recursive pattern bindings]
Alas, this confused the pattern-match overlap checker; see #18323.
Note that this patch only affects pattern bindings like that
for (x,y) in this program
combine :: (forall a . [a] -> a) -> [forall a. a -> a]
-> ((forall a . [a] -> a), [forall a. a -> a])
breaks = let (x,y) = combine head ids
in x y True
We need ImpredicativeTypes for those [forall a. a->a] types to be
valid. And with ImpredicativeTypes the old, unprincipled "allow
unification variables to unify with a polytype" story actually
works quite well. So this test compiles fine (if delicatedly) with
old GHCs; but not with QuickLook unless we add this patch
|
|
|
|
|
|
|
| |
Currently the "Enumeration is empty" warning (-Wempty-enumerations)
only fires for numeric literals. This patch adds support for `Char`
literals so that enumerating an empty list of `Char`s will also
trigger the warning.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This patch simplifies GHC to use simple subsumption.
Ticket #17775
Implements GHC proposal #287
https://github.com/ghc-proposals/ghc-proposals/blob/master/
proposals/0287-simplify-subsumption.rst
All the motivation is described there; I will not repeat it here.
The implementation payload:
* tcSubType and friends become noticably simpler, because it no
longer uses eta-expansion when checking subsumption.
* No deeplyInstantiate or deeplySkolemise
That in turn means that some tests fail, by design; they can all
be fixed by eta expansion. There is a list of such changes below.
Implementing the patch led me into a variety of sticky corners, so
the patch includes several othe changes, some quite significant:
* I made String wired-in, so that
"foo" :: String rather than
"foo" :: [Char]
This improves error messages, and fixes #15679
* The pattern match checker relies on knowing about in-scope equality
constraints, andd adds them to the desugarer's environment using
addTyCsDs. But the co_fn in a FunBind was missed, and for some reason
simple-subsumption ends up with dictionaries there. So I added a
call to addTyCsDs. This is really part of #18049.
* I moved the ic_telescope field out of Implication and into
ForAllSkol instead. This is a nice win; just expresses the code
much better.
* There was a bug in GHC.Tc.TyCl.Instance.tcDataFamInstHeader.
We called checkDataKindSig inside tc_kind_sig, /before/
solveEqualities and zonking. Obviously wrong, easily fixed.
* solveLocalEqualitiesX: there was a whole mess in here, around
failing fast enough. I discovered a bad latent bug where we
could successfully kind-check a type signature, and use it,
but have unsolved constraints that could fill in coercion
holes in that signature -- aargh.
It's all explained in Note [Failure in local type signatures]
in GHC.Tc.Solver. Much better now.
* I fixed a serious bug in anonymous type holes. IN
f :: Int -> (forall a. a -> _) -> Int
that "_" should be a unification variable at the /outer/
level; it cannot be instantiated to 'a'. This was plain
wrong. New fields mode_lvl and mode_holes in TcTyMode,
and auxiliary data type GHC.Tc.Gen.HsType.HoleMode.
This fixes #16292, but makes no progress towards the more
ambitious #16082
* I got sucked into an enormous refactoring of the reporting of
equality errors in GHC.Tc.Errors, especially in
mkEqErr1
mkTyVarEqErr
misMatchMsg
misMatchMsgOrCND
In particular, the very tricky mkExpectedActualMsg function
is gone.
It took me a full day. But the result is far easier to understand.
(Still not easy!) This led to various minor improvements in error
output, and an enormous number of test-case error wibbles.
One particular point: for occurs-check errors I now just say
Can't match 'a' against '[a]'
rather than using the intimidating language of "occurs check".
* Pretty-printing AbsBinds
Tests review
* Eta expansions
T11305: one eta expansion
T12082: one eta expansion (undefined)
T13585a: one eta expansion
T3102: one eta expansion
T3692: two eta expansions (tricky)
T2239: two eta expansions
T16473: one eta
determ004: two eta expansions (undefined)
annfail06: two eta (undefined)
T17923: four eta expansions (a strange program indeed!)
tcrun035: one eta expansion
* Ambiguity check at higher rank. Now that we have simple
subsumption, a type like
f :: (forall a. Eq a => Int) -> Int
is no longer ambiguous, because we could write
g :: (forall a. Eq a => Int) -> Int
g = f
and it'd typecheck just fine. But f's type is a bit
suspicious, and we might want to consider making the
ambiguity check do a check on each sub-term. Meanwhile,
these tests are accepted, whereas they were previously
rejected as ambiguous:
T7220a
T15438
T10503
T9222
* Some more interesting error message wibbles
T13381: Fine: one error (Int ~ Exp Int)
rather than two (Int ~ Exp Int, Exp Int ~ Int)
T9834: Small change in error (improvement)
T10619: Improved
T2414: Small change, due to order of unification, fine
T2534: A very simple case in which a change of unification order
means we get tow unsolved constraints instead of one
tc211: bizarre impredicative tests; just accept this for now
Updates Cabal and haddock submodules.
Metric Increase:
T12150
T12234
T5837
haddock.base
Metric Decrease:
haddock.compiler
haddock.Cabal
haddock.base
Merge note: This appears to break the
`UnliftedNewtypesDifficultUnification` test. It has been marked as
broken in the interest of merging.
(cherry picked from commit 66b7b195cb3dce93ed5078b80bf568efae904cc5)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This patch implements eager instantiation, a small but critical change
to the type inference engine, #17173. The main change is this:
When inferring types, always return an instantiated type
(for now, deeply instantiated; in future shallowly instantiated)
There is more discussion in
https://www.tweag.io/posts/2020-04-02-lazy-eager-instantiation.html
There is quite a bit of refactoring in this patch:
* The ir_inst field of GHC.Tc.Utils.TcType.InferResultk
has entirely gone. So tcInferInst and tcInferNoInst have collapsed
into tcInfer.
* Type inference of applications, via tcInferApp and
tcInferAppHead, are substantially refactored, preparing
the way for Quick Look impredicativity.
* New pure function GHC.Tc.Gen.Expr.collectHsArgs and applyHsArgs
are beatifully dual. We can see the zipper!
* GHC.Tc.Gen.Expr.tcArgs is now much nicer; no longer needs to return
a wrapper
* In HsExpr, HsTypeApp now contains the the actual type argument,
and is used in desugaring, rather than putting it in a mysterious
wrapper.
* I struggled a bit with good error reporting in
Unify.matchActualFunTysPart. It's a little bit simpler than before,
but still not great.
Some smaller things
* Rename tcPolyExpr --> tcCheckExpr
tcMonoExpr --> tcLExpr
* tcPatSig moves from GHC.Tc.Gen.HsType to GHC.Tc.Gen.Pat
Metric Decrease:
T9961
Reduction of 1.6% in comiler allocation on T9961, I think.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
We now always show "forall {a}. T" for inferred variables,
previously this was controlled by -fprint-explicit-foralls.
This implements part 1 of https://github.com/ghc-proposals/ghc-proposals/pull/179.
Part of GHC ticket #16320.
Furthermore, when printing a levity restriction error, we now display
the HsWrap of the expression. This lets users see the full elaboration with
-fprint-typechecker-elaboration (see also #17670)
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
`GHC.Prim.seq` previously had the rather plain type:
seq :: forall a b. a -> b -> b
However, it also had a special typing rule to applications
where `b` is not of kind `Type`.
Issue #17440 noted that levity polymorphism allows us to rather give
it the more precise type:
seq :: forall (r :: RuntimeRep) a (b :: TYPE r). a -> b -> b
This allows us to remove the special typing rule that we previously
required to allow applications on unlifted arguments. T9404 contains a
non-Type application of `seq` which should verify that this works as
expected.
Closes #17440.
|
|
|
|
|
|
|
|
|
| |
Basically do what we currently only do for -XEmptyCase in other cases
where adding the type signature won't distract from pattern
matches in other positions.
We use the precedence to guide us, equating "need to parenthesise" with
"too much noise".
|
| |
|
|
|
|
| |
As noted in #16543.
|
|
|
|
|
|
|
|
|
|
|
|
| |
Reviewers: bgamari, simonpj
Reviewed By: simonpj
Subscribers: hvr, simonpj, mpickering, rwbarton, carter
GHC Trac Issues: #15838
Differential Revision: https://phabricator.haskell.org/D5285
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Following the discussion under #16473, this change allows the
specializer to work on any dicts in a lambda, not just those that occur
at the beginning.
For example, if you use data types which contain dictionaries and
higher-rank functions then once these are erased by the optimiser you
end up with functions such as:
```
go_s4K9
Int#
-> forall (m :: * -> *).
Monad m =>
(forall x. Union '[State (Sum Int)] x -> m x) -> m ()
```
The dictionary argument is after the Int# value argument, this patch
allows `go` to be specialised.
|
|
|
|
|
|
|
| |
Previously, -W(all-)missed-specs was created with 'NoReason',
so no information about the flag was printed along with the warning.
Now, -Wall-missed-specs is listed as the Reason if it was set,
otherwise -Wmissed-specs is listed as the reason.
|
|
|
|
|
|
| |
As per https://prime.haskell.org/wiki/Libraries/Proposals/MonadFail
Coauthored-by: Ben Gamari <ben@well-typed.com>
|
| |
|
|
|
|
| |
These were added in 75a8349b2a7d0142d3d687837caf5a95bbb4368d.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary:
These changes were motivated by #13256. While poking around, I
realized we weren't very consistent in our "-Woverflowed-literals"
warnings. This patch fixes that by:
* warning earlier on in the pipeline (ie. before we've desugared
'Int' patterns into 'I# Int#')
* handling 'HsLit' as well as 'HsOverLit' (this covers unboxed
literals)
* covering more pattern / expression forms
4/6 of the warnings in the 'Overflow' test are due to this patch. The
other two are mostly for completeness.
Also fixed a missing empty-enumeration warning for 'Natural'.
This warnings were tripped up by the 'Bounded Word' instance (see #9505),
but the fix was obvious and simple: use unboxed word literals.
Test Plan: make TEST=Overflow && make TEST=T10930
Reviewers: hvr, bgamari, RyanGlScott
Reviewed By: RyanGlScott
Subscribers: RyanGlScott, rwbarton, carter
GHC Trac Issues: #13256, #10930
Differential Revision: https://phabricator.haskell.org/D5181
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Enabling -Werror=compat in the testsuite allows us to easily see the
impact that a new warning has on code. It also means that in the period
between adding the warning and making the actual breaking change, all
new test cases that are being added to the testsuite will be
forwards-compatible. This is good because it will make the actual
breaking change contain less irrelevant testsuite updates.
Things that -Wcompat warns about are things that are going to break in
the future, so we can be proactive and keep our testsuite
forwards-compatible.
This patch consists of two main changes:
* Add `TEST_HC_OPTS += -Werror=compat` to the testsuite configuration.
* Fix all broken test cases.
Test Plan: Validate
Reviewers: hvr, goldfire, bgamari, simonpj, RyanGlScott
Reviewed By: goldfire, RyanGlScott
Subscribers: rwbarton, carter
GHC Trac Issues: #15278
Differential Revision: https://phabricator.haskell.org/D5200
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Implementation of the "Embrace TypeInType" proposal was done according
to the spec, which specified that TypeOperators must imply NoStarIsType.
This implication was meant to prevent breakage and to be removed in 2
releases. However, compiling head.hackage has shown that this
implication only magnified the breakage, so there is no reason to have
it in the first place.
To remain in compliance with the three-release policy, we add a
workaround to define the (*) type operator even when -XStarIsType is on.
Test Plan: ./validate
Reviewers: bgamari, RyanGlScott, goldfire, phadej, hvr
Reviewed By: bgamari, RyanGlScott
Subscribers: harpocrates, rwbarton, thomie, carter
Differential Revision: https://phabricator.haskell.org/D4865
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This patch is a pure refactoring, which I've wanted to do for
some time. The main payload is
* Remove the wc_insol field from WantedConstraints;
instead put all the insolubles in wc_simple
* Remove inert_insols from InertCans
Instead put all the insolubles in inert_irreds
* Add a cc_insol flag to CIrredCan, to record that
the constraint is definitely insoluble
Reasons
* Quite a bit of code gets slightly simpler
* Fewer concepts to keep separate
* Insolubles don't happen at all in production code that is
just being recompiled, so previously there was a lot of
moving-about of empty sets
A couple of error messages acutally improved.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Previously -Werror or -Werror=flag printed warnings as usual and then
printed
these two lines:
<no location info>: error:
Failing due to -Werror.
This is not ideal: first, it's not clear which flag made one of the
warnings an
error. Second, warning messages are not modified in any way, so there's
no way
to know which warnings caused this error.
With this patch we (1) promote warning messages to error messages if a
relevant
-Werror is enabled (2) mention which -Werror is used during this
promotion.
Previously:
[1 of 1] Compiling Main ( test.hs, test.o )
test.hs:9:10: warning: [-Wincomplete-patterns]
Pattern match(es) are non-exhaustive
In a case alternative: Patterns not matched: (C2 _)
|
9 | sInt s = case s of
| ^^^^^^^^^...
test.hs:12:14: warning: [-Wmissing-fields]
• Fields of ‘Rec’ not initialised: f2
• In the first argument of ‘print’, namely ‘Rec {f1 =
1}’
In the expression: print Rec {f1 = 1}
In an equation for ‘main’: main = print Rec {f1 = 1}
|
12 | main = print Rec{ f1 = 1 }
| ^^^^^^^^^^^^^
<no location info>: error:
Failing due to -Werror.
Now:
[1 of 1] Compiling Main ( test.hs, test.o )
test.hs:9:10: error: [-Wincomplete-patterns,
-Werror=incomplete-patterns]
Pattern match(es) are non-exhaustive
In a case alternative: Patterns not matched: (C2 _)
|
9 | sInt s = case s of
| ^^^^^^^^^...
test.hs:12:14: error: [-Wmissing-fields, -Werror=missing-fields]
• Fields of ‘Rec’ not initialised: f2
• In the first argument of ‘print’, namely ‘Rec {f1 =
1}’
In the expression: print Rec {f1 = 1}
In an equation for ‘main’: main = print Rec {f1 = 1}
|
12 | main = print Rec{ f1 = 1 }
| ^^^^^^^^^^^^^
Test Plan: - Update old tests, add new tests if there aren't any
relevant tests
Reviewers: austin, bgamari
Reviewed By: bgamari
Subscribers: rwbarton, thomie
Differential Revision: https://phabricator.haskell.org/D3709
|
|
|
|
|
|
|
|
|
|
|
|
| |
Reviewers: hvr, alanz, austin
Reviewed By: alanz
Subscribers: rwbarton, thomie
GHC Trac Issues: #13899
Differential Revision: https://phabricator.haskell.org/D3686
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When main module is listed on command line as a file, we should not
issue a warning about it. See Trac #13727
Reviewers: austin, bgamari, Yuras
Reviewed By: bgamari, Yuras
Subscribers: 23Skidoo, rwbarton, thomie
GHC Trac Issues: #13727
Differential Revision: https://phabricator.haskell.org/D3598
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
rwbarton pointed out that tab expansions can affect the column numbers
of subsequent characters, so a unstateful map + zip won't do. This
commit hopefully fixes that. It also adds a test for this particular
case.
Test Plan: validate
Reviewers: bgamari, rwbarton, austin
Reviewed By: bgamari
Subscribers: dfeuer, thomie
Differential Revision: https://phabricator.haskell.org/D3578
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Test Plan: validate
Reviewers: austin, bgamari, rwbarton
Reviewed By: bgamari
Subscribers: rwbarton, thomie
GHC Trac Issues: #13664
Differential Revision: https://phabricator.haskell.org/D3549
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
In error messages like this
• Couldn't match type ‘c’ with ‘f0 (a -> b)’
‘c’ is a rigid type variable bound by
the type signature for:
f :: ((a -> b) -> b) -> forall c. c -> a
we need to take case both to actually show that 'forall c',
and to make sure that its name lines with the 'c' in the
error message.
This has been shaky for some time, and this commit puts it on solid
ground. See TcRnTypes: Note [SigSkol SkolemInfo]
The main changes are
* SigSkol gets an extra field that records the way in which the
type signature was skolemised.
* The type in SigSkol is now the /un/-skolemised version
* pprSkolemInfo uses the info to make the tidy type line up
nicely
Lots of error message wibbles!
|
|
|
|
|
|
|
|
|
|
|
|
| |
The script I used is included as testsuite/driver/kill_extra_files.py,
though at this point it is for mostly historical interest.
Some of the tests in libraries/hpc relied on extra_files.py, so this
commit includes an update to that submodule.
One test in libraries/process also relies on extra_files.py, but we
cannot update that submodule so easily, so for now we special-case it
in the test driver.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The `clean_cmd` and `extra_clean` setup functions don't do anything.
Remove them from .T files.
Created using https://github.com/thomie/refactor-ghc-testsuite. This
diff is a test for the .T-file parser/processor/pretty-printer in that
repository.
find . -name '*.T' -exec ~/refactor-ghc-testsuite/Main "{}" \;
Tests containing inline comments or multiline strings are not modified.
Preparation for #12223.
Test Plan: Harbormaster
Reviewers: austin, hvr, simonmar, mpickering, bgamari
Reviewed By: mpickering
Subscribers: mpickering
Differential Revision: https://phabricator.haskell.org/D3000
GHC Trac Issues: #12223
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Introduce a warning, -Wmissing-home-modules, to warn about home modules,
not listed in command line.
It is usefull for cabal when user fails to list a module in
`exposed-modules` and `other-modules`.
Test Plan: make TEST=MissingMod
Reviewers: mpickering, austin, bgamari
Reviewed By: bgamari
Subscribers: simonpj, mpickering, thomie
Differential Revision: https://phabricator.haskell.org/D2977
GHC Trac Issues: #13129
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This is controlled by -f[no-]diagnostics-show-caret.
Example of what it looks like:
```
|
42 | x = 1 + ()
| ^^^^^^
```
This is appended to each diagnostic message.
Test Plan:
testsuite/tests/warnings/should_fail/CaretDiagnostics1
testsuite/tests/warnings/should_fail/CaretDiagnostics2
Reviewers: simonpj, austin, bgamari
Reviewed By: simonpj, bgamari
Subscribers: joehillen, mpickering, Phyx, simonpj, alanz, thomie
Differential Revision: https://phabricator.haskell.org/D2718
GHC Trac Issues: #8809
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Previously, GHC would not warn whenever there was a class instance that
didn't implement a class method whose name begins with an underscore.
Fixes #12959.
Test Plan: make test TEST=WarnMinimal
Reviewers: austin, bgamari, simonpj
Reviewed By: bgamari, simonpj
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D2849
GHC Trac Issues: #12959
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This patch reverts the change introduced with
587dcccfdfa7a319e27300a4f3885071060b1f8e and restores the previous
default output of GHC (i.e., show source path and object path for each
compiled module).
The -fhide-source-paths flag can be used to hide these paths and reduce
the line
noise.
Reviewers: gracjan, nomeata, austin, bgamari, simonmar, hvr
Reviewed By: hvr
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D2728
GHC Trac Issues: #12851
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This patch add new options `-Werror=...`, `-Wwarn=...` and
`-Wno-error=...` (synonym for `-Wwarn=...`).
Semantics:
- `-Werror` marks all warnings as fatal, including those that don't
have a warning flag, and CPP warnings.
- `-Werror=...` enables a warning and marks it as fatal
- `-Wwarn=...` marks a warning as non-fatal, but doesn't disable it
Test Plan: validate
Reviewers: austin, bgamari
Reviewed By: bgamari
Subscribers: mpickering, svenpanne, RyanGlScott, thomie
Differential Revision: https://phabricator.haskell.org/D2706
GHC Trac Issues: #11219
|
|
|
|
|
|
|
|
|
|
|
|
| |
Reviewers: simonmar, mpickering, austin, bgamari
Reviewed By: bgamari
Subscribers: mpickering, nomeata, thomie
Differential Revision: https://phabricator.haskell.org/D2679
GHC Trac Issues: #12807
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When looking up flags, we make sure to lookup the non-deprecated flags first
by ordering the list of flags.
Reviewers: bgamari, austin, mpickering
Reviewed By: mpickering
Subscribers: mpickering, thomie
Differential Revision: https://phabricator.haskell.org/D2541
GHC Trac Issues: #12574
|
|
|
|
|
| |
This fixes Trac #12597: in RnNames.warnMissingSignatures,
use pprSigmaType not pprType
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Removes -Wredundant-constraints from -Wall, as per the
discussion in #10635.
Reviewers: austin, bgamari
Reviewed By: bgamari
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D2498
GHC Trac Issues: #10635
|
|
|
|
| |
This allows the removal of the override_flags stuff in testlib.py.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary:
foldUFM introduces unnecessary non-determinism that actually
leads to different generated code as explained in
Note [TrieMap determinism].
As we're switching from UniqFM to UniqDFM here you might be
concerned about performance. There's nothing that ./validate
detects. nofib reports no change in Compile Allocations, but
Compile Time got better on some tests and worse on some,
yielding this summary:
-1 s.d. ----- -3.8%
+1 s.d. ----- +5.4%
Average ----- +0.7%
This is not a fair comparison as the order of Uniques
changes what GHC is actually doing. One benefit from making
this deterministic is also that it will make the
performance results more stable.
Full nofib results: P108
Test Plan: ./validate, nofib
Reviewers: goldfire, simonpj, simonmar, austin, bgamari
Reviewed By: simonpj
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D2169
GHC Trac Issues: #4012
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
Test Plan: It works, I promise.
Reviewers: austin
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D1956
GHC Trac Issues: #11370
|
|
|
|
| |
This was missed in bb5afd3c274011c5ea302210b4c290ec1f83209c
|
|
|
|
|
|
|
| |
This is extends bb5afd3c274011c5ea302210b4c290ec1f83209c to cover
warnings emitted during lexing.
This implements another part of #10752
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
- Replace "Sigs" with "Signatures" in WarningFlag data constructors.
- Replace "PatSyn" with "PatternSynonym" in WarningFlag data
constructors.
- Deprecate "missing-local-sigs" in favor of "missing-local-signatures".
- Deprecate "missing-exported-sigs" in favor of
"missing-exported-signatures".
- Deprecate "missing-pat-syn-signatures" in favor of
"missing-pattern-synonym-signatures".
- Replace "ddump-strsigs" with "ddump-str-signatures"
These complete the tasks that were explicitly mentioned in #11583
Test Plan:
Executed `ghc --show-options` and verified that the flags were changed
as expected.
Reviewers: svenpanne, austin, bgamari
Reviewed By: austin, bgamari
Subscribers: mpickering, thomie
Differential Revision: https://phabricator.haskell.org/D1939
GHC Trac Issues: #11583
|