summaryrefslogtreecommitdiff
path: root/compiler/GHC
Commit message (Collapse)AuthorAgeFilesLines
...
* Follow up #12449: Improve function `Inspect.hs:check2`Roland Senn2021-06-031-20/+64
| | | | | | | | | * Add a Note to clarify RttiTypes. * Don't call `quantifyType` at all the call sites of `check2`. * Simplyfy arguments of functions `Inspect.hs:check1` and `Inspect.hs:check2`. - `check1` only uses the two lists of type variables, but not the types. - `check2` only uses the two types, but not the lists of type variables. * In `Inspect.hs:check2` send only the tau part of the type to `tcSplitTyConApp_maybe`.
* Port HsToCore messages to new infrastructureAlfredo Di Napoli2021-06-0324-446/+959
| | | | | | | | | | | This commit converts a bunch of HsToCore (Ds) messages to use the new GHC's diagnostic message infrastructure. In particular the DsMessage type has been expanded with a lot of type constructors, each encapsulating a particular error and warning emitted during desugaring. Due to the fact that levity polymorphism checking can happen both at the Ds and at the TcRn level, a new `TcLevityCheckDsMessage` constructor has been added to the `TcRnMessage` type.
* Driver Rework PatchMatthew Pickering2021-06-0327-826/+769
| | | | | | | | | | | | | | | | | | | | | | | | | | | This patch comprises of four different but closely related ideas. The net result is fixing a large number of open issues with the driver whilst making it simpler to understand. 1. Use the hash of the source file to determine whether the source file has changed or not. This makes the recompilation checking more robust to modern build systems which are liable to copy files around changing their modification times. 2. Remove the concept of a "stable module", a stable module was one where the object file was older than the source file, and all transitive dependencies were also stable. Now we don't rely on the modification time of the source file, the notion of stability is moot. 3. Fix TH/plugin recompilation after the removal of stable modules. The TH recompilation check used to rely on stable modules. Now there is a uniform and simple way, we directly track the linkables which were loaded into the interpreter whilst compiling a module. This is an over-approximation but more robust wrt package dependencies changing. 4. Fix recompilation checking for dynamic object files. Now we actually check if the dynamic object file exists when compiling with -dynamic-too Fixes #19774 #19771 #19758 #17434 #11556 #9121 #8211 #16495 #7277 #16093
* WW: Mark absent errors as diverging againSebastian Graf2021-06-024-56/+57
| | | | | | | | | | | | | | | As the now historic part of `NOTE [aBSENT_ERROR_ID]` explains, we used to have `exprIsHNF` respond True to `absentError` and give it a non-bottoming demand signature, in order to perform case-to-let on certain `case`s we used to emit that scrutinised `absentError` (Urgh). What changed, why don't we emit these questionable absent errors anymore? The absent errors in question filled in for binders that would end up in strict fields after being seq'd. Apparently, the old strictness analyser would give these binders an absent demand, but today we give them head-strict demand `1A` and thus don't replace with absent errors at all. This fixes items (1) and (2) of #19853.
* Fix infinite looping in hptSomeModulesBelowMatthew Pickering2021-06-021-6/+14
| | | | | | | | | | | | | | | | When compiling Agda we entered into an infinite loop as the stopping condition was a bit wrong in hptSomeModulesBelow. The bad situation was something like * We would see module A (NotBoot) and follow it dependencies * Later on we would encounter A (Boot) and follow it's dependencies, because the lookup would not match A (NotBoot) and A (IsBoot) * Somewhere in A (Boot)s dependencies, A (Boot) would appear again and lead us into an infinite loop. Now the state marks whether we have been both variants (IsBoot and NotBoot) so we don't follow dependencies for A (Boot) many times.
* Disallow linear arrows in GADT records (#19928)Vladislav Zavialov2021-06-023-11/+27
| | | | | | | | | | | | | Before this patch, GHC used to silently accept programs such as the following: data R where D1 :: { d1 :: Int } %1 -> R The %1 annotation was completely ignored. Now it is a proper error. One remaining issue is that in the error message (⊸) turns into (%1 ->). This is to be corrected with upcoming exactprint updates.
* Specify the reason for import for the backpack's extra importsDivam2021-06-022-9/+13
|
* Fail before checking instances in checkHsigIface if exports don't match (#19244)Zubin Duggal2021-06-021-0/+9
|
* Allow primops in a :print (and friends) command. Fix #19394Roland Senn2021-06-022-11/+38
| | | | | | | * For primops from `GHC.Prim` lookup the HValues in `GHC.PrimopWrappers`. * Add short error messages if a user tries to use a *Non-Id* value or a `pseudoop` in a `:print`, `:sprint` or `force`command. * Add additional test cases for `Magic Ids`.
* StgM: Use ReaderT rather than StateTBen Gamari2021-05-291-5/+5
|
* Use GHC's State monad consistentlyBen Gamari2021-05-2910-12/+22
| | | | | | | | | | | | | GHC's internal State monad benefits from oneShot annotations on its state, allowing for more aggressive eta expansion. We currently don't have monad transformers with the same optimisation, so we only change uses of the pure State monad here. See #19657 and 19380. Metric Decrease: hie002
* Split GHC.Utils.Monad.State into .Strict and .LazyBen Gamari2021-05-2910-9/+95
|
* Rip GHC.Tc.Solver.Monad asunder (only)Richard Eisenberg2021-05-2913-1926/+2029
| | | | | | | | | | | This creates new modules GHC.Tc.Solver.InertSet and GHC.Tc.Solver.Types. The Monad module is still pretty big, but this is an improvement. Moreover, it means that GHC.HsToCore.Pmc.Solver.Types no longer depends on the constraint solver (it now depends on GHC.Tc.Solver.InertSet), making the error-messages work easier. This patch thus contributes to #18516.
* Fix and slight improvement to datacon worker/wrapper notesSylvain Henry2021-05-292-2/+5
|
* Bignum: match on DataCon workers in rules (#19892)Sylvain Henry2021-05-291-7/+26
| | | | | | | | | We need to match on DataCon workers for the rules to be triggered. T13701 ghc/alloc decreases by ~2.5% on some archs Metric Decrease: T13701
* Fix Note [Positioning of forkM]Zubin Duggal2021-05-291-5/+4
|
* ghci: Enable -fkeep-going by defaultMatthew Pickering2021-05-291-1/+1
| | | | | | | | | | | This also demotes the error message about -fkeep-going to a trace message which matches the behaviour of other build systems (such as cabal-install and nix) which don't print any message like this on a failure. We want to remove the stable module check in a future patch, which is an approximation of `-fkeep-going`. At the moment this change shouldn't do very much.
* Work around LLVM backend overlapping register limitationsLuite Stegeman2021-05-296-80/+117
| | | | | | | | The stg_ctoi_t and stg_ret_t procedures which convert unboxed tuples between the bytecode an native calling convention were causing a panic when using the LLVM backend. Fixes #19591
* Add -Wmissing-exported-pattern-synonym-signaturesThomas Winant2021-05-293-128/+163
| | | | | | | | | | | | | After !4741, it was no longer possible to silence a warning about a missing pattern synonym signature if the `-Wmissing-signatures` flag was on. Restore the previous semantics while still adhering to the principle "enabling an additional warning flag should never make prior warnings disappear". For more symmetry and granularity, introduce `-Wmissing-exported-pattern-synonym-signatures`. See Note [Missing signatures] for an overview of all flags involved.
* Change representation of HsGetField and HsProjectionShayne Fletcher2021-05-276-33/+36
| | | | | Another change in a series improving record syntax in the AST. The key change in this commit is the renaming of `HsFieldLabel` to `DotFieldOcc`.
* Enable strict dicts by default at -O2.Andreas Klebinger2021-05-272-17/+56
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In the common case this is a straight performance win at a compile time cost so we enable it at -O2. In rare cases it can lead to compile time regressions because of changed inlining behaviour. Which can very rarely also affect runtime performance. Increasing the inlining threshold can help to avoid this which is documented in the user guide. In terms of measured results this reduced instructions executed for nofib by 1%. However for some cases (e.g. Cabal) enabling this by default increases compile time by 2-3% so we enable it only at -O2 where it's clear that a user is willing to trade compile time for runtime. Most of the testsuite runs without -O2 so there are few perf changes. Increases: T12545/T18698: We perform more WW work because dicts are now treated strict. T9198: Also some more work because functions are now subject to W/W Decreases: T14697: Compiling empty modules. Probably because of changes inside ghc. T9203: I can't reproduce this improvement locally. Might be spurious. ------------------------- Metric Decrease: T12227 T14697 T9203 Metric Increase: T9198 T12545 T18698a T18698b -------------------------
* Avoid fingerprinting the absolute path to the source filePepe Iborra2021-05-263-8/+45
| | | | | | | | | | | | | | | | | | | | | | | This change aims to make source files relocatable w.r.t. to the interface files produced by the compiler. This is so that we can download interface files produced by a cloud build system and then reuse them in a local ghcide session catch another case of implicit includes actually use the implicit quote includes add another missing case recomp020 test that .hi files are reused even if .hs files are moved to a new location Added recomp021 to record behaviour with non implicit includes add a note additional pointer to the note Mention #16956 in Note
* Support new parser types in GHCAlfredo Di Napoli2021-05-2620-1257/+1524
| | | | | | | | | | | | | | This commit converts the lexers and all the parser machinery to use the new parser types and diagnostics infrastructure. Furthermore, it cleans up the way the parser code was emitting hints. As a result of this systematic approach, the test output of the `InfixAppPatErr` and `T984` tests have been changed. Previously they would emit a `SuggestMissingDo` hint, but this was not at all helpful in resolving the error, and it was even confusing by just looking at the original program that triggered the errors. Update haddock submodule
* Make tcIfaceCompleteMatch lazier.Zubin Duggal2021-05-251-2/+13
| | | | | Insufficient lazyness causes a loop while typechecking COMPLETE pragmas from interfaces (#19744).
* Refactor driver code; de-duplicate and split APIs (#14095, !5555)Divam2021-05-258-367/+368
| | | | | | | | | | | | | | | | | This commit does some de-duplication of logic between the one-shot and --make modes, and splitting of some of the APIs so that its easier to do the fine-grained parallelism implementation. This is the first part of the implementation plan as described in #14095 * compileOne now uses the runPhase pipeline for most of the work. The Interpreter backend handling has been moved to the runPhase. * hscIncrementalCompile has been broken down into multiple APIs. * haddock submodule bump: Rename of variables in html-test ref: This is caused by a change in ModDetails in case of NoBackend. Now the initModDetails is used to recreate the ModDetails from interface and in-memory ModDetails is not used.
* check-{ppr/exact}: Rewrite more directly to just parse filesMatthew Pickering2021-05-241-0/+1
| | | | | | There was quite a large amount of indirection in these tests, so I have rewritten them to just directly parse the files rather than making a module graph and entering other twisty packages.
* Move warning flag handling into Flags moduleSylvain Henry2021-05-243-277/+407
| | | | | | | | | | | I need this to make the Logger independent of DynFlags. Also fix copy-paste errors: Opt_WarnNonCanonicalMonadInstances was associated to "noncanonical-monadfail-instances" (MonadFailInstances vs MonadInstances). In the process I've also made the default name for each flag more explicit.
* HsToken for HsPar, ParPat, HsCmdPar (#19523)Vladislav Zavialov2021-05-2327-129/+141
| | | | This patch is a first step towards a simpler design for exact printing.
* Introduce Strict.Maybe, Strict.Pair (#19156)Vladislav Zavialov2021-05-2314-68/+162
| | | | | | | | | | | | | This patch fixes a space leak related to the use of Maybe in RealSrcSpan by introducing a strict variant of Maybe. In addition to that, it also introduces a strict pair and uses the newly introduced strict data types in a few other places (e.g. the lexer/parser state) to reduce allocations. Includes a regression test.
* EPA: AnnAt missing for type application in patternsAlan Zimmerman2021-05-234-13/+16
| | | | | | | | | | Ensure that the exact print annotations accurately record the `@` for code like tyApp :: Con k a -> Proxy a tyApp (Con @kx @ax (x :: Proxy ax)) = x :: Proxy (ax :: kx) Closes #19850
* Change representation of field selector occurencesShayne Fletcher2021-05-2321-336/+121
| | | | | | | | | | | | - Change the names of the fields in in `data FieldOcc` - Renames `HsRecFld` to `HsRecSel` - Replace `AmbiguousFieldOcc p` in `HsRecSel` with `FieldOcc p` - Contains a haddock submodule update The primary motivation of this change is to remove `AmbiguousFieldOcc`. This is one of a suite of changes improving how record syntax (most notably record update syntax) is represented in the AST.
* Remove Maybe from Context in HsQualTyAlan Zimmerman2021-05-218-46/+45
| | | | | | Updates haddock submodule Closes #19845
* EPA: Fix explicit specificity and unicode linear arrow annotationsAlan Zimmerman2021-05-212-3/+8
| | | | | Closes #19839 Closes #19840
* SysTools: make file copy more efficientSylvain Henry2021-05-213-47/+43
|
* Only suggest names that make sense (#19843)Jakob Brünker2021-05-218-103/+284
| | | | | | | | | | | | | | | | * Don't show suggestions for similar variables when a data constructor in a pattern is not in scope. * Only suggest record fields when a record field for record creation or updating is not in scope. * Suggest similar record fields when a record field is not in scope with -XOverloadedRecordDot. * Show suggestions for data constructors if a type constructor or type is not in scope, but only if -XDataKinds is enabled. Fixes #19843.
* Add exports to GHC.Tc.Errors.Hole (fixes #19864)Matthías Páll Gissurarson2021-05-202-107/+153
|
* Extensible Hints for diagnostic messagesAlfredo Di Napoli2021-05-2022-138/+304
| | | | | | | | | | | | | | | | | | This commit extends the GHC diagnostic hierarchy with a `GhcHint` type, modelling helpful suggestions emitted by GHC which can be used to deal with a particular warning or error. As a direct consequence of this, the `Diagnostic` typeclass has been extended with a `diagnosticHints` method, which returns a `[GhcHint]`. This means that now we can clearly separate out the printing of the diagnostic message with the suggested fixes. This is done by extending the `printMessages` function in `GHC.Driver.Errors`. On top of that, the old `PsHint` type has been superseded by the new `GhcHint` type, which de-duplicates some hints in favour of a general `SuggestExtension` constructor that takes a `GHC.LanguageExtensions.Extension`.
* Use pprSigmaType to print GHCi debugger Suspension Terms (Fix #19355)Roland Senn2021-05-201-3/+2
| | | | | | | | In the GHCi debugger use the function `pprSigmaType` to print out Suspension Terms. The function `pprSigmaType` respect the flag `-f(no-)print-explicit-foralls` and so it fixes #19355. Switch back output of existing tests to default mode (no explicit foralls).
* Remove wired-in names hs-boot check bypass (#19855)Sylvain Henry2021-05-191-3/+0
| | | | The check bypass is no longer necessary and the check would have avoided #19638.
* constant folding: Make shiftRule for Word8/16/32# types return correct typeMatthew Pickering2021-05-191-6/+6
| | | | Fixes #19851
* Make setBndrsDemandInfo work with only type variablesMatthew Pickering2021-05-191-4/+4
| | | | | | Fixes #19849 Co-authored-by: Krzysztof Gogolewski <krzysztof.gogolewski@tweag.io>
* PPC NCG: Fix unsigned compare with 16-bit constantsPeter Trommler2021-05-191-1/+2
| | | | Fixes #19852 and #19609
* driver: check if clang is the assembler when passing clang specific ↵Adam Sandberg Ericsson2021-05-193-15/+34
| | | | | | | arguments (#19827) Previously we assumed that the assembler was the same as the c compiler, but we allow setting them to different programs with -pgmc and -pgma.
* Changes to HsRecField'Shayne Fletcher2021-05-1922-154/+156
|
* Cmm: fix sinking after suspendThreadSylvain Henry2021-05-199-21/+53
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Suppose a safe call: myCall(x,y,z) It is lowered into three unsafe calls in Cmm: r = suspendThread(...); myCall(x,y,z); resumeThread(r); Consider the following situation for myCall arguments: x = Sp[..] -- stack y = Hp[..] -- heap z = R1 -- global register r = suspendThread(...); myCall(x,y,z); resumeThread(r); The sink pass assumes that unsafe calls clobber memory (heap and stack), hence x and y assignments are not sunk after `suspendThread`. The sink pass also correctly handles global register clobbering for all unsafe calls, except `suspendThread`! `suspendThread` is special because it releases the capability the thread is running on. Hence the sink pass must also take into account global registers that are mapped into memory (in the capability). In the example above, we could get: r = suspendThread(...); z = R1 myCall(x,y,z); resumeThread(r); But this transformation isn't valid if R1 is (BaseReg->rR1) as BaseReg is invalid between suspendThread and resumeThread. This caused argument corruption at least with the C backend ("unregisterised") in #19237. Fix #19237
* CPR: Detect constructed products in `runRW#` apps (#19822)Sebastian Graf2021-05-193-26/+54
| | | | | | | | | | | | | | | | | | | | | In #19822, we realised that the Simplifier's new habit of floating cases into `runRW#` continuations inhibits CPR analysis from giving key functions of `text` the CPR property, such as `singleton`. This patch fixes that by anticipating part of !5667 (Nested CPR) to give `runRW#` the proper CPR transformer it now deserves: Namely, `runRW# (\s -> e)` should have the CPR property iff `e` has it. The details are in `Note [Simplification of runRW#]` in GHC.CoreToStg.Prep. The output of T18086 changed a bit: `panic` (which calls `runRW#`) now has `botCpr`. As outlined in Note [Bottom CPR iff Dead-Ending Divergence], that's OK. Fixes #19822. Metric Decrease: T9872d
* EPA: Remove duplicate annotations from HsDataDefnAlan Zimmerman2021-05-194-17/+14
| | | | | | | | They are repeated in the surrounding DataDecl and FamEqn. Updates haddock submodule Closes #19834
* Tidy: Ignore rules (more) when -fomit-interface-pragmas is onMatthew Pickering2021-05-191-1/+8
| | | | | | | | | | | Before this commit, the RHS of a rule would expose additional definitions, despite the fact that the rule wouldn't get exposed so it wouldn't be possible to ever use these definitions. The net-result is slightly less recompilation when specialisation introduces rules. Related to #19836
* Fix LitRubbish being applied to values.Andreas Klebinger2021-05-191-12/+14
| | | | This fixes #19824
* Implement :info for record pattern synonyms (#19462)nineonine2021-05-193-12/+19
|