summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* docs: Remove mentions of ArrayArray# from unlifted FFI sectionwip/romes/fix-docsRodrigo Mesquita2023-04-281-21/+18
| | | | Fixes #23277
* Give more guarntees about ImplicitParams (#23289)Andrei Borzenkov2023-04-254-2/+37
| | | | | | | | | | | | | | | | - Added new section in the GHC user's guide that legends behavior of nested implicit parameter bindings in these two cases: let ?f = 1 in let ?f = 2 in ?f and data T where MkT :: (?f :: Int) => T f :: T -> T -> Int f MkT MkT = ?f - Added new test case to examine this behavior.
* JS: Fix h$base_access implementation (issue 22576)Josh Meredith2023-04-255-7/+11
|
* JS/base: provide implementation for mkdir (issue 22374)Josh Meredith2023-04-255-2/+31
|
* More informative errors for bad imports (#21826)Soham Chowdhury2023-04-2557-237/+474
|
* Add since pragma to Data.Functor.unzipBodigrim2023-04-241-1/+4
|
* hadrian: fix non-ghc program paths passed to testsuite driver when testing ↵Cheng Shao2023-04-241-4/+5
| | | | cross GHC
* compiler: don't install signal handlers when the host platform doesn't have ↵Cheng Shao2023-04-241-0/+8
| | | | | | | | | | signals Previously, large parts of GHC API will transitively invoke withSignalHandlers, which doesn't work on host platforms without signal functionality at all (e.g. wasm32-wasi). By making withSignalHandlers a no-op on those platforms, we can make more parts of GHC API work out of the box when signals aren't supported.
* rts: always build 64-bit atomic opsCheng Shao2023-04-246-71/+36
| | | | | | | | | | This patch does a few things: - Always build 64-bit atomic ops in rts/ghc-prim, even on 32-bit platforms - Remove legacy "64bit" cabal flag of rts package - Fix hs_xchg64 function prototype for 32-bit platforms - Fix AtomicFetch test for wasm32
* testsuite/T20137: Avoid impl.-defined behaviorBen Gamari2023-04-242-14/+14
| | | | | | | | Previously we would cast pointers to uint64_t. However, implementations are allowed to either zero- or sign-extend such casts. Instead cast to uintptr_t to avoid this. Fixes #23247.
* Fix doc typos in libraries/basetocic2023-04-237-9/+9
|
* Implement executablePath for Solaris and make getBaseDir less platform-dependentPHO2023-04-233-19/+50
| | | | | | | | | | Use base-4.17 executablePath when possible, and fall back on getExecutablePath when it's not available. The sole reason why getBaseDir had #ifdef's was apparently that getExecutablePath wasn't reliable, and we could reduce the number of CPP conditionals by making use of executablePath instead. Also export executablePath on js_HOST_ARCH.
* User's guide: DeepSubsumption is implied by Haskell{98,2010}amesgen2023-04-211-0/+2
|
* Minor doc fixesKrzysztof Gogolewski2023-04-215-13/+15
| | | | | | | | | - Add docs/index.html to .gitignore. It is created by ./hadrian/build docs, and it was the only file in Hadrian's templateRules not present in .gitignore. - Mention that MultiWayIf supports non-boolean guards - Remove documentation of optdll - removed in 2007, 763daed95 - Fix markdown syntax
* Testsuite: replace some js_broken/js_skip predicates with req_cSylvain Henry2023-04-215-9/+9
| | | | Using req_c is more precise.
* Fix doc typos in libraries/base/GHCtocic2023-04-216-8/+8
|
* testsuite: Add test for #23071Ben Gamari2023-04-202-0/+6
|
* rts: Initialize Array# header in listThreads#Ben Gamari2023-04-201-0/+1
| | | | | | | Previously the implementation of listThreads# failed to initialize the header of the created array, leading to various nastiness. Fixes #23071
* Implement -jsem: parallelism controlled by semaphoressheaf2023-04-2014-59/+714
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | See https://github.com/ghc-proposals/ghc-proposals/pull/540/ for a complete description for the motivation for this feature. The `-jsem` option allows a build tool to pass a semaphore to GHC which GHC can use in order to control how much parallelism it requests. GHC itself acts as a client in the GHC jobserver protocol. ``` GHC Jobserver Protocol ~~~~~~~~~~~~~~~~~~~~~~ This proposal introduces the GHC Jobserver Protocol. This protocol allows a server to dynamically invoke many instances of a client process, while restricting all of those instances to use no more than <n> capabilities. This is achieved by coordination over a system semaphore (either a POSIX semaphore [6]_ in the case of Linux and Darwin, or a Win32 semaphore [7]_ in the case of Windows platforms). There are two kinds of participants in the GHC Jobserver protocol: - The *jobserver* creates a system semaphore with a certain number of available tokens. Each time the jobserver wants to spawn a new jobclient subprocess, it **must** first acquire a single token from the semaphore, before spawning the subprocess. This token **must** be released once the subprocess terminates. Once work is finished, the jobserver **must** destroy the semaphore it created. - A *jobclient* is a subprocess spawned by the jobserver or another jobclient. Each jobclient starts with one available token (its *implicit token*, which was acquired by the parent which spawned it), and can request more tokens through the Jobserver Protocol by waiting on the semaphore. Each time a jobclient wants to spawn a new jobclient subprocess, it **must** pass on a single token to the child jobclient. This token can either be the jobclient's implicit token, or another token which the jobclient acquired from the semaphore. Each jobclient **must** release exactly as many tokens as it has acquired from the semaphore (this does not include the implicit tokens). ``` Build tools such as cabal act as jobservers in the protocol and are responsibile for correctly creating, cleaning up and managing the semaphore. Adds a new submodule (semaphore-compat) for managing and interacting with semaphores in a cross-platform way. Fixes #19349
* Fix doc typo in GHC.Read.readListtocic2023-04-201-2/+2
|
* hadrian: Pass haddock file arguments in a response fileMatthew Pickering2023-04-202-1/+13
| | | | | | | | | | | In !10119 CI was failing on windows because the command line was too long. We can mitigate this by passing the file arguments to haddock in a response file. We can't easily pass all the arguments in a response file because the `+RTS` arguments can't be placed in the response file. Fixes #23273
* Testsuite: don't use obsolescent egrep (#22351)Sylvain Henry2023-04-194-7/+7
| | | | | | | | Recent egrep displays the following message, breaking golden tests: egrep: warning: egrep is obsolescent; using grep -E Switch to using "grep -E" instead
* CI: Disable abi-test-nightlyBryan Richter2023-04-191-0/+3
| | | | See #23269
* JS: fix thread-related primopsSylvain Henry2023-04-196-14/+36
|
* Don't panic in ltPatersonSizesheaf2023-04-183-20/+79
| | | | | | | | | | | | | | | | The function GHC.Tc.Utils.TcType.ltPatersonSize would panic when it encountered a type family on the RHS, as usually these are not allowed (type families are not allowed on the RHS of class instances or of quantified constraints). However, it is possible to still encounter type families on the RHS after doing a bit of constraint solving, as seen in test case T23171. This could trigger the panic in the call to ltPatersonSize in GHC.Tc.Solver.Canonical.mk_strict_superclasses, which is involved in avoiding loopy superclass constraints. This patch simply changes ltPatersonSize to return "I don't know, because there's a type family involved" in these cases. Fixes #23171
* Convert interface file loading errors into proper diagnosticsMatthew Pickering2023-04-1859-508/+853
| | | | | | | | | | | | | | This patch converts all the errors to do with loading interface files into proper structured diagnostics. * DriverMessage: Sometimes in the driver we attempt to load an interface file so we embed the IfaceMessage into the DriverMessage. * TcRnMessage: Most the time we are loading interface files during typechecking, so we embed the IfaceMessage This patch also removes the TcRnInterfaceLookupError constructor which is superceded by the IfaceMessage, which is now structured compared to just storing an SDoc before.
* Misc cleanupKrzysztof Gogolewski2023-04-1713-33/+30
| | | | | | - Use dedicated list functions - Make cloneBndrs and cloneRecIdBndrs monadic - Fix invalid haddock comments in libraries/base
* validDerivPred: Reject exotic constraints in IrredPredsRyan Scott2023-04-1712-111/+285
| | | | | | | | | | | | | | | | | | | | | | | | | This brings the `IrredPred` case in sync with the treatment of `ClassPred`s as described in `Note [Valid 'deriving' predicate]` in `GHC.Tc.Validity`. Namely, we should reject `IrredPred`s that are inferred from `deriving` clauses whose arguments contain other type constructors, as described in `(VD2) Reject exotic constraints` of that Note. This has the nice property that `deriving` clauses whose inferred instance context mention `TypeError` will now emit the type error in the resulting error message, which better matches existing intuitions about how `TypeError` should work. While I was in town, I noticed that much of `Note [Valid 'deriving' predicate]` was duplicated in a separate `Note [Exotic derived instance contexts]` in `GHC.Tc.Deriv.Infer`. I decided to fold the latter Note into the former so that there is a single authority on describing the conditions under which an inferred `deriving` constraint can be considered valid. This changes the behavior of `deriving` in a way that existing code might break, so I have made a mention of this in the GHC User's Guide. It seems very, very unlikely that much code is relying on this strange behavior, however, and even if there is, there is a clear, backwards-compatible migration path using `StandaloneDeriving`. Fixes #22696.
* Add regression test for #23199Simon Peyton Jones2023-04-172-0/+11
|
* Account for special GHC.Prim import in warnUnusedPackagesMatthew Pickering2023-04-173-3/+14
| | | | | | | | | | | | The GHC.Prim import is treated quite specially primarily because there isn't an interface file for GHC.Prim. Therefore we record separately in the ModSummary if it's imported or not so we don't go looking for it. This logic hasn't made it's way to `-Wunused-packages` so if you imported GHC.Prim then the warning would complain you didn't use `-package ghc-prim`. Fixes #23212
* Add import lists to few GHC.Driver.Session importsOleg Grenrus2023-04-164-4/+6
| | | | | | Related to https://gitlab.haskell.org/ghc/ghc/-/issues/23261. There are a lot of GHC.Driver.Session which only use DynFlags, but not the parsing code.
* Transfer DFunId_ness onto specialised bindingsSimon Peyton Jones2023-04-161-41/+78
| | | | | | | | | | | | | | | | | | | | Whether a binding is a DFunId or not has consequences for the `-fdicts-strict` flag, essentially if we are doing demand analysis for a DFunId then `-fdicts-strict` does not apply because the constraint solver can create recursive groups of dictionaries. In #22549 this was fixed for the "normal" case, see Note [Do not strictify the argument dictionaries of a dfun]. However the loop still existed if the DFunId was being specialised. The problem was that the specialiser would specialise a DFunId and turn it into a VanillaId and so the demand analyser didn't know to apply special treatment to the binding anymore and the whole recursive group was optimised to bottom. The solution is to transfer over the DFunId-ness of the binding in the specialiser so that the demand analyser knows not to apply the `-fstrict-dicts`. Fixes #22549
* Handle ConcreteTvs in inferResultToTypewip/T23153sheaf2023-04-1513-34/+90
| | | | | | | | | | inferResultToType was discarding the ir_frr information, which meant some metavariables ended up being MetaTvs instead of ConcreteTvs. This function now creates new ConcreteTvs as necessary, instead of always creating MetaTvs. Fixes #23154
* Show an error when we cannot default a concrete tyvarKrzysztof Gogolewski2023-04-157-4/+55
| | | | Fixes #23153
* docs: Update template-haskell docs to use Code Q a rather than Q (TExp a)Matthew Pickering2023-04-151-37/+41
| | | | | | | | Since GHC Proposal #195, the type of [|| ... ||] has been Code Q a rather than Q (TExp a). The documentation in the `template-haskell` library wasn't updated to reflect this change. Fixes #23148
* Make approximateWC a bit clevererwip/T22194-flagsSimon Peyton Jones2023-04-141-61/+94
| | | | | | | | | | | This MR fixes #23224: making approximateWC more clever See the long `Note [ApproximateWC]` in GHC.Tc.Solver All this is delicate and ad-hoc -- but it /has/ to be: we are talking about inferring a type for a binding in the presence of GADTs, type families and whatnot: known difficult territory. We just try as hard as we can.
* Improve partial signaturesSimon Peyton Jones2023-04-1411-138/+181
| | | | | | | | | | | | | | | | | | | | | | | This MR fixes #23223. The changes are in two places: * GHC.Tc.Bind.checkMonomorphismRestriction See the new `Note [When the MR applies]` We now no longer stupidly attempt to apply the MR when the user specifies a context, e.g. f :: Eq a => _ -> _ * GHC.Tc.Solver.decideQuantification See rewritten `Note [Constraints in partial type signatures]` Fixing this bug apparently breaks three tests: * partial-sigs/should_compile/T11192 * partial-sigs/should_fail/Defaulting1MROff * partial-sigs/should_fail/T11122 However they are all symptoms of #23232, so I'm marking them as expect_broken(23232). I feel happy about this MR. Nice.
* Add some documentation about redundant constraintsSimon Peyton Jones2023-04-142-5/+28
|
* Major refactor in the handling of equality constraintsSimon Peyton Jones2023-04-1440-1240/+2181
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This MR substantially refactors the way in which the constraint solver deals with equality constraints. The big thing is: * Intead of a pipeline in which we /first/ canonicalise and /then/ interact (the latter including performing unification) the two steps are more closely integreated into one. That avoids the current rather indirect communication between the two steps. The proximate cause for this refactoring is fixing #22194, which involve solving [W] alpha[2] ~ Maybe (F beta[4]) by doing this: alpha[2] := Maybe delta[2] [W] delta[2] ~ F beta[4] That is, we don't promote beta[4]! This is very like introducing a cycle breaker, and was very awkward to do before, but now it is all nice. See GHC.Tc.Utils.Unify Note [Promotion and level-checking] and Note [Family applications in canonical constraints]. The big change is this: * Several canonicalisation checks (occurs-check, cycle-breaking, checking for concreteness) are combined into one new function: GHC.Tc.Utils.Unify.checkTyEqRhs This function is controlled by `TyEqFlags`, which says what to do for foralls, type families etc. * `canEqCanLHSFinish` now sees if unification is possible, and if so, actually does it: see `canEqCanLHSFinish_try_unification`. There are loads of smaller changes: * The on-the-fly unifier `GHC.Tc.Utils.Unify.unifyType` has a cheap-and-cheerful version of `checkTyEqRhs`, called `simpleUnifyCheck`. If `simpleUnifyCheck` succeeds, it can unify, otherwise it defers by emitting a constraint. This is simpler than before. * I simplified the swapping code in `GHC.Tc.Solver.Equality.canEqCanLHS`. Especially the nasty stuff involving `swap_for_occurs` and `canEqTyVarFunEq`. Much nicer now. See Note [Orienting TyVarLHS/TyFamLHS] Note [Orienting TyFamLHS/TyFamLHS] * Added `cteSkolemOccurs`, `cteConcrete`, and `cteCoercionHole` to the problems that can be discovered by `checkTyEqRhs`. * I fixed #23199 `pickQuantifiablePreds`, which actually allows GHC to to accept both cases in #22194 rather than rejecting both. Yet smaller: * Added a `synIsConcrete` flag to `SynonymTyCon` (alongside `synIsFamFree`) to reduce the need for synonym expansion when checking concreteness. Use it in `isConcreteType`. * Renamed `isConcrete` to `isConcreteType` * Defined `GHC.Core.TyCo.FVs.isInjectiveInType` as a more efficient way to find if a particular type variable is used injectively than finding all the injective variables. It is called in `GHC.Tc.Utils.Unify.definitely_poly`, which in turn is used quite a lot. * Moved `rewriterView` to `GHC.Core.Type`, so we can use it from the constraint solver. Fixes #22194, #23199 Compile times decrease by an average of 0.1%; but there is a 7.4% drop in compiler allocation on T15703. Metric Decrease: T15703
* Stop if type constructors have kind errorsSimon Peyton Jones2023-04-146-17/+35
| | | | | | | | | Otherwise we get knock-on errors, such as #23252. This makes GHC fail a bit sooner, and I have not attempted to add recovery code, to add a fake TyCon place of the erroneous one, in an attempt to get more type errors in one pass. We could do that (perhaps) if there was a call for it.
* docs: Generate docs/index.html with version numberMatthew Pickering2023-04-143-4/+5
| | | | | | | | | | * Generate docs/index.html to include the version of the ghc library * This also fixes the packageVersions interpolations which were - Missing an interpolation for `LIBRARY_ghc_VERSION` - Double quoting the version so that "9.7" was being inserted. Fixes #23121
* rts: improve memory ordering and add some comments in the StablePtr ↵Adam Sandberg Ericsson2023-04-141-10/+36
| | | | implementation
* Base/JS: GHC.JS.Foreign.Callback module (issue 23126)Josh Meredith2023-04-1328-4/+638
| | | | | | | | | | | | | * Add the Callback module for "exporting" Haskell functions to be available to plain JavaScript code * Fix some primitives defined in GHC.JS.Prim * Add a JavaScript section to the user guide with instructions on how to use the JavaScript FFI, building up to using Callbacks to interact with the browser * Add tests for the JavaScript FFI and Callbacks
* Make WordQuotRem2Op ok-for-speculation tooSylvain Henry2023-04-132-3/+6
|
* Make Int64/Word64 division ok for speculation too.Sylvain Henry2023-04-132-13/+10
| | | | Only when the divisor is definitely non-zero.
* Add quot folding rule (#22152)Sylvain Henry2023-04-136-19/+177
| | | | | | | (x / l1) / l2 l1 and l2 /= 0 l1*l2 doesn't overflow ==> x / (l1 * l2)
* Add quotRem rules (#22152)Sylvain Henry2023-04-135-0/+92
| | | | | | | | | | | | | | case quotRemInt# x y of (# q, _ #) -> body ====> case quotInt# x y of q -> body case quotRemInt# x y of (# _, r #) -> body ====> case remInt# x y of r -> body
* Add regression test for #23229Rodrigo Mesquita2023-04-123-0/+3
|
* Allow generation of TTH syntax with THOleg Grenrus2023-04-1217-1/+88
| | | | | | | | | | | | | | | | | | | | In other words allow generation of typed splices and brackets with Untyped Template Haskell. That is useful in cases where a library is build with TTH in mind, but we still want to generate some auxiliary declarations, where TTH cannot help us, but untyped TH can. Such example is e.g. `staged-sop` which works with TTH, but we would like to derive `Generic` declarations with TH. An alternative approach is to use `unsafeCodeCoerce`, but then the derived `Generic` instances would be type-checked only at use sites, i.e. much later. Also `-ddump-splices` output is quite ugly: user-written instances would use TTH brackets, not `unsafeCodeCoerce`. This commit doesn't allow generating of untyped template splices and brackets with untyped TH, as I don't know why one would want to do that (instead of merging the splices, e.g.)
* Clarify a couple of Notes about 'nospec'Simon Peyton Jones2023-04-112-5/+12
|