1. 24 Nov, 2015 1 commit
    • elaforge's avatar
      Rearrange error msgs and add section markers (Trac #11014). · c05fddde
      elaforge authored
      This puts the "Relevant bindings" section at the end.
      
      It uses a TcErrors.Report Monoid to divide messages by importance and
      then mappends them together.  This is not the most efficient way since
      there are various intermediate Reports and list appends, but it probably
      doesn't matter since error messages shouldn't get that large, and are
      usually prepended.  In practice, everything is `important` except
      `relevantBindings`, which is `supplementary`.
      
      ErrMsg's errMsgShortDoc and errMsgExtraInfo were extracted into ErrDoc,
      which has important, context, and suppelementary fields.  Each of those
      three sections is marked with a bullet character, '•' on unicode
      terminals and '*' on ascii terminals.  Since this breaks tons of tests,
      I also modified testlib.normalise_errmsg to strip out '•'s.
      
      --- Additional notes:
      
      To avoid prepending * to an empty doc, I needed to filter empty docs.
      This seemed less error-prone than trying to modify everyone who produces
      SDoc to instead produce Maybe SDoc.  So I added `Outputable.isEmpty`.
      Unfortunately it needs a DynFlags, which is kind of bogus, but otherwise
      I think I'd need another Empty case for SDoc, and then it couldn't be a
      newtype any more.
      
      ErrMsg's errMsgShortString is only used by the Show instance, which is
      in turn only used by Show HscTypes.SourceError, which is in turn only
      needed for the Exception instance.  So it's probably possible to get rid
      of errMsgShortString, but that would a be an unrelated cleanup.
      
      Fixes #11014.
      
      Test Plan: see above
      
      Reviewers: austin, simonpj, thomie, bgamari
      
      Reviewed By: thomie, bgamari
      
      Subscribers: simonpj, nomeata, thomie
      
      Differential Revision: https://phabricator.haskell.org/D1427
      
      GHC Trac Issues: #11014
      c05fddde
  2. 18 Nov, 2015 1 commit
    • msosn's avatar
      Fix inconsistent pretty-printing of type families · c61759d5
      msosn authored
      After the changes, the three functions used to print type families
      were identical, so they are refactored into one.
      
      Original RHSs of data instance declarations are recreated and
      printed in user error messages.
      
      RHSs containing representation TyCons are printed in the
      Coercion Axioms section in a typechecker dump.
      
      Add vbar to the list of SDocs exported by Outputable.
      Replace all text "|" docs with it.
      
      Fixes #10839
      
      Reviewers: goldfire, jstolarek, austin, bgamari
      
      Reviewed By: jstolarek
      
      Subscribers: jstolarek, thomie
      
      Differential Revision: https://phabricator.haskell.org/D1441
      
      GHC Trac Issues: #10839
      c61759d5
  3. 14 Nov, 2015 1 commit
    • Ben Gamari's avatar
      Fix bootstrapping with GHC 7.10.1 · 54884220
      Ben Gamari authored
      Relying on CallStack being in GLASGOW_HASKELL >= 710 breaks
      bootstrappability with 7.10.1
      
      7.10.2 added the CallStack mechanism, and GHC already relies on this
      while being built. Unfortunately, it is enabled with "GLASGOW_HASKELL
      >= 710", which also applies to GHC 7.10.1, which does not have
      CallStack, and fails building the stage-1 compiler because the symbol
      is not found.
      
      This patch makes the CPP directive more strict, requiring **more than**
      7.10 instead of **at least**.
      
      Reviewers: jstolarek, austin, bgamari
      
      Reviewed By: bgamari
      
      Subscribers: thomie
      
      Differential Revision: https://phabricator.haskell.org/D1472
      
      GHC Trac Issues: #11085
      54884220
  4. 13 Nov, 2015 1 commit
  5. 07 Nov, 2015 1 commit
    • Bartosz Nitka's avatar
      Add pprSTrace for debugging with call stacks · 80d7ce80
      Bartosz Nitka authored
      I've spent quite a bit of time giving unique labels to my `pprTrace`
      calls and then trying to intuit where the function is called from.
      Thanks to the new implicit parameter CallStack functionality I don't
      have to do that anymore.
      
      Test Plan: harbormaster
      
      Reviewers: austin, simonmar, bgamari
      
      Reviewed By: simonmar, bgamari
      
      Subscribers: thomie
      
      Differential Revision: https://phabricator.haskell.org/D1440
      80d7ce80
  6. 15 Oct, 2015 1 commit
  7. 15 Sep, 2015 1 commit
    • Sebastian Reuße's avatar
      Pretty: fix unicode arrow operators. · 14c4090e
      Sebastian Reuße authored
      As per issue #10509, the documentation gave the wrong glyphs for Unicode
      alternatives to the -< and >- arrow operators (the codepoints were
      correct, but the glyphs were not). The incorrect glyphs have also
      made it into the error output. This replaces those characters with the
      correct versions.
      
      GHC Trac Issues: #10883
      14c4090e
  8. 11 Sep, 2015 1 commit
  9. 03 Sep, 2015 1 commit
  10. 21 Aug, 2015 1 commit
    • thomie's avatar
      Refactor: delete most of the module FastTypes · 2f29ebbb
      thomie authored
      This reverses some of the work done in #1405, and goes back to the
      assumption that the bootstrap compiler understands GHC-haskell.
      
      In particular:
        * use MagicHash instead of _ILIT and _CLIT
        * pattern matching on I# if possible, instead of using iUnbox
          unnecessarily
        * use Int#/Char#/Addr# instead of the following type synonyms:
          - type FastInt   = Int#
          - type FastChar  = Char#
          - type FastPtr a = Addr#
        * inline the following functions:
          - iBox           = I#
          - cBox           = C#
          - fastChr        = chr#
          - fastOrd        = ord#
          - eqFastChar     = eqChar#
          - shiftLFastInt  = uncheckedIShiftL#
          - shiftR_FastInt = uncheckedIShiftRL#
          - shiftRLFastInt = uncheckedIShiftRL#
        * delete the following unused functions:
          - minFastInt
          - maxFastInt
          - uncheckedIShiftRA#
          - castFastPtr
          - panicDocFastInt and pprPanicFastInt
        * rename panicFastInt back to panic#
      
      These functions remain, since they actually do something:
        * iUnbox
        * bitAndFastInt
        * bitOrFastInt
      
      Test Plan: validate
      
      Reviewers: austin, bgamari
      
      Subscribers: rwbarton
      
      Differential Revision: https://phabricator.haskell.org/D1141
      
      GHC Trac Issues: #1405
      2f29ebbb
  11. 05 Aug, 2015 2 commits
  12. 03 Aug, 2015 1 commit
  13. 22 Jul, 2015 1 commit
  14. 07 Apr, 2015 1 commit
    • Simon Peyton Jones's avatar
      Reduce module qualifiers in pretty-printing · 547c5971
      Simon Peyton Jones authored
      The change is in HscTypes.mkPrintUnqualified, and suppresses the
      module qualifier on Names from ghc-prim, base, and template-haskell,
      where no ambiguity can aries.  It's somewhat arbitrary, but helps
      with things like 'Constraint' which are often not in scope, but
      occasionally show up in error messages.
      547c5971
  15. 16 Mar, 2015 1 commit
    • thomie's avatar
      Dont call unsafeGlobalDynFlags if it is not set · 5166ee94
      thomie authored
      Parsing of static and mode flags happens before any session is started,
      i.e., before the first call to 'GHC.withGhc'. Therefore, to report
      errors for invalid usage of these two types of flags, we can not call
      any function that needs DynFlags, as there are no DynFlags available yet
      (unsafeGlobalDynFlags is not set either). So we always print "on the
      commandline" as the location, which is true except for Api users, which
      is probably ok.
      
      When reporting errors for invalid usage of dynamic flags we /can/ make
      use of DynFlags, and we do so explicitly in
      DynFlags.parseDynamicFlagsFull.
      
      Before, we called unsafeGlobalDynFlags when an invalid (combination of)
      flag(s) was given on the commandline, resulting in panics (#9963). This
      regression was introduced in 1d6124de.
      
      Also rename showSDocSimple to showSDocUnsafe, to hopefully prevent this
      from happening again.
      
      Reviewed By: austin
      
      Differential Revision: https://phabricator.haskell.org/D730
      
      GHC Trac Issues: #9963
      5166ee94
  16. 09 Mar, 2015 3 commits
  17. 03 Mar, 2015 1 commit
    • thomie's avatar
      Pretty-print # on unboxed literals in core · 89458eba
      thomie authored
      Summary:
      Ticket #10104 dealt with showing the '#'s on types with unboxed fields. This
      commit pretty prints the '#'s on unboxed literals in core output.
      
      Test Plan: simplCore/should_compile/T8274
      
      Reviewers: jstolarek, simonpj, austin
      
      Reviewed By: simonpj, austin
      
      Subscribers: simonpj, thomie
      
      Differential Revision: https://phabricator.haskell.org/D678
      
      GHC Trac Issues: #8274
      89458eba
  18. 03 Dec, 2014 1 commit
  19. 04 Nov, 2014 1 commit
  20. 25 Aug, 2014 1 commit
    • Simon Peyton Jones's avatar
      Use DumpStyle rather than UserStyle for pprTrace output · 9f8754eb
      Simon Peyton Jones authored
      The main motivation is that user-style output assumes that everything has been
      tidied, not enough uniques are printed by default.
      
      The downside is that pprTrace output now has module prefixes which can be overwhelming,
      but -dsuppress-module-prefixes will suppress them.
      9f8754eb
  21. 05 Aug, 2014 1 commit
    • Edward Z. Yang's avatar
      Package keys (for linking/type equality) separated from package IDs. · 66218d15
      Edward Z. Yang authored
      This patch set makes us no longer assume that a package key is a human
      readable string, leaving Cabal free to "do whatever it wants" to allocate
      keys; we'll look up the PackageId in the database to display to the user.
      This also means we have a new level of qualifier decisions to make at the
      package level, and rewriting some Safe Haskell error reporting code to DTRT.
      
      Additionally, we adjust the build system to use a new ghc-cabal output
      Make variable PACKAGE_KEY to determine library names and other things,
      rather than concatenating PACKAGE/VERSION as before.
      
      Adds a new `-this-package-key` flag to subsume the old, erroneously named
      `-package-name` flag, and `-package-key` to select packages by package key.
      
      RFC: The md5 hashes are pretty tough on the eye, as far as the file
      system is concerned :(
      
      ToDo: safePkg01 test had its output updated, but the fix is not really right:
      the rest of the dependencies are truncated due to the fact the we're only
      grepping a single line, but ghc-pkg is wrapping its output.
      
      ToDo: In a later commit, update all submodules to stop using -package-name
      and use -this-package-key.  For now, we don't do it to avoid submodule
      explosion.
      Signed-off-by: default avatarEdward Z. Yang <ezyang@cs.stanford.edu>
      
      Test Plan: validate
      
      Reviewers: simonpj, simonmar, hvr, austin
      
      Subscribers: simonmar, relrod, carter
      
      Differential Revision: https://phabricator.haskell.org/D80
      66218d15
  22. 06 Jun, 2014 2 commits
  23. 24 Apr, 2014 1 commit
  24. 25 Feb, 2014 1 commit
  25. 10 Jan, 2014 1 commit
    • Simon Peyton Jones's avatar
      Make showSDoc and friends respect -dppr-cols · 08a3536e
      Simon Peyton Jones authored
      Previously they just used a fixed width of 100, ignoring
      -dppr-cols.  I think this dates back to a time when
      the flag didn't exist, or wasn't conveniently available.
      
      Thanks to Andrew Gibiansky for pointing this out.
      08a3536e
  26. 09 Jan, 2014 1 commit
    • Simon Peyton Jones's avatar
      Re-work the naming story for the GHCi prompt (Trac #8649) · 73c08ab1
      Simon Peyton Jones authored
      The basic idea here is simple, and described in Note [The interactive package]
      in HscTypes, which starts thus:
      
          Note [The interactive package]
          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          Type and class declarations at the command prompt are treated as if
          they were defined in modules
             interactive:Ghci1
             interactive:Ghci2
             ...etc...
          with each bunch of declarations using a new module, all sharing a
          common package 'interactive' (see Module.interactivePackageId, and
          PrelNames.mkInteractiveModule).
      
          This scheme deals well with shadowing.  For example:
      
             ghci> data T = A
             ghci> data T = B
             ghci> :i A
             data Ghci1.T = A  -- Defined at <interactive>:2:10
      
          Here we must display info about constructor A, but its type T has been
          shadowed by the second declaration.  But it has a respectable
          qualified name (Ghci1.T), and its source location says where it was
          defined.
      
          So the main invariant continues to hold, that in any session an original
          name M.T only refers to oe unique thing.  (In a previous iteration both
          the T's above were called :Interactive.T, albeit with different uniques,
          which gave rise to all sorts of trouble.)
      
      This scheme deals nicely with the original problem.  It allows us to
      eliminate a couple of grotseque hacks
        - Note [Outputable Orig RdrName] in HscTypes
        - Note [interactive name cache] in IfaceEnv
      (both these comments have gone, because the hacks they describe are no
      longer necessary). I was also able to simplify Outputable.QueryQualifyName,
      so that it takes a Module/OccName as args rather than a Name.
      
      However, matters are never simple, and this change took me an
      unreasonably long time to get right.  There are some details in
      Note [The interactive package] in HscTypes.
      73c08ab1
  27. 13 Sep, 2013 1 commit
  28. 27 Jun, 2013 1 commit
    • Peter Wortmann's avatar
      Use SDoc for all LLVM pretty-printing · 99d39221
      Peter Wortmann authored
      This patch reworks some parts of the LLVM pretty-printing code that were
      still using Show and String. Now we should be using SDoc and Outputable
      throughout. Note that many get*Name functions become pp*Name
      here as a side-effect.
      99d39221
  29. 24 Jun, 2013 1 commit
    • Simon Peyton Jones's avatar
      Make sure that Pretty.text is inlined in stage 0, · d2c3630d
      Simon Peyton Jones authored
      so that RULE text/str gets a chance to fire (Trac #7995).
      
      And make sure that Outputable.text is inlined, so that the underlying
      Pretty.text rule can fire.
      
      The thing is that literal strings only turn into unpackCString#
      in phase 1.
      d2c3630d
  30. 09 Mar, 2013 1 commit
  31. 24 Feb, 2013 1 commit
  32. 14 Feb, 2013 1 commit
    • Simon Peyton Jones's avatar
      Add OverloadedLists, allowing list syntax to be overloaded · 3234a4ad
      Simon Peyton Jones authored
      This work was all done by
         Achim Krause <achim.t.krause@gmail.com>
         George Giorgidze <giorgidze@gmail.com>
         Weijers Jeroen <jeroen.weijers@uni-tuebingen.de>
      
      It allows list syntax, such as [a,b], [a..b] and so on, to be
      overloaded so that it works for a variety of types.
      
      The design is described here:
          http://hackage.haskell.org/trac/ghc/wiki/OverloadedLists
      
      Eg. you can use it for maps, so that
              [(1,"foo"), (4,"bar")] :: Map Int String
      
      The main changes
       * The ExplicitList constructor of HsExpr gets witness field
       * Ditto ArithSeq constructor
       * Ditto the ListPat constructor of HsPat
      
      Everything else flows from this.
      3234a4ad
  33. 29 Jan, 2013 1 commit
  34. 14 Dec, 2012 2 commits
  35. 04 Dec, 2012 1 commit