Skip to content
Snippets Groups Projects
  1. Mar 09, 2024
    • Ben Gamari's avatar
      rts: Lazily decode IPE tables · 6948e24d
      Ben Gamari authored
      Previously we would eagerly allocate `InfoTableEnt`s for each
      info table registered in the info table provenance map. However, this
      costs considerable memory and initialization time. Instead we now
      lazily decode these tables. This allows us to use one-third the memory
      *and* opens the door to taking advantage of sharing opportunities within
      a module.
      
      This required considerable reworking since lookupIPE now must be passed
      its result buffer.
      6948e24d
    • Ben Gamari's avatar
      base: Move internals of GHC.InfoProv into GHC.InfoProv.Types · e831ce31
      Ben Gamari authored
      Such that we can add new helpers into GHC.InfoProv.Types without
      breakage.
      e831ce31
    • Vladislav Zavialov's avatar
      Drop outdated comment on TcRnIllformedTypePattern · 2e592857
      Vladislav Zavialov authored and Marge Bot's avatar Marge Bot committed
      This should have been done in 0f0c53a5 but I missed it.
      2e592857
    • Patrick's avatar
      HieAst: add module name #24493 · cfb197e3
      Patrick authored and Marge Bot's avatar Marge Bot committed
      The main purpose of this is to tuck the module name `xxx` in `module xxx where` into the hieAst.
      It should fix #24493.
      
      The following have been done:
      1. Renamed and update the `tcg_doc_hdr :: Maybe (LHsDoc GhcRn)` to `tcg_hdr_info :: (Maybe (LHsDoc GhcRn), Maybe (XRec GhcRn ModuleName))`
         To store the located module name information.
      2. update the `RenamedSource` and `RenamedStuff` with extra `Maybe (XRec GhcRn ModuleName)` located module name information.
      3. add test `testsuite/tests/hiefile/should_compile/T24493.hs` to ensure the module name is added and update several relevent tests.
      4. accompanied submodule haddoc test update MR in haddock!53
      cfb197e3
    • Jade's avatar
      Error messages: Improve Error messages for Data constructors in type signatures. · edb9bf77
      Jade authored and Marge Bot's avatar Marge Bot committed
      This patch improves the error messages from invalid type signatures by
      trying to guess what the user did and suggesting an appropriate fix.
      
      Partially fixes: #17879
      edb9bf77
  2. Mar 08, 2024
  3. Mar 07, 2024
    • Vladislav Zavialov's avatar
      Rephrase error message to say "visible arguments" (#24318) · 9cd9efb4
      Vladislav Zavialov authored
      * Main change: make the error message generated by mkFunTysMsg more
        accurate by changing "value arguments" to "visible arguments".
      
      * Refactor: define a new type synonym VisArity and use it instead of
        Arity in a few places.
      
      It might be the case that there other places in the compiler that should
      talk about visible arguments rather than value arguments, but I haven't
      tried to find them all, focusing only on the error message reported in
      the ticket.
      9cd9efb4
  4. Mar 06, 2024
  5. Mar 05, 2024
  6. Mar 04, 2024
  7. Mar 01, 2024
    • Arnaud Spiwack's avatar
      Improve error messages coming from non-linear patterns · dec6d8d3
      Arnaud Spiwack authored and Marge Bot's avatar Marge Bot committed
      This enriched the `CtOrigin` for non-linear patterns to include data
      of the pattern that created the constraint (which can be quite useful
      if it occurs nested in a pattern) as well as an explanation why the
      pattern is non-restricted in (at least in some cases).
      dec6d8d3
    • Torsten Schmits's avatar
      Introduce ListTuplePuns extension · d91d00fc
      Torsten Schmits authored and Marge Bot's avatar Marge Bot committed
      This implements Proposal 0475, introducing the `ListTuplePuns` extension
      which is enabled by default.
      
      Disabling this extension makes it invalid to refer to list, tuple and
      sum type constructors by using built-in syntax like `[Int]`,
      `(Int, Int)`, `(# Int#, Int# #)` or `(# Int | Int #)`.
      Instead, this syntax exclusively denotes data constructors for use with
      `DataKinds`.
      The conventional way of referring to these data constructors by
      prefixing them with a single quote (`'(Int, Int)`) is now a parser
      error.
      
      Tuple declarations have been moved to `GHC.Tuple.Prim` and the `Solo`
      data constructor has been renamed to `MkSolo` (in a previous commit).
      Unboxed tuples and sums now have real source declarations in `GHC.Types`.
      Unit and solo types for tuples are now called `Unit`, `Unit#`, `Solo`
      and `Solo#`.
      Constraint tuples now have the unambiguous type constructors `CTuple<n>`
      as well as `CUnit` and `CSolo`, defined in `GHC.Classes` like before.
      
      A new parser construct has been added for the unboxed sum data
      constructor declarations.
      
      The type families `Tuple`, `Sum#` etc. that were intended to provide
      nicer syntax have been omitted from this change set due to inference
      problems, to be implemented at a later time.
      See the MR discussion for more info.
      
      Updates the submodule utils/haddock.
      Updates the cabal submodule due to new language extension.
      
          Metric Increase:
              haddock.base
      
          Metric Decrease:
              MultiLayerModulesTH_OneShot
              size_hello_artifact
      
      Proposal document: https://github.com/ghc-proposals/ghc-proposals/blob/master/proposals/0475-tuple-syntax.rst
      
      Merge request: !8820
      
      Tracking ticket: #21294
      d91d00fc
    • Cheng Shao's avatar
      testsuite: fix T23540 fragility on 32-bit platforms · 3836a110
      Cheng Shao authored and Marge Bot's avatar Marge Bot committed
      T23540 is fragile on 32-bit platforms. The root cause is usage of
      `getEvidenceTreesAtPoint`, which internally relies on `Name`'s `Ord`
      instance, which is indeterministic. The solution is adding a
      deterministic `Ord` instance for `EvidenceInfo` and sorting the
      evidence trees before pretty printing. Fixes #24449.
      3836a110
  8. Feb 29, 2024
  9. Feb 27, 2024
  10. Feb 26, 2024
  11. Feb 25, 2024
  12. Feb 24, 2024
  13. 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
  14. 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
  15. 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
  16. Feb 17, 2024
  17. Feb 16, 2024
  18. Feb 15, 2024
Loading