Skip to content
Snippets Groups Projects
  1. Aug 30, 2023
  2. Aug 26, 2023
  3. Aug 23, 2023
  4. Aug 22, 2023
  5. Aug 17, 2023
  6. Aug 15, 2023
  7. Aug 14, 2023
  8. Aug 10, 2023
    • Finley McIlwaine's avatar
      Add -finfo-table-map-with-fallback -finfo-table-map-with-stack · 261c4acb
      Finley McIlwaine authored and Marge Bot's avatar Marge Bot committed
      The -fno-info-table-map-with-stack flag omits STACK info tables from the info
      table map, and the -fno-info-table-map-with-fallback flag omits info tables
      with defaulted source locations from the map. In a test on the Agda codebase
      the build results were about 7% smaller when both of those types of tables
      were omitted.
      
      Adds a test that verifies that passing each combination of these flags
      results in the correct output for -dipe-stats, which is disabled for the js
      backend since profiling is not implemented.
      
      This commit also refactors a lot of the logic around extracting info tables
      from the Cmm results and building the info table map.
      
      This commit also fixes some issues in the users guide rst source to fix
      warnings that were noticed while debugging the documentation for these flags.
      
      Fixes #23702
      261c4acb
    • Finley McIlwaine's avatar
      Add -dipe-stats flag · cc52c358
      Finley McIlwaine authored and Marge Bot's avatar Marge Bot committed
      This is useful for seeing which info tables have information.
      cc52c358
  9. Aug 09, 2023
    • Sebastian Graf's avatar
      CorePrep: Eta expand arguments (#23083) · 00d31188
      Sebastian Graf authored and Marge Bot's avatar Marge Bot committed
      Previously, we'd only eta expand let bindings and lambdas,
      now we'll also eta expand arguments such as in T23083:
      ```hs
      g f h = f (h `seq` (h $))
      ```
      Unless `-fpedantic-bottoms` is set, we'll now transform to
      ```hs
      g f h = f (\eta -> h eta)
      ```
      in CorePrep.
      
      See the new `Note [Eta expansion of arguments in CorePrep]` for the details.
      
      We only do this optimisation with -O2 because we saw 2-3% ghc/alloc regressions
      in T4801 and T5321FD.
      
      Fixes #23083.
      00d31188
  10. Aug 03, 2023
  11. Aug 01, 2023
    • Bartłomiej Cieślar's avatar
      Implementation of the Deprecated Instances proposal #575 · d2bedffd
      Bartłomiej Cieślar authored and Marge Bot's avatar Marge Bot committed
      
      This commit implements the ability to deprecate certain instances,
      which causes the compiler to emit the desired deprecation message
      whenever they are instantiated. For example:
      
        module A where
        class C t where
        instance {-# DEPRECATED "dont use" #-} C Int where
      
        module B where
        import A
        f :: C t => t
        f = undefined
        g :: Int
        g = f -- "dont use" emitted here
      
      The implementation is as follows:
        - In the parser, we parse deprecations/warnings attached to instances:
      
            instance {-# DEPRECATED "msg" #-} Show X
            deriving instance {-# WARNING "msg2" #-} Eq Y
      
          (Note that non-standalone deriving instance declarations do not support
          this mechanism.)
      
        - We store the resulting warning message in `ClsInstDecl` (respectively, `DerivDecl`).
          In `GHC.Tc.TyCl.Instance.tcClsInstDecl` (respectively, `GHC.Tc.Deriv.Utils.newDerivClsInst`),
          we pass on that information to `ClsInst` (and eventually store it in `IfaceClsInst` too).
      
        - Finally, when we solve a constraint using such an instance, in
          `GHC.Tc.Instance.Class.matchInstEnv`, we emit the appropriate warning
          that was stored in `ClsInst`.
          Note that we only emit a warning when the instance is used in a different module
          than it is defined, which keeps the behaviour in line with the deprecation of
          top-level identifiers.
      
      Signed-off-by: default avatarBartłomiej Cieślar <bcieslar2001@gmail.com>
      d2bedffd
  12. Jul 26, 2023
    • Bartłomiej Cieślar's avatar
      This MR is an implementation of the proposal #516. · 503fd647
      Bartłomiej Cieślar authored and Marge Bot's avatar Marge Bot committed
      It adds a warning -Wincomplete-record-selectors for usages of a record
      field access function (either a record selector or getField @"rec"),
      while trying to silence the warning whenever it can be sure that a constructor
      without the record field would not be invoked (which would otherwise cause
      the program to fail). For example:
      
          data T = T1 | T2 {x :: Bool}
      
          f a = x a -- this would throw an error
      
          g T1 = True
          g a = x a -- this would not throw an error
      
          h :: HasField "x" r Bool => r -> Bool
          h = getField @"x"
      
          j :: T -> Bool
          j = h -- this would throw an error because of the `HasField`
                -- constraint being solved
      
      See the tests DsIncompleteRecSel* and TcIncompleteRecSel for more examples of the warning.
      See Note [Detecting incomplete record selectors] in GHC.HsToCore.Expr for implementation details
      503fd647
  13. Jul 23, 2023
    • Vladislav Zavialov's avatar
      Visible forall in types of terms: Part 1 (#22326) · 33b6850a
      Vladislav Zavialov authored and Marge Bot's avatar Marge Bot committed
      This patch implements part 1 of GHC Proposal #281,
      introducing explicit `type` patterns and `type` arguments.
      
      Summary of the changes:
      
      1. New extension flag:
           RequiredTypeArguments
      
      2. New user-facing syntax:
           `type p` patterns    (represented by EmbTyPat)
           `type e` expressions (represented by HsEmbTy)
      
      3. Functions with required type arguments (visible forall)
         can now be defined and applied:
            idv :: forall a -> a -> a    -- signature   (relevant change: checkVdqOK in GHC/Tc/Validity.hs)
            idv (type a) (x :: a) = x    -- definition  (relevant change: tcPats in GHC/Tc/Gen/Pat.hs)
            x = idv (type Int) 42        -- usage       (relevant change: tcInstFun in GHC/Tc/Gen/App.hs)
      
      4. template-haskell support:
            TH.TypeE corresponds to HsEmbTy
            TH.TypeP corresponds to EmbTyPat
      
      5. Test cases and a new User's Guide section
      
      Changes *not* included here are the t2t (term-to-type) transformation
      and term variable capture; those belong to part 2.
      33b6850a
  14. Jul 22, 2023
  15. Jul 19, 2023
  16. Jul 18, 2023
  17. Jul 15, 2023
    • Matthew Craven's avatar
      Equality of forall-types is visibility aware · cf86f3ec
      Matthew Craven authored and Vladislav Zavialov's avatar Vladislav Zavialov committed
      This patch finally (I hope) nails the question of whether
         (forall a. ty) and (forall a -> ty)
      are `eqType`: they aren't!
      
      There is a long discussion in #22762, plus useful Notes:
      
      * Note [ForAllTy and type equality] in GHC.Core.TyCo.Compare
      * Note [Comparing visiblities] in GHC.Core.TyCo.Compare
      * Note [ForAllCo] in GHC.Core.TyCo.Rep
      
      It also establishes a helpful new invariant for ForAllCo,
      and ForAllTy, when the bound variable is a CoVar:in that
      case the visibility must be coreTyLamForAllTyFlag.
      
      All this is well documented in revised Notes.
      cf86f3ec
  18. Jul 13, 2023
    • Rodrigo Mesquita's avatar
      configure: Drop DllWrap command · 5e951395
      Rodrigo Mesquita authored and Marge Bot's avatar Marge Bot committed
      We used to configure into settings a DllWrap command for windows
      builds and distributions, however, we no longer do, and dllwrap is
      effectively unused.
      
      This simplification is motivated in part by the larger
      toolchain-selection project (#19877, !9263)
      5e951395
  19. Jul 11, 2023
    • Ben Gamari's avatar
      compiler: Record original thunk info tables on stack · eb623149
      Ben Gamari authored and Marge Bot's avatar Marge Bot committed
      Here we introduce a new code generation option, `-forig-thunk-info`,
      which ensures that an `stg_orig_thunk_info` frame is pushed before every
      update frame. This can be invaluable when debugging thunk cycles and
      similar.
      
      See Note [Original thunk info table frames] for details.
      
      Closes #23255.
      eb623149
  20. Jul 08, 2023
  21. Jul 06, 2023
  22. Jul 05, 2023
  23. Jul 03, 2023
  24. Jun 29, 2023
  25. Jun 27, 2023
  26. Jun 21, 2023
    • Bartłomiej Cieślar's avatar
      Add support for deprecating exported items (proposal #134) · 711b1d24
      Bartłomiej Cieślar authored and Ben Gamari's avatar Ben Gamari committed
      
      This is an implementation of the deprecated exports proposal #134.
      The proposal introduces an ability to introduce warnings to exports.
      This allows for deprecating a name only when it is exported from a specific
      module, rather than always depreacting its usage. In this example:
      
          module A ({-# DEPRECATED "do not use" #-} x) where
          x = undefined
          ---
          module B where
          import A(x)
      
      `x` will emit a warning when it is explicitly imported.
      
      Like the declaration warnings, export warnings are first accumulated within
      the `Warnings` struct, then passed into the ModIface, from which they are
      then looked up and warned about in the importing module in the `lookup_ie`
      helpers of the `filterImports` function (for the explicitly imported names)
      and in the `addUsedGRE(s)` functions where they warn about regular usages
      of the imported name.
      
      In terms of the AST information, the custom warning is stored in the
      extension field of the variants of the `IE` type (see Trees that Grow for
      more information).
      
      The commit includes a bump to the haddock submodule added in MR #28
      
      Signed-off-by: default avatarBartłomiej Cieślar <bcieslar2001@gmail.com>
      711b1d24
  27. Jun 19, 2023
    • Finley McIlwaine's avatar
      IPE data compression · cb9e1ce4
      Finley McIlwaine authored
      IPE data resulting from the `-finfo-table-map` flag may now be
      compressed by configuring the GHC build with the
      `--enable-ipe-data-compression` flag. This results in about a 20%
      reduction in the size of IPE-enabled build results.
      
      The compression library, zstd, may optionally be statically linked by
      configuring with the `--enabled-static-libzstd` flag (on non-darwin
      platforms)
      
      libzstd version 1.4.0 or greater is required.
      cb9e1ce4
  28. Jun 17, 2023
    • Andrei Borzenkov's avatar
      Type/data instances: require that variables on the RHS are mentioned on the LHS (#23512) · 800aad7e
      Andrei Borzenkov authored and Marge Bot's avatar Marge Bot committed
      GHC Proposal #425 "Invisible binders in type declarations" restricts the
      scope of type and data family instances as follows:
      
        In type family and data family instances, require that every variable
        mentioned on the RHS must also occur on the LHS.
      
      For example, here are three equivalent type instance definitions accepted before this patch:
      
        type family F1 a :: k
        type instance F1 Int = Any :: j -> j
      
        type family F2 a :: k
        type instance F2 @(j -> j) Int = Any :: j -> j
      
        type family F3 a :: k
        type instance forall j. F3 Int = Any :: j -> j
      
      - In F1, j is implicitly quantified and it occurs only on the RHS;
      - In F2, j is implicitly quantified and it occurs both on the LHS and the RHS;
      - In F3, j is explicitly quantified.
      
      Now F1 is rejected with an out-of-scope error, while F2 and F3 continue to be accepted.
      800aad7e
  29. Jun 16, 2023
  30. Jun 15, 2023
    • Andrei Borzenkov's avatar
      Implement the -Wimplicit-rhs-quantification warning (#23510) · a71b60e9
      Andrei Borzenkov authored and Marge Bot's avatar Marge Bot committed
      GHC Proposal #425 "Invisible binders in type declarations" forbids
      implicit quantification of type variables that occur free on the
      right-hand side of a type synonym but are not mentioned on the left-hand side.
      The users are expected to rewrite this using invisible binders:
      
          type T1 :: forall a . Maybe a
          type T1    = 'Nothing :: Maybe a      -- old
          type T1 @a = 'Nothing :: Maybe a      -- new
      
      Since the @k-binders are a new feature, we need to wait for three releases
      before we require the use of the new syntax. In the meantime, we ought to
      provide users with a new warning, -Wimplicit-rhs-quantification, that would
      detect when such implicit quantification takes place, and include it in -Wcompat.
      a71b60e9
  31. Jun 14, 2023
  32. Jun 13, 2023
  33. Jun 09, 2023
  34. Jun 07, 2023
Loading