Skip to content
Snippets Groups Projects
  1. Jul 22, 2023
  2. Jul 21, 2023
    • Finley McIlwaine's avatar
      Insert documentation into parsed signature modules · b444c16f
      Finley McIlwaine authored and Marge Bot's avatar Marge Bot committed
      Causes haddock comments in signature modules to be properly
      inserted into the AST (just as they are for regular modules)
      if the `-haddock` flag is given.
      
      Also adds a test that compares `-ddump-parsed-ast` output
      for a signature module to prevent further regressions.
      
      Fixes #23315
      b444c16f
  3. Jul 19, 2023
    • Alan Zimmerman's avatar
      EPA: Improve annotation management in getMonoBind · 9c8fdda3
      Alan Zimmerman authored and Marge Bot's avatar Marge Bot committed
      Ensure the LHsDecl for a FunBind has the correct leading comments and
      trailing annotations.
      
      See the added note for details.
      9c8fdda3
    • sheaf's avatar
      Prioritise Parent when looking up class sub-binder · 3bd4d5b5
      sheaf authored and Marge Bot's avatar Marge Bot committed
      When we look up children GlobalRdrElts of a given Parent, we sometimes
      would rather prioritise those GlobalRdrElts which have the right Parent,
      and sometimes prioritise those that have the right NameSpace:
      
        - in export lists, we should prioritise NameSpace
        - for class/instance binders, we should prioritise Parent
      
      See Note [childGREPriority] in GHC.Types.Name.Reader.
      
      fixes #23664
      3bd4d5b5
    • Sven Tennie's avatar
      Add test for %mulmayoflo primop · a36f9dc9
      Sven Tennie authored and Marge Bot's avatar Marge Bot committed
      The test expects a perfect implementation with no false positives.
      a36f9dc9
  4. Jul 18, 2023
    • Krzysztof Gogolewski's avatar
      Use extended literals when deriving Show · 787bae96
      Krzysztof Gogolewski authored and Marge Bot's avatar Marge Bot committed
      This implements GHC proposal
      https://github.com/ghc-proposals/ghc-proposals/pull/596
      
      Also add support for Int64# and Word64#; see testcase ShowPrim.
      787bae96
    • Krzysztof Gogolewski's avatar
      Core Lint: distinguish let and letrec in locations · 00648e5d
      Krzysztof Gogolewski authored and Marge Bot's avatar Marge Bot committed
      Lint messages were saying "in the body of letrec" even for non-recursive
      let.
      
      I've also renamed BodyOfLetRec to BodyOfLet in stg, since there's no
      separate letrec.
      00648e5d
    • sheaf's avatar
      Do primop rep-poly checks when instantiating · 889c2bbb
      sheaf authored and Marge Bot's avatar Marge Bot committed
      This patch changes how we perform representation-polymorphism checking
      for primops (and other wired-in Ids such as coerce).
      When instantiating the primop, we check whether each type variable
      is required to instantiated to a concrete type, and if so we create a
      new concrete metavariable (a ConcreteTv) instead of a simple MetaTv.
      (A little subtlety is the need to apply the substitution obtained from
      instantiating to the ConcreteTvOrigins, see
      Note [substConcreteTvOrigin] in GHC.Tc.Utils.TcMType.)
      
      This allows us to prevent representation-polymorphism in non-argument
      position, as that is required for some of these primops.
      
      We can also remove the logic in tcRemainingValArgs, except for
      the part concerning representation-polymorphic unlifted newtypes.
      The function has been renamed rejectRepPolyNewtypes; all it does now
      is reject unsaturated occurrences of representation-polymorphic newtype
      constructors when the representation of its argument isn't a concrete
      RuntimeRep (i.e. still a PHASE 1 FixedRuntimeRep check).
      The Note [Eta-expanding rep-poly unlifted newtypes] in GHC.Tc.Gen.Head
      gives more explanation about a possible path to PHASE 2, which would be
      in line with the treatment for primops taken in this patch.
      
      We also update the Core Lint check to handle this new framework. This
      means Core Lint now checks representation-polymorphism in continuation
      position like needed for catch#.
      
      Fixes #21906
      
      -------------------------
      Metric Increase:
          LargeRecord
      -------------------------
      889c2bbb
    • sheaf's avatar
      Skip PMC for boring patterns · bea0e323
      sheaf authored and Marge Bot's avatar Marge Bot committed
      Some patterns introduce no new information to the pattern-match
      checker (such as plain variable or wildcard patterns). We can thus
      skip doing any pattern-match checking on them when the sole purpose
      for doing so was introducing new long-distance information.
      
      See Note [Boring patterns] in GHC.Hs.Pat.
      
      Doing this avoids regressing in performance now that we do additional
      pattern-match checking inside do notation.
      bea0e323
    • sheaf's avatar
      Propagate long-distance information in do-notation · 1d05971e
      sheaf authored and Marge Bot's avatar Marge Bot committed
      The preceding commit re-enabled pattern-match checking inside record
      updates. This revealed that #21360 was in fact NOT fixed by e74fc066.
      
      This commit makes sure we correctly propagate long-distance information
      in do blocks, e.g. in
      
      ```haskell
      data T = A { fld :: Int } | B
      
      f :: T -> Maybe T
      f r = do
        a@A{} <- Just r
        Just $ case a of { A _ -> A 9 }
      ```
      
      we need to propagate the fact that "a" is headed by the constructor "A"
      to see that the case expression "case a of { A _ -> A 9 }" cannot fail.
      
      Fixes #21360
      1d05971e
    • sheaf's avatar
      Re-instate -Wincomplete-record-updates · df706de3
      sheaf authored and Marge Bot's avatar Marge Bot committed
      Commit e74fc066 refactored the handling of record updates to use
      the HsExpanded mechanism. This meant that the pattern matching inherent
      to a record update was considered to be "generated code", and thus we
      stopped emitting "incomplete record update" warnings entirely.
      
      This commit changes the "data Origin = Source | Generated" datatype,
      adding a field to the Generated constructor to indicate whether we
      still want to perform pattern-match checking. We also have to do a bit
      of plumbing with HsCase, to record that the HsCase arose from an
      HsExpansion of a RecUpd, so that the error message continues to mention
      record updates as opposed to a generic "incomplete pattern matches in case"
      error.
      
      Finally, this patch also changes the way we handle inaccessible code
      warnings. Commit e74fc066 was also a regression in this regard, as we
      were emitting "inaccessible code" warnings for case statements spuriously
      generated when desugaring a record update (remember: the desugaring mechanism
      happens before typechecking; it thus can't take into account e.g. GADT information
      in order to decide which constructors to include in the RHS of the desugaring
      of the record update).
      We fix this by changing the mechanism through which we disable inaccessible
      code warnings: we now check whether we are in generated code in
      GHC.Tc.Utils.TcMType.newImplication in order to determine whether to
      emit inaccessible code warnings.
      
      Fixes #23520
      Updates haddock submodule, to avoid incomplete record update warnings
      df706de3
  5. Jul 17, 2023
    • Alan Zimmerman's avatar
      EPA: Store leading AnnSemi for decllist in al_rest · 654fdb98
      Alan Zimmerman authored and Marge Bot's avatar Marge Bot committed
      This simplifies the markAnnListA implementation in ExactPrint
      654fdb98
    • sheaf's avatar
      Suggest similar names in imports · 1af2e773
      sheaf authored and Marge Bot's avatar Marge Bot committed
      This commit adds similar name suggestions when importing. For example
      
        module A where { spelling = 'o' }
        module B where { import B ( speling ) }
      
      will give rise to the error message:
      
        Module ‘A’ does not export ‘speling’.
        Suggested fix: Perhaps use ‘spelling’
      
      This also provides hints when users try to import record fields defined
      with NoFieldSelectors.
      1af2e773
    • sheaf's avatar
      rnImports: var shouldn't import NoFldSelectors · c7bbad9a
      sheaf authored and Marge Bot's avatar Marge Bot committed
      In an import declaration such as
      
        import M ( var )
      
      the import of the variable "var" should **not** bring into scope record
      fields named "var" which are defined with NoFieldSelectors.
      Doing so can cause spurious "unused import" warnings, as reported in
      ticket #23557.
      
      Fixes #23557
      c7bbad9a
  6. Jul 16, 2023
    • Andrei Borzenkov's avatar
      Type patterns (#22478, #18986) · 2afbddb0
      Andrei Borzenkov authored
      Improved name resolution and type checking of type patterns in constructors:
      
      1. HsTyPat: a new dedicated data type that represents type patterns in
         HsConPatDetails instead of reusing HsPatSigType
      
      2. rnHsTyPat: a new function that renames a type
         pattern and collects its binders into three groups:
          - explicitly bound type variables, excluding locally bound
            variables
          - implicitly bound type variables from kind signatures
            (only if ScopedTypeVariables are enabled)
          - named wildcards (only from kind signatures)
      2a. rnHsPatSigTypeBindingVars: removed in favour of rnHsTyPat
      2b. rnImplcitTvBndrs: removed because no longer needed
      
      3. collect_pat: updated to collect type variable binders from type patterns
         (this means that types and terms use the same infrastructure to detect
         conflicting bindings, unused variables and name shadowing)
      3a. CollVarTyVarBinders: a new CollectFlag constructor that enables
          collection of type variables
      
      4. tcHsTyPat: a new function that typechecks type patterns, capable of
         handling polymorphic kinds.
         See Note [Type patterns: binders and unifiers]
      
      Examples of code that is now accepted:
      
         f = \(P @a) -> \(P @a) -> ...  -- triggers -Wname-shadowing
      
         g :: forall a. Proxy a -> ...
         g (P @a) = ...                 -- also triggers -Wname-shadowing
      
         h (P @($(TH.varT (TH.mkName "t")))) = ...
                                        -- t is bound at splice time
      
         j (P @(a :: (x,x))) = ...      -- (x,x) is no longer rejected
      
         data T where
           MkT :: forall (f :: forall k. k -> Type).
             f Int -> f Maybe -> T
         k :: T -> ()
         k (MkT @f (x :: f Int) (y :: f Maybe)) = ()
                                        -- f :: forall k. k -> Type
      
      Examples of code that is rejected with better error messages:
      
        f (Left @a @a _) = ...
        -- new message:
        --     • Conflicting definitions for ‘a’
        --       Bound at: Test.hs:1:11
        --                 Test.hs:1:14
      
      Examples of code that is now rejected:
      
        {-# OPTIONS_GHC -Werror=unused-matches #-}
        f (P @a) = ()
        -- Defined but not used: type variable ‘a’
      2afbddb0
  7. 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
  8. Jul 14, 2023
  9. 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
    • sheaf's avatar
      Refactor lookupGRE_... functions · 7f0a86ed
      sheaf authored and Marge Bot's avatar Marge Bot committed
      This commit consolidates all the logic for looking up something in
      the Global Reader Environment into the single function lookupGRE.
      This allows us to declaratively specify all the different modes of
      looking up in the GlobalRdrEnv, and avoids manually passing around
      filtering functions as was the case in e.g. the function
      GHC.Rename.Env.lookupSubBndrOcc_helper.
      
      -------------------------
      Metric Decrease:
          T8095
      -------------------------
      -------------------------
      Metric Increase:
          T8095
      -------------------------
      7f0a86ed
    • sheaf's avatar
      Fix deprecation of record fields · 6143838a
      sheaf authored and Marge Bot's avatar Marge Bot committed
      Commit 3f374399 inadvertently broke the deprecation/warning mechanism
      for record fields due to its introduction of record field namespaces.
      
      This patch ensures that, when a top-level deprecation is applied to
      an identifier, it applies to all the record fields as well.
      This is achieved by refactoring GHC.Rename.Env.lookupLocalTcNames, and
      GHC.Rename.Env.lookupBindGroupOcc, to not look up a fixed number of
      NameSpaces but to look up all NameSpaces and filter out the irrelevant
      ones.
      6143838a
    • Krzysztof Gogolewski's avatar
      Fix #23567, a specializer bug · bf9b9de0
      Krzysztof Gogolewski authored and Marge Bot's avatar Marge Bot committed
      Found by Simon in #23567 (comment 507834)
      
      The testcase isn't ideal because it doesn't detect the bug in master,
      unless doNotUnbox is removed as in
      #23567 (comment 507692).
      But I have confirmed that with that modification, it fails before
      and passes afterwards.
      bf9b9de0
  10. Jul 12, 2023
  11. 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
  12. Jul 10, 2023
    • Jade's avatar
      Add a hint to enable ExplicitNamespaces for type operator imports (Fixes/Enhances #20007) · 8e11630e
      Jade authored and Marge Bot's avatar Marge Bot committed
      As suggested in #20007 and implemented in !8895, trying to import type operators
      will suggest a fix to use the 'type' keyword, without considering whether
      ExplicitNamespaces is enabled. This patch will query whether ExplicitNamespaces
      is enabled and add a hint to suggest enabling ExplicitNamespaces if it isn't enabled,
      alongside the suggestion of adding the 'type' keyword.
      8e11630e
  13. Jul 08, 2023
  14. Jul 07, 2023
    • Matthew Pickering's avatar
      driver: Fix -S with .cmm files · 76983a0d
      Matthew Pickering authored and Marge Bot's avatar Marge Bot committed
      There was an oversight in the driver which assumed that you would always
      produce a `.o` file when compiling a .cmm file.
      
      Fixes #23610
      76983a0d
    • Ben Gamari's avatar
      testsuite: Allow preservation of unexpected output · 9955eead
      Ben Gamari authored and Marge Bot's avatar Marge Bot committed
      Here we introduce a new flag to the testsuite driver,
      --unexpected-output-dir=<dir>, which allows the user to ask
      the driver to preserve unexpected output from tests. The intent is for
      this to be used in CI to allow users to more easily fix unexpected
      platform-dependent output.
      9955eead
  15. Jul 06, 2023
  16. Jul 05, 2023
    • Rodrigo Mesquita's avatar
      configure: Drop Clang command from settings · 53ed21c5
      Rodrigo Mesquita authored and Marge Bot's avatar Marge Bot committed
      Due to 01542cb7 we no longer use the
      `runClang` function, and no longer need to configure into settings the
      Clang command. We used to determine options at runtime to pass clang when
      it was used as an assembler, but now that we configure at configure time
      we no longer need to.
      53ed21c5
    • sheaf's avatar
      Reinstate untouchable variable error messages · 2b55cb5f
      sheaf authored and Marge Bot's avatar Marge Bot committed
      This extra bit of information was accidentally being discarded after
      a refactoring of the way we reported problems when unifying a type
      variable with another type. This patch rectifies that.
      2b55cb5f
    • Torsten Schmits's avatar
      Substitute free variables captured by breakpoints in SpecConstr · 40f4ef7c
      Torsten Schmits authored and Marge Bot's avatar Marge Bot committed
      Fixes #23267
      40f4ef7c
    • Jaro Reinders's avatar
      Refactor Unique to be represented by Word64 · 9edcb1fb
      Jaro Reinders authored and Marge Bot's avatar Marge Bot committed
      In #22010 we established that Int was not always sufficient to store all
      the uniques we generate during compilation on 32-bit platforms. This
      commit addresses that problem by using Word64 instead of Int for
      uniques.
      
      The core of the change is in GHC.Core.Types.Unique and
      GHC.Core.Types.Unique.Supply. However, the representation of uniques is
      used in many other places, so those needed changes too. Additionally, the RTS
      has been extended with an atomic_inc64 operation.
      
      One major change from this commit is the introduction of the Word64Set and
      Word64Map data types. These are adapted versions of IntSet and IntMap
      from the containers package. These are planned to be upstreamed in the
      future.
      
      As a natural consequence of these changes, the compiler will be a bit
      slower and take more space on 32-bit platforms. Our CI tests indicate
      around a 5% residency increase.
      
      Metric Increase:
          CoOpt_Read
          CoOpt_Singletons
          LargeRecord
          ManyAlternatives
          ManyConstructors
          MultiComponentModules
          MultiComponentModulesRecomp
          MultiLayerModulesTH_OneShot
          RecordUpdPerf
          T10421
          T10547
          T12150
          T12227
          T12234
          T12425
          T12707
          T13035
          T13056
          T13253
          T13253-spj
          T13379
          T13386
          T13719
          T14683
          T14697
          T14766
          T15164
          T15703
          T16577
          T16875
          T17516
          T18140
          T18223
          T18282
          T18304
          T18698a
          T18698b
          T18923
          T1969
          T19695
          T20049
          T21839c
          T3064
          T3294
          T4801
          T5030
          T5321FD
          T5321Fun
          T5631
          T5642
          T5837
          T6048
          T783
          T8095
          T9020
          T9198
          T9233
          T9630
          T9675
          T9872a
          T9872b
          T9872b_defer
          T9872c
          T9872d
          T9961
          TcPlugin_RewritePerf
          UniqLoop
          WWRec
          hard_hole_fits
      9edcb1fb
    • meooow's avatar
      Improve the situation with the stimes cycle · 9ce44336
      meooow authored and Marge Bot's avatar Marge Bot committed
      Currently the Semigroup stimes cycle is resolved in GHC.Base by
      importing stimes implementations from a hs-boot file. Resolve the cycle
      using hs-boot files for required classes (Num, Integral) instead. Now
      stimes can be defined directly in GHC.Base, making inlining and
      specialization possible.
      
      This leads to some new boot files for `GHC.Num` and `GHC.Real`, the
      methods for those are only used to implement `stimes` so it doesn't
      appear that these boot files will introduce any new performance traps.
      
      Metric Decrease:
          T13386
          T8095
      Metric Increase:
          T13253
          T13386
          T18698a
          T18698b
          T19695
          T8095
      9ce44336
    • Mario's avatar
      Fixed ticket #23571, TH.Ppr.pprLit hanging on large numeric literals · 4af7eac2
      Mario authored and Marge Bot's avatar Marge Bot committed
      4af7eac2
Loading