Skip to content
Snippets Groups Projects
  1. Jul 27, 2023
  2. Jul 25, 2023
    • Ben Gamari's avatar
      linker/PEi386: Don't sign-extend symbol section number · 877ec97b
      Ben Gamari authored
      Previously we incorrectly interpreted PE section numbers as signed
      values. However, this isn't the case; rather, it's an unsigned 16-bit number
      with a few special bit-patterns (0xffff and 0xfffe). This resulted in #22941
      as the linker would conclude that the sections were invalid.
      
      Fixing this required quite a bit of refactoring.
      
      Closes #22941.
      877ec97b
  3. Jul 24, 2023
  4. Jul 21, 2023
  5. Jul 20, 2023
    • sheaf's avatar
      Skip PMC for boring patterns · ae88ed9a
      sheaf authored and Ben Gamari's avatar Ben Gamari 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.
      
      (cherry picked from commit bea0e323)
      ae88ed9a
    • sheaf's avatar
      Propagate long-distance information in do-notation · c7688443
      sheaf authored and Ben Gamari's avatar Ben Gamari 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
      
      (cherry picked from commit 1d05971e)
      c7688443
    • sheaf's avatar
      Re-instate -Wincomplete-record-updates · 071dd8ca
      sheaf authored and Ben Gamari's avatar Ben Gamari 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
      
      (cherry picked from commit df706de3)
      071dd8ca
    • sheaf's avatar
      exactprint: silence incomplete record update warnings · f9f4714e
      sheaf authored and Ben Gamari's avatar Ben Gamari committed
      (cherry picked from commit 860f6269)
      f9f4714e
    • sheaf's avatar
      base: add COMPLETE pragma to BufferCodec PatSyn · fa084def
      sheaf authored and Ben Gamari's avatar Ben Gamari committed
      This implements CLC proposal #178, rectifying an oversight in the
      implementation of CLC proposal #134 which could lead to spurious
      pattern match warnings.
      
      https://github.com/haskell/core-libraries-committee/issues/178
      https://github.com/haskell/core-libraries-committee/issues/134
      (cherry picked from commit 22565506)
      fa084def
    • sheaf's avatar
      Prioritise Parent when looking up class sub-binder · 84e6df59
      sheaf authored and Ben Gamari's avatar Ben Gamari 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
      
      (cherry picked from commit 3bd4d5b5)
      84e6df59
    • sheaf's avatar
      Suggest similar names in imports · 2734d370
      sheaf authored and Ben Gamari's avatar Ben Gamari 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.
      
      (cherry picked from commit 1af2e773)
      2734d370
    • sheaf's avatar
      rnImports: var shouldn't import NoFldSelectors · ff06b820
      sheaf authored and Ben Gamari's avatar Ben Gamari 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
      
      (cherry picked from commit c7bbad9a)
      ff06b820
    • sheaf's avatar
      Refactor lookupGRE_... functions · c5533204
      sheaf authored and Ben Gamari's avatar Ben Gamari 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
      -------------------------
      
      (cherry picked from commit 7f0a86ed)
      c5533204
    • sheaf's avatar
      Introduce greInfo, greParent · 45ab7560
      sheaf authored and Ben Gamari's avatar Ben Gamari committed
      These are simple helper functions that wrap the internal
      field names gre_info, gre_par.
      
      (cherry picked from commit 6fd8f566)
      45ab7560
    • sheaf's avatar
      Fix deprecation of record fields · 3d913cbe
      sheaf authored and Ben Gamari's avatar Ben Gamari 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.
      
      (cherry picked from commit 6143838a)
      3d913cbe
    • Ryan Scott's avatar
      Fix typechecking of promoted empty lists · 6e044db1
      Ryan Scott authored
      The `'[]` case in `tc_infer_hs_type` is smart enough to handle arity-0 uses of
      `'[]` (see the newly added `T23543` test case for an example), but the `'[]`
      case in `tc_hs_type` was not. We fix this by changing the `tc_hs_type` case to
      invoke `tc_infer_hs_type`, as prescribed in `Note [Future-proofing the type
      checker]`.
      
      There are some benign changes to test cases' expected output due to the new
      code path using `forall a. [a]` as the kind of `'[]` rather than `[k]`.
      
      Fixes #23543.
      
      (cherry picked from commit c335fb7c)
      6e044db1
    • Krzysztof Gogolewski's avatar
      Use extended literals when deriving Show · 8f77107f
      Krzysztof Gogolewski authored and Ben Gamari's avatar Ben Gamari committed
      This implements GHC proposal
      https://github.com/ghc-proposals/ghc-proposals/pull/596
      
      Also add support for Int64# and Word64#; see testcase ShowPrim.
      
      (cherry picked from commit 787bae96)
      8f77107f
    • Sylvain Henry's avatar
      JS: better implementation for plusWord64 (#23597) · 27df38c2
      Sylvain Henry authored
      (cherry picked from commit b55a8ea7)
      27df38c2
    • Vladislav Zavialov's avatar
      List and Tuple<n>: update documentation · e0fbb1d4
      Vladislav Zavialov authored and Ben Gamari's avatar Ben Gamari committed
      Add the missing changelog.md entries and @since-annotations.
      
      (cherry picked from commit 7f13acbf)
      e0fbb1d4
    • Krzysztof Gogolewski's avatar
      Fix #23567, a specializer bug · ba2f9f34
      Krzysztof Gogolewski authored and Ben Gamari's avatar Ben Gamari committed
      Found by Simon in ghc/ghc#23567 (comment 507834)
      
      The testcase isn't ideal because it doesn't detect the bug in master,
      unless doNotUnbox is removed as in
      ghc/ghc#23567 (comment 507692).
      But I have confirmed that with that modification, it fails before
      and passes afterwards.
      
      (cherry picked from commit bf9b9de0)
      ba2f9f34
    • Matthew Pickering's avatar
      Use deb10 for i386 bindists · e5ed9c58
      Matthew Pickering authored and Ben Gamari's avatar Ben Gamari committed
      deb9 is now EOL so it's time to upgrade the i386 bindist to use deb10
      
      Fixes #23585
      
      (cherry picked from commit c39f279b)
      e5ed9c58
    • sheaf's avatar
      Valid hole fits: don't panic on a Given · b9c2aa3f
      sheaf authored and Ben Gamari's avatar Ben Gamari committed
      The function GHC.Tc.Errors.validHoleFits would end up panicking when
      encountering a Given constraint. To fix this, it suffices to filter out
      the Givens before continuing.
      
      Fixes #22684
      
      (cherry picked from commit 630e3026)
      b9c2aa3f
    • Sylvain Henry's avatar
      JS: support -this-unit-id for programs in the linker (#23613) · 90846d43
      Sylvain Henry authored
      (cherry picked from commit 550af505)
      90846d43
    • sheaf's avatar
      tyThingLocalGREs: include all DataCons for RecFlds · fd3fcfe5
      sheaf authored and Ben Gamari's avatar Ben Gamari committed
      The GREInfo for a record field should include the collection of all
      the data constructors of the parent TyCon that have this record field.
      This information was being incorrectly computed in the tyThingLocalGREs
      function for a DataCon, as we were not taking into account other
      DataCons with the same parent TyCon.
      
      Fixes #23546
      
      (cherry picked from commit 61b1932e)
      fd3fcfe5
    • Bodigrim's avatar
      Add since annotations for Data.Foldable1 · 30830523
      Bodigrim authored
      (cherry picked from commit 054261dd)
      30830523
    • Matthew Pickering's avatar
      driver: Fix -S with .cmm files · 0c877166
      Matthew Pickering authored and Ben Gamari's avatar Ben Gamari 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
      
      (cherry picked from commit 76983a0d)
      0c877166
    • sheaf's avatar
      Reinstate untouchable variable error messages · d33581c5
      sheaf authored and Ben Gamari's avatar Ben Gamari 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.
      
      (cherry picked from commit 2b55cb5f)
      d33581c5
    • Mario's avatar
      Fixed ticket #23571, TH.Ppr.pprLit hanging on large numeric literals · e5215256
      Mario authored and Ben Gamari's avatar Ben Gamari committed
      (cherry picked from commit 4af7eac2)
      e5215256
    • Matthew Pickering's avatar
      Add -fpolymorphic-specialisation flag (off by default at all optimisation levels) · 7cec29d8
      Matthew Pickering authored and Ben Gamari's avatar Ben Gamari committed
      Polymorphic specialisation has led to a number of hard to diagnose
      incorrect runtime result bugs (see #23469, #23109, #21229, #23445) so
      this commit introduces a flag `-fpolymorhphic-specialisation` which
      allows users to turn on this experimental optimisation if they are
      willing to buy into things going very wrong.
      
      Ticket #23469
      
      (cherry picked from commit 9f01d14b)
      7cec29d8
    • Dave Barton's avatar
      Fix some broken links and typos · 77117e5f
      Dave Barton authored and Ben Gamari's avatar Ben Gamari committed
      (cherry picked from commit 4457da2a)
      77117e5f
    • Sylvain Henry's avatar
      JS: fix JS stack printing (#23565) · fb4ecd83
      Sylvain Henry authored
      (cherry picked from commit 78b2f3cc)
      fb4ecd83
    • Ben Gamari's avatar
Loading