1. 25 Jan, 2020 5 commits
    • Sylvain Henry's avatar
      Module hierarchy: Cmm (cf #13009) · 6e2d9ee2
      Sylvain Henry authored
    • Ryan Scott's avatar
      Handle local fixity declarations in DsMeta properly · c3fde723
      Ryan Scott authored
      `DsMeta.rep_sig` used to skip over `FixSig` entirely, which had the
      effect of causing local fixity declarations to be dropped when quoted
      in Template Haskell. But there is no good reason for this state of
      affairs, as the code in `DsMeta.repFixD` (which handles top-level
      fixity declarations) handles local fixity declarations just fine.
      This patch factors out the necessary parts of `repFixD` so that they
      can be used in `rep_sig` as well.
      There was one minor complication: the fixity signatures for class
      methods in each `HsGroup` were stored both in `FixSig`s _and_ the
      list of `LFixitySig`s for top-level fixity signatures, so I needed
      to take action to prevent fixity signatures for class methods being
      converted to `Dec`s twice. I tweaked `RnSource.add` to avoid putting
      these fixity signatures in two places and added
      `Note [Top-level fixity signatures in an HsGroup]` in `GHC.Hs.Decls`
      to explain the new design.
      Fixes #17608. Bumps the Haddock submodule.
    • Sebastian Graf's avatar
      PmCheck: Properly handle constructor-bound type variables · 86966d48
      Sebastian Graf authored
      In ghc/ghc!2192 (comment 246551)
      Simon convinced me that ignoring type variables existentially bound by
      data constructors have to be the same way as value binders.
      Sadly I couldn't think of a regression test, but I'm confident that this
      change strictly improves on the status quo.
    • Sebastian Graf's avatar
      PmCheck: Formulate as translation between Clause Trees · 8038cbd9
      Sebastian Graf authored
      We used to check `GrdVec`s arising from multiple clauses and guards in
      isolation. That resulted in a split between `pmCheck` and
      `pmCheckGuards`, the implementations of which were similar, but subtly
      different in detail. Also the throttling mechanism described in
      `Note [Countering exponential blowup]` ultimately got quite complicated
      because it had to cater for both checking functions.
      This patch realises that pattern match checking doesn't just consider
      single guarded RHSs, but that it's always a whole set of clauses, each
      of which can have multiple guarded RHSs in turn. We do so by
      translating a list of `Match`es to a `GrdTree`:
      data GrdTree
        = Rhs !RhsInfo
        | Guard !PmGrd !GrdTree      -- captures lef-to-right  match semantics
        | Sequence !GrdTree !GrdTree -- captures top-to-bottom match semantics
        | Empty                      -- For -XEmptyCase, neutral element of Sequence
      Then we have a function `checkGrdTree` that matches a given `GrdTree`
      against an incoming set of values, represented by `Deltas`:
      checkGrdTree :: GrdTree -> Deltas -> CheckResult
      Throttling is isolated to the `Sequence` case and becomes as easy as one
      would expect: When the union of uncovered values becomes too big, just
      return the original incoming `Deltas` instead (which is always a
      superset of the union, thus a sound approximation).
      The returned `CheckResult` contains two things:
      1. The set of values that were not covered by any of the clauses, for
         exhaustivity warnings.
      2. The `AnnotatedTree` that enriches the syntactic structure of the
         input program with divergence and inaccessibility information.
      This is `AnnotatedTree`:
      data AnnotatedTree
        = AccessibleRhs !RhsInfo
        | InaccessibleRhs !RhsInfo
        | MayDiverge !AnnotatedTree
        | SequenceAnn !AnnotatedTree !AnnotatedTree
        | EmptyAnn
      Crucially, `MayDiverge` asserts that the tree may force diverging
      values, so not all of its wrapped clauses can be redundant.
      While the set of uncovered values can be used to generate the missing
      equations for warning messages, redundant and proper inaccessible
      equations can be extracted from `AnnotatedTree` by
      For this to work properly, the interface to the Oracle had to change.
      There's only `addPmCts` now, which takes a bag of `PmCt`s. There's a
      whole bunch of `PmCt` variants to replace the different oracle functions
      from before.
      The new `AnnotatedTree` structure allows for more accurate warning
      reporting (as evidenced by a number of changes spread throughout GHC's
      code base), thus we fix #17465.
      Fixes #17646 on the go.
      Metric Decrease:
    • Sebastian Graf's avatar
  2. 20 Jan, 2020 6 commits
  3. 16 Jan, 2020 6 commits
    • Sebastian Graf's avatar
      Revert "`exprOkForSpeculation` for Note [IO hack in the demand analyser]" · f6bf2ce8
      Sebastian Graf authored
      This reverts commit ce64b397 on the
      grounds of the regression it would introduce in a couple of packages.
      Fixes #17653.
      Also undoes a slight metric increase in #13701 introduced by that commit
      that we didn't see prior to !1983.
      Metric Decrease:
    • Adam Wespiser's avatar
      replace dead html link (fixes #17661) · f416fe64
      Adam Wespiser authored
    • John Ericson's avatar
      Remove special case case of bool during STG -> C-- · 1ff55226
      John Ericson authored
      Allow removing the no longer needed cgPrimOp, getting rid of a small a
      small layer violation too.
      Change which made the special case no longer needed was #6135 /
      6579a6c7, which dates back to 2013,
      making me feel better.
    • John Ericson's avatar
      Get rid of OpDest · ee5d63f4
      John Ericson authored
      `OpDest` was basically a defunctionalization. Just turn the code that
      cased on it into those functions, and call them directly.
    • John Ericson's avatar
      Handle TagToEnum in the same big case as the other primops · 22c0bdc3
      John Ericson authored
      Before, it was a panic because it was handled above. But there must have
      been an error in my reasoning (another caller?) because #17442 reported
      the panic was hit.
      But, rather than figuring out what happened, I can just make it
      impossible by construction. By adding just a bit more bureaucracy in the
      return types, I can handle TagToEnum in the same case as all the others,
      so the big case is is now total, and the panic is removed.
      Fixes #17442
    • Sebastian Graf's avatar
      Better documentation for mkEtaWW [skip ci] · c5977d4d
      Sebastian Graf authored
      So that hopefully I understand it faster next time. Also got rid of the
      confusing `orig_expr`, which makes the call site in `etaExpand` look out
      of sync with the passed `n` (which is not the original `n`).
  4. 13 Jan, 2020 8 commits
  5. 08 Jan, 2020 2 commits
  6. 07 Jan, 2020 2 commits
  7. 06 Jan, 2020 1 commit
  8. 04 Jan, 2020 4 commits
  9. 01 Jan, 2020 1 commit
  10. 31 Dec, 2019 1 commit
  11. 30 Dec, 2019 4 commits