1. 03 Mar, 2021 25 commits
  2. 02 Mar, 2021 6 commits
  3. 01 Mar, 2021 9 commits
    • Sebastian Graf's avatar
      Pmc: Implement `considerAccessible` (#18610) · e571eda7
      Sebastian Graf authored
      Consider (`T18610`):
        f :: Bool -> Int
        f x = case (x, x) of
          (True,  True)  -> 1
          (False, False) -> 2
          (True,  False) -> 3 -- Warning: Redundant
      The third clause will be flagged as redundant. Nevertheless, the
      programmer might intend to keep the clause in order to avoid bitrot.
      After this patch, the programmer can write
        g :: Bool -> Int
        g x = case (x, x) of
          (True,  True)  -> 1
          (False, False) -> 2
          (True,  False) | GHC.Exts.considerAccessible -> 3 -- No warning
      And won't be bothered any longer. See also `Note [considerAccessible]`
      and the updated entries in the user's guide.
      Fixes #18610 and #19228.
    • Sebastian Graf's avatar
      Fix a bug causing loss of sharing in `UniqSDFM` · 51828c6d
      Sebastian Graf authored
      While fixing #18610, I noticed that
      f :: Bool -> Int
      f x = case (x, x) of
        (True,  True)  -> 1
        (False, False) -> 2
      was *not* detected as exhaustive. I tracked it down to `equateUSDFM`,
      where upon merging equality classes of `x` and `y`, we failed to atually
      indirect the *representative* `x'` of the equality class of `x` to the
      representative `y'` of `y`.
      The fixed code is much more naturally and would I should have written in
      the first place. I can confirm that the above example now is detected as
      exhaustive. The commit that fixes #18610 comes directly after and it has
      `f` above as a regression test, so I saw no need to open a ticket or
      commit a separate regression test.
    • Alan Zimmerman's avatar
      Wrap LHsContext in Maybe in the GHC AST · ce85cffc
      Alan Zimmerman authored
      If the context is missing it is captured as Nothing, rather than
      putting a noLoc in the ParsedSource.
      Updates haddock submodule
    • Simon Peyton Jones's avatar
      Fix terrible occurrence-analysis bug · 6429943b
      Simon Peyton Jones authored
      Ticket #19360 showed up a terrible bug in the occurrence analyser,
      in a situation like this
         Rec { f = g
             ; g = ..f...
               {-# RULE g .. = ...f... #-}  }
      Then f was postInlineUnconditionally, but not in the RULE (which
      is simplified first), so we had a RULE mentioning a variable that
      was not in scope.
      This led me to review (again) the subtle loop-breaker stuff in the
      occurrence analyser. The actual changes are few, and are largely
      simplifications.  I did a /lot/ of comment re-organising though.
      There was an unexpected amount of fallout.
      * Validation failed when compiling the stage2 compiler with profiling
        on. That turned to tickle a second latent bug in the same OccAnal
        code (at least I think it was always there), which led me to
        simplify still further; see Note [inl_fvs] in GHC.Core.Opt.OccurAnal.
      * But that in turn let me to some strange behaviour in CSE when ticks
        are in the picture, which I duly fixed.  See Note [Dealing with ticks]
        in GHC.Core.Opt.CSE.
      * Then I got an ASSERT failure in CoreToStg, which again seems to be
        a latent bug.  See Note [Ticks in applications] in GHC.CoreToStg
      * I also made one unforced change: I now simplify the RHS of a RULE in
        the same way as the RHS of a stable unfolding. This can allow a
        trivial binding to disappear sooner than otherwise, and I don't
        think it has any downsides.  The change is in
    • Krzysztof Gogolewski's avatar
      Infer multiplicity in case expressions · 3b79e8b8
      Krzysztof Gogolewski authored
      This is a first step towards #18738.
    • Simon Peyton Jones's avatar
      Unify result type earlier to improve error messages · 7730713b
      Simon Peyton Jones authored
      Ticket #19364 helpfully points out that we do not currently take
      advantage of pushing the result type of an application into the
      arguments.  This makes error messages notably less good.
      The fix is rather easy: move the result-type unification step earlier.
      It's even a bit more efficient; in the the checking case we now
      do one less zonk.
      See Note [Unify with expected type before typechecking arguments]
      in GHC.Tc.Gen.App
      This change generally improves error messages, but it made one worse:
      typecheck/should_fail/T16204c. That led me to the realisation that
      a good error can be replaced by a less-good one, which provoked
      me to change GHC.Tc.Solver.Interact.inertsCanDischarge.  It's
      explained in the new Note [Combining equalities]
      One other refactoring: I discovered that KindEqOrigin didn't need a
      Maybe in its type -- a nice simplification.
    • Sebastian Graf's avatar
      Widen acceptance window of `MultiLayerModules` (#19293) [skip ci] · 8c425bd8
      Sebastian Graf authored
      As #19293 realises, this one keeps on flip flopping by 2.5%
      depending on how many modules there are within the GHC package.
      We should revert this once we figured out how to fix what's going on.
    • Ben Gamari's avatar
      testsuite: Accept allocations change in T10421 · f512f9e2
      Ben Gamari authored
      Metric Decrease:
    • Ben Gamari's avatar
      rts/eventlog: Flush MainCapability buffer in non-threaded RTS · e18c430d
      Ben Gamari authored
      Previously flushEventLog failed to flush anything but the global event
      buffer in the non-threaded RTS.
      Fixes #19436.