1. 26 Jul, 2017 1 commit
    • Ryan Scott's avatar
      Fix #13968 by consulting isBuiltInOcc_maybe · d774b4e2
      Ryan Scott authored
      Summary:
      We were unconditionally reporting `Illegal binding of built-in syntax`
      in an error message, but this error doesn't make sense in certain Template
      Haskell scenarios which can trigger it. Let's give a more sensible error
      message by first checking if the name we're binding really is built-in syntax,
      using the handy `isBuiltInOcc_maybe` function.
      
      Test Plan: make test TEST=T13968
      
      Reviewers: bgamari, austin, goldfire
      
      Reviewed By: goldfire
      
      Subscribers: goldfire, rwbarton, thomie
      
      GHC Trac Issues: #13968
      
      Differential Revision: https://phabricator.haskell.org/D3789
      d774b4e2
  2. 11 Jul, 2017 1 commit
  3. 23 Jun, 2017 1 commit
  4. 21 Jun, 2017 1 commit
  5. 12 Jun, 2017 1 commit
  6. 11 May, 2017 1 commit
  7. 04 May, 2017 1 commit
    • Simon Peyton Jones's avatar
      Deal with exceptions in dsWhenNoErrs · e7701976
      Simon Peyton Jones authored
      Gracious me.  Ever since this patch
      
        commit 37445780
        Author: Jan Stolarek <jan.stolarek@p.lodz.pl>
        Date:   Fri Jul 11 13:54:45 2014 +0200
      
            Injective type families
      
      TcRnMonad.askNoErrs has been wrong. It looked like this
      
         askNoErrs :: TcRn a -> TcRn (a, Bool)
         askNoErrs m
          = do { errs_var <- newTcRef emptyMessages
               ; res  <- setErrsVar errs_var m
               ; (warns, errs) <- readTcRef errs_var
               ; addMessages (warns, errs)
               ; return (res, isEmptyBag errs) }
      
      The trouble comes if 'm' throws an exception in the TcRn monad.
      Then 'errs_var is never read, so any errors are simply lost.
      
      This mistake was then propgated into DsMonad.dsWhenNoErrs, where
      it gave rise to Trac #13642.
      
      Thank to Ryan for narrowing it down so sharply.
      
      I did some refactoring, as usual.
      e7701976
  8. 28 Apr, 2017 1 commit
    • Ryan Scott's avatar
      Make the tyvars in TH-reified data family instances uniform · b2c38d6b
      Ryan Scott authored
      It turns out we were using two different sets of type variables when
      reifying data family instances in Template Haskell. We were using the
      tyvars quantifying over the instance itself for the LHS, but using the
      tyvars quantifying over the data family instance constructor for the
      RHS. This commit uses the instance tyvars for both the LHS and the RHS,
      fixing #13618.
      
      Test Plan: make test TEST=T13618
      
      Reviewers: goldfire, austin, bgamari
      
      Reviewed By: goldfire, bgamari
      
      Subscribers: rwbarton, thomie
      
      GHC Trac Issues: #13618
      
      Differential Revision: https://phabricator.haskell.org/D3505
      b2c38d6b
  9. 23 Apr, 2017 1 commit
  10. 09 Mar, 2017 1 commit
    • bitonic's avatar
      Allow compilation of C/C++/ObjC/ObjC++ files with module from TH · 0fac488c
      bitonic authored
      The main goal is to easily allow the inline-c project (and
      similar projects such as inline-java) to emit C/C++ files to
      be compiled and linked with the current module.
      
      Moreover, `addCStub` is removed, since it's quite fragile. Most
      notably, the C stubs end up in the file generated by
      `CodeOutput.outputForeignStubs`, which is tuned towards
      generating a file for stubs coming from `capi` and Haskell-to-C
      exports.
      
      Reviewers: simonmar, austin, goldfire, facundominguez, dfeuer, bgamari
      
      Reviewed By: dfeuer, bgamari
      
      Subscribers: snowleopard, rwbarton, dfeuer, thomie, duncan, mboes
      
      Differential Revision: https://phabricator.haskell.org/D3280
      0fac488c
  11. 06 Mar, 2017 1 commit
  12. 10 Feb, 2017 2 commits
    • Facundo Domínguez's avatar
      Relax test TH_addCStub2 so it succeeds on travis. · e79ef75d
      Facundo Domínguez authored
      Test Plan: ./validate
      
      Reviewers: bgamari, nomeata, austin, mpickering
      
      Reviewed By: mpickering
      
      Subscribers: mpickering, rwbarton, mboes, thomie
      
      Differential Revision: https://phabricator.haskell.org/D3124
      e79ef75d
    • Ryan Scott's avatar
      Prevent Template Haskell splices from throwing a spurious TypeInType error · 283a3465
      Ryan Scott authored
      Summary:
      There was a rather annoying corner case where splicing poly-kinded
      Template Haskell declarations could trigger an error muttering about
      `TypeInType` not being enabled, whereas the equivalent non-TH code would
      compile without issue. This was causing by overzealous validity check in the
      renamer, wherein failed to distinguish between two different `Exact` names
      with the same `OccName`. As a result, it mistakenly believed some type
      variables were being used as both type and kind variables simultaneously! Ack.
      
      This avoids the issue by simply disabling the aforementioned validity check
      for Exact names. Fixes #12503.
      
      Test Plan: ./validate
      
      Reviewers: austin, bgamari, goldfire
      
      Subscribers: thomie
      
      Differential Revision: https://phabricator.haskell.org/D3022
      283a3465
  13. 09 Feb, 2017 1 commit
  14. 30 Jan, 2017 1 commit
    • Iavor S. Diatchki's avatar
      Fixes bug #11046 · 55935738
      Iavor S. Diatchki authored
      For some time now, type-level operators such as '+' have been treated as
      type constructors, rahter than type variables.  This pathc fixes TH's
      `lookupName` function to account for this behavior.
      
      Reviewers: bgamari, austin, goldfire, RyanGlScott
      
      Reviewed By: RyanGlScott
      
      Subscribers: Phyx, thomie
      
      Differential Revision: https://phabricator.haskell.org/D3025
      
      GHC Trac Issues: #11046
      55935738
  15. 26 Jan, 2017 1 commit
  16. 23 Jan, 2017 1 commit
    • Ryan Scott's avatar
      Don't quantify implicit type variables when quoting type signatures in TH · 729a5e45
      Ryan Scott authored
      Summary:
      A bug was introduced in GHC 8.0 in which Template Haskell-quoted type
      signatures would quantify _all_ their type variables, even the implicit ones.
      This would cause splices like this:
      
      ```
      $([d| idProxy :: forall proxy (a :: k). proxy a -> proxy a
            idProxy x = x
         |])
      ```
      
      To splice back in something that was slightly different:
      
      ```
      idProxy :: forall k proxy (a :: k). proxy a -> proxy a
      idProxy x = x
      ```
      
      Notice that the kind variable `k` is now explicitly quantified! What's worse,
      this now requires the `TypeInType` extension to be enabled.
      
      This changes the behavior of Template Haskell quoting to never explicitly
      quantify type variables which are implicitly quantified in the source.
      
      There are some other places where this behavior pops up too, including
      class methods, type ascriptions, `SPECIALIZE` pragmas, foreign imports,
      and pattern synonynms (#13018), so I fixed those too.
      
      Fixes #13018 and #13123.
      
      Test Plan: ./validate
      
      Reviewers: simonpj, goldfire, austin, bgamari
      
      Reviewed By: simonpj, goldfire
      
      Subscribers: simonpj, mpickering, thomie
      
      Differential Revision: https://phabricator.haskell.org/D2974
      
      GHC Trac Issues: #13018, #13123
      729a5e45
  17. 22 Jan, 2017 1 commit
  18. 27 Dec, 2016 1 commit
    • Peter Trommler's avatar
      Testsuite: Skip failing tests on PowerPC 64-bit · 4dec7d19
      Peter Trommler authored
      The Power ISA says the result of a division by zero is undefined.  So
      ignore stdout on PowerPC 64-bit systems.
      
      Disable ext-interp tests on 64-bit PowerPC.  We don't have support for
      PowerPC 64-bit ELF in the RTS linker, which is needed for the external
      interpreter.
      
      Test Plan: ./validate
      
      Reviewers: austin, simonmar, hvr, erikd, bgamari
      
      Reviewed By: bgamari
      
      Subscribers: thomie
      
      Differential Revision: https://phabricator.haskell.org/D2782
      4dec7d19
  19. 18 Dec, 2016 1 commit
    • Ryan Scott's avatar
      Introduce unboxedSum{Data,Type}Name to template-haskell · b5d788aa
      Ryan Scott authored
      Summary:
      In D2448 (which introduced Template Haskell support for unboxed
      sums), I neglected to add `unboxedSumDataName` and `unboxedSumTypeName`
      functions, since there wasn't any way you could write unboxed sum data or type
      constructors in prefix form to begin with (see #12514). But even if you can't
      write these `Name`s directly in source code, it would still be nice to be able
      to use these `Name`s in Template Haskell (for instance, to be able to treat
      unboxed sum type constructors like any other type constructors).
      
      Along the way, this uncovered a minor bug in `isBuiltInOcc_maybe` in
      `TysWiredIn`, which was calculating the arity of unboxed sum data constructors
      incorrectly.
      
      Test Plan: make test TEST=T12478_5
      
      Reviewers: osa1, goldfire, austin, bgamari
      
      Subscribers: thomie
      
      Differential Revision: https://phabricator.haskell.org/D2854
      
      GHC Trac Issues: #12478, #12514
      b5d788aa
  20. 17 Dec, 2016 2 commits
  21. 15 Dec, 2016 1 commit
    • Ryan Scott's avatar
      Make unboxedTuple{Type,Data}Name support 0- and 1-tuples · 9550b8d8
      Ryan Scott authored
      Previously, these functions were hardcoded so as to always `error`
      whenever given an argument of 0 or 1. This restriction can be lifted
      pretty easily, however.
      
      This requires a slight tweak to `isBuiltInOcc_maybe` in `TysWiredIn` to
      allow it to recognize `Unit#` (which is the hard-wired `OccName` for
      unboxed 1-tuples).
      
      Fixes #12977.
      
      Test Plan: make test TEST=12977
      
      Reviewers: austin, goldfire, bgamari
      
      Reviewed By: bgamari
      
      Subscribers: thomie
      
      Differential Revision: https://phabricator.haskell.org/D2847
      
      GHC Trac Issues: #12977
      9550b8d8
  22. 09 Dec, 2016 1 commit
  23. 24 Nov, 2016 1 commit
  24. 17 Nov, 2016 1 commit
    • Facundo Domínguez's avatar
      Have reify work for local variables with functional dependencies. · 231a3ae1
      Facundo Domínguez authored
      It turned out that finalizers were run too early and information
      resulting from simplifying constraints was not available.
      
      This patch runs finalizers after a first call to simplifyTop, and
      then calls simplifyTop a second time to deal with constraints
      that could result from running the finalizers.
      
      Fixes T12777
      
      Test Plan: ./validate
      
      Reviewers: goldfire, simonpj, bgamari, austin
      
      Reviewed By: simonpj
      
      Subscribers: mpickering, mboes, thomie
      
      Differential Revision: https://phabricator.haskell.org/D2659
      
      GHC Trac Issues: #12777
      231a3ae1
  25. 05 Nov, 2016 1 commit
  26. 03 Nov, 2016 1 commit
  27. 12 Oct, 2016 1 commit
  28. 01 Oct, 2016 1 commit
    • Ryan Scott's avatar
      Implement deriving strategies · 9e862765
      Ryan Scott authored
      Allows users to explicitly request which approach to `deriving` to use
      via keywords, e.g.,
      
      ```
      newtype Foo = Foo Bar
        deriving Eq
        deriving stock    Ord
        deriving newtype Show
      ```
      
      Fixes #10598. Updates haddock submodule.
      
      Test Plan: ./validate
      
      Reviewers: hvr, kosmikus, goldfire, alanz, bgamari, simonpj, austin,
      erikd, simonmar
      
      Reviewed By: alanz, bgamari, simonpj
      
      Subscribers: thomie, mpickering, oerjan
      
      Differential Revision: https://phabricator.haskell.org/D2280
      
      GHC Trac Issues: #10598
      9e862765
  29. 05 Sep, 2016 1 commit
    • Facundo Domínguez's avatar
      Don't ignore addTopDecls in module finalizers. · 71dd6e44
      Facundo Domínguez authored
      Summary:
      Module finalizer could call addTopDecls, however, the declarations
      added in this fashion were ignored. This patch makes sure to rename,
      type check and incorporate this declarations.
      
      Because a declaration may include a splice which calls addModFinalizer,
      the list of finalizers is repeteadly checked after adding declarations
      until no more finalizers remain.
      
      Test Plan: ./validate
      
      Reviewers: bgamari, goldfire, simonpj, austin
      
      Reviewed By: bgamari, simonpj
      
      Subscribers: simonmar, mboes, thomie
      
      Differential Revision: https://phabricator.haskell.org/D2505
      
      GHC Trac Issues: #12559
      71dd6e44
  30. 29 Aug, 2016 1 commit
  31. 23 Aug, 2016 1 commit
    • Ryan Scott's avatar
      Template Haskell support for unboxed sums · 613d7455
      Ryan Scott authored
      This adds new constructors `UnboxedSumE`, `UnboxedSumT`, and
      `UnboxedSumP` to represent unboxed sums in Template Haskell.
      
      One thing you can't currently do is, e.g., `reify ''(#||#)`, since I
      don't believe unboxed sum type/data constructors can be written in
      prefix form.  I will look at fixing that as part of #12514.
      
      Fixes #12478.
      
      Test Plan: make test TEST=T12478_{1,2,3}
      
      Reviewers: osa1, goldfire, austin, bgamari
      
      Reviewed By: goldfire, bgamari
      
      Subscribers: thomie
      
      Differential Revision: https://phabricator.haskell.org/D2448
      
      GHC Trac Issues: #12478
      613d7455
  32. 22 Aug, 2016 1 commit
  33. 18 Jul, 2016 2 commits
  34. 06 Jul, 2016 1 commit
    • Facundo Domínguez's avatar
      Have addModFinalizer expose the local type environment. · 567dbd9b
      Facundo Domínguez authored
      Summary:
      This annotates the splice point with 'HsSpliced ref e' where 'e' is the
      result of the splice. 'ref' is a reference that the typechecker will fill with
      the local type environment.
      
      The finalizer then reads the ref and uses the local type environment, which
      causes 'reify' to find local variables when run in the finalizer.
      
      Test Plan: ./validate
      
      Reviewers: simonpj, simonmar, bgamari, austin, goldfire
      
      Reviewed By: goldfire
      
      Subscribers: simonmar, thomie, mboes
      
      Differential Revision: https://phabricator.haskell.org/D2286
      
      GHC Trac Issues: #11832
      567dbd9b
  35. 27 Jun, 2016 1 commit
  36. 24 Jun, 2016 2 commits