1. 28 Nov, 2019 2 commits
    • Brian Wignall's avatar
    • Philipp Krüger's avatar
      Reduce boolean blindness in OccInfo(OneOcc) #17482 · 5f84b52a
      Philipp Krüger authored
      * Transformed the type aliases `InterestingCxt`, `InsideLam` and `OneBranch`
        into data types.
      * Added Semigroup and Monoid instances for use in orOccInfo in OccurAnal.hs
      * Simplified some usage sites by using pattern matching instead of boolean algebra.
      Metric Increase:
      This increase was on a Mac-build of exactly 1%. This commit does *not* re-intruduce
      the asymptotic memory usage described in T12150.
  2. 27 Nov, 2019 2 commits
    • Vladislav Zavialov's avatar
      Whitespace-sensitive bang patterns (#1087, #17162) · 8168b42a
      Vladislav Zavialov authored
      This patch implements a part of GHC Proposal #229 that covers five
      * the bang operator (!)
      * the tilde operator (~)
      * the at operator (@)
      * the dollar operator ($)
      * the double dollar operator ($$)
      Based on surrounding whitespace, these operators are disambiguated into
      bang patterns, lazy patterns, strictness annotations, type
      applications, splices, and typed splices.
      This patch doesn't cover the (-) operator or the -Woperator-whitespace
      warning, which are left as future work.
    • Sebastian Graf's avatar
      Make warnings for TH splices opt-in · 5a08f7d4
      Sebastian Graf authored
      In #17270 we have the pattern-match checker emit incorrect warnings. The
      reason for that behavior is ultimately an inconsistency in whether we
      treat TH splices as written by the user (`FromSource :: Origin`) or as
      generated code (`Generated`). This was first reported in #14838.
      The current solution is to TH splices as `Generated` by default and only
      treat them as `FromSource` when the user requests so
      (-fenable-th-splice-warnings). There are multiple reasons for opt-in
      rather than opt-out:
        * It's not clear that the user that compiles a splice is the author of the code
          that produces the warning. Think of the situation where she just splices in
          code from a third-party library that produces incomplete pattern matches.
          In this scenario, the user isn't even able to fix that warning.
        * Gathering information for producing the warnings (pattern-match check
          warnings in particular) is costly. There's no point in doing so if the user
          is not interested in those warnings.
      Fixes #17270, but not #14838, because the proper solution needs a GHC
      proposal extending the TH AST syntax.
  3. 25 Nov, 2019 1 commit
  4. 24 Nov, 2019 1 commit
  5. 23 Nov, 2019 5 commits
    • Ben Gamari's avatar
      Packages: Don't use expectJust · cb11fcb5
      Ben Gamari authored
      Throw a slightly more informative error on failure. Motivated by the
      errors seen in !2160.
    • Ryan Scott's avatar
      Prevent -optc arguments from being duplicated in reverse order (#17471) · 15f1dc33
      Ryan Scott authored
      This reverts a part of commit
      7bc5d6c6 that causes all arguments
      to `-optc` (and `-optcxx`) to be passed twice to the C/C++ compiler,
      once in reverse order and then again in the correct order. While
      passing duplicate arguments is usually harmless it can cause breakage
      in this pattern, which is employed by Hackage libraries in the wild:
      ghc Foo.hs foo.c -optc-D -optcFOO
      As `FOO -D -D FOO` will cause compilers to error.
      Fixes #17471.
    • Abigail's avatar
      Make CorePrep.tryEtaReducePrep and CoreUtils.tryEtaReduce line up · 4a1e7e47
      Abigail authored
      Simon PJ says he prefers this fix to #17429 over banning eta-reduction
      for jumps entirely. Sure enough, this also works.
      Test case: simplCore/should_compile/T17429.hs
    • Abigail's avatar
      Take care to not eta-reduce jumps in CorePrep · de6bbdf2
      Abigail authored
      CorePrep already had a check to prevent it from eta-reducing Ids that
      respond true to hasNoBinding (foreign calls, constructors for unboxed
      sums and products, and Ids with compulsory unfoldings). It did not,
      however, consider join points as ids that 'must be saturated'.
      Checking whether the Id responds True to 'isJoinId' should prevent
      CorePrep from turning saturated jumps like the following (from #17429)
      into undersaturated ones:
            (\ eta_XP ->
               join { mapped_s1vo _ = lvl_s1vs } in jump mapped_s1vo eta_XP)
    • Alex D's avatar
      Fix typo in Note reference [skip ci] · 889d475b
      Alex D authored
  6. 20 Nov, 2019 1 commit
  7. 19 Nov, 2019 4 commits
  8. 17 Nov, 2019 2 commits
  9. 14 Nov, 2019 1 commit
  10. 13 Nov, 2019 4 commits
    • Ömer Sinan Ağacan's avatar
      Only pass mod_location with HscRecomp instead of the entire ModSummary · a06cfb59
      Ömer Sinan Ağacan authored
      HscRecomp users only need the ModLocation of the module being compiled,
      so only pass that to users instead of the entire ModSummary
      Metric Decrease:
    • Ryan Scott's avatar
      Print name prefixly in the Outputable instance for StandaloneKindSig · 9a939a6c
      Ryan Scott authored
      Issue #17461 was occurring because the `Outputable` instance for
      standalone kind signatures was simply calling `ppr` on the name in
      the kind signature, which does not add parentheses to infix names.
      The solution is simple: use `pprPrefixOcc` instead.
      Fixes #17461.
    • Ben Gamari's avatar
      Ensure that coreView/tcView are able to inline · 2d4f9ad8
      Ben Gamari authored
      Previously an import cycle between Type and TyCoRep meant that several
      functions in TyCoRep ended up SOURCE import coreView. This is quite
      unfortunate as coreView is intended to be fused into a larger pattern
      match and not incur an extra call.
      Fix this with a bit of restructuring:
       * Move the functions in `TyCoRep` which depend upon things in `Type`
         into `Type`
       * Fold contents of `Kind` into `Type` and turn `Kind` into a simple
         wrapper re-exporting kind-ish things from `Type`
       * Clean up the redundant imports that popped up as a result
      Closes #17441.
      Metric Decrease:
    • Ömer Sinan Ağacan's avatar
      Document CmmTopInfo type · 535d0edc
      Ömer Sinan Ağacan authored
      [ci skip]
  11. 10 Nov, 2019 2 commits
  12. 09 Nov, 2019 1 commit
  13. 08 Nov, 2019 2 commits
  14. 07 Nov, 2019 3 commits
  15. 05 Nov, 2019 3 commits
    • Ömer Sinan Ağacan's avatar
      CoreTidy: hide tidyRule · b7460492
      Ömer Sinan Ağacan authored
    • Ömer Sinan Ağacan's avatar
    • Sebastian Graf's avatar
      Check EmptyCase by simply adding a non-void constraint · 1593debf
      Sebastian Graf authored
      We can handle non-void constraints since !1733, so we can now express
      the strictness of `-XEmptyCase` just by adding a non-void constraint
      to the initial Uncovered set.
      For `case x of {}` we thus check that the Uncovered set `{ x | x /~ ⊥ }`
      is non-empty. This is conceptually simpler than the plan outlined in
       #17376, because it talks to the oracle directly.
      In order for this patch to pass the testsuite, I had to fix handling of
      newtypes in the pattern-match checker (#17248).
      Since we use a different code path (well, the main code path) for
      `-XEmptyCase` now, we apparently also handle #13717 correctly.
      There's also some dead code that we can get rid off now.
      `provideEvidence` has been updated to provide output more in line with
      the old logic, which used `inhabitationCandidates` under the hood.
      A consequence of the shift away from the `UncoveredPatterns` type is
      that we don't report reduced type families for empty case matches,
      because the pretty printer is pure and only knows the match variable's
      Fixes #13717, #17248, #17386
  16. 04 Nov, 2019 1 commit
  17. 03 Nov, 2019 2 commits
    • Richard Eisenberg's avatar
      Update Note references -- comments only · 3c916162
      Richard Eisenberg authored
      Follow-on from !2041.
    • Sebastian Graf's avatar
      Separate `LPat` from `Pat` on the type-level · 182b1199
      Sebastian Graf authored
      Since the Trees That Grow effort started, we had `type LPat = Pat`.
      This is so that `SrcLoc`s would only be annotated in GHC's AST, which is
      the reason why all GHC passes use the extension constructor `XPat` to
      attach source locations. See #15495 for the design discussion behind
      But now suddenly there are `XPat`s everywhere!
      There are several functions which dont't cope with `XPat`s by either
      crashing (`hsPatType`) or simply returning incorrect results
      This issue was raised in #17330. I also came up with a rather clean and
      type-safe solution to the problem: We define
      type family XRec p (f :: * -> *) = r | r -> p f
      type instance XRec (GhcPass p) f = Located (f (GhcPass p))
      type instance XRec TH          f =          f p
      type LPat p = XRec p Pat
      This is a rather modular embedding of the old "ping-pong" style, while
      we only pay for the `Located` wrapper within GHC. No ping-ponging in
      a potential Template Haskell AST, for example. Yet, we miss no case
      where we should've handled a `SrcLoc`: `hsPatType` and
      `collectEvVarsPat` are not callable at an `LPat`.
      Also, this gets rid of one indirection in `Located` variants:
      Previously, we'd have to go through `XPat` and `Located` to get from
      `LPat` to the wrapped `Pat`. Now it's just `Located` again.
      Thus we fix #17330.
  18. 02 Nov, 2019 1 commit
    • Simon Peyton Jones's avatar
      Make CSE delay inlining less · 4a6d3d68
      Simon Peyton Jones authored
      CSE delays inlining a little bit, to avoid losing vital
      specialisations; see Note [Delay inlining after CSE] in CSE.
      But it was being over-enthusiastic.  This patch makes the
      delay only apply to Ids with specialisation rules, which
      avoids unnecessary delay (#17409).
  19. 01 Nov, 2019 2 commits