Skip to content
Snippets Groups Projects
  1. Nov 09, 2023
  2. Nov 05, 2023
  3. Nov 03, 2023
    • Vladislav Zavialov's avatar
      T2T in Expressions (#23738) · 0dfb1fa7
      Vladislav Zavialov authored and Marge Bot's avatar Marge Bot committed
      This patch implements the T2T (term-to-type) transformation in
      expressions. Given a function with a required type argument
      	vfun :: forall a -> ...
      
      the user can now call it as
      	vfun (Maybe Int)
      
      instead of
      	vfun (type (Maybe Int))
      
      The Maybe Int argument is parsed and renamed as a term (HsExpr), but then
      undergoes a conversion to a type (HsType).
      See the new function expr_to_type in compiler/GHC/Tc/Gen/App.hs
      and Note [RequiredTypeArguments and the T2T mapping]
      
      Left as future work: checking for puns.
      0dfb1fa7
    • Jaro Reinders's avatar
      Add NCG support for common 64bit operations to the x86 backend. · 6755d833
      Jaro Reinders authored and Andreas Klebinger's avatar Andreas Klebinger committed
      These used to be implemented via C calls which was obviously quite bad
      for performance for operations like simple addition.
      
      Co-authored-by: Andreas Klebinger
      6755d833
  4. Nov 02, 2023
    • Alan Zimmerman's avatar
      EPA: Use full range for Anchor · 81fb8885
      Alan Zimmerman authored and Marge Bot's avatar Marge Bot committed
      This change requires a series of related changes, which must all land
      at the same time, otherwise all the EPA tests break.
      
      * Use the current Anchor end as prior end
      
        Use the original anchor location end as the source of truth for
        calculating print deltas.
      
        This allows original spacing to apply in most cases, only changed
        AST items need initial delta positions.
      
      * Add DArrow to TrailingAnn
      
      * EPA Introduce HasTrailing in ExactPrint
      
         Use [TrailingAnn] in enterAnn and remove it from
         ExactPrint (LocatedN RdrName)
      
      * In HsDo, put TrailingAnns at top of LastStmt
      
      * EPA: do not convert comments to deltas when balancing.
      
      * EPA: deal with fallout from getMonoBind
      
      * EPA fix captureLineSpacing
      
      * EPA print any comments in the span before exiting it
      
      * EPA: Add comments to AnchorOperation
      
      * EPA: remove AnnEofComment, it is no longer used
      
      Updates Haddock submodule
      81fb8885
  5. Nov 01, 2023
    • Sylvain Henry's avatar
      JS: fix FFI "wrapper" and "dynamic" · 575d7690
      Sylvain Henry authored and Marge Bot's avatar Marge Bot committed
      Fix codegen and helper functions for "wrapper" and "dynamic" foreign
      imports.
      
      Fix tests:
      - ffi006
      - ffi011
      - T2469
      - T4038
      
      Related to #22363
      575d7690
    • Ryan Scott's avatar
      More robust checking for DataKinds · 9f9c9227
      Ryan Scott authored and Marge Bot's avatar Marge Bot committed
      As observed in #22141, GHC was not doing its due diligence in catching code
      that should require `DataKinds` in order to use. Most notably, it was allowing
      the use of arbitrary data types in kind contexts without `DataKinds`, e.g.,
      
      ```hs
      data Vector :: Nat -> Type -> Type where
      ```
      
      This patch revamps how GHC tracks `DataKinds`. The full specification is
      written out in the `DataKinds` section of the GHC User's Guide, and the
      implementation thereof is described in `Note [Checking for DataKinds]` in
      `GHC.Tc.Validity`. In brief:
      
      * We catch _type_-level `DataKinds` violations in the renamer. See
        `checkDataKinds` in `GHC.Rename.HsType` and `check_data_kinds` in
        `GHC.Rename.Pat`.
      
      * We catch _kind_-level `DataKinds` violations in the typechecker, as this
        allows us to catch things that appear beneath type synonyms. (We do *not*
        want to do this in type-level contexts, as it is perfectly fine for a type
        synonym to mention something that requires DataKinds while still using the
        type synonym in a module that doesn't enable DataKinds.) See `checkValidType`
        in `GHC.Tc.Validity`.
      
      * There is now a single `TcRnDataKindsError` that classifies all manner of
        `DataKinds` violations, both in the renamer and the typechecker. The
        `NoDataKindsDC` error has been removed, as it has been subsumed by
        `TcRnDataKindsError`.
      
      * I have added `CONSTRAINT` is `isKindTyCon`, which is what checks for illicit
        uses of data types at the kind level without `DataKinds`. Previously,
        `isKindTyCon` checked for `Constraint` but not `CONSTRAINT`. This is
        inconsistent, given that both `Type` and `TYPE` were checked by `isKindTyCon`.
        Moreover, it thwarted the implementation of the `DataKinds` check in
        `checkValidType`, since we would expand `Constraint` (which was OK without
        `DataKinds`) to `CONSTRAINT` (which was _not_ OK without `DataKinds`) and
        reject it. Now both are allowed.
      
      * I have added a flurry of additional test cases that test various corners of
        `DataKinds` checking.
      
      Fixes #22141.
      9f9c9227
    • Krzysztof Gogolewski's avatar
      Fix pretty-printing of type family dependencies · 49f69f50
      Krzysztof Gogolewski authored and Marge Bot's avatar Marge Bot committed
      "where" should be after the injectivity annotation.
      49f69f50
  6. Oct 31, 2023
  7. Oct 28, 2023
  8. Oct 27, 2023
  9. Oct 24, 2023
    • Cheng Shao's avatar
      testsuite: increase timeout of ghc-api tests for wasm32 · 07ab5cc1
      Cheng Shao authored and Marge Bot's avatar Marge Bot committed
      ghc-api tests for wasm32 are more likely to timeout due to the large
      wasm module sizes, especially when testing with wasm native tail
      calls, given wasmtime's handling of tail call opcodes are suboptimal
      at the moment. It makes sense to increase timeout specifically for
      these tests on wasm32. This doesn't affect other targets, and for
      wasm32 we don't increase timeout for all tests, so not to risk letting
      major performance regressions slip through the testsuite.
      07ab5cc1
  10. Oct 23, 2023
  11. Oct 20, 2023
  12. Oct 19, 2023
  13. Oct 18, 2023
  14. Oct 14, 2023
    • sheaf's avatar
      Combine GREs when combining in mkImportOccEnv · ec3c4488
      sheaf authored and Marge Bot's avatar Marge Bot committed
      In `GHC.Rename.Names.mkImportOccEnv`, we sometimes discard one import
      item in favour of another, as explained in Note [Dealing with imports]
      in `GHC.Rename.Names`. However, this can cause us to lose track of
      important parent information.
      
      Consider for example #24084:
      
        module M1 where { class C a where { type T a } }
        module M2 ( module M1 ) where { import M1 }
        module M3 where { import M2 ( C, T ); instance C () where T () = () }
      
      When processing the import list of `M3`, we start off (for reasons that
      are not relevant right now) with two `Avail`s attached to `T`, namely
      `C(C, T)` and `T(T)`. We combine them in the `combine` function of
      `mkImportOccEnv`; as described in Note [Dealing with imports] we discard
      `C(C, T)` in favour of `T(T)`. However, in doing so, we **must not**
      discard the information want that `C` is the parent of `T`. Indeed,
      losing track of this information can cause errors when importing,
      as we could get an error of the form
      
        ‘T’ is not a (visible) associated type of class ‘C’
      
      We fix this by combining the two GREs for `T` using `plusGRE`.
      
      Fixes #24084
      ec3c4488
  15. Oct 12, 2023
  16. Oct 10, 2023
  17. Oct 08, 2023
  18. Oct 06, 2023
    • Finley McIlwaine's avatar
      Ensure unconstrained instance dictionaries get IPE info · 69abb171
      Finley McIlwaine authored
      In the `StgRhsCon` case of `GHC.Stg.Debug.collectStgRhs`, we were not coming up
      with an initial source span based on the span of the binder, which was causing
      instance dictionaries without dynamic superclass constraints to not have source
      locations in their IPE info. Now they do.
      
      Resolves #24005
      69abb171
  19. Oct 05, 2023
  20. Oct 04, 2023
  21. Sep 30, 2023
    • Simon Peyton Jones's avatar
      Refactor to combine HsLam and HsLamCase · ef5342cd
      Simon Peyton Jones authored and Marge Bot's avatar Marge Bot committed
      This MR is pure refactoring (#23916):
      * Combine `HsLam` and `HsLamCase`
      * Combine `HsCmdLam` and `HsCmdLamCase`
      
      This just arranges to treat uniformly
         \x -> e
         \case pi -> ei
         \cases pis -> ie
      
      In the exising code base the first is treated differently
      to the latter two.
      
      No change in behaviour.
      
      More specifics:
      
      * Combine `HsLam` and `HsLamCase` (constructors of `Language.Haskell.Syntax.Expr.HsExpr`) into one data construtor covering
        * Lambda
        * `\case`
        * `\cases`
      
      * The new `HsLam` has an argument of type `HsLamVariant` to distinguish the three cases.
      
      * Similarly, combine `HsCmdLam` and `HsCmdLamCase` (constructors of `Language.Haskell.Syntax.Expr.HsCmd` ) into one.
      
      * Similarly, combine `mkHsLamPV` and `mkHsLamCasePV` (methods of class `DisambECP`) into one. (Thank you Alan Zimmerman.)
      
      * Similarly, combine `LambdaExpr` and `LamCaseAlt` (constructors of `Language.Haskell.Syntax.Expr.HsMatchContext`) into one: `LamAlt` with a `HsLamVariant` argument.
      
      * Similarly, combine `KappaExpr` and `ArrowLamCaseAlt` (constructors of `Language.Haskell.Syntax.Expr.HsArrowMatchContext`) into one: `ArrowLamAlt` with a `HsLamVariant` argument.
      
      * Similarly, combine `PsErrLambdaInPat` and `PsErrLambdaCaseInPat` (constructors of `GHC.Parser.Errors.Ppr.PsError`) into one.
      
      * Similarly, combine `PsErrLambdaInPat` and `PsErrLambdaCaseInPat` (constructors of `GHC.Parser.Errors.Ppr.PsError`) into one.
      
      * In the same `PsError` data type, combine `PsErrLambdaCmdInFunAppCmd` and `PsErrLambdaCaseCmdInFunAppCmd` into one.
      
      * In the same `PsError` data tpye, combine `PsErrLambdaInFunAppExpr` and `PsErrLambdaCaseInFunAppExpr` into one.
      
      p* Smilarly combine `ExpectedFunTyLam` and `ExpectedFunTyLamCase` (constructors of `GHC.Tc.Types.Origin.ExpectedFunTyOrigin`) into one.
      
      Phew!
      ef5342cd
    • Torsten Schmits's avatar
      Fix several mistakes around free variables in iface breakpoints · d3874407
      Torsten Schmits authored and Marge Bot's avatar Marge Bot committed
      Fixes #23612 , #23607, #23998 and #23666.
      
      MR: !11026
      
      The fingerprinting logic in `Iface.Recomp` failed lookups when processing decls containing breakpoints for two reasons:
      
      * IfaceBreakpoint created binders for free variables instead of expressions
      
      * When collecting free names for the dependency analysis for fingerprinting, breakpoint FVs were skipped
      d3874407
  22. Sep 28, 2023
  23. Sep 27, 2023
Loading