1. 17 Oct, 2016 5 commits
    • Simon Peyton Jones's avatar
      Correct order of existentials in pattern synonyms · a693d1cb
      Simon Peyton Jones authored
      Trac #12698 exposed a nasty bug in the typechecking for
      pattern synonmys: the existential type variables weren't
      being put in properly-scoped order.
      
      For some reason TcPatSyn.tcCollectEx was colleting them as a
      set, not as a list!  Easily fixed.
      a693d1cb
    • Simon Peyton Jones's avatar
      Typo in comment · 609d2c81
      Simon Peyton Jones authored
      609d2c81
    • Simon Peyton Jones's avatar
      Fix shadowing in mkWwBodies · 692c8df0
      Simon Peyton Jones authored
      This bug, exposed by Trac #12562 was very obscure, and has been
      lurking for a long time.  What happened was that, in the
      worker/wrapper split
      
        a tyvar binder for a worker function
        accidentally shadowed an in-scope term variable
        that was mentioned in the body of the function
      
      It's jolly hard to provoke, so I have not even attempted to make
      a test case.  There's a Note [Freshen WW arguments] to explain.
      
      Interestingly, fixing the bug (which meant fresher type variables)
      revealed a second lurking bug: I'd failed to apply the substitution to
      the coercion in the second last case of mkWWArgs, which introduces a
      Cast.
      692c8df0
    • Simon Peyton Jones's avatar
      Fix comment typo · 82b54fcf
      Simon Peyton Jones authored
      82b54fcf
    • Simon Peyton Jones's avatar
      3174beb6
  2. 15 Oct, 2016 2 commits
  3. 14 Oct, 2016 7 commits
    • Sylvain HENRY's avatar
      Check for empty entity string in "prim" foreign imports · 6c739326
      Sylvain HENRY authored
      Foreign imports with "prim" convention require a valid symbol identifier
      (see linked issue). We check this.
      
      Fix line too long
      
      Test Plan: Validate
      
      Reviewers: austin, bgamari
      
      Reviewed By: bgamari
      
      Subscribers: thomie
      
      Differential Revision: https://phabricator.haskell.org/D2563
      
      GHC Trac Issues: #12355
      6c739326
    • Ryan Scott's avatar
      Make error when deriving an instance for a typeclass less misleading · d5a4e49d
      Ryan Scott authored
      Before, when you attempted to derive an instance for a typeclass,
      e.g.,
      
      ```
      class C1 (a :: Constraint) where
      class C2 where
      
      deriving instance C1 C2
      ```
      
      GHC would complain that `C2`'s data constructors aren't in scope. But
      that
      makes no sense, since typeclasses don't have constructors! By refining
      the
      checks that GHC performs when deriving, we can make the error message a
      little more sensible.
      
      This also cleans up a related `DeriveAnyClass` infelicity. Before, you
      wouldn't have been able to compile code like this:
      
      ```
      import System.IO (Handle)
      class C a
      deriving instance C Handle
      ```
      
      Since GHC was requiring that all data constructors of `Handle` be in
      scope. But `DeriveAnyClass` doesn't even generate code that mentions
      any data constructors, so this requirement is silly!
      
      Fixes #11509.
      
      Test Plan: make test TEST=T11509
      
      Reviewers: simonpj, austin, bgamari
      
      Reviewed By: simonpj, bgamari
      
      Subscribers: thomie, simonpj
      
      Differential Revision: https://phabricator.haskell.org/D2558
      
      GHC Trac Issues: #11509
      d5a4e49d
    • Ben Gamari's avatar
      PrelInfo: Fix style · 90df91a0
      Ben Gamari authored
      90df91a0
    • Ben Gamari's avatar
      Improve find_lbl panic message · aa06883c
      Ben Gamari authored
      aa06883c
    • Ben Gamari's avatar
      MkIface: Turn a foldr into a foldl' · 3991da46
      Ben Gamari authored
      There is no reason why this should be a foldr considering we are
      building a map.
      3991da46
    • Ben Gamari's avatar
      Clean up handling of known-key Names in interface files · 34d933d6
      Ben Gamari authored
      Previously BinIface had some dedicated logic for handling tuple names in
      the symbol table. As it turns out, this logic was essentially dead code
      as it was superceded by the special handling of known-key things. Here
      we cull the tuple code-path and use the known-key codepath for all
      tuple-ish things.
      
      This had a surprising number of knock-on effects,
      
       * constraint tuple datacons had to be made known-key (previously they
         were not)
      
       * IfaceTopBndr was changed from being a synonym of OccName to a
         synonym of Name (since we now need to be able to deserialize Names
         directly from interface files)
      
       * the change to IfaceTopBndr complicated fingerprinting, since we need
         to ensure that we don't go looking for the fingerprint of the thing
         we are currently fingerprinting in the fingerprint environment (see
         notes in MkIface). Handling this required distinguishing between
         binding and non-binding Name occurrences in the Binary serializers.
      
       *...
      34d933d6
    • Ben Gamari's avatar
      Unique: Simplify encoding of sum uniques · 1cccb646
      Ben Gamari authored
      The previous encoding was entropically a bit better, but harder to
      encode and decode. Now we just split up the integer part of the unique
      into a bitfield.
      
      Test Plan: Validate
      
      Reviewers: austin
      
      Subscribers: thomie
      
      Differential Revision: https://phabricator.haskell.org/D2468
      1cccb646
  4. 13 Oct, 2016 1 commit
    • Simon Peyton Jones's avatar
      Further improve error handling in TcRn monad · 2fdf21bf
      Simon Peyton Jones authored
      This patch builds on the one for Trac #12124, by dealing properly
      with out-of-scope "hole" errors.
      
      This fixes Trac #12529. The hard error coming from visible type application
      is still there, but the out-of-scope error is no longer suppressed.
      
      (Arguably the VTA message should be suppressed somehow, but that's a
      battle for another day.)
      2fdf21bf
  5. 12 Oct, 2016 3 commits
  6. 10 Oct, 2016 4 commits
    • Simon Peyton Jones's avatar
      Move zonking out of tcFamTyPats · 76a5477b
      Simon Peyton Jones authored
      In tcFamTyPats we were zonking from the TcType world to the
      Type world, ready to build the results into a CoAxiom (which
      should have no TcType stuff.  But the 'thing_inside' for
      tcFamTyPats also must be zonked, and that zonking must have
      the ZonkEnv from the binders zonked tcFamTyPats.
      
      Ugh.  This caused an assertion failure (with DEBUG on) in
      RaeBlobPost and TypeLevelVec, both in tests/dependent, as
      shown in Trac #12682.  Why it hasn't shown up before now
      is obscure to me.
      
      So I moved the zonking stuff out of tcFamTyPats to its
      three call sites, where we can do it all together. Very
      slightly longer, but much more robust.
      76a5477b
    • Simon Peyton Jones's avatar
      Delete orphan where clause · 88eb7738
      Simon Peyton Jones authored
      88eb7738
    • Simon Peyton Jones's avatar
      Rename a parameter; trivial refactor · b5c89636
      Simon Peyton Jones authored
      b5c89636
    • Simon Peyton Jones's avatar
      Orient improvement constraints better · b255ae7b
      Simon Peyton Jones authored
      This patch fixes an infinite loop in the constraint solver,
      shown up by Trac #12522.
      
      The solution is /very/ simple: just reverse the orientation of the
      derived constraints arising from improvement using type-family
      injectivity.  I'm not very proud of the fix --- it seems fragile
      --- but it has the very great merit of simplicity, and it works
      fine.
      
      See Note [Improvement orientation] in TcInteract, and some
      discussion on the Trac ticket.
      b255ae7b
  7. 09 Oct, 2016 1 commit
  8. 08 Oct, 2016 9 commits
  9. 07 Oct, 2016 2 commits
  10. 06 Oct, 2016 3 commits
    • Joachim Breitner's avatar
      Remove dead code “mkHsConApp” · 57a207ca
      Joachim Breitner authored
      Differential Revision: https://phabricator.haskell.org/D2574
      57a207ca
    • Joachim Breitner's avatar
      RegAlloc: Make some pattern matched complete · a2bedb5c
      Joachim Breitner authored
      these actually are complete, but due to the use of pattern guards, the
      compiler does not see that. Refactor the code that it does.
      
      Differential Revision: https://phabricator.haskell.org/D2574
      a2bedb5c
    • Ryan Scott's avatar
      Refactor TcDeriv and TcGenDeriv · 4a03012a
      Ryan Scott authored
      Summary:
      Keeping a promise I made to Simon to clean up these modules.
      
      This change splits up the massive `TcDeriv` and `TcGenDeriv` modules into
      somewhat more manageable pieces. The new modules are:
      
      * `TcGenFunctor`: This contains the deriving machinery for `Functor`,
        `Foldable`, and `Traversable` (which all use the same underlying algorithm).
      * `TcDerivInfer`: This is the new home for `inferConstraints`,
        `simplifyInstanceContexts`, and related functions, whose role is to come up
        with the derived instance context and subsequently simplify it.
      * `TcDerivUtils`: This is a grab-bag module that contains several
        error-checking utilities originally in `TcDeriv`, as well as some functions
        that `TcDeriv` and `TcDerivInfer` both need.
      
      The end result is that `TcDeriv` is now less than 1,600 SLOC (originally 2,686
      SLOC), and `TcGenDeriv` is now about 2,000 SLOC (originally 2,964).
      
      In addition, this also implements a couple of tiny refactorings:
      
      * I transformed `type Condition = (DynFlags, TyCon) -> Validity` into
        `type Condition = DynFlags -> TyCon -> Validity`
      * I killed the `DerivSpecGeneric` constructor for `DerivSpecMechanism`, and
        merged its functionality into `DerivSpecStock`. In addition,
        `hasStockDeriving` now contains key-value pairs for `Generic` and `Generic1`,
        so they're no longer treated as an awkward special case in `TcDeriv`.
      
      Test Plan: ./validate
      
      Reviewers: simonpj, austin, bgamari
      
      Reviewed By: simonpj
      
      Subscribers: thomie, mpickering
      
      Differential Revision: https://phabricator.haskell.org/D2568
      4a03012a
  11. 05 Oct, 2016 2 commits
  12. 04 Oct, 2016 1 commit