This project is mirrored from https://*****:*****@gitlab.haskell.org/ghc/ghc.git.
Pull mirroring updated .
- Mar 13, 2025
-
-
-
A ModIface is the result of compilation that we keep for a long time in memory. Therefore, it's very important to manage what we are going to retain and remove any external references to things which we might have captured compilation. If storing your ModIface in memory uses too much space, then store less things or make it use a more efficient representation. In the past there have been many space leak bugs by not sufficiently forcing a ModIface (#15111) This patch adds all the missing NFData instances for all the places I could find where we weren't deeply forcing the structure.
-
- Mar 12, 2025
-
-
These are no longer used. I noticed these while looking for uses of __PIC__ in Cmm sources.
-
Getting this file right has historically been quite painful as it is a dynamically-typed script running only late in the release pipeline.
-
It seems that we need a direct dependency on ghc-internal, otherwise Haddock cannot find our haddocks The bug seems to be caused by Hadrian because if I rebuild with cabal-install (without this extra dependency) then I get accurate Haddocks. Resolves #25705
-
-
This MR fixes #25672 See Note [Unpacking GADTs and existentials] in GHC.Types.Id.Make
-
- Mar 11, 2025
-
-
The `mi_hpc` field is not used for anything as far as I can discern so there is no reason to record in the private interface of a module that there are modules in the transitive closure which use `hpc`. You can freely mix modules which use `-fhpc` and ones which don't. Whether to recompile a module due to `-fhpc` being passed to the module itself is determined in `fingerprintDynFlags`.
-
In the distant past, recompilation checking was disabled for interfaces which used TemplateHaskell, but for several years now recompilation checking has been more fine-grained. This has rendered this field unused and lingering in an interface file.
-
On darwin platforms, `-fPIC` is always enabled but on linux it is only enabled in the dynamic flavour. This can cause a difference in interface files (see #25836). The purpose of this test isn't to test module A recompilation, so we avoid this platform dependency by always passing `-fPIC`.
-
The "interface hash" should contain a hash of everything in the interface file. We are not doing that yet but at least a start is to include a hash of everything in `mi_self_recomp`, rather than just `mi_src_hash` and `mi_usages`. In particular, this fixes #25837, a bug where we should recompile a `dyn_hi` file but fail to do so.
-
This commit extends the documentation of the OverloadedStrings extension with some usage information, in particular suggestions to: - use default declarations, such as `default (Text)` or `default IsString(Text)` (with the NamedDefaults extension), - enable the ExtendedDefaultRules extension to relax the requirement that a defaultable type variable must only appear in unary standard classes Fixes #23388
-
This commit adds a new section on defaulting, which consolidates various parts of documentation surrounding defaulting into one central place. It explains type class defaulting in detail, extensions to it with OverloadedStrings, NamedDefaults and ExtendedDefaultRules, as well as other defaulting mechanisms (e.g. kind-based defaulting such as RuntimeRep defaulting, and defaulting of equalities).
-
Fix a panic triggered by a combination of \case{} and forall t -> ghci> let f :: forall (xs :: Type) -> (); f = \case {} panic! (the 'impossible' happened) GHC version 9.10.1: Util: only The new error message looks like this: ghci> let f :: forall (xs :: Type) -> (); f = \case {} <interactive>:5:41: error: [GHC-48010] • Empty list of alternatives in \case expression checked against a forall-type: forall xs -> ... This is achieved as follows: * A new data type, BadEmptyCaseReason, is now used to describe why an empty case has been rejected. Used in TcRnEmptyCase. * HsMatchContextRn is passed to tcMatches, so that the type checker can attach the syntactic context to the error message. * tcMatches now rejects type arguments if the list of alternatives is empty. This is what fixes the bug.
-
This patch changes PrefixCon to use one list instead of two: -data HsConDetails tyarg arg rec - = PrefixCon [tyarg] [arg] +data HsConDetails arg rec + = PrefixCon [arg] | RecCon rec | InfixCon arg arg The [tyarg] list is now gone. To understand the effect of this change, recall that there are three instantiations of HsConDetails: 1. type HsConPatDetails p = HsConDetails (HsConPatTyArg (NoGhcTc p)) -- tyarg (LPat p) -- arg (HsRecFields p (LPat p)) -- rec 2. type HsConDeclH98Details pass = HsConDetails Void -- tyarg (HsScaled pass (LBangType pass)) -- arg (XRec pass [LConDeclField pass]) -- rec 3. type HsPatSynDetails pass = HsConDetails Void -- tyarg (LIdP pass) -- arg [RecordPatSynField pass] -- rec In cases (2) and (3), tyarg was instantiated to Void, so the [tyarg] list was always empty. Its removal is basically a no-op. The interesting case is (1), which is used in ConPat to represent pattern matching of the form (MkE @tp1 @tp2 p1 p2). With this patch, its representation is changed as follows: ConPat "MkE" [tp1, tp2] [p1, p2] -- old ConPat "MkE" [InvisP tp1, InvisP tp2, p1, p2] -- new The new mixed-list representation is consintent with lambdas, where InvisP is already used to deal with \ @tp1 @tp2 p1 p2 -> body. The immediate effect of the new representation is an improvement to error messages. Consider the pattern (Con x @t y). Previously it resulted in a parse error because @t could not occur after x. Now it is reported as [GHC-14964]. Test case: TyAppPat_MisplacedApplication. In the long term, this is intended as preparation for #18389 and #25127, which would make (Con x @t y) potentially valid, e.g. if its type is Con :: forall a -> forall b. (a, b) -> T The TH AST is left unchanged for the moment to avoid breakage.
-
In #25577 we found that some GOT relocation types were not being given relocation entries. Add assertions to catch this sort of failure in the future.
-
These tests can be expressed perfectly well using the testsuite driver itself.
-
-
This commit ensures we directly solve Wanted quantified constraints from matching inert Given quantified constraints,instead of going through the trouble of emitting an implication constraint and processing that. This is not just an optimisation; it makes our lives easier when generating RULEs for specialisation. See Note [Solving Wanted QCs from Given QCs] for details Fixes #25758
-
Otherwise, we would not get a callstack printed out when the exception occurs. Fixes #25829
-
-
- Mar 09, 2025
-
-
This patch revamps the wasm backend's JSFFI internal implementation and documentation: - `JSValManager` logic to allocate a key is simplified to simple bumping. According to experiments with all major browsers, the internal `Map` would overflow the heap much earlier before we really exhaust the 32-bit key space, so there's no point in the extra complexity. - `freeJSVal` is now idempotent and safe to call more than once. This is achieved by attaching the `StablePtr#` to the `JSVal#` closure and nullifying it when calling `freeJSVal`, so the same stable pointer cannot be double freed. - `mkWeakJSVal` no longer exposes the internal `Weak#` pointer and always creates a new `Weak#` on the fly. Otherwise by finalizing that `Weak#`, user could accidentally drop the `JSVal`, but `mkWeakJSVal` is only supposed to create a `Weak` that observes the `JSVal`'s liveliness without actually interfering it. - `PromisePendingException` is no longer exported since it's never meant to be caught by user code; it's a severe bug if it's actually raised at runtime. - Everything exported by user-facing `GHC.Wasm.Prim` now has proper haddock documentation. - Note [JSVal representation for wasm] has been updated to reflect the new JSVal# memory layout.
-
There's a much more efficient way to convert an unsigned i32 to a signed one. Thanks, o3-mini-high.
-
The wasm dynamic linker used to depend on v8's experimental wasm type reflection support to generate stub functions when treating GOT.func items that aren't exported by any loaded library yet. However, as we work towards wasm ghci browser mode (#25399), we need to ensure the wasm dyld logic is portable across browsers. So this commit removes the usage of wasm type reflection in wasm dyld, and it shall only be added many months later when this feature is widely available in browsers.
-
- Mar 08, 2025
-
-
The relative metric is already in %, so no need to multiply by 100.
-
This commit generalises the defaulting of equality constraints that was introduced in 663daf8d (with follow-up in 6863503c) to allow the defaulting of *representational* equality constraints. Now we default a representational equality ty1 ~R# ty2 by unifying ty1 ~# ty2. This allows the following defaulting to take place: - Coercible alpha[tau] Int ==> alpha := Int - Coercible (IO beta[tau]) (IO Char) ==> beta := Char See Note [Defaulting representational equalities] in GHC.Tc.Solver.Default for more details. Fixes #21003
-
https://hackage.haskell.org/package/fix-whitespace IMO this should be included into lint suite
-
- Mar 07, 2025
-
-
Matthew Pickering authored
When reporting the reason why a module is recompiled (using `-dump-hi-diffs`), it is much more informative to inform the user about which flag exactly has changed, rather than just an opaque reference to a hash. Now, when the user enables `-fwrite-if-self-recomp-flags` there is a difference the precise part of the flags is reported: ``` codegen flags changed: before: [Opt_NoTypeableBinds, Opt_OmitYields] after: [Opt_NoTypeableBinds, Opt_OmitYields, Opt_DictsStrict] ``` Fixes #25571
-
- Mar 06, 2025
-
-
-
-
-
Matthew Pickering authored
The interface files that we distribute should not contain any information which is used by the recompilation checking logic since source file will never be compiled again. I am not 100% sure this won't cause unexpected issues, there many be downstream consumers which are incorrectly using the information from interfaces, but this commit can be reverted if we detect issues.
-
Matthew Pickering authored
This patch adds the flag -fwrite-if-self-recomp which controls whether interface files contain the information necessary to answer the question: Do I need to recompile myself or is this current interface file suitable? Why? Most packages are only built once either by a distribution or cabal and then placed into an immutable store, after which we will never ask this question. Therefore we can derive two benefits from omitting this information. * Primary motivation: It vastly reduces the surface area for creating non-deterministic interface files. See issue #10424 which motivated a proper fix to that issue. Distributions have long contained versions of GHC which just have broken self-recompilation checking (in order to get deterministic interface files). * Secondary motivation: This reduces the size of interface files slightly.. the `mi_usages` field can be quite big but probably this isn't such a great benefit. * Third motivation: Conceptually clarity about which parts of an interface file are used in order to **communicate** with subsequent packages about the **interface** for a module. And which parts are used to self-communicate during recompilation checking. The main tracking issue is #22188 but fixes issues such as #10424 in a proper way.
-
- Mar 05, 2025
-
-
Fixes #25799
-
Care must be taken to remove unfoldings from `Var`s collected by exprFreeVars before using them to construct an in-scope set hence `zapIdUnfolding` in `init_subst`. Consider calling `simpleOptExpr` on an expression like ``` case x of (a,b) -> (x,a) ``` * One of those two occurrences of x has an unfolding (the one in (x,a), with unfolding x = (a,b)) and the other does not. (Inside a case GHC adds unfolding-info to the scrutinee's Id.) * But exprFreeVars just builds a set, so it's a bit random which occurrence is collected. * Then simpleOptExpr replaces each occurrence of x with the one in the in-scope set. * Bad bad bad: then the x in case x of ... may be replaced with a version that has an unfolding. Fixes #25790
-
This commit adds a mkWeakJSVal function that can be used to set up a Weak pointer with a JSVal key to observe the key's lifetime and optionally attach a finalizer.
-