Skip to content
Snippets Groups Projects
  1. Feb 25, 2024
  2. Feb 24, 2024
  3. Feb 23, 2024
    • Ben Gamari's avatar
      Allow docstrings after exports · 5121a4ed
      Ben Gamari authored and Marge Bot's avatar Marge Bot committed
      Here we extend the parser and AST to preserve docstrings following
      export items. We then extend Haddock to parse `@since` annotations in
      such docstrings, allowing changes in export structure to be properly
      documented.
      
      Bumps haddock submodule.
      5121a4ed
  4. Feb 21, 2024
    • Adam Gundry's avatar
      Define GHC2024 language edition (#24320) · 09941666
      Adam Gundry authored
      See https://github.com/ghc-proposals/ghc-proposals/pull/613
      
      . Also
      fixes #24343 and improves the documentation of language editions.
      
      Co-authored-by: Joachim Breitner's avatarJoachim Breitner <mail@joachim-breitner.de>
      09941666
    • Andrei Borzenkov's avatar
      Namespacing for fixity signatures (#14032) · 77629e76
      Andrei Borzenkov authored and Marge Bot's avatar Marge Bot committed
      Namespace specifiers were added to syntax of fixity signatures:
        - sigdecl ::= infix prec ops | ...
        + sigdecl ::= infix prec namespace_spec ops | ...
      
      To preserve namespace during renaming MiniFixityEnv type
      now has separate FastStringEnv fields for names that should be
      on the term level and for name that should be on the type level.
      
      makeMiniFixityEnv function was changed to fill MiniFixityEnv in the right way:
       - signatures without namespace specifiers fill both fields
       - signatures with 'data' specifier fill data field only
       - signatures with 'type' specifier fill type field only
      
      Was added helper function lookupMiniFixityEnv that takes care about
      looking for a name in an appropriate namespace.
      
      Updates haddock submodule.
      
      Metric Decrease:
          MultiLayerModulesTH_OneShot
      77629e76
  5. Feb 19, 2024
    • Cheng Shao's avatar
      testsuite: mark T23540 as fragile on i386 · a6142e0c
      Cheng Shao authored and Marge Bot's avatar Marge Bot committed
      See #24449 for details.
      a6142e0c
    • Jade's avatar
    • Andrei Borzenkov's avatar
      Parser, renamer, type checker for @a-binders (#17594) · 0dbd729e
      Andrei Borzenkov authored and Marge Bot's avatar Marge Bot committed
      GHC Proposal 448 introduces binders for invisible type arguments
      (@a-binders) in various contexts. This patch implements @-binders
      in lambda patterns and function equations:
      
        {-# LANGUAGE TypeAbstractions #-}
      
        id1 :: a -> a
        id1 @t x = x :: t      -- @t-binder on the LHS of a function equation
      
        higherRank :: (forall a. (Num a, Bounded a) => a -> a) -> (Int8, Int16)
        higherRank f = (f 42, f 42)
      
        ex :: (Int8, Int16)
        ex = higherRank (\ @a x -> maxBound @a - x )
                               -- @a-binder in a lambda pattern in an argument
                               -- to a higher-order function
      
      Syntax
      ------
      
      To represent those @-binders in the AST, the list of patterns in Match
      now uses ArgPat instead of Pat:
      
        data Match p body
           = Match {
               ...
      -        m_pats  :: [LPat p],
      +        m_pats  :: [LArgPat p],
               ...
         }
      
      + data ArgPat pass
      +   = VisPat (XVisPat pass) (LPat pass)
      +   | InvisPat (XInvisPat pass) (HsTyPat (NoGhcTc pass))
      +   | XArgPat !(XXArgPat pass)
      
      The VisPat constructor represents patterns for visible arguments,
      which include ordinary value-level arguments and required type arguments
      (neither is prefixed with a @), while InvisPat represents invisible type
      arguments (prefixed with a @).
      
      Parser
      ------
      
      In the grammar (Parser.y), the lambda and lambda-cases productions of
      aexp non-terminal were updated to accept argpats instead of apats:
      
        aexp : ...
      -        | '\\' apats '->' exp
      +        | '\\' argpats '->' exp
               ...
      -        | '\\' 'lcases' altslist(apats)
      +        | '\\' 'lcases' altslist(argpats)
               ...
      
      + argpat : apat
      +        | PREFIX_AT atype
      
      Function left-hand sides did not require any changes to the grammar, as
      they were already parsed with productions capable of parsing @-binders.
      Those binders were being rejected in post-processing (isFunLhs), and now
      we accept them.
      
      In Parser.PostProcess, patterns are constructed with the help of
      PatBuilder, which is used as an intermediate data structure when
      disambiguating between FunBind and PatBind. In this patch we define
      ArgPatBuilder to accompany PatBuilder. ArgPatBuilder is a short-lived
      data structure produced in isFunLhs and consumed in checkFunBind.
      
      Renamer
      -------
      
      Renaming of @-binders builds upon prior work on type patterns,
      implemented in 2afbddb0, which guarantees proper scoping and
      shadowing behavior of bound type variables.
      
      This patch merely defines rnLArgPatsAndThen to process a mix of visible
      and invisible patterns:
      
      + rnLArgPatsAndThen :: NameMaker -> [LArgPat GhcPs] -> CpsRn [LArgPat GhcRn]
      + rnLArgPatsAndThen mk = mapM (wrapSrcSpanCps rnArgPatAndThen) where
      +   rnArgPatAndThen (VisPat x p)    = ... rnLPatAndThen ...
      +   rnArgPatAndThen (InvisPat _ tp) = ... rnHsTyPat ...
      
      Common logic between rnArgPats and rnPats is factored out into the
      rn_pats_general helper.
      
      Type checker
      ------------
      
      Type-checking of @-binders builds upon prior work on lazy skolemisation,
      implemented in f5d3e03c.
      
      This patch extends tcMatchPats to handle @-binders. Now it takes and
      returns a list of LArgPat rather than LPat:
      
        tcMatchPats ::
                    ...
      -             -> [LPat GhcRn]
      +             -> [LArgPat GhcRn]
                    ...
      -             -> TcM ([LPat GhcTc], a)
      +             -> TcM ([LArgPat GhcTc], a)
      
      Invisible binders in the Match are matched up with invisible (Specified)
      foralls in the type. This is done with a new clause in the `loop` worker
      of tcMatchPats:
      
        loop :: [LArgPat GhcRn] -> [ExpPatType] -> TcM ([LArgPat GhcTc], a)
        loop (L l apat : pats) (ExpForAllPatTy (Bndr tv vis) : pat_tys)
          ...
          -- NEW CLAUSE:
          | InvisPat _ tp <- apat, isSpecifiedForAllTyFlag vis
          = ...
      
      In addition to that, tcMatchPats no longer discards type patterns. This
      is done by filterOutErasedPats in the desugarer instead.
      
      x86_64-linux-deb10-validate+debug_info
      Metric Increase:
          MultiLayerModulesTH_OneShot
      0dbd729e
  6. Feb 17, 2024
  7. Feb 16, 2024
  8. Feb 15, 2024
  9. Feb 14, 2024
  10. Feb 13, 2024
  11. Feb 12, 2024
    • Teo Camarasu's avatar
      nonmoving: Add support for heap profiling · bedb4f0d
      Teo Camarasu authored and Marge Bot's avatar Marge Bot committed
      Add support for heap profiling while using the nonmoving collector.
      
      We greatly simply the implementation by disabling concurrent collection for
      GCs when heap profiling is enabled. This entails that the marked objects on
      the nonmoving heap are exactly the live objects.
      
      Note that we match the behaviour for live bytes accounting by taking the size
      of objects on the nonmoving heap to be that of the segment's block
      rather than the object itself.
      
      Resolves #22221
      bedb4f0d
    • Simon Peyton Jones's avatar
      Remove a dead comment · ff2c0cc9
      Simon Peyton Jones authored and Marge Bot's avatar Marge Bot committed
      Just remove an out of date block of commented-out code, and tidy up
      the relevant Notes.  See #8317.
      ff2c0cc9
    • Sylvain Henry's avatar
      JS: avoid EMCC logging spurious failure · b71b392f
      Sylvain Henry authored and Marge Bot's avatar Marge Bot committed
      emcc would sometime output messages like:
      
        cache:INFO: generating system asset: symbol_lists/424b44514e43d789148e69e4e7d1c7fdc0350b79.json... (this will be cached in "/emsdk/upstream/emscripten/cache/symbol_lists/424b44514e43d789148e69e4e7d1c7fdc0350b79.json" for subsequent builds)
        cache:INFO:  - ok
      
      Cf https://github.com/emscripten-core/emscripten/issues/18607
      
      This breaks our tests matching the stderr output. We avoid this by setting EMCC_LOGGING=0
      b71b392f
    • Sylvain Henry's avatar
      JS: add support for linking C sources · aef587f6
      Sylvain Henry authored and Marge Bot's avatar Marge Bot committed
      Support linking C sources with JS output of the JavaScript backend.
      See the added documentation in the users guide.
      
      The implementation simply extends the JS linker to use the objects (.o)
      that were already produced by the emcc compiler and which were filtered
      out previously. I've also added some options to control the link with C
      functions (see the documentation about pragmas).
      
      With this change I've successfully compiled the direct-sqlite package
      which embeds the sqlite.c database code. Some wrappers are still
      required (see the documentation about wrappers) but everything generic
      enough to be reused for other libraries have been integrated into
      rts/js/mem.js.
      aef587f6
    • Sylvain Henry's avatar
      JS: disable MergeObjsMode test · 55346ede
      Sylvain Henry authored and Marge Bot's avatar Marge Bot committed
      This isn't implemented for JS backend objects.
      55346ede
  12. Feb 10, 2024
    • Jade's avatar
      Adjust error message for trailing whitespace in as-pattern. · be674a2c
      Jade authored and Marge Bot's avatar Marge Bot committed
      Fixes #22524
      be674a2c
    • Matthew Pickering's avatar
      rts: eras profiling mode · b0293f78
      Matthew Pickering authored and Marge Bot's avatar Marge Bot committed
      The eras profiling mode is useful for tracking the life-time of
      closures. When a closure is written, the current era is recorded in the
      profiling header. This records the era in which the closure was created.
      
      * Enable with -he
      * User mode: Use functions ghc-experimental module GHC.Profiling.Eras to modify the era
      * Automatically: --automatic-era-increment, increases the user era on major
        collections
      * The first era is era 1
      * -he<era> can be used with other profiling modes to select a specific
        era
      
      If you just want to record the era but not to perform heap profiling you
      can use `-he --no-automatic-heap-samples`.
      
      https://well-typed.com/blog/2024/01/ghc-eras-profiling/
      
      Fixes #24332
      b0293f78
  13. Feb 08, 2024
    • Apoorv Ingle's avatar
      Enable mdo statements to use HsExpansions · 9f987235
      Apoorv Ingle authored and Marge Bot's avatar Marge Bot committed
      Fixes: #24411
      Added test T24411 for regression
      9f987235
    • Vladislav Zavialov's avatar
      Haddock comments on infix constructors (#24221) · e8fb2451
      Vladislav Zavialov authored and Marge Bot's avatar Marge Bot committed
      Rewrite the `HasHaddock` instance for `ConDecl GhcPs` to account for
      infix constructors.
      
      This change fixes a Haddock regression (introduced in 19e80b9a)
      that affected leading comments on infix data constructor declarations:
      
      	-- | Docs for infix constructor
      	| Int :* Bool
      
      The comment should be associated with the data constructor (:*), not
      with its left-hand side Int.
      e8fb2451
    • Ben Gamari's avatar
      Move `base` to `ghc-internal` · 44f6557a
      Ben Gamari authored and Marge Bot's avatar Marge Bot committed
      Here we move a good deal of the implementation of `base` into a new
      package, `ghc-internal` such that it can be evolved independently
      from the user-visible interfaces of `base`.
      
      While we want to isolate implementation from interfaces, naturally, we
      would like to avoid turning `base` into a mere set of module re-exports.
      However, this is a non-trivial undertaking for a variety of reasons:
      
       * `base` contains numerous known-key and wired-in things, requiring
         corresponding changes in the compiler
      
       * `base` contains a significant amount of C code and corresponding
         autoconf logic, which is very fragile and difficult to break apart
      
       * `base` has numerous import cycles, which are currently dealt with via
         carefully balanced `hs-boot` files
      
       * We must not break existing users
      
      To accomplish this migration, I tried the following approaches:
      
      * [Split-GHC.Base]: Break apart the GHC.Base knot to allow incremental
        migration of modules into ghc-internal: this knot is simply too
        intertwined to be easily pulled apart, especially given the rather
        tricky import cycles that it contains)
      
      * [Move-Core]: Moving the "core" connected component of base (roughly
        150 modules) into ghc-internal. While the Haskell side of this seems
        tractable, the C dependencies are very subtle to break apart.
      
      * [Move-Incrementally]:
      
        1. Move all of base into ghc-internal
        2. Examine the module structure and begin moving obvious modules (e.g.
           leaves of the import graph) back into base
        3. Examine the modules remaining in ghc-internal, refactor as necessary
           to facilitate further moves
        4. Go to (2) iterate until the cost/benefit of further moves is
           insufficient to justify continuing
        5. Rename the modules moved into ghc-internal to ensure that they don't
           overlap with those in base
        6. For each module moved into ghc-internal, add a shim module to base
           with the declarations which should be exposed and any requisite
           Haddocks (thus guaranteeing that base will be insulated from changes
           in the export lists of modules in ghc-internal
      
      Here I am using the [Move-Incrementally] approach, which is empirically
      the least painful of the unpleasant options above
      
      Bumps haddock submodule.
      
      Metric Decrease:
          haddock.Cabal
          haddock.base
      Metric Increase:
          MultiComponentModulesRecomp
          T16875
          size_hello_artifact
      44f6557a
    • Matthew Pickering's avatar
      Javascript: Don't filter out rtsDeps list · 20b702b5
      Matthew Pickering authored and Marge Bot's avatar Marge Bot committed
      This logic appears to be incorrect as it would drop any dependency which
      was not in a direct dependency of the package being linked.
      
      In the ghc-internals split this started to cause errors because
      `ghc-internal` is not a direct dependency of most packages, and hence
      important symbols to keep which are hard coded into the js runtime were
      getting dropped.
      20b702b5
  14. Feb 07, 2024
    • jeffrey young's avatar
      ts: add wasm_arch, heapprof002 wasm extension · 75a31379
      jeffrey young authored and Marge Bot's avatar Marge Bot committed
      75a31379
    • jeffrey young's avatar
      ts: add compile_artifact, ignore_extension flag · 569b4c10
      jeffrey young authored and Marge Bot's avatar Marge Bot committed
      In b5213542 the testsuite gained the
      capability to collect generic metrics. But this assumed that the test
      was not linking and producing artifacts and we only wanted to track
      object files, interface files, or build artifacts from the compiler
      build. However, some backends, such as the JS backend, produce artifacts when
      compiling, such as the jsexe directory which we want to track.
      
      This patch:
      
      - tweaks the testsuite to collect generic metrics on any build artifact
      in the test directory.
      
      - expands the exe_extension function to consider windows and adds the
      ignore_extension flag.
      
      - Modifies certain tests to add the ignore_extension flag. Tests such as
      heaprof002 expect a .ps file, but on windows without ignore_extensions
      the testsuite will look for foo.exe.ps. Hence the flag.
      
      - adds the size_hello_artifact test
      569b4c10
  15. Feb 06, 2024
    • Zubin's avatar
      testsuite: Add test for #24327 · b09e6958
      Zubin authored and Marge Bot's avatar Marge Bot committed
      b09e6958
    • Zubin's avatar
      driver: Really don't lose track of nodes when we fail to resolve cycles · 532993c8
      Zubin authored and Marge Bot's avatar Marge Bot committed
      This fixes a bug in 8db8d2fd, where we could lose
      track of acyclic components at the start of an unresolved cycle. We now ensure we
      never loose track of any of these components.
      
      As T24275 demonstrates, a "cyclic" SCC might not really be a true SCC:
      
      When viewed without boot files, we have a single SCC
      
      ```
      [REC main:T24275B [main:T24275B {-# SOURCE #-},
                         main:T24275A {-# SOURCE #-}]
           main:T24275A [main:T24275A {-# SOURCE #-}]]
      ```
      
      But with boot files this turns into
      
      ```
      [NONREC main:T24275B {-# SOURCE #-} [],
       REC main:T24275B [main:T24275B {-# SOURCE #-},
                         main:T24275A {-# SOURCE #-}]
          main:T24275A {-# SOURCE #-} [main:T24275B],
       NONREC main:T24275A [main:T24275A {-# SOURCE #-}]]
      ```
      
      Note that this is truly not an SCC, as no nodes are reachable from T24275B.hs-boot.
      However, we treat this entire group as a single "SCC" because it seems so when we
      analyse the graph without taking boot files into account.
      
      Indeed, we must return a single ResolvedCycle element in the BuildPlan for this
      as described in Note [Upsweep].
      
      However, since after resolving this is not a true SCC anymore, `findCycle` fails
      to find a cycle and we have a sub-optimal error message as a result.
      
      To handle this, I extended `findCycle` to not assume its input is an SCC, and to
      try harder to find cycles in its input.
      
      Fixes #24275
      532993c8
    • Andrei Borzenkov's avatar
      Lazy skolemisation for @a-binders (#17594) · f5d3e03c
      Andrei Borzenkov authored and Marge Bot's avatar Marge Bot committed
      This patch is a preparation for @a-binders implementation.  The main changes are:
      
      * Skolemisation is now prepared to deal with @binders.
        See Note [Skolemisation overview] in GHC.Tc.Utils.Unify.
        Most of the action is in
          - Utils.Unify.matchExpectedFunTys
          - Gen.Pat.tcMatchPats
          - Gen.Expr.tcPolyExprCheck
          - Gen.Binds.tcPolyCheck
      
      Some accompanying refactoring:
      
      * I found that funTyConAppTy_maybe was doing a lot of allocation, and
        rejigged userTypeError_maybe to avoid calling it.
      f5d3e03c
Loading