Skip to content
Snippets Groups Projects
  1. Sep 13, 2022
    • sheaf's avatar
      Diagnostic codes: acccept test changes · 362cca13
      sheaf authored and Marge Bot's avatar Marge Bot committed
      The testsuite output now contains diagnostic codes, so many tests need
      to be updated at once.
      We decided it was best to keep the diagnostic codes in the testsuite
      output, so that contributors don't inadvertently make changes to the
      diagnostic codes.
      362cca13
  2. Aug 19, 2022
  3. May 29, 2022
  4. Dec 03, 2021
    • Matthew Pickering's avatar
      Revert "Data.List specialization to []" · 81082cf4
      Matthew Pickering authored and Marge Bot's avatar Marge Bot committed
      This reverts commit bddecda1.
      
      This implements the first step in the plan formulated in #20025 to
      improve the communication and migration strategy for the proposed
      changes to Data.List.
      
      Requires changing the haddock submodule to update the test output.
      81082cf4
  5. Nov 20, 2021
    • sheaf's avatar
      Include "not more specific" info in overlap msg · 742d8b60
      sheaf authored and Marge Bot's avatar Marge Bot committed
        When instances overlap, we now include additional information
        about why we weren't able to select an instance: perhaps
        one instance overlapped another but was not strictly more specific,
        so we aren't able to directly choose it.
      
      Fixes #20542
      742d8b60
  6. Oct 06, 2021
    • sheaf's avatar
      Improve overlap error for polykinded constraints · a466b024
      sheaf authored and Marge Bot's avatar Marge Bot committed
      There were two problems around `mkDictErr`:
      
        1. An outdated call to `flattenTys` meant that we missed out on some
           instances. As we no longer flatten type-family applications,
           the logic is obsolete and can be removed.
      
        2. We reported "out of scope" errors in a poly-kinded situation
           because `BoxedRep` and `Lifted` were considered out of scope.
           We fix this by using `pretendNameIsInScope`.
      
      fixes #20465
      a466b024
  7. Jun 29, 2021
  8. Apr 01, 2021
  9. Jan 27, 2021
    • Ben Gamari's avatar
      Add instances for GHC.Tuple.Solo · 5d6009a8
      Ben Gamari authored and Marge Bot's avatar Marge Bot committed
      The `Applicative` instance is the most important one (for
      array/vector/sequence indexing purposes), but it deserves
      all the usual ones.
      
      T12545 does silly 1% wibbles both ways, it seems, maybe depending
      on architecture.
      
      Metric Increase:
          T12545
      
      Metric Decrease:
          T12545
      5d6009a8
  10. Jun 17, 2020
    • Sylvain Henry's avatar
      Update testsuite · f817d816
      Sylvain Henry authored
      * support detection of slow ghc-bignum backend (to replace the detection
        of integer-simple use). There are still some test cases that the
        native backend doesn't handle efficiently enough.
      
      * remove tests for GMP only functions that have been removed from
        ghc-bignum
      
      * fix test results showing dependent packages (e.g. integer-gmp) or
        showing suggested instances
      
      * fix test using Integer/Natural API or showing internal names
      f817d816
  11. Jun 05, 2020
    • Simon Peyton Jones's avatar
      Simple subsumption · 2b792fac
      Simon Peyton Jones authored
      This patch simplifies GHC to use simple subsumption.
        Ticket #17775
      
      Implements GHC proposal #287
         https://github.com/ghc-proposals/ghc-proposals/blob/master/
         proposals/0287-simplify-subsumption.rst
      
      All the motivation is described there; I will not repeat it here.
      The implementation payload:
       * tcSubType and friends become noticably simpler, because it no
         longer uses eta-expansion when checking subsumption.
       * No deeplyInstantiate or deeplySkolemise
      
      That in turn means that some tests fail, by design; they can all
      be fixed by eta expansion.  There is a list of such changes below.
      
      Implementing the patch led me into a variety of sticky corners, so
      the patch includes several othe changes, some quite significant:
      
      * I made String wired-in, so that
          "foo" :: String   rather than
          "foo" :: [Char]
        This improves error messages, and fixes #15679
      
      * The pattern match checker relies on knowing about in-scope equality
        constraints, andd adds them to the desugarer's environment using
        addTyCsDs.  But the co_fn in a FunBind was missed, and for some reason
        simple-subsumption ends up with dictionaries there. So I added a
        call to addTyCsDs.  This is really part of #18049.
      
      * I moved the ic_telescope field out of Implication and into
        ForAllSkol instead.  This is a nice win; just expresses the code
        much better.
      
      * There was a bug in GHC.Tc.TyCl.Instance.tcDataFamInstHeader.
        We called checkDataKindSig inside tc_kind_sig, /before/
        solveEqualities and zonking.  Obviously wrong, easily fixed.
      
      * solveLocalEqualitiesX: there was a whole mess in here, around
        failing fast enough.  I discovered a bad latent bug where we
        could successfully kind-check a type signature, and use it,
        but have unsolved constraints that could fill in coercion
        holes in that signature --  aargh.
      
        It's all explained in Note [Failure in local type signatures]
        in GHC.Tc.Solver. Much better now.
      
      * I fixed a serious bug in anonymous type holes. IN
          f :: Int -> (forall a. a -> _) -> Int
        that "_" should be a unification variable at the /outer/
        level; it cannot be instantiated to 'a'.  This was plain
        wrong.  New fields mode_lvl and mode_holes in TcTyMode,
        and auxiliary data type GHC.Tc.Gen.HsType.HoleMode.
      
        This fixes #16292, but makes no progress towards the more
        ambitious #16082
      
      * I got sucked into an enormous refactoring of the reporting of
        equality errors in GHC.Tc.Errors, especially in
            mkEqErr1
            mkTyVarEqErr
            misMatchMsg
            misMatchMsgOrCND
        In particular, the very tricky mkExpectedActualMsg function
        is gone.
      
        It took me a full day.  But the result is far easier to understand.
        (Still not easy!)  This led to various minor improvements in error
        output, and an enormous number of test-case error wibbles.
      
        One particular point: for occurs-check errors I now just say
           Can't match 'a' against '[a]'
        rather than using the intimidating language of "occurs check".
      
      * Pretty-printing AbsBinds
      
      Tests review
      
      * Eta expansions
         T11305: one eta expansion
         T12082: one eta expansion (undefined)
         T13585a: one eta expansion
         T3102:  one eta expansion
         T3692:  two eta expansions (tricky)
         T2239:  two eta expansions
         T16473: one eta
         determ004: two eta expansions (undefined)
         annfail06: two eta (undefined)
         T17923: four eta expansions (a strange program indeed!)
         tcrun035: one eta expansion
      
      * Ambiguity check at higher rank.  Now that we have simple
        subsumption, a type like
           f :: (forall a. Eq a => Int) -> Int
        is no longer ambiguous, because we could write
           g :: (forall a. Eq a => Int) -> Int
           g = f
        and it'd typecheck just fine.  But f's type is a bit
        suspicious, and we might want to consider making the
        ambiguity check do a check on each sub-term.  Meanwhile,
        these tests are accepted, whereas they were previously
        rejected as ambiguous:
           T7220a
           T15438
           T10503
           T9222
      
      * Some more interesting error message wibbles
         T13381: Fine: one error (Int ~ Exp Int)
                 rather than two (Int ~ Exp Int, Exp Int ~ Int)
         T9834:  Small change in error (improvement)
         T10619: Improved
         T2414:  Small change, due to order of unification, fine
         T2534:  A very simple case in which a change of unification order
                 means we get tow unsolved constraints instead of one
         tc211: bizarre impredicative tests; just accept this for now
      
      Updates Cabal and haddock submodules.
      
      Metric Increase:
        T12150
        T12234
        T5837
        haddock.base
      Metric Decrease:
        haddock.compiler
        haddock.Cabal
        haddock.base
      
      Merge note: This appears to break the
      `UnliftedNewtypesDifficultUnification` test. It has been marked as
      broken in the interest of merging.
      
      (cherry picked from commit 66b7b195)
      2b792fac
  12. Feb 08, 2020
  13. Jun 15, 2018
    • Sylvain Henry's avatar
      Built-in Natural literals in Core · fe770c21
      Sylvain Henry authored
      Add support for built-in Natural literals in Core.
      
      - Replace MachInt,MachWord, LitInteger, etc. with a single LitNumber
        constructor with a LitNumType field
      - Support built-in Natural literals
      - Add desugar warning for negative literals
      - Move Maybe(..) from GHC.Base to GHC.Maybe for module dependency
        reasons
      
      This patch introduces only a few rules for Natural literals (compared
      to Integer's rules). Factorization of the built-in rules for numeric
      literals will be done in another patch as this one is already big to
      review.
      
      Test Plan:
        validate
        test build with integer-simple
      
      Reviewers: hvr, bgamari, goldfire, Bodigrim, simonmar
      
      Reviewed By: bgamari
      
      Subscribers: phadej, simonpj, RyanGlScott, carter, hsyl20, rwbarton,
      thomie
      
      GHC Trac Issues: #14170, #14465
      
      Differential Revision: https://phabricator.haskell.org/D4212
      fe770c21
  14. Dec 01, 2017
    • David Feuer's avatar
      Cache TypeRep kinds aggressively · bc761ad9
      David Feuer authored
      Cache `TypeRep k` in each `TrApp` or `TrTyCon` constructor of
      `TypeRep (a :: k)`. This makes `typeRepKind` cheap.
      
      With this change, we won't need any special effort to deserialize
      typereps efficiently. The downside, of course, is that we make
      `TypeRep`s slightly larger.
      
      Reviewers: austin, hvr, bgamari, simonpj
      
      Reviewed By: bgamari, simonpj
      
      Subscribers: carter, simonpj, rwbarton, thomie
      
      GHC Trac Issues: #14254
      
      Differential Revision: https://phabricator.haskell.org/D4085
      bc761ad9
  15. Sep 04, 2017
  16. Feb 12, 2016
  17. Feb 09, 2016
    • Ben Gamari's avatar
      TcErrors: Fix plural form of "instance" error · c8702e30
      Ben Gamari authored
      Previously "types" was inappropriately made plural instead of
      "instance",
      
          instance Eq Ordering -- Defined in ‘GHC.Classes’
          ...plus 24 others
          ...plus 13 instance involving out-of-scope typess
      c8702e30
  18. Feb 06, 2016
    • Eric Seidel's avatar
      Add a derived `Show SrcLoc` instance · 38af3d1d
      Eric Seidel authored
      Test Plan:
      ```
      ghci> import GHC.Stack
      ghci> SrcLoc "f" "b" "c" 1 2 3 4
      SrcLoc {srcLocPackage = "f", srcLocModule = "b", srcLocFile = "c",
      srcLocStartLine = 1, srcLocStartCol = 2, srcLocEndLine = 3,
      srcLocEndCol = 4}
      ```
      
      Reviewers: austin, hvr, bgamari
      
      Reviewed By: bgamari
      
      Subscribers: thomie
      
      Projects: #ghc
      
      Differential Revision: https://phabricator.haskell.org/D1886
      
      GHC Trac Issues: #11510
      38af3d1d
  19. Jan 27, 2016
    • Richard Eisenberg's avatar
      Refactor the typechecker to use ExpTypes. · 00cbbab3
      Richard Eisenberg authored
      The idea here is described in [wiki:Typechecker]. Briefly,
      this refactor keeps solid track of "synthesis" mode vs
      "checking" in GHC's bidirectional type-checking algorithm.
      When in synthesis mode, the expected type is just an IORef
      to write to.
      
      In addition, this patch does a significant reworking of
      RebindableSyntax, allowing much more freedom in the types
      of the rebindable operators. For example, we can now have
      `negate :: Int -> Bool` and
      `(>>=) :: m a -> (forall x. a x -> m b) -> m b`. The magic
      is in tcSyntaxOp.
      
      This addresses tickets #11397, #11452, and #11458.
      
      Tests:
        typecheck/should_compile/{RebindHR,RebindNegate,T11397,T11458}
        th/T11452
      00cbbab3
  20. Dec 15, 2015
    • Ben Gamari's avatar
      Narrow scope of special-case for unqualified printing of names in core libraries · e2c91738
      Ben Gamari authored and Ben Gamari's avatar Ben Gamari committed
      Commit 547c5971 modifies the
      pretty-printer to render names from a set of core packages (`base`,
      `ghc-prim`, `template-haskell`) as unqualified. The idea here was that
      many of these names typically are not in scope but are well-known by the
      user and therefore qualification merely introduces noise.
      
      This, however, is a very large hammer and potentially breaks any
      consumer who relies on parsing GHC output (hence #11208). This commit
      partially reverts this change, now only printing `Constraint` (which
      appears quite often in errors) as unqualified.
      
      Fixes #11208.
      
      Updates tests in `array` submodule.
      
      Test Plan: validate
      
      Reviewers: hvr, thomie, austin
      
      Subscribers: thomie
      
      Differential Revision: https://phabricator.haskell.org/D1619
      
      GHC Trac Issues: #11208
      e2c91738
  21. Oct 30, 2015
    • Ben Gamari's avatar
      Generate Typeable info at definition sites · 91c6b1f5
      Ben Gamari authored and Ben Gamari's avatar Ben Gamari committed
      This is the second attempt at merging D757.
      
      This patch implements the idea floated in Trac #9858, namely that we
      should generate type-representation information at the data type
      declaration site, rather than when solving a Typeable constraint.
      
      However, this turned out quite a bit harder than I expected. I still
      think it's the right thing to do, and it's done now, but it was quite
      a struggle.
      
      See particularly
      
       * Note [Grand plan for Typeable] in TcTypeable (which is a new module)
       * Note [The overall promotion story] in DataCon (clarifies existing
      stuff)
      
      The most painful bit was that to generate Typeable instances (ie
      TyConRepName bindings) for every TyCon is tricky for types in ghc-prim
      etc:
      
       * We need to have enough data types around to *define* a TyCon
       * Many of these types are wired-in
      
      Also, to minimise the code generated for each data type, I wanted to
      generate pure data, not CAFs with unpackCString# stuff floating about.
      
      Performance
      ~~~~~~~~~~~
      Three perf/compiler tests start to allocate quite a bit more. This isn't
      surprising, because they all allocate zillions of data types, with
      practically no other code, esp. T1969
      
       * T1969:    GHC allocates 19% more
       * T4801:    GHC allocates 13% more
       * T5321FD:  GHC allocates 13% more
       * T9675:    GHC allocates 11% more
       * T783:     GHC allocates 11% more
       * T5642:    GHC allocates 10% more
      
      I'm treating this as acceptable. The payoff comes in Typeable-heavy
      code.
      
      Remaining to do
      ~~~~~~~~~~~~~~~
      
       * I think that "TyCon" and "Module" are over-generic names to use for
         the runtime type representations used in GHC.Typeable. Better might
      be
         "TrTyCon" and "TrModule". But I have not yet done this
      
       * Add more info the the "TyCon" e.g. source location where it was
         defined
      
       * Use the new "Module" type to help with Trac Trac #10068
      
       * It would be possible to generate TyConRepName (ie Typeable
         instances) selectively rather than all the time. We'd need to persist
         the information in interface files. Lacking a motivating reason I
      have
         not done this, but it would not be difficult.
      
      Refactoring
      ~~~~~~~~~~~
      As is so often the case, I ended up refactoring more than I intended.
      In particular
      
       * In TyCon, a type *family* (whether type or data) is repesented by a
         FamilyTyCon
           * a algebraic data type (including data/newtype instances) is
             represented by AlgTyCon This wasn't true before; a data family
             was represented as an AlgTyCon. There are some corresponding
             changes in IfaceSyn.
      
           * Also get rid of the (unhelpfully named) tyConParent.
      
       * In TyCon define 'Promoted', isomorphic to Maybe, used when things are
         optionally promoted; and use it elsewhere in GHC.
      
       * Cleanup handling of knownKeyNames
      
       * Each TyCon, including promoted TyCons, contains its TyConRepName, if
         it has one. This is, in effect, the name of its Typeable instance.
      
      Updates haddock submodule
      
      Test Plan: Let Harbormaster validate
      
      Reviewers: austin, hvr, goldfire
      
      Subscribers: goldfire, thomie
      
      Differential Revision: https://phabricator.haskell.org/D1404
      
      GHC Trac Issues: #9858
      91c6b1f5
  22. Oct 29, 2015
    • Ben Gamari's avatar
      Revert "Generate Typeable info at definition sites" · bbaf76f9
      Ben Gamari authored
      This reverts commit bef2f03e.
      
      This merge was botched
      
      Also reverts haddock submodule.
      bbaf76f9
    • Ben Gamari's avatar
      Generate Typeable info at definition sites · bef2f03e
      Ben Gamari authored
      This patch implements the idea floated in Trac #9858, namely that we
      should generate type-representation information at the data type
      declaration site, rather than when solving a Typeable constraint.
      
      However, this turned out quite a bit harder than I expected. I still
      think it's the right thing to do, and it's done now, but it was quite
      a struggle.
      
      See particularly
      
       * Note [Grand plan for Typeable] in TcTypeable (which is a new module)
       * Note [The overall promotion story] in DataCon (clarifies existing stuff)
      
      The most painful bit was that to generate Typeable instances (ie
      TyConRepName bindings) for every TyCon is tricky for types in ghc-prim
      etc:
      
       * We need to have enough data types around to *define* a TyCon
       * Many of these types are wired-in
      
      Also, to minimise the code generated for each data type, I wanted to
      generate pure data, not CAFs with unpackCString# stuff floating about.
      
      Performance
      ~~~~~~~~~~~
      Three perf/compiler tests start to allocate quite a bit more. This isn't
      surprising, because they all allocate zillions of data types, with
      practically no other code, esp. T1969
      
       * T3294:   GHC allocates 110% more (filed #11030 to track this)
       * T1969:   GHC allocates 30% more
       * T4801:   GHC allocates 14% more
       * T5321FD: GHC allocates 13% more
       * T783:    GHC allocates 12% more
       * T9675:   GHC allocates 12% more
       * T5642:   GHC allocates 10% more
       * T9961:   GHC allocates 6% more
      
       * T9203:   Program allocates 54% less
      
      I'm treating this as acceptable. The payoff comes in Typeable-heavy
      code.
      
      Remaining to do
      ~~~~~~~~~~~~~~~
      
       * I think that "TyCon" and "Module" are over-generic names to use for
         the runtime type representations used in GHC.Typeable. Better might be
         "TrTyCon" and "TrModule". But I have not yet done this
      
       * Add more info the the "TyCon" e.g. source location where it was
         defined
      
       * Use the new "Module" type to help with Trac Trac #10068
      
       * It would be possible to generate TyConRepName (ie Typeable
         instances) selectively rather than all the time. We'd need to persist
         the information in interface files. Lacking a motivating reason I have
         not done this, but it would not be difficult.
      
      Refactoring
      ~~~~~~~~~~~
      As is so often the case, I ended up refactoring more than I intended.
      In particular
      
       * In TyCon, a type *family* (whether type or data) is repesented by a
         FamilyTyCon
           * a algebraic data type (including data/newtype instances) is
             represented by AlgTyCon This wasn't true before; a data family
             was represented as an AlgTyCon. There are some corresponding
             changes in IfaceSyn.
      
           * Also get rid of the (unhelpfully named) tyConParent.
      
       * In TyCon define 'Promoted', isomorphic to Maybe, used when things are
         optionally promoted; and use it elsewhere in GHC.
      
       * Cleanup handling of knownKeyNames
      
       * Each TyCon, including promoted TyCons, contains its TyConRepName, if
         it has one. This is, in effect, the name of its Typeable instance.
      
      Requires update of the haddock submodule.
      
      Differential Revision: https://phabricator.haskell.org/D757
      bef2f03e
  23. Oct 08, 2015
  24. Sep 03, 2015
  25. Sep 02, 2015
  26. Apr 07, 2015
  27. Dec 19, 2014
  28. Nov 19, 2014
  29. Aug 28, 2014
  30. May 19, 2014
  31. Apr 20, 2014
  32. Feb 25, 2014
  33. Sep 12, 2013
  34. Feb 24, 2013
  35. Feb 14, 2013
Loading