summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* Establish invariant (GivenInv)wip/T18929Simon Peyton Jones2020-12-2818-146/+297
| | | | | | | | | | | | | | | | | | This patch establishes invariant (GivenInv) from GHC.Tc.Utils.TcType Note [TcLevel invariants]. (GivenInv) says that unification variables from level 'n' should not appear in the Givens for level 'n'. See Note [GivenInv] in teh same module. This invariant was already very nearly true, but a dark corner of partial type signatures made it false. The patch re-jigs partial type signatures a bit to avoid the problem, and documents the invariant much more thorughly Fixes #18646 along the way: see Note [Extra-constraints wildcards] in GHC.Tc.Gen.Bind I also simplified the interface to tcSimplifyInfer slightly, so that it /emits/ the residual constraint, rather than /returning/ it.
* Test cases for #15772 and #17139.Richard Eisenberg2020-12-256-0/+125
|
* Use mutable update to defer out-of-scope errorsRichard Eisenberg2020-12-2521-84/+143
| | | | | | | | | | | | | Previously, we let-bound an identifier to use to carry the erroring evidence for an out-of-scope variable. But this failed for levity-polymorphic out-of-scope variables, leading to a panic (#17812). The new plan is to use a mutable update to just write the erroring expression directly where it needs to go. Close #17812. Test case: typecheck/should_compile/T17812
* Use `hscFrontendHook` againJohn Ericson2020-12-241-2/+5
| | | | | | In eb629fab I accidentally got rid of it when inlining tons of helpers. Closes #19004
* Refactor renamer datastructuresAdam Gundry2020-12-2473-743/+1207
| | | | | | | | | | | | | | | This patch significantly refactors key renamer datastructures (primarily Avail and GlobalRdrElt) in order to treat DuplicateRecordFields in a more robust way. In particular it allows the extension to be used with pattern synonyms (fixes where mangled record selector names could be printed instead of field labels (e.g. with -Wpartial-fields or hole fits, see new tests). The key idea is the introduction of a new type GreName for names that may represent either normal entities or field labels. This is then used in GlobalRdrElt and AvailInfo, in place of the old way of representing fields using FldParent (yuck) and an extra list in AvailTC. Updates the haddock submodule.
* Require ScopedTypeVariables+TypeApplications to use type applications in ↵Ryan Scott2020-12-2431-22/+67
| | | | | | patterns Fixes #19109.
* Clone the binders of a SAKS where necessarySimon Peyton Jones2020-12-247-28/+117
| | | | | | | | | | | | | | Given a kind signature type T :: forall k. k -> forall k. k -> blah data T a b = ... where those k's have the same unique (which is possible; see #19093) we were giving the tyConBinders in tycon T the same unique, which caused chaos. Fix is simple: ensure uniqueness when decomposing the kind signature. See GHC.Tc.Gen.HsType.zipBinders
* Document scoping of named wildcard type variablesSimon Peyton Jones2020-12-231-0/+14
| | | | | | See `Note [Scoping of named wildcards]` in GHC.Hs.Type This lack of documentation came up in #19051.
* spelling: thead -> threadDouglas Wilson2020-12-232-3/+3
|
* Support package qualifier in Prelude importSylvain Henry2020-12-236-5/+31
| | | | Fix #19082, #17045
* WorkWrap: Unbox constructors with existentials (#18982)Sebastian Graf2020-12-2314-234/+542
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Consider ```hs data Ex where Ex :: e -> Int -> Ex f :: Ex -> Int f (Ex e n) = e `seq` n + 1 ``` Worker/wrapper should build the following worker for `f`: ```hs $wf :: forall e. e -> Int# -> Int# $wf e n = e `seq` n +# 1# ``` But previously it didn't, because `Ex` binds an existential. This patch lifts that condition. That entailed having to instantiate existential binders in `GHC.Core.Opt.WorkWrap.Utils.mkWWstr` via `GHC.Core.Utils.dataConRepFSInstPat`, requiring a bit of a refactoring around what is now `DataConPatContext`. CPR W/W still won't unbox DataCons with existentials. See `Note [Which types are unboxed?]` for details. I also refactored the various `tyCon*DataCon(s)_maybe` functions in `GHC.Core.TyCon`, deleting some of them which are no longer needed (`isDataProductType_maybe` and `isDataSumType_maybe`). I cleaned up a couple of call sites, some of which weren't very explicit about whether they cared for existentials or not. The test output of `T18013` changed, because we now unbox the `Rule` data type. Its constructor carries existential state and will be w/w'd now. In the particular example, the worker functions inlines right back into the wrapper, which then unnecessarily has a (quite big) stable unfolding. I think this kind of fallout is inevitable; see also Note [Don't w/w inline small non-loop-breaker things]. There's a new regression test case `T18982`. Fixes #18982.
* DmdAnal: Keep alive RULE vars in LetUp (#18971)Sebastian Graf2020-12-233-85/+67
| | | | I also took the liberty to refactor the logic around `ruleFVs`.
* mkDocs: address shellcheck issuesAdam Sandberg Ericsson2020-12-221-4/+4
|
* mkDocs: fix extraction of Win32 docs from hadrian bindistAdam Sandberg Ericsson2020-12-222-4/+6
|
* Increase -A default to 4MB.Andreas Klebinger2020-12-224-15/+23
| | | | | | | | | | | This gives a small increase in performance under most circumstances. For single threaded GC the improvement is on the order of 1-2%. For multi threaded GC the results are quite noisy but seem to fall into the same ballpark. Fixes #16499
* Require alex < 3.2.6Ryan Scott2020-12-222-1/+4
| | | | A workaround for #19099.
* Add Monoid instances for Product and ComposeJoe Hermaszewski2020-12-223-0/+14
| | | | Semigroup too of course
* Fix another haddock parse errorMatthew Pickering2020-12-221-1/+1
|
* make: disable ghc package environments #18988Adam Sandberg Ericsson2020-12-222-0/+2
|
* hadrian: disable ghc package environments #18988Adam Sandberg Ericsson2020-12-221-0/+1
|
* gitlab-ci: Use gtar on FreeBSDBen Gamari2020-12-211-2/+4
|
* nonmoving: Add comments to nonmovingResurrectThreadsGHC GitLab CI2020-12-201-0/+5
|
* nonmoving: Don't push objects during deadlock detect GCBen Gamari2020-12-201-2/+6
| | | | | | Previously we would push large objects and compact regions to the mark queue during the deadlock detect GC, resulting in failure to detect deadlocks.
* nonmoving: Refactor alloc_for_copyGHC GitLab CI2020-12-201-48/+79
| | | | Pull the cold non-moving allocation path out of alloc_for_copy.
* nonmoving: Ensure deadlock detection promotion worksGHC GitLab CI2020-12-201-18/+22
| | | | | | Previously the deadlock-detection promotion logic in alloc_for_copy was just plain wrong: it failed to fire when gct->evac_gen_no != oldest_gen->gen_no. The fix is simple: move the
* nonmoving: Assert deadlock-gc promotion invariantGHC GitLab CI2020-12-201-0/+8
| | | | | When performing a deadlock-detection GC we must ensure that all objects end up in the non-moving generation. Assert this in scavenge.
* nonmoving: Fix small CPP bugBen Gamari2020-12-201-1/+3
| | | | | Previously an incorrect semicolon meant that we would fail to call busy_wait_nop when spinning.
* Fix Haddock parse error in GHC.Parser.PostProcess.HaddockMatthew Pickering2020-12-201-2/+2
|
* Fix printing in -ddump-rule-rewrites (#18668)Krzysztof Gogolewski2020-12-204-1/+38
| | | | The unapplied arguments were not printed out.
* Kill floatEqualities completelySimon Peyton Jones2020-12-2020-987/+998
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch delivers on #17656, by entirel killing off the complex floatEqualities mechanism. Previously, floatEqualities would float an equality out of an implication, so that it could be solved at an outer level. But now we simply do unification in-place, without floating the constraint, relying on level numbers to determine untouchability. There are a number of important new Notes: * GHC.Tc.Utils.Unify Note [Unification preconditions] describes the preconditions for unification, including both skolem-escape and touchability. * GHC.Tc.Solver.Interact Note [Solve by unification] describes what we do when we do unify * GHC.Tc.Solver.Monad Note [The Unification Level Flag] describes how we control solver iteration under this new scheme * GHC.Tc.Solver.Monad Note [Tracking Given equalities] describes how we track when we have Given equalities * GHC.Tc.Types.Constraint Note [HasGivenEqs] is a new explanation of the ic_given_eqs field of an implication A big raft of subtle Notes in Solver, concerning floatEqualities, disappears. Main code changes: * GHC.Tc.Solver.floatEqualities disappears entirely * GHC.Tc.Solver.Monad: new fields in InertCans, inert_given_eq_lvl and inert_given_eq, updated by updateGivenEqs See Note [Tracking Given equalities]. * In exchange for updateGivenEqa, GHC.Tc.Solver.Monad.getHasGivenEqs is much simpler and more efficient * I found I could kill of metaTyVarUpdateOK entirely One test case T14683 showed a 5.1% decrease in compile-time allocation; and T5631 was down 2.2%. Other changes were small. Metric Decrease: T14683 T5631
* rts: enable thread label table in all RTS flavours #17972Adam Sandberg Ericsson2020-12-207-22/+9
|
* Improve inference with linear typesKrzysztof Gogolewski2020-12-204-12/+15
| | | | | This fixes test Linear14. The code in Unify.hs was always using multiplicity Many instead of a new metavariable.
* Correct documentation around -XTypeOperatorsRichard Eisenberg2020-12-201-18/+25
| | | | Close #19064
* Add two warnings to -WallTom Ellis2020-12-196-8/+8
| | | | | | | * -Wincomplete-uni-patterns * -Wincomplete-record-updates See https://gitlab.haskell.org/ghc/ghc/-/issues/15656
* submodule update: haddockTom Ellis2020-12-191-0/+0
| | | | | Ensure it is ready for -Wincomplete-uni-patterns and -Wincomplete-record-updates in -Wall
* rts: Use weaker cas in WSDequeDouglas Wilson2020-12-192-1/+26
| | | | | | | | The algorithm described in the referenced paper uses this slightly weaker atomic op. This is the first "exotic" cas we're using. I've added a macro in the <ORDERING>_OP style to match existing ones.
* Make noinline more reliableSimon Peyton Jones2020-12-196-12/+112
| | | | | | | | | | This patch makes the desugarer rewrite noinline (f d) --> noinline f d This makes 'noinline' much more reliable: see #18995 It's explained in the improved Note [noinlineId magic] in GHC.Types.Id.Make
* Quick Look: zonk result typeSimon Peyton Jones2020-12-192-19/+72
| | | | | | | | | | | | | | | | | Provoked by #18987, this patch adds a missing zonkQuickLook of app_res_rho in tcApp. Most of the time this zonk is unnecesary. In fact, I can't think of a concrete case where it is needed -- hence no test. But even if it isn't necessary, the reasoning that allows it to be omitted is very subtle. So I've put it in. However, adding this zonk does /not/ affect the emitted constraints, so the reported symptoms for #18987 remain, but harmlessly so, and now documented in a new Note [Instantiation variables are short lived] in GHC.Tc.Gen.App. No change in behaviour, no tests.
* Cite "Kind Inference for Datatypes"Richard Eisenberg2020-12-181-0/+3
|
* testsuite: Fix two shell quoting issuesBen Gamari2020-12-182-4/+4
| | | | | | | | Fixes two ancient bugs in the testsuite driver makefiles due to insufficient quoting. I have no idea how these went unnoticed for so long. Thanks to @tomjaguarpaw for testing.
* primops: Document semantics of Float/Int conversionsBen Gamari2020-12-181-0/+12
| | | | Fixes #18840.
* rts: Fix typo in macro nameBen Gamari2020-12-181-1/+1
| | | | | THREADED_RTS was previously misspelled as THREADEDED_RTS. Fixes #19057.
* Fix #19044 by tweaking unification in inst lookupRichard Eisenberg2020-12-185-52/+168
| | | | | | | | | | See Note [Infinitary substitution in lookup] in GHC.Core.InstEnv and Note [Unification result] in GHC.Core.Unify. Test case: typecheck/should_compile/T190{44,52} Close #19044 Close #19052
* Rename parser Error and Warning typesAlfredo Di Napoli2020-12-1811-352/+353
| | | | | | | | | This commit renames parser's Error and Warning types (and their constructors) to have a 'Ps' prefix, so that this would play nicely when more errors and warnings for other phases of the pipeline will be added. This will make more explicit which is the particular type of error and warning we are dealing with, and will be more informative for users to see in the generated Haddock.
* Split Driver.Env moduleAlfredo Di Napoli2020-12-184-135/+156
| | | | | | | This commit splits the GHC.Driver.Env module creating a separate GHC.Driver.Env.Types module where HscEnv and Hsc would live. This will pave the way to the structured error values by avoiding one boot module later down the line.
* Rts/elf-linker: Upcast to 64bit to satisfy format string.Andreas Klebinger2020-12-181-2/+2
| | | | | The elf size is 32bit on 32bit builds and 64 otherwise. We just upcast to 64bits before printing now.
* rts: EventLog.c: Properly cast (potential) 32bit pointers to uint64_tAndreas Klebinger2020-12-181-2/+3
|
* OSMem.c: Use proper type for mbinds mask argument.Andreas Klebinger2020-12-181-1/+1
| | | | | StgWord has different widths on 32/64bit. So use the proper type instead.
* Use HsOuterExplicit in instance sigs in deriving-generated codeRyan Scott2020-12-1810-54/+211
| | | | | | | | | | | | | | | | | | | | | | | | | Issue #18914 revealed that `GeneralizedNewtypeDeriving` would generate code that mentions unbound type variables, which is dangerously fragile. The problem (and fix) is described in the new `Wrinkle: Use HsOuterExplicit` in `Note [GND and QuantifiedConstraints]`. The gist of it: make sure to put the top-level `forall`s in `deriving`-generated instance signatures in an `HsOuterExplicit` to ensure that they scope over the bodies of methods correctly. A side effect of this process is that it will expand any type synonyms in the instance signature, which will surface any `forall`s that are hidden underneath type synonyms (such as in the test case for #18914). While I was in town, I also performed some maintenance on `NewHsTypeX`, which powers `GeneralizedNewtypeDeriving`: * I renamed `NewHsTypeX` to `HsCoreTy`, which more accurately describes its intended purpose (#15706). I also made `HsCoreTy` a type synonym instead of a newtype, as making it a distinct data type wasn't buying us much. * To make sure that mistakes similar to #18914 do not occur later, I added an additional validity check when renaming `HsCoreTy`s that complains if an `HsCoreTy`s contains an out-of-scope type variable. See the new `Note [Renaming HsCoreTys]` in `GHC.Rename.HsType` for the details. Fixes #15706. Fixes #18914. Bumps the `haddock` submodule.
* Fix project version for ProjectVersionMunged (fix #19058)Sylvain Henry2020-12-172-3/+7
|