1. 02 Oct, 2020 1 commit
  2. 01 Oct, 2020 1 commit
  3. 12 Aug, 2020 1 commit
    • Sylvain Henry's avatar
      DynFlags: disentangle Outputable · accbc242
      Sylvain Henry authored
      - put panic related functions into GHC.Utils.Panic
      - put trace related functions using DynFlags in GHC.Driver.Ppr
      
      One step closer making Outputable fully independent of DynFlags.
      
      Bump haddock submodule
      accbc242
  4. 30 Apr, 2020 1 commit
  5. 26 Apr, 2020 1 commit
  6. 18 Apr, 2020 1 commit
    • Sylvain Henry's avatar
      Modules (#13009) · 15312bbb
      Sylvain Henry authored
      * SysTools
      * Parser
      * GHC.Builtin
      * GHC.Iface.Recomp
      * Settings
      
      Update Haddock submodule
      
      Metric Decrease:
          Naperian
          parsing001
      15312bbb
  7. 07 Apr, 2020 1 commit
  8. 29 Mar, 2020 1 commit
  9. 17 Mar, 2020 1 commit
  10. 24 Feb, 2020 1 commit
    • Vladislav Zavialov's avatar
      Remove Ord SrcLoc, Ord SrcSpan · 26e8fff3
      Vladislav Zavialov authored
      Before this patch, GHC relied on Ord SrcSpan to identify source elements, by
      using SrcSpan as Map keys:
      
      	blackList :: Map SrcSpan ()      -- compiler/GHC/HsToCore/Coverage.hs
      	instanceMap :: Map SrcSpan Name  -- compiler/GHC/HsToCore/Docs.hs
      
      Firstly, this design is not valid in presence of UnhelpfulSpan, as it
      distinguishes between  UnhelpfulSpan "X"  and  UnhelpfulSpan "Y", but those
      strings are messages for the user, unfit to serve as identifiers for source
      elements.
      
      Secondly, this design made it hard to extend SrcSpan with additional data.
      Recall that the definition of SrcSpan is:
      
      	data SrcSpan =
      	    RealSrcSpan !RealSrcSpan
      	  | UnhelpfulSpan !FastString
      
      Say we want to extend the RealSrcSpan constructor with additional information:
      
      	data SrcSpan =
      	    RealSrcSpan !RealSrcSpan !AdditionalInformation
      	  | UnhelpfulSpan !FastString
      
      	getAdditionalInformation :: SrcSpan -> AdditionalInformation
      	getAdditionalInformation (RealSrcSpan _ a) = a
      
      Now, in order for  Map SrcSpan  to keep working correctly, we must *ignore* additional
      information when comparing SrcSpan values:
      
      	instance Ord SrcSpan where
      	  compare (RealSrcSpan r1 _) (RealSrcSpan r2 _) = compare r1 r2
      	  ...
      
      However, this would violate an important law:
      
      	a == b  therefore  f a == f b
      
      Ignoring  AdditionalInformation  in comparisons would mean that with
      f=getAdditionalInformation, the law above does not hold.
      
      A more robust design is to avoid  Ord SrcSpan  altogether, which is what this patch implements.
      The mappings are changed to use RealSrcSpan instead:
      
      	blackList :: Set RealSrcSpan         -- compiler/GHC/HsToCore/Coverage.hs
      	instanceMap :: Map RealSrcSpan Name  -- compiler/GHC/HsToCore/Docs.hs
      
      All SrcSpan comparisons are now done with explicit comparison strategies:
      
      	SrcLoc.leftmost_smallest
      	SrcLoc.leftmost_largest
      	SrcLoc.rightmost_smallest
      
      These strategies are not subject to the law mentioned above and can easily
      discard both the string stored in  UnhelpfulSpan  and  AdditionalInformation.
      
      Updates haddock submodule.
      26e8fff3
  11. 22 Feb, 2020 1 commit
  12. 21 Feb, 2020 2 commits
  13. 08 Jan, 2020 1 commit
  14. 30 Nov, 2019 1 commit
  15. 30 Oct, 2019 1 commit
    • Vladislav Zavialov's avatar
      Whitespace forward compatibility for proposal #229 · 3e7569bc
      Vladislav Zavialov authored
      GHC Proposal #229 changes the lexical rules of Haskell, which may
      require slight whitespace adjustments in certain cases.
      
      This patch changes formatting in a few places in GHC and its testsuite
      in a way that enables it to compile under the proposed rules.
      3e7569bc
  16. 28 Oct, 2019 1 commit
    • Sebastian Graf's avatar
      Use FlexibleInstances for `Outputable (* p)` instead of match-all instances... · e951f219
      Sebastian Graf authored
      Use FlexibleInstances for `Outputable (* p)` instead of match-all instances with equality constraints
      
      In #17304, Richard and Simon dicovered that using `-XFlexibleInstances`
      for `Outputable` instances of AST data types means users can provide orphan
      `Outputable` instances for passes other than `GhcPass`.
      
      Type inference doesn't currently to suffer, and Richard gave an example
      in #17304 that shows how rare a case would be where the slightly worse
      type inference would matter.
      
      So I went ahead with the refactoring, attempting to fix #17304.
      e951f219
  17. 20 Sep, 2019 1 commit
  18. 09 Jul, 2019 1 commit
    • Ryan Scott's avatar
      Use an empty data type in TTG extension constructors (#15247) · 6a03d77b
      Ryan Scott authored
      To avoid having to `panic` any time a TTG extension constructor is
      consumed, this MR introduces an uninhabited 'NoExtCon' type and uses
      that in every extension constructor's type family instance where it
      is appropriate. This also introduces a 'noExtCon' function which
      eliminates a 'NoExtCon', much like 'Data.Void.absurd' eliminates
      a 'Void'.
      
      I also renamed the existing `NoExt` type to `NoExtField` to better
      distinguish it from `NoExtCon`. Unsurprisingly, there is a lot of
      code churn resulting from this.
      
      Bumps the Haddock submodule. Fixes #15247.
      6a03d77b
  19. 16 Mar, 2019 1 commit
    • Simon Peyton Jones's avatar
      Improve error recovery in the typechecker · 4927117c
      Simon Peyton Jones authored
      Issue #16418 showed that we were carrying on too eagerly after a bogus
      type signature was identified (a bad telescope in fact), leading to a
      subsequent crash.
      
      This led me in to a maze of twisty little passages in the typechecker's
      error recovery, and I ended up doing some refactoring in TcRnMonad.
      Some specfifics
      
      * TcRnMonad.try_m is now called attemptM.
      
      * I switched the order of the result pair in tryTc,
        to make it consistent with other similar functions.
      
      * The actual exception used in the Tc monad is irrelevant so,
        to avoid polluting type signatures, I made tcTryM, a simple
        wrapper around tryM, and used it.
      
      The more important changes are in
      
      * TcSimplify.captureTopConstraints, where we should have been calling
        simplifyTop rather than reportUnsolved, so that levity defaulting
        takes place properly.
      
      * TcUnify.emitResidualTvConstraint, where we need to set the correct
        status for a new implication constraint.  (Previously we ended up
        with an Insoluble constraint wrapped in an Unsolved implication,
        which meant that insolubleWC gave the wrong answer.
      4927117c
  20. 15 Mar, 2019 1 commit
  21. 08 Mar, 2019 1 commit
  22. 18 Feb, 2019 1 commit
    • Alec Theriault's avatar
      Uphold AvailTC Invariant for associated data fams · 2a431640
      Alec Theriault authored
      The AvailTC was not be upheld for explicit export module
      export lists when the module contains associated data families.
      
          module A (module A) where
          class    C a  where { data T a }
          instance C () where { data T () = D }
      
      Used to (incorrectly) report avails as `[C{C, T;}, T{D;}]`. Note that
      although `T` is exported, the avail where it is the parent does _not_
      list it as its first element. This avail is now correctly listed as
      `[C{C, T;}, T{T, D;}]`.
      
      This was induces a [crash in Haddock][0].
      
      See #16077.
      
      [0]: https://github.com/haskell/haddock/issues/979
      2a431640
  23. 24 Nov, 2018 1 commit
  24. 22 Nov, 2018 1 commit
  25. 17 Nov, 2018 1 commit
    • Chris Smith's avatar
      Fix trac #15702, as a followon to fix for #13704. · 0e7790ab
      Chris Smith authored
      Summary:
      The effect of this change is that -main-is changes the default
      export list for the main module, but does not apply the same
      change to non-main modules.  This fixes some cases where -main-is
      was used to wrap a module that expected that default behavior
      (exporting `main`, even when that wasn't the main entry point
      name).
      
      Reviewers: mpickering, monoidal, bgamari
      
      Subscribers: rwbarton, carter
      
      GHC Trac Issues: #13704, #15702
      
      Differential Revision: https://phabricator.haskell.org/D5322
      0e7790ab
  26. 02 Oct, 2018 1 commit
    • chessai's avatar
      resolve T13704 · abfb91fb
      chessai authored
      Summary: allow -main-is to change export list for default module
      header, allowing one to change the entry point to one's program.
      
      Test Plan: ./validate
      
      Reviewers: bgamari, nomeata, mpickering
      
      Reviewed By: mpickering
      
      Subscribers: mpickering, rwbarton, carter
      
      GHC Trac Issues: #13704
      
      Differential Revision: https://phabricator.haskell.org/D5189
      abfb91fb
  27. 17 Jun, 2018 1 commit
  28. 27 Apr, 2018 1 commit
    • Alan Zimmerman's avatar
      TTG : complete for balance of hsSyn AST · c3823cba
      Alan Zimmerman authored
      Summary:
      - 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
      c3823cba
  29. 25 Mar, 2018 1 commit
  30. 28 Nov, 2017 1 commit
  31. 22 Nov, 2017 1 commit
    • Evan Rutledge Borden's avatar
      Add warn-missing-export-lists · 63e4ac37
      Evan Rutledge Borden authored
      Many industrial users have aligned around the idea that implicit exports
      are an anti-pattern. They lead to namespace pollution and byzantine
      naming schemes. They also prevent GHC's dead code analysis and create
      more obstacles to optimization. This warning allows teams/projects to
      warn on or enforce via -Werror explicit export lists.
      
      This warning also serves as a complement to warn-missing-import-lists.
      
      This was originally discussed here:
      https://github.com/ghc-proposals/ghc-proposals/pull/93
      
      Test Plan: Three new minimal tests have been added to the type checker.
      
      Reviewers: bgamari
      
      Reviewed By: bgamari
      
      Subscribers: rwbarton, thomie
      
      Differential Revision: https://phabricator.haskell.org/D4197
      63e4ac37
  32. 11 Oct, 2017 1 commit
    • Simon Peyton Jones's avatar
      Tidy up some convoluted "child/parent" code · 7720c293
      Simon Peyton Jones authored
      In investigating something else (Trac #14307) I encountered the
      wonders of TcRnExports.lookupChildrenExport, and the data
      type ChildLookupResult.
      
      I managed to remove the NameErr constructor from ChildLookupResult,
      and simplify the code significantly at the same time.
      
      This is just refactoring; no change in behaviour.
      7720c293
  33. 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
      modules.
      
      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
      f63bc730
  34. 15 Sep, 2017 1 commit
    • Alan Zimmerman's avatar
      Renamer now preserves location for IEThingWith list items · 9498c50e
      Alan Zimmerman authored
      Prior to this, in the RenamedSource for
      
          module Renaming.RenameInExportedType
            (
            MyType (NT)
            ) where
      
          data MyType = MT Int | NT
      
      The (NT) was given the location of MyType earlier on the line in the
      export list.
      
      Also the location was discarded for any field labels, and replaced with
      a `noLoc`.
      
      Test Plan: ./validate
      
      Reviewers: bgamari, austin
      
      Reviewed By: bgamari
      
      Subscribers: rwbarton, thomie
      
      GHC Trac Issues: #14189
      
      Differential Revision: https://phabricator.haskell.org/D3968
      9498c50e
  35. 05 Sep, 2017 1 commit
  36. 11 Jul, 2017 1 commit
    • Ömer Sinan Ağacan's avatar
      Mention which -Werror promoted a warning to an error · 4befb415
      Ömer Sinan Ağacan authored
      Previously -Werror or -Werror=flag printed warnings as usual and then
      printed
      these two lines:
      
          <no location info>: error:
          Failing due to -Werror.
      
      This is not ideal: first, it's not clear which flag made one of the
      warnings an
      error. Second, warning messages are not modified in any way, so there's
      no way
      to know which warnings caused this error.
      
      With this patch we (1) promote warning messages to error messages if a
      relevant
      -Werror is enabled (2) mention which -Werror is used during this
      promotion.
      
      Previously:
      
          [1 of 1] Compiling Main             ( test.hs, test.o )
      
          test.hs:9:10: warning: [-Wincomplete-patterns]
              Pattern match(es) are non-exhaustive
              In a case alternative: Patterns not matched: (C2 _)
            |
          9 | sInt s = case s of
            |          ^^^^^^^^^...
      
          test.hs:12:14: warning: [-Wmissing-fields]
              • Fields of ‘Rec’ not initialised: f2
              • In the first argument of ‘print’, namely ‘Rec {f1 =
      1}’
                In the expression: print Rec {f1 = 1}
                In an equation for ‘main’: main = print Rec {f1 = 1}
             |
          12 | main = print Rec{ f1 = 1 }
             |              ^^^^^^^^^^^^^
      
          <no location info>: error:
          Failing due to -Werror.
      
      Now:
      
          [1 of 1] Compiling Main             ( test.hs, test.o )
      
          test.hs:9:10: error: [-Wincomplete-patterns,
      -Werror=incomplete-patterns]
              Pattern match(es) are non-exhaustive
              In a case alternative: Patterns not matched: (C2 _)
            |
          9 | sInt s = case s of
            |          ^^^^^^^^^...
      
          test.hs:12:14: error: [-Wmissing-fields, -Werror=missing-fields]
              • Fields of ‘Rec’ not initialised: f2
              • In the first argument of ‘print’, namely ‘Rec {f1 =
      1}’
                In the expression: print Rec {f1 = 1}
                In an equation for ‘main’: main = print Rec {f1 = 1}
             |
          12 | main = print Rec{ f1 = 1 }
             |              ^^^^^^^^^^^^^
      
      Test Plan: - Update old tests, add new tests if there aren't any
      relevant tests
      
      Reviewers: austin, bgamari
      
      Reviewed By: bgamari
      
      Subscribers: rwbarton, thomie
      
      Differential Revision: https://phabricator.haskell.org/D3709
      4befb415
  37. 05 Jun, 2017 1 commit
    • Alan Zimmerman's avatar
      Udate hsSyn AST to use Trees that Grow · 8e6ec0fa
      Alan Zimmerman authored
      Summary:
      See https://ghc.haskell.org/trac/ghc/wiki/ImplementingTreesThatGrow
      
      This commit prepares the ground for a full extensible AST, by replacing the type
      parameter for the hsSyn data types with a set of indices into type families,
      
          data GhcPs -- ^ Index for GHC parser output
          data GhcRn -- ^ Index for GHC renamer output
          data GhcTc -- ^ Index for GHC typechecker output
      
      These are now used instead of `RdrName`, `Name` and `Id`/`TcId`/`Var`
      
      Where the original name type is required in a polymorphic context, this is
      accessible via the IdP type family, defined as
      
          type family IdP p
          type instance IdP GhcPs = RdrName
          type instance IdP GhcRn = Name
          type instance IdP GhcTc = Id
      
      These types are declared in the new 'hsSyn/HsExtension.hs' module.
      
      To gain a better understanding of the extension mechanism, it has been applied
      to `HsLit` only, also replacing the `SourceText` fields in them with extension
      types.
      
      To preserve extension generality, a type class is introduced to capture the
      `SourceText` interface, which must be honoured by all of the extension points
      which originally had a `SourceText`.  The class is defined as
      
          class HasSourceText a where
            -- Provide setters to mimic existing constructors
            noSourceText  :: a
            sourceText    :: String -> a
      
            setSourceText :: SourceText -> a
            getSourceText :: a -> SourceText
      
      And the constraint is captured in `SourceTextX`, which is a constraint type
      listing all the extension points that make use of the class.
      
      Updating Haddock submodule to match.
      
      Test Plan: ./validate
      
      Reviewers: simonpj, shayan-najd, goldfire, austin, bgamari
      
      Subscribers: rwbarton, thomie, mpickering
      
      Differential Revision: https://phabricator.haskell.org/D3609
      8e6ec0fa
  38. 11 May, 2017 1 commit
  39. 04 May, 2017 1 commit
    • Matthew Pickering's avatar
      Implement sequential name lookup properly · 1829d265
      Matthew Pickering authored
      Previously we would run all the monadic actions and then
      combine their results. This caused problems if later actions
      raised errors but earlier lookups suceeded. We only want to run later
      lookups if the earlier ones fail.
      
      Fixes #13622
      
      Reviewers: RyanGlScott, austin, bgamari, simonpj
      
      Reviewed By: simonpj
      
      Subscribers: simonpj, rwbarton, thomie
      
      GHC Trac Issues: #13622
      
      Differential Revision: https://phabricator.haskell.org/D3515
      1829d265