- Apr 11, 2025
-
-
There were incomplete record selector warnings in GHC.Runtime.Heap.Inspect due to the use of the partial 'dataArgs' record selector. This is fixed by passing the fields to the 'extractSubTerms' function directly, rather than passing a value of the parent data type.
-
The behaviour of how/when exceptions are raised was not really covered in the docs.
-
- Apr 10, 2025
-
-
As remarked in #25933, a pure refactoring of checkTyEqRhs in ab77fc8c inadvertently changed behaviour, as it caused GHC to introduce cycle-breaker variables in some unnecessary circumstances. This commit refactors 'GHC.Tc.Utils.Unify.checkFamApp' in a way that should restore the old behaviour, so that, when possible, we first recur into the arguments and only introduce a cycle breaker if this recursion fails (e.g. due to an occurs check failure). Fixes #25933
-
Vladislav Zavialov authored
Retry type/class declarations and instances to account for non-lexical dependencies arising from type/data family instances. This patch improves the kind checker's ability to use type instances in kind checking of other declarations in the same module. * Key change: tcTyAndClassDecls now does multiple passes over the TyClGroups, as long as it is able to make progress. See the new Note [Retrying TyClGroups] in GHC.Tc.TyCl * Supporting change: FVs of a TyClGroup are now recorded in its extension field, namely XCTyClGroup. See the new Note [Prepare TyClGroup FVs] in GHC.Rename.Module * Instances are no longer inserted at the earliest positions where their FVs are bound. This is a simplification. See the new Note [Put instances at the end] in GHC.Rename.Module * Automatic unpacking is now more predictable, but fewer fields get unpacked by default. Use explicit {-# UNPACK #-} pragmas instead. See the new Note [Flaky -funbox-strict-fields with type/data families] For the wide range of newly accepted programs, consult the added test cases. Fixed tickets: #12088, #12239, #14668, #15561, #16410, #16448, #16693, #19611, #20875, #21172, #22257, #25238, #25834 Metric Decrease: T8095
-
- Apr 09, 2025
-
-
We now only default type variables if they only appear in constraints of the form `C v`, where `C` is either a standard class or a class with an in-scope default declaration. This rectifies an oversight in the original implementation of the NamedDefault extensions that was remarked in #25775; that implementation allowed type variables to appear in unary constraints which had arbitrary classes at the head. See the rewritten Note [How type-class constraints are defaulted] for details of the implementation. Fixes #25775 Fixes #25778
-
Constructor applications always need to take the exact number of arguments. If we can't ensure that instead apply the constructor worker like a regular function. Fixes #23865
-
-
This commit moves out functions that help in creating and validating a GHC multi session from Main into the ghc library where they can be used by other GHC applications. Moreover, `Mode` processing and `checkOptions` linting were moved to separate modules within the ghc-bin executable package. In particular: - Move `Mode` types and functions (referring to the mode GHC is running on) to `ghc-bin:GHC.Driver.Session.Mode` - Move `checkOptions` and aux functions, which validates GHC DynFlags based on the mode, to `ghc-bin:GHC.Driver.Session.Lint` - Moves `initMulti`, `initMake`, and aux functions, which initializes a make/multi-unit session, into `ghc:GHC.Driver.Session.Units`.
-
This commit makes GHC emit a simple error message in the case of an illegal term-level use of a data constructor: we will try to report an out-of-scope error instead of a "Illegal term level use" error, as the latter might be a bit overwhelming for newcomers. We do this when we have a data constructor import suggestion to provide to the user. For example: module M where { data A = A } module N where import M(A) x = Bool -- Illegal term-level use of Bool y = A -- Data constructor not in scope: A. -- Perhaps add 'A' to the import list of 'M'. This commit also revamps the "similar names" suggestion mechanism, and in particular its treatment of name spaces. Now, which name spaces we suggest is based solely on what we are looking for, and no longer on the NameSpace of the Name we have. This is because, for illegal term-level use errors, it doesn't make much sense to change the suggestions based on the fact that we resolved to e.g. a type constructor/class; what matters is what we were expecting to see in this position. See GHC.Rename.Unbound.{suggestionIsRelevant,relevantNameSpace} as well as the new constructors to GHC.Tc.Errors.Types.WhatLooking. Fixes #23982
-
- Apr 08, 2025
-
-
This will facilitate using the downsweep functions in other parts of the compiler than just --make mode. Also, the GHC.Driver.Make module was huge. Now it's still huge but slightly smaller!
-
While single-stepping through a Haskell program we stop at every breakpoint. However, we don't introduce breakpoints at every single expression (e.g. single variables) because they would be too many and uninteresting. That said, in a do-block, it is expected that stepping over would break at every line, even if it isn't particularly interesting (e.g. a single arg like getArgs). Moreover, let-statements in do-blocks, despite only being evaluated once needed, lead to surprising jumps while stepping through because some have outermost (outside the let) breakpoints while others don't. This commit makes every statement in a do-block have a breakpoint. This leads to predictable stepping through in a do-block. Duplicate breakpoints in the same location are avoided using the existing blacklist mechanism, which was missing a check in one relevant place. Fixes #25932
-
Moves `enclosingTickSpan`, `getCurrentBreakSpan`, and `getCurrentBreakModule`, general utilities on the internal debugger state, into the GHC library.
-
-
Breakpoints can be set on functions using syntax of the form `[Module.]function`. The parsing, resolution (e.g. inferring implicit module), and validation of this syntax for referring to functions was tightly coupled with its GHCi use. This commit extracts the general purpose bits of resolving this syntax into `GHC.Runtime.Debugger.Breakpoints` so it can be further used by other GHC applications and to improve the code structure of GHCi. Moreover, a few utilities that do splitting and joining of identifiers as strings were moved to `GHC.Runtime.Eval.Utils`, which also can be used in the future to clean up `GHC.Runtime.Eval` a bit.
-
Breakpoints are uniquely identified by a module and an index unique within that module. `ModBreaks` of a Module contains arrays mapping from this unique breakpoint index to information about each breakpoint. For instance, `modBreaks_locs` stores the `SrcSpan` for each breakpoint. To find a breakpoint using the line number you need to go through all breakpoints in the array for a given module and look at the line and column stored in the `SrcSpan`s. Similarly for columns and finding breakpoints by name. This logic previously lived within the `GHCi` application sources, however, it is common to any GHC applications wanting to set breakpoints, like the upcoming `ghc-debugger`. This commit moves this logic for finding and setting breakpoints to the GHC library so it can be used by both `ghci` and `ghc-debugger`.
-
-
This patch solves a potential test flakiness in `WasmControlFlow` by removing `WasmControlFlow.stdout` which is not so portable/stable as it seems. See added `Note [WasmControlFlow]` for more detailed explanation.
-
Load subword values as full words from the stack truncating/expanding as neccesary when dealing with subwords. This way byte order is implicitly correct. This commit also fixes the order in which we are pushing literals onto the stack on big endian archs. Last but not least we enable a test for ghci which actually tests these subword operations.
-
Based on analysis documented in #25791 this doesn't fully fix the big while introducing new bugs on little endian architectures. A more complete fix will have to be implemented to fix #23387 This reverts commit 4f02d3c1.
-
When enabled the arm backend will assume jumps to targets outside of the current module are further than 128MB away. This will allow for code to work if: * The current module results in less than 128MB of code. * The whole program is loaded within a 4GB memory region. We have seen a few reports of broken linkers (#24648) where this flag might allow a program to compile/run successfully at a very small performance cost. ------------------------- Metric Increase: T783 -------------------------
-
- Apr 07, 2025
-
-
This commit refines the recompilation checking logic, to avoid recompiling modules with an explicit import list when the modules they import start exporting new items. More specifically, when: 1. module N imports module M, 2. M is changed, but in a way that: a. preserves the exports that N imports b. does not introduce anything that forces recompilation downstream, such as orphan instances then we no longer require recompilation of N. Note that there is more to (2a) as initially meets the eye: - if N includes a whole module or "import hiding" import of M, then we require that the export list of M does not change, - if N only includes explicit imports, we check that the imported items don't change, e.g. - if we have @import M(T(K, f), g)@, we must check that N continues to export all these identifiers, with the same Avail structure (i.e. we should error if N stops bundling K or f with T) - if we have @import M(T(..))@, we must check that the children of T have not changed See Note [When to recompile when export lists change?] in GHC.Iface.Recomp. This is all tested in the new tests RecompExports{1,2,3,4,5} Fixes #25881
-
Introduce `defaultLogActionWithHandles` to allow GHC applications to use GHC's formatting but using custom handles. `defaultLogAction` is then trivially reimplemented as ``` defaultLogActionWithHandles stdout stderr ```
-
- Apr 04, 2025
-
-
This corrects a stale reference to OverloadedRecordFields (which should be OverloadedRecordDot), fixes the haddock link syntax and adds an @since pragma.
-
This patch adds ghc-wasm-meta integration testing jobs to the CI pipeline, which are only triggered via the `test-wasm` MR label or manually when the `wasm` label is set. These jobs will fetch the wasm bindists and test them against a variety of downstream projects, similarly to head.hackage jobs for native bindists, offering a convenient way to catch potential downstream breakage while refactoring the wasm backend.
-
This commit adds a new check to Cmm lint to ensure that the argument types to a CallishMachOp are correct. The lack of this check was detected in the AtomicFetch test: the literals being passed as the second arguments to operations such as 'fetch_add', 'fetch_and'... were of the wrong width, which tripped up the LLVM backend.
-
With this commit, we accept named default declarations for poly-kinded classes such as Typeable, e.g. default Typeable (Char) This used to fail because we assumed the kind of the class was monomorphic, e.g. Type -> Constraint (Type -> Type) -> Constraint Nat -> Constraint Now, we can handle a simple polymorphic class such as Typeable :: forall k. k -> Constraint Note that we keep the restriction that the class must only have one visible argument. This is all explained in the new Note [Instance check for default declarations] in GHC.Tc.Gen.Default. Fixes #25882
-
This commit changes GHC.Driver.Flags.impliedXFlags to make the MonadComprehensions extension enable the ParallelListComp extension. Fixes #25645
-
- Apr 03, 2025
-
-
In #25204, it was noted that GHC didn't properly deal with having spaces in its executable path, as it would compute an invalid path for the C compiler. The original fix in 31bf85ee used a trick: escape spaces before splitting up flags into a list. This fixed the behaviour with extra flags (e.g. -I), but forgot to also unescape for non-flags, e.g. for an executable path (such as the C compiler). This commit rectifies this oversight by consistently unescaping the spaces that were introduced in order to split up argument lists. Fixes #25204
-
-
-
- Apr 02, 2025
-
-
This commit changes the way we check for duplicate exports of named default declarations. They are now treated entirely separately from other exports, because in an export list of the form module M ( default Cls, Cls ) the default declaration does not export the class 'Cls', but only its default declarations. Also fixes a bug in Backpack where named default exports were getting dropped entirely. No test for that. Fixes #25857
-
A {-# COMPLETE P, Q #-} pragma is associated with the pattern synonyms P and Q during recompilation checking. Therefore, the existence of a pattern synonym becomes part of the ABI hash for P and Q. Then if a module uses these pattern synonyms and a complete pragma changes, it will trigger recompilation in that module. Fixes #25854
-
Since the exported defaults are not associated with any identifier from the module, they are just added to the export hash rather than the fine-grained recompilation logic. Fixes #25855
-
computeFingerprint is morally a pure function, which is implemented by mutating a buffer. Using unsafePerformIO inside the definition allows it to be used in pure contexts, fixing one place where an ad-hoc call to unsafePerformIO is already needed.
-
- Mar 31, 2025
-
-
In #25858, GHC hangs when processing modules with class defaults due to a circular dependency in the interface rehydration process. The deadlock/loop occurred when eager class defaults rehydration accessed not-yet-complete module details. To fix the immediate deadlock/loop. `tcIfaceDefaults` is refactored, we use the class name directly from the iface and use `forM` for lazy loading the class, which algins with the handling of other fields of ModDetails. This laziness ensure rehydration waits for HomePackageTable (HPT) to be updated and prevent premature evaluation of ModDetails inside `fixIO``. As suggested by Matthew, class defaults importing is also refactored to align with the compiler's established interface loading conventions. - add class defaults field to ExternalPackageState (EPS). - rehydrate and store class defaults in EPS at `loadInterface`. - Instead of using `tcIfaceDefaults` in `tcRnImports`, we add and use `tcGetClsDefaults` to read defaults directly from HPT or EPS when importing modules. Tests: - T25858, T25858v1-2: Test class hydration in defaults - T25858v3-4: Test type list hydration in defaults New Note [Tricky rehydrating IfaceDefaults loop] is added. Thanks to @sheaf (Sam), @mpickering (Matthew), and @simonpj (Simon) for their valuable input and analysis. Fixes #25858.
-