1. 08 May, 2017 1 commit
  2. 06 Mar, 2017 1 commit
  3. 26 Feb, 2017 1 commit
    • Joachim Breitner's avatar
      Ensure that Literals are in range · 6dfc5ebf
      Joachim Breitner authored
      This commit fixes several bugs related to case expressions
      involving numeric literals which are not in the range of values of
      their (fixed-width, integral) type.
      
      There is a new invariant on Literal: The argument of a MachInt[64]
      or MachWord[64] must lie within the range of the corresponding
      primitive type Int[64]# or Word[64]#, as defined by the target machine.
      This invariant is enforced in mkMachInt[64]/mkMachWord[64] by wrapping
      the argument to the target type's range if necessary.
      
      Test Plan: Test Plan: make slowtest TEST="T9533 T9533b T9533c T10245
      T10246"
      
      Trac issues: #9533, #10245, #10246, #13171
      
      Reviewers: simonmar, simonpj, austin, bgamari, nomeata
      
      Reviewed By: bgamari
      
      Subscribers: thomie, rwbarton
      
      Differential Revision: https://phabricator.haskell.org/D810
      6dfc5ebf
  4. 07 Dec, 2016 1 commit
    • Alan Zimmerman's avatar
      Add HsSyn prettyprinter tests · 499e4382
      Alan Zimmerman authored
      Summary:
      Add prettyprinter tests, which take a file, parse it, pretty print it,
      re-parse the pretty printed version and then compare the original and
      new ASTs (ignoring locations)
      
      Updates haddock submodule to match the AST changes.
      
      There are three issues outstanding
      
      1. Extra parens around a context are not reproduced. This will require an
         AST change and will be done in a separate patch.
      
      2. Currently if an `HsTickPragma` is found, this is not pretty-printed,
         to prevent noise in the output.
      
         I am not sure what the desired behaviour in this case is, so have left
         it as before. Test Ppr047 is marked as expected fail for this.
      
      3. Apart from in a context, the ParsedSource AST keeps all the parens from
         the original source.  Something is happening in the renamer to remove the
         parens around visible type application, causing T12530 to fail, as the
         dumped splice decl is after the renamer.
      
         This needs to be fixed by keeping the parens, but I do not know where they
         are being removed.  I have amended the test to pass, by removing the parens
         in the expected output.
      
      Test Plan: ./validate
      
      Reviewers: goldfire, mpickering, simonpj, bgamari, austin
      
      Reviewed By: simonpj, bgamari
      
      Subscribers: simonpj, goldfire, thomie, mpickering
      
      Differential Revision: https://phabricator.haskell.org/D2752
      
      GHC Trac Issues: #3384
      499e4382
  5. 27 Feb, 2016 1 commit
  6. 27 Jan, 2016 1 commit
    • eir@cis.upenn.edu's avatar
      Refactor the typechecker to use ExpTypes. · 00cbbab3
      eir@cis.upenn.edu 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
  7. 18 Jan, 2016 1 commit
    • Jan Stolarek's avatar
      Replace calls to `ptext . sLit` with `text` · b8abd852
      Jan Stolarek authored
      Summary:
      In the past the canonical way for constructing an SDoc string literal was the
      composition `ptext . sLit`.  But for some time now we have function `text` that
      does the same.  Plus it has some rules that optimize its runtime behaviour.
      This patch takes all uses of `ptext . sLit` in the compiler and replaces them
      with calls to `text`.  The main benefits of this patch are clener (shorter) code
      and less dependencies between module, because many modules now do not need to
      import `FastString`.  I don't expect any performance benefits - we mostly use
      SDocs to report errors and it seems there is little to be gained here.
      
      Test Plan: ./validate
      
      Reviewers: bgamari, austin, goldfire, hvr, alanz
      
      Subscribers: goldfire, thomie, mpickering
      
      Differential Revision: https://phabricator.haskell.org/D1784
      b8abd852
  8. 31 Dec, 2015 1 commit
  9. 15 Dec, 2015 1 commit
    • Ben Gamari's avatar
      Expose enabled language extensions to TH · c1e25536
      Ben Gamari authored
      This exposes `template-haskell` functions for querying the language
      extensions which are enabled when compiling a module,
      
      - an `isExtEnabled` function to check whether an extension is enabled
      - an `extsEnabled` function to obtain a full list of enabled extensions
      
      To avoid code duplication this adds a `GHC.LanguageExtensions` module to
      `ghc-boot` and moves `DynFlags.ExtensionFlag` into it. A happy
      consequence of this is that the ungainly `DynFlags` lost around 500
      lines. Moreover, flags corresponding to language extensions are now
      clearly distinguished from other flags due to the `LangExt.*` prefix.
      
      Updates haddock submodule.
      
      This fixes #10820.
      
      Test Plan: validate
      
      Reviewers: austin, spinda, hvr, goldfire, alanz
      
      Reviewed By: goldfire
      
      Subscribers: mpickering, RyanGlScott, hvr, simonpj, thomie
      
      Differential Revision: https://phabricator.haskell.org/D1200
      
      GHC Trac Issues: #10820
      c1e25536
  10. 03 Oct, 2015 1 commit
  11. 02 Oct, 2015 1 commit
    • Ben Gamari's avatar
      Fix treatment of -0.0 · eb975d2e
      Ben Gamari authored
      Here we fix a few mis-optimizations that could occur in code with
      floating point comparisons with -0.0. These issues arose from our
      insistence on rewriting equalities into case analyses and the
      simplifier's ignorance of floating-point semantics.
      
      For instance, in Trac #10215 (and the similar issue Trac #9238) we
      turned `ds == 0.0` into a case analysis,
      
      ```
      case ds of
          __DEFAULT -> ...
          0.0 -> ...
      ```
      
      Where the second alternative matches where `ds` is +0.0 and *also* -0.0.
      However, the simplifier doesn't realize this and will introduce a local
      inlining of `ds = -- +0.0` as it believes this is the only
      value that matches this pattern.
      
      Instead of teaching the simplifier about floating-point semantics
      we simply prohibit case analysis on floating-point scrutinees and keep
      this logic in the comparison primops, where it belongs.
      
      We do several things here,
      
       - Add test cases from relevant tickets
       - Clean up a bit of documentation
       - Desugar literal matches against floats into applications of the
         appropriate equality primitive instead of case analysis
       - Add a CoreLint to ensure we don't pattern match on floats in Core
      
      Test Plan: validate with included testcases
      
      Reviewers: goldfire, simonpj, austin
      
      Subscribers: thomie
      
      Differential Revision: https://phabricator.haskell.org/D1061
      
      GHC Trac Issues: #10215, #9238
      eb975d2e
  12. 16 Jan, 2015 1 commit
    • Alan Zimmerman's avatar
      API Annotations tweaks. · 11881ec6
      Alan Zimmerman authored
      Summary:
      HsTyLit now has SourceText
      
      Update documentation of HsSyn to reflect which annotations are attached to which element.
      
      Ensure that the parser always keeps HsSCC and HsTickPragma values, to
      be ignored in the desugar phase if not needed
      
      Bringing in SourceText for pragmas
      
      Add Location in NPlusKPat
      
      Add Location in FunDep
      
      Make RecCon payload Located
      
      Explicitly add AnnVal to RdrName where it is compound
      
      Add Location in IPBind
      
      Add Location to name in IEThingAbs
      
      Add Maybe (Located id,Bool) to Match to track fun_id,infix
        This includes converting Match into a record and adding a note about why
        the fun_id needs to be replicated in the Match.
      
      Add Location in KindedTyVar
      
      Sort out semi-colons for parsing
      
        - import statements
        - stmts
        - decls
        - decls_cls
        - decls_inst
      
      This updates the haddock submodule.
      
      Test Plan: ./validate
      
      Reviewers: hvr, austin, goldfire, simonpj
      
      Reviewed By: simonpj
      
      Subscribers: thomie, carter
      
      Differential Revision: https://phabricator.haskell.org/D538
      11881ec6
  13. 06 Jan, 2015 1 commit
  14. 03 Dec, 2014 1 commit
  15. 21 Nov, 2014 1 commit
  16. 24 Sep, 2014 1 commit
  17. 21 Sep, 2014 1 commit
  18. 09 Sep, 2014 1 commit
    • Austin Seipp's avatar
      Make Applicative a superclass of Monad · d94de872
      Austin Seipp authored
      Summary:
      This includes pretty much all the changes needed to make `Applicative`
      a superclass of `Monad` finally. There's mostly reshuffling in the
      interests of avoid orphans and boot files, but luckily we can resolve
      all of them, pretty much. The only catch was that
      Alternative/MonadPlus also had to go into Prelude to avoid this.
      
      As a result, we must update the hsc2hs and haddock submodules.
      Signed-off-by: default avatarAustin Seipp <austin@well-typed.com>
      
      Test Plan: Build things, they might not explode horribly.
      
      Reviewers: hvr, simonmar
      
      Subscribers: simonmar
      
      Differential Revision: https://phabricator.haskell.org/D13
      d94de872
  19. 29 Aug, 2014 1 commit
  20. 07 Aug, 2014 1 commit
    • Simon Peyton Jones's avatar
      When desugaring Use the smart mkCoreConApps and friends · 1fc60ea1
      Simon Peyton Jones authored
      This is actually the bug that triggered Trac #9390.  We had
      an unboxed tuple (# writeArray# ..., () #), and that writeArray#
      argument isn't ok-for-speculation, so disobeys the invariant.
      
      The desugaring of unboxed tuples was to blame; the fix is easy.
      1fc60ea1
  21. 05 Jun, 2014 1 commit
    • Simon Peyton Jones's avatar
      Fix egregious instantiation bug in matchOneConLike (fixing Trac #9023) · 0a55a3ca
      Simon Peyton Jones authored
      We simply weren't giving anything like the right instantiating types
      to patSynInstArgTys in matchOneConLike.
      
      To get these instantiating types would have involved matching the
      result type of the pattern synonym with the pattern type, which is
      tiresome.  So instead I changed ConPatOut so that instead of recording
      the type of the *whole* pattern (in old field pat_ty), it not records
      the *instantiating* types (in new field pat_arg_tys).  Then we canuse
      TcHsSyn.conLikeResTy to get the pattern type when needed.
      
      There are lots of knock-on incidental effects, but they mostly made
      the code simpler, so I'm happy.
      0a55a3ca
  22. 15 May, 2014 1 commit
    • Herbert Valerio Riedel's avatar
      Add LANGUAGE pragmas to compiler/ source files · 23892440
      Herbert Valerio Riedel authored
      In some cases, the layout of the LANGUAGE/OPTIONS_GHC lines has been
      reorganized, while following the convention, to
      
      - place `{-# LANGUAGE #-}` pragmas at the top of the source file, before
        any `{-# OPTIONS_GHC #-}`-lines.
      
      - Moreover, if the list of language extensions fit into a single
        `{-# LANGUAGE ... -#}`-line (shorter than 80 characters), keep it on one
        line. Otherwise split into `{-# LANGUAGE ... -#}`-lines for each
        individual language extension. In both cases, try to keep the
        enumeration alphabetically ordered.
        (The latter layout is preferable as it's more diff-friendly)
      
      While at it, this also replaces obsolete `{-# OPTIONS ... #-}` pragma
      occurences by `{-# OPTIONS_GHC ... #-}` pragmas.
      23892440
  23. 22 Nov, 2013 1 commit
  24. 18 Nov, 2013 1 commit
  25. 12 Oct, 2013 1 commit
  26. 03 Oct, 2013 1 commit
  27. 18 Sep, 2013 1 commit
  28. 20 Aug, 2013 1 commit
  29. 31 Jul, 2013 1 commit
  30. 30 Jan, 2013 1 commit
  31. 04 Jan, 2013 1 commit
    • Simon Peyton Jones's avatar
      Allow empty case expressions (and lambda-case) with -XEmptyCase · 3671e674
      Simon Peyton Jones authored
      The main changes are:
        * Parser accepts empty case alternatives
        * Renamer checks that -XEmptyCase is on in that case
        * (Typechecker is pretty much unchanged.)
        * Desugarer desugars empty case alternatives, esp:
            - Match.matchWrapper and Match.match now accept empty eqns
            - New function matchEmpty deals with the empty case
            - See Note [Empty case alternatives] in Match
      
      This patch contains most of the work, but it's a bit mixed up
      with a refactoring of MatchGroup that I did at the same time
      (next commit).
      3671e674
  32. 14 Dec, 2012 2 commits
  33. 04 Oct, 2012 1 commit
  34. 17 Sep, 2012 1 commit
  35. 14 Jul, 2012 2 commits
    • Ian Lynagh's avatar
      3248fd92
    • Ian Lynagh's avatar
      Implement FastBytes, and use it for MachStr · 7ae1bec5
      Ian Lynagh authored
      This is a first step on the way to refactoring the FastString type.
      
      FastBytes currently has no unique, mainly because there isn't currently
      a nice way to produce them in Binary.
      
      Also, we don't currently do the "Dictionary" thing with FastBytes in
      Binary. I'm not sure whether this is important.
      
      We can change both decisions later, but in the meantime this gets the
      refactoring underway.
      7ae1bec5
  36. 04 Nov, 2011 1 commit
  37. 12 Jul, 2011 1 commit
  38. 15 May, 2011 1 commit