Skip to content
Snippets Groups Projects
  1. Nov 17, 2023
  2. Nov 16, 2023
    • Krzysztof Gogolewski's avatar
      Fix IPE test · 3e606230
      Krzysztof Gogolewski authored and Marge Bot's avatar Marge Bot committed
      A helper function was defined in a different module than used.
      To reproduce: ./hadrian/build test --test-root-dirs=testsuite/tests/rts/ipe
      3e606230
    • Sylvain Henry's avatar
      Fix unusable units and module reexport interaction (#21097) · cee81370
      Sylvain Henry authored and Marge Bot's avatar Marge Bot committed
      This commit fixes an issue with ModUnusable introduced in df0f148f.
      
      In mkUnusableModuleNameProvidersMap we traverse the list of unusable
      units and generate ModUnusable origin for all the modules they contain:
      exposed modules, hidden modules, and also re-exported modules. To do
      this we have a two-level map:
      
        ModuleName -> Unit:ModuleName (aka Module) -> ModuleOrigin
      
      So for each module name "M" in broken unit "u" we have:
        "M" -> u:M -> ModUnusable reason
      
      However in the case of module reexports we were using the *target*
      module as a key. E.g. if "u:M" is a reexport for "X" from unit "o":
         "M" -> o:X -> ModUnusable reason
      
      Case 1: suppose a reexport without module renaming (u:M -> o:M) from
      unusable unit u:
         "M" -> o:M -> ModUnusable reason
      
      Here it's claiming that the import of M is unusable because a reexport
      from u is unusable. But if unit o isn't unusable we could also have in
      the map:
         "M" -> o:M -> ModOrigin ...
      
      Issue: the Semigroup instance of ModuleOrigin doesn't handle the case
      (ModUnusable <> ModOrigin)
      
      Case 2: similarly we could have 2 unusable units reexporting the same module
      without renaming, say (u:M -> o:M) and (v:M -> o:M) with u and v
      unusable. It gives:
      
        "M" -> o:M -> ModUnusable ... (for u)
        "M" -> o:M -> ModUnusable ... (for v)
      
      Issue: the Semigroup instance of ModuleOrigin doesn't handle the case
      (ModUnusable <> ModUnusable).
      
      This led to #21097, #16996, #11050.
      
      To fix this, in this commit we make ModUnusable track whether the module
      used as key is a reexport or not (for better error messages) and we use
      the re-export module as key. E.g. if "u:M" is a reexport for "o:X" and u
      is unusable, we now record:
      
          "M" -> u:M -> ModUnusable reason reexported=True
      
      So now, we have two cases for a reexport u:M -> o:X:
         - u unusable: "M" -> u:M -> ModUnusable ... reexported=True
         - u usable:   "M" -> o:X -> ModOrigin   ... reexportedFrom=u:M
      
      The second case is indexed with o:X because in this case the Semigroup
      instance of ModOrigin is used to combine valid expositions of a module
      (directly or via reexports).
      
      Note that module lookup functions select usable modules first (those who
      have a ModOrigin value), so it doesn't matter if we add new ModUnusable
      entries in the map like this:
      
        "M" -> {
          u:M -> ModUnusable ... reexported=True
          o:M -> ModOrigin ...
        }
      
      The ModOrigin one will be used. Only if there is no ModOrigin or
      ModHidden entry will the ModUnusable error be printed. See T21097 for an
      example printing several reasons why an import is unusable.
      cee81370
    • Simon Peyton Jones's avatar
      Second fix to #24083 · 2776920e
      Simon Peyton Jones authored and Marge Bot's avatar Marge Bot committed
      My earlier fix turns out to be too aggressive for data/type families
      
      See wrinkle (DTV1) in Note [Disconnected type variables]
      2776920e
  3. Nov 15, 2023
    • Krzysztof Gogolewski's avatar
      Remove loopy superclass solve mechanism · 99ced73b
      Krzysztof Gogolewski authored and Marge Bot's avatar Marge Bot committed
      Programs with a -Wloopy-superclass-solve warning will now fail with an error.
      
      Fixes #23017
      99ced73b
    • Rodrigo Mesquita's avatar
      testsuite: Skip MultiLayerModulesTH_Make on darwin · 929ba2f9
      Rodrigo Mesquita authored and Marge Bot's avatar Marge Bot committed
      The recent toolchain upgrade on darwin machines resulted in the
      MultiLayerModulesTH_Make test metrics varying too much from the
      baseline, ultimately blocking the CI pipelines.
      
      This commit skips the test on darwin to temporarily avoid failures due
      to the environment change in the runners. However, the metrics
      divergence is being investigated still (tracked in #24177)
      929ba2f9
    • Rodrigo Mesquita's avatar
      testsuite: Update to LC_ALL=C no longer being ignored in darwin · ce7fe5a9
      Rodrigo Mesquita authored and Marge Bot's avatar Marge Bot committed
      MacOS seems to have fixed an issue where it used to ignore the variable
      `LC_ALL` in program invocations and default to using Unicode.
      
      Since the behaviour seems to be fixed to account for the locale
      variable, we mark tests that were previously broken in spite of it as
      fragile (since they now pass in recent macOS distributions)
      
      See #24161
      ce7fe5a9
  4. Nov 12, 2023
    • Alan Zimmerman's avatar
      EPA: Replace Anchor with EpaLocation · 3f0036ec
      Alan Zimmerman authored and Marge Bot's avatar Marge Bot committed
      An Anchor has a location and an operation, which is either that it is
      unchanged or that it has moved with a DeltaPos
      
          data Anchor = Anchor { anchor :: RealSrcSpan
                               , anchor_op :: AnchorOperation }
      
      An EpaLocation also has either a location or a DeltaPos
      
          data EpaLocation = EpaSpan !RealSrcSpan !(Strict.Maybe BufSpan)
                           | EpaDelta !DeltaPos ![LEpaComment]
      
      Now that we do not care about always having a location in the anchor,
      we remove Anchor and replace it with EpaLocation
      
      We do this with a type alias initially, to ease the transition.
      The alias will be removed in time.
      
      We also have helpers to reconstruct the AnchorOperation from an
      EpaLocation. This is also temporary.
      
      Updates Haddock submodule
      3f0036ec
  5. Nov 10, 2023
    • Simon Peyton Jones's avatar
      Add an extra check in kcCheckDeclHeader_sig · 6dbab180
      Simon Peyton Jones authored and Marge Bot's avatar Marge Bot committed
      Fix #24083 by checking for a implicitly-scoped type variable that is not
      actually bound.  See Note [Disconnected type variables] in GHC.Tc.Gen.HsType
      
      For some reason, on aarch64-darwin we saw a 2.8% decrease in compiler
      allocations for MultiLayerModulesTH_Make; but 0.0% on other architectures.
      
      Metric Decrease:
          MultiLayerModulesTH_Make
      6dbab180
  6. Nov 09, 2023
  7. Nov 05, 2023
  8. 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
  9. 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
  10. 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
  11. Oct 31, 2023
  12. Oct 28, 2023
  13. Oct 27, 2023
  14. 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
  15. Oct 23, 2023
  16. Oct 20, 2023
  17. Oct 19, 2023
  18. Oct 18, 2023
  19. 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
  20. Oct 12, 2023
  21. Oct 10, 2023
  22. Oct 08, 2023
  23. 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
  24. Oct 05, 2023
Loading