1. 27 Mar, 2019 1 commit
  2. 25 Mar, 2019 1 commit
    • Takenobu Tani's avatar
      Update Wiki URLs to point to GitLab · 3769e3a8
      Takenobu Tani authored
      This moves all URL references to Trac Wiki to their corresponding
      GitLab counterparts.
      This substitution is classified as follows:
      1. Automated substitution using sed with Ben's mapping rule [1]
          Old: ghc.haskell.org/trac/ghc/wiki/XxxYyy...
          New: gitlab.haskell.org/ghc/ghc/wikis/xxx-yyy...
      2. Manual substitution for URLs containing `#` index
          Old: ghc.haskell.org/trac/ghc/wiki/XxxYyy...#Zzz
          New: gitlab.haskell.org/ghc/ghc/wikis/xxx-yyy...#zzz
      3. Manual substitution for strings starting with `Commentary`
          Old: Commentary/XxxYyy...
          New: commentary/xxx-yyy...
      See also !539
      [1]: https://gitlab.haskell.org/bgamari/gitlab-migration/blob/master/wiki-mapping.json
  3. 21 Mar, 2019 1 commit
  4. 15 Mar, 2019 1 commit
  5. 08 Feb, 2019 1 commit
    • Richard Eisenberg's avatar
      Fix #14729 by making the normaliser homogeneous · 2b90356d
      Richard Eisenberg authored
      This ports the fix to #12919 to the normaliser. (#12919 was about
      the flattener.) Because the fix is involved, this is done by
      moving the critical piece of code to Coercion, and then calling
      this from both the flattener and the normaliser.
      The key bit is: simplifying type families in a type is always
      a *homogeneous* operation. See #12919 for a discussion of why
      this is the Right Way to simplify type families.
      Also fixes #15549.
      test case: dependent/should_compile/T14729{,kind}
  6. 24 Nov, 2018 1 commit
  7. 27 Oct, 2018 1 commit
    • mayac's avatar
      More explicit foralls (GHC Proposal 0007) · 512eeb9b
      mayac authored
      Allow the user to explicitly bind type/kind variables in type and data
      family instances (including associated instances), closed type family
      equations, and RULES pragmas. Follows the specification of GHC
      Proposal 0007, also fixes #2600. Advised by Richard Eisenberg.
      This modifies the Template Haskell AST -- old code may break!
      Other Changes:
      - convert HsRule to a record
      - make rnHsSigWcType more general
      - add repMaybe to DsMeta
      Includes submodule update for Haddock.
      Test Plan: validate
      Reviewers: goldfire, bgamari, alanz
      Subscribers: simonpj, RyanGlScott, goldfire, rwbarton,
                   thomie, mpickering, carter
      GHC Trac Issues: #2600, #14268
      Differential Revision: https://phabricator.haskell.org/D4894
  8. 28 Sep, 2018 1 commit
    • Ryan Scott's avatar
      Normalise EmptyCase types using the constraint solver · e72d7880
      Ryan Scott authored
      Certain `EmptyCase` expressions were mistakently producing
      warnings since their types did not have as many type families reduced
      as they could have. The most direct way to fix this is to normalise
      these types initially using the constraint solver to solve for any
      local equalities that may be in scope.
      Test Plan: make test TEST=T14813
      Reviewers: simonpj, bgamari, goldfire
      Reviewed By: simonpj
      Subscribers: rwbarton, carter
      GHC Trac Issues: #14813
      Differential Revision: https://phabricator.haskell.org/D5094
  9. 23 Sep, 2018 1 commit
    • Ryan Scott's avatar
      Add a recursivity check in nonVoid · e68b439f
      Ryan Scott authored
      Previously `nonVoid` outright refused to call itself
      recursively to avoid the risk of hitting infinite loops when
      checking recurisve types. But this is too conservative—we //can//
      call `nonVoid` recursively as long as we incorporate a way to detect
      the presence of recursive types, and bail out if we do detect one.
      Happily, such a mechanism already exists in the form of `checkRecTc`,
      so let's use it.
      Test Plan: make test TEST=T15584
      Reviewers: simonpj, bgamari
      Reviewed By: simonpj
      Subscribers: rwbarton, carter
      GHC Trac Issues: #15584
      Differential Revision: https://phabricator.haskell.org/D5116
  10. 27 Aug, 2018 1 commit
    • Ryan Scott's avatar
      Take strict fields into account in coverage checking · 744b034d
      Ryan Scott authored
      The current pattern-match coverage checker implements the
      formalism presented in the //GADTs Meet Their Match// paper in a
      fairly faithful matter. However, it was discovered recently that
      there is a class of unreachable patterns that
      //GADTs Meet Their Match// does not handle: unreachable code due to
      strict argument types, as demonstrated in #15305. This patch
      therefore goes off-script a little and implements an extension to
      the formalism presented in the paper to handle this case.
      Essentially, when determining if each constructor can be matched on,
      GHC checks if its associated term and type constraints are
      satisfiable. This patch introduces a new form of constraint,
      `NonVoid(ty)`, and checks if each constructor's strict argument types
      satisfy `NonVoid`. If any of them do not, then that constructor is
      deemed uninhabitable, and thus cannot be matched on. For the full
      story of how this works, see
      `Note [Extensions to GADTs Meet Their Match]`.
      Along the way, I did a little bit of much-needed refactoring. In
      particular, several functions in `Check` were passing a triple of
      `(ValAbs, ComplexEq, Bag EvVar)` around to represent a constructor
      and its constraints. Now that we're adding yet another form of
      constraint to the mix, I thought it appropriate to turn this into
      a proper data type, which I call `InhabitationCandidate`.
      Test Plan: make test TEST=T15305
      Reviewers: simonpj, bgamari
      Reviewed By: simonpj
      Subscribers: rwbarton, carter
      GHC Trac Issues: #15305
      Differential Revision: https://phabricator.haskell.org/D5087
  11. 01 Aug, 2018 1 commit
    • Ryan Scott's avatar
      Fix #15450 by refactoring checkEmptyCase' · 7f3cb50d
      Ryan Scott authored
      `checkEmptyCase'` (the code path for coverage-checking
      `EmptyCase` expressions) had a fair bit of code duplication from the
      code path for coverage-checking non-`EmptyCase` expressions, and to
      make things worse, it behaved subtly different in some respects (for
      instance, emitting different warnings under unsatisfiable
      constraints, as shown in #15450). This patch attempts to clean up
      both this discrepancy and the code duplication by doing the
      * Factor out a `pmInitialTmTyCs` function, which returns the initial
        set of term and type constraints to use when beginning coverage
        checking. If either set of constraints is unsatisfiable, we use an
        empty set in its place so that we can continue to emit as many
        warnings as possible. (The code path for non-`EmptyCase`
        expressions was doing this already, but not the code path for
        `EmptyCase` expressions, which is the root cause of #15450.)
        Along the way, I added a `Note` to explain why we do this.
      * Factor out a `pmIsSatisfiable` constraint which checks if a set of
        term and type constraints are satisfiable. This does not change any
        existing behavior; this is just for the sake of deduplicating code.
      Test Plan: make test TEST=T15450
      Reviewers: simonpj, bgamari
      Subscribers: rwbarton, thomie, carter
      GHC Trac Issues: #15450
      Differential Revision: https://phabricator.haskell.org/D5017
  12. 30 Jul, 2018 1 commit
    • Ryan Scott's avatar
      Fix #15385 by using addDictsDs in matchGuards · 9d388eb8
      Ryan Scott authored
      When coverage checking pattern-matches, we rely on the call
      sites in the desugarer to populate the local dictionaries and term
      evidence in scope using `addDictsDs` and `addTmCsDs`. But it turns
      out that only the call site for desugaring `case` expressions was
      actually doing this properly. In another part of the desugarer,
      `matchGuards` (which handles pattern guards), it did not update the
      local dictionaries in scope at all, leading to #15385.
      Fixing this is relatively straightforward: just augment the
      `BindStmt` case of `matchGuards` to use `addDictsDs` and `addTmCsDs`.
      Accomplishing this took a little bit of import/export tweaking:
      * We now need to export `collectEvVarsPat` from `HsPat.hs`.
      * To avoid an import cycle with `Check.hs`, I moved `isTrueLHsExpr`
        from `DsGRHSs.hs` to `DsUtils.hs`, which resides lower on the
        import chain.
      Test Plan: make test TEST=T15385
      Reviewers: simonpj, bgamari
      Reviewed By: simonpj
      Subscribers: rwbarton, thomie, carter
      GHC Trac Issues: #15385
      Differential Revision: https://phabricator.haskell.org/D4968
  13. 04 Jun, 2018 1 commit
  14. 03 Jun, 2018 2 commits
    • Tao He's avatar
      Improve exhaustiveness checking for literal values and patterns, fix #14546 · 1f88f541
      Tao He authored
      Currently, we parse both the **integral literal** value and the patterns
      as `OverLit HsIntegral`.  For example:
        case 0::Int of
            0 -> putStrLn "A"
            1 -> putStrLn "B"
            _ -> putStrLn "C"
      When checking the exhaustiveness of pattern matching, we translate the
      `0` in value position as `PmOLit`, but translate the `0` and `1` in
      pattern position as `PmSLit`. The inconsistency leads to the failure of
      `eqPmLit` to detect the equality and report warning of "Pattern match is
      redundant" on pattern `0`, as reported in #14546. In this patch we
      remove the specialization of `OverLit` patterns, and keep the overloaded
      number literal in pattern as it is to maintain the consistency.  Now we
      can capture the exhaustiveness of pattern `0` and the redundancy of
      pattern `1` and `_`.
      For **string literals**, we parse the string literals as `HsString`.
      When  `OverloadedStrings` is enabled, it further be turned as `HsOverLit
      HsIsString`, whether it's type is `String` or not. For example:
        case "foo" of
            "foo" -> putStrLn "A"
            "bar" -> putStrLn "B"
            "baz" -> putStrLn "C"
      Previously, the overloaded string values are translated to `PmOLit` and
      the non-overloaded string values are translated to `PmSLit`. However the
      string patterns, both overloaded and non-overloaded, are translated to
      list of characters. The inconsistency leads to wrong warnings about
      redundant and non-exhaustive pattern matching warnings, as reported
      in #14546.
      In order to catch the redundant pattern in following case:
        case "foo" of
            ('f':_) -> putStrLn "A"
            "bar" -> putStrLn "B"
      In this patch, we translate non-overloaded string literals, both in
      value position and pattern position, as list of characters. For
      overloaded string literals, we only translate it to list of characters
      only when it's type is `stringTy`, since we know nothing about the
      `toString` methods.  But we know that if two overloaded strings are
      syntax equal, then they are equal. Then if it's type is not `stringTy`,
      we just translate it to `PmOLit`. We can still capture the
      exhaustiveness of pattern `"foo"` and the redundancy of pattern `"bar"`
      and `"baz"` in the following code:
      {-# LANGUAGE OverloadedStrings #-}
      main = do
        case "foo" of
            "foo" -> putStrLn "A"
            "bar" -> putStrLn "B"
            "baz" -> putStrLn "C"
      Test Plan: make test TEST="T14546"
      Reviewers: bgamari, simonpj
      Reviewed By: bgamari, simonpj
      Subscribers: simonpj, thomie, carter
      GHC Trac Issues: #14546
      Differential Revision: https://phabricator.haskell.org/D4571
    • Ryan Scott's avatar
      Fix a bad interaction between GADTs and COMPLETE sets · 4d800448
      Ryan Scott authored
      As observed in #14059 (starting at comment 5), the error
      messages surrounding a program involving GADTs and a `COMPLETE` set
      became worse between 8.2 and 8.4. The culprit was a new validity
      check in 8.4 which filters out `COMPLETE` set candidates if a return
      type of any conlike in the set doesn't match the type of the
      scrutinee. However, this check was too conservative, since it removed
      perfectly valid `COMPLETE` sets that contained GADT constructors,
      which quite often have return types that don't match the type of a
      To fix this, I adopted the most straightforward possible solution of
      only performing this validity check on //pattern synonym//
      constructors, not //data// constructors.
      Note that this does not fix #14059 entirely, but instead simply fixes
      a particular buglet that was discovered in that ticket.
      Test Plan: make test TEST=T14059
      Reviewers: bgamari, mpickering
      Reviewed By: mpickering
      Subscribers: rwbarton, thomie, carter
      GHC Trac Issues: #14059
      Differential Revision: https://phabricator.haskell.org/D4752
  15. 02 Jun, 2018 1 commit
    • Ben Gamari's avatar
      vectorise: Put it out of its misery · faee23bb
      Ben Gamari authored
      Poor DPH and its vectoriser have long been languishing; sadly it seems there is
      little chance that the effort will be rekindled. Every few years we discuss
      what to do with this mass of code and at least once we have agreed that it
      should be archived on a branch and removed from `master`. Here we do just that,
      eliminating heaps of dead code in the process.
      Here we drop the ParallelArrays extension, the vectoriser, and the `vector` and
      `primitive` submodules.
      Test Plan: Validate
      Reviewers: simonpj, simonmar, hvr, goldfire, alanz
      Reviewed By: simonmar
      Subscribers: goldfire, rwbarton, thomie, mpickering, carter
      Differential Revision: https://phabricator.haskell.org/D4761
  16. 21 May, 2018 1 commit
    • Simon Peyton Jones's avatar
      Remove TcType.toTcType · b7e80ae0
      Simon Peyton Jones authored
      In the olden days we insisted that only TcTyVars could appear
      in a TcType.  But now we are more accommodating; see TcType
        Note [TcTyVars and TyVars in the typechecker]
      This patch removes a function that converted a Type to a TcType.
      It didn't do anything useful except statisfy an invariant that
      we no longer have.  Now it's gone.
  17. 08 May, 2018 4 commits
  18. 05 May, 2018 1 commit
    • Tao He's avatar
      Normalize the element type of ListPat, fix #14547 · 361d23a8
      Tao He authored
      The element type of `List` maybe a type family instacen, rather than a
      trivial type.  For example in Trac #14547,
      {-# LANGUAGE TypeFamilies, OverloadedLists #-}
      class Foo f where
              type It f
              foo :: [It f] -> f
      data List a = Empty | a :! List a deriving Show
      instance Foo (List a) where
              type It (List a) = a
              foo [] = Empty
              foo (x : xs) = x :! foo xs
      Here the element type of `[]` is `It (List a)`, we should also normalize
      it as `a`.
      Test Plan: make test TEST="T14547"
      Reviewers: bgamari
      Reviewed By: bgamari
      Subscribers: thomie, carter
      GHC Trac Issues: #14547
      Differential Revision: https://phabricator.haskell.org/D4624
  19. 27 Apr, 2018 1 commit
    • Alan Zimmerman's avatar
      TTG : complete for balance of hsSyn AST · c3823cba
      Alan Zimmerman authored
      - remove PostRn/PostTc fields
      - remove the HsVect In/Out distinction for Type, Class and Instance
      - remove PlaceHolder in favour of NoExt
      - Simplify OutputableX constraint
      Updates haddock submodule
      Test Plan: ./validate
      Reviewers: goldfire, bgamari
      Subscribers: goldfire, thomie, mpickering, carter
      Differential Revision: https://phabricator.haskell.org/D4625
  20. 09 Apr, 2018 1 commit
  21. 02 Mar, 2018 2 commits
    • Ryan Scott's avatar
      Fix the coverage checker's treatment of existential tyvars · a2d03c69
      Ryan Scott authored
      Previously, the pattern-match coverage checker was far too
      eager to freshen the names of existentially quantified type
      variables, which led to incorrect sets of type constraints that
      misled GHC into thinking that certain programs that involve nested
      GADT pattern matches were non-exhaustive (when in fact they were).
      Now, we generate extra equality constraints in the ConCon case of
      the coverage algorithm to ensure that these fresh tyvars align
      with existing existential tyvars. See
      `Note [Coverage checking and existential tyvars]` for the full story.
      Test Plan: make test TEST="T11984 T14098"
      Reviewers: gkaracha, bgamari, simonpj
      Reviewed By: simonpj
      Subscribers: simonpj, rwbarton, thomie, carter
      GHC Trac Issues: #11984, #14098
      Differential Revision: https://phabricator.haskell.org/D4434
    • Tao He's avatar
      Improve exhaustive checking for guards in pattern bindings and MultiIf. · e8e9f6a7
      Tao He authored
      Previously we didn't do exhaustive checking on MultiIf expressions
      and guards in pattern bindings.
      We can construct the `LMatch` directly from GRHSs or [LHsExpr]
      (MultiIf's alts) then feed it to checkMatches, without construct the
      MatchGroup and using function `matchWrapper`.
      Signed-off-by: Tao He's avatarHE, Tao <sighingnow@gmail.com>
      Test Plan: make test TEST="T14773a T14773b"
      Reviewers: bgamari, RyanGlScott, simonpj
      Reviewed By: bgamari, simonpj
      Subscribers: rwbarton, thomie, carter
      GHC Trac Issues: #14773
      Differential Revision: https://phabricator.haskell.org/D4400
  22. 14 Dec, 2017 1 commit
    • carlostome's avatar
      Fix #14135 by validity checking matches · 16c7d9dc
      carlostome authored
      We filter the complete patterns given in a COMPLETE set to only those that
      subsume the type we are matching. Otherwise we end up introducing an ill-typed
      equation into the overlap checking, provoking a crash. This was the cause of
      Trac #14135.
      Reviewers: austin, bgamari, mpickering, gkaracha, simonpj, RyanGlScott,
      Reviewed By: bgamari
      Subscribers: carter, dfeuer, RyanGlScott, goldfire, rwbarton, thomie
      GHC Trac Issues: #14135
      Differential Revision: https://phabricator.haskell.org/D3981
  23. 21 Nov, 2017 1 commit
    • Ben Gamari's avatar
      Revert "trees that grow" work · 314bc314
      Ben Gamari authored
      As documented in #14490, the Data instances currently blow up
      compilation time by too much to stomach. Alan will continue working on
      this in a branch and we will perhaps merge to 8.2 before 8.2.1 to avoid
      having to perform painful cherry-picks in 8.2 minor releases.
      Reverts haddock submodule.
      This reverts commit 47ad6578.
      This reverts commit e3ec2e7a.
      This reverts commit 438dd1cb.
      This reverts commit 0ff152c9.
  24. 11 Nov, 2017 1 commit
  25. 08 Nov, 2017 1 commit
  26. 07 Nov, 2017 2 commits
  27. 30 Oct, 2017 1 commit
  28. 11 Oct, 2017 1 commit
    • Simon Peyton Jones's avatar
      Minor refactoring · 461c8316
      Simon Peyton Jones authored
      I'm trying to understand Check.hs.  This patch is a very
      minor refactoring.  No change in behaviour.
  29. 27 Sep, 2017 1 commit
  30. 25 Sep, 2017 1 commit
  31. 19 Sep, 2017 1 commit
    • Herbert Valerio Riedel's avatar
      compiler: introduce custom "GhcPrelude" Prelude · f63bc730
      Herbert Valerio Riedel authored
      This switches the compiler/ component to get compiled with
      -XNoImplicitPrelude and a `import GhcPrelude` is inserted in all
      This is motivated by the upcoming "Prelude" re-export of
      `Semigroup((<>))` which would cause lots of name clashes in every
      modulewhich imports also `Outputable`
      Reviewers: austin, goldfire, bgamari, alanz, simonmar
      Reviewed By: bgamari
      Subscribers: goldfire, rwbarton, thomie, mpickering, bgamari
      Differential Revision: https://phabricator.haskell.org/D3989
  32. 31 Aug, 2017 1 commit
  33. 12 Aug, 2017 1 commit
    • Ryan Scott's avatar
      Change isClosedAlgType to be TYPE-aware, and rename it to pmIsClosedType · 4f1f9868
      Ryan Scott authored
      In a267580e, I somewhat awkwardly
      inserted a special case for `TYPE` in the `EmptyCase` coverage checker.
      Instead of placing it there, @mpickering noted that `isClosedAlgType` would
      be a better fit for it. I do just that in this patch.
      I also renamed `isClosedAlgType` to `pmIsClosedType`, reflecting the fact that
      `TYPE` technically isn't an algebraic type (it's a primitive one), and that its
      behavior is pattern-match coverage checking-oriented. I also moved it to
      `Check`, which is a better home for this function than `Type`. Luckily,
      the only call sites for `isClosedAlgType` were in the pattern-match coverage
      checker anyways, so this change is simple enough.
      Test Plan: ./validate
      Reviewers: mpickering, austin, goldfire, bgamari
      Reviewed By: goldfire
      Subscribers: rwbarton, thomie, mpickering
      GHC Trac Issues: #14086
      Differential Revision: https://phabricator.haskell.org/D3830
  34. 05 Aug, 2017 1 commit
    • Ryan Scott's avatar
      Don't warn when empty casing on Type · a267580e
      Ryan Scott authored
      `Type` (a.k.a. `TYPE LiftedRep`) can be used at the type level thanks
      to `TypeInType`. However, expressions like
      f :: Type -> Int
      f x = case x of {}
      were falsely claiming that the empty case on the value of type `Type` was
      non-exhaustive. The reason is a bit silly: `TYPE` is technically not an empty
      datatype in GHC's eyes, since it's a builtin, primitive type. To convince the
      pattern coverage checker otherwise, this adds a special case for `TYPE`.
      Test Plan: make test TEST=T14086
      Reviewers: gkaracha, austin, bgamari, goldfire
      Reviewed By: goldfire
      Subscribers: goldfire, rwbarton, thomie
      GHC Trac Issues: #14086
      Differential Revision: https://phabricator.haskell.org/D3819