1. 18 Jan, 2016 2 commits
    • Simon Peyton Jones's avatar
      Refactoring on IdInfo and system derived names · ec8a188a
      Simon Peyton Jones authored
      Some modest refactoring, triggered in part by Trac #11051
      
      * Kill off PatSynId, ReflectionId in IdDetails
        They were barely used, and only for pretty-printing
      
      * Add helper function Id.mkExportedVanillaId, and use it
      
      * Polish up OccName.isDerivedOccName, as a predicate for
        definitions generated internally by GHC, which we
        might not want to show to the user.
      
      * Kill off unused OccName.mkDerivedTyConOcc
      
      * Shorten the derived OccNames for newtype and data
        instance axioms
      
      * A bit of related refactoring around newFamInstAxiomName
      ec8a188a
    • Simon Peyton Jones's avatar
      Fix typecheck of default associated type decls · cb24e684
      Simon Peyton Jones authored
      This bug was thrown up by Trac #11361, but I found that the
      problem was deeper: GHC was allowing
      
        class C a where
          type F (a :: k) :: *
          type F (x :: *) = x    -- Not right!
      
      (Which is now indexed-types/should_compile/T11361a.)
      
      Anyway the fix is relatively simple; use tcMatchTys in
      tcDefaultAssocDecl.
      
      Merge to 8.0 branch.
      cb24e684
  2. 17 Jan, 2016 2 commits
  3. 16 Jan, 2016 3 commits
    • Simon Peyton Jones's avatar
      Add missing T11408.hs · 3b6a4909
      Simon Peyton Jones authored
      3b6a4909
    • Simon Peyton Jones's avatar
      Fix a number of subtle solver bugs · 9308c736
      Simon Peyton Jones authored
      As a result of some other unrelated changes I found that
      IndTypesPerf was failing, and opened Trac #11408.  There's
      a test in indexed-types/should-compile/T11408.
      
      The bug was that a type like
       forall t. (MT (UL t) (UR t) ~ t) => UL t -> UR t -> Int
      is in fact unambiguous, but it's a bit subtle to prove
      that it is unambiguous.
      
      In investigating, Dimitrios and I found several subtle
      bugs in the constraint solver, fixed by this patch
      
      * canRewrite was missing a Derived/Derived case.  This was
        lost by accident in Richard's big kind-equality patch.
      
      * Interact.interactTyVarEq would discard [D] a ~ ty if there
        was a [W] a ~ ty in the inert set.  But that is wrong because
        the former can rewrite things that the latter cannot.
        Fix: a new function eqCanDischarge
      
      * In TcSMonad.addInertEq, the process was outright wrong for
        a Given/Wanted in the (GWModel) case.  We were adding a new
        Derived without kicking out things that it could rewrite.
        Now the code is simpler (no special GWModel case), and works
        correctly.
      
      * The special case in kickOutRewritable for [W] fsk ~ ty,
        turns out not to be needed.  (We emit a [D] fsk ~ ty which
        will do the job.
      
      I improved comments and documentation, esp in TcSMonad.
      9308c736
    • Alan Zimmerman's avatar
      Work SourceText in for all integer literals · 3a1babd6
      Alan Zimmerman authored
      Summary:
      Certain syntactic elements have integers in them, such as fixity
      specifications, SPECIALISE pragmas and so on.
      
      The lexer will accept mult-radix literals, with arbitrary leading zeros
      in these.
      
      Bring in a SourceText field to each affected AST element to capture the
      original literal text for use with API Annotations.
      
      Affected hsSyn elements are
      
      ```
           -- See note [Pragma source text]
           data Activation = NeverActive
                           | AlwaysActive
                           | ActiveBefore SourceText PhaseNum
                                -- Active only *strictly before* this phase
                           | ActiveAfter SourceText PhaseNum
                                 -- Active in this phase and later
                           deriving( Eq, Data, Typeable )
                                     -- Eq used in comparing rules in HsDecls
      
           data Fixity = Fixity SourceText Int FixityDirection
             -- Note [Pragma source text]
             deriving (Data, Typeable)
       ```
      
      and
      
      ```
            | HsTickPragma         -- A pragma introduced tick
               SourceText           -- Note [Pragma source text] in BasicTypes
               (StringLiteral,(Int,Int),(Int,Int))
                                                -- external span for this tick
               ((SourceText,SourceText),(SourceText,SourceText))
                  -- Source text for the four integers used in the span.
                  -- See note [Pragma source text] in BasicTypes
               (LHsExpr id)
      ```
      
      Updates haddock submodule
      
      Test Plan: ./validate
      
      Reviewers: goldfire, bgamari, austin
      
      Reviewed By: bgamari
      
      Subscribers: thomie, mpickering
      
      Differential Revision: https://phabricator.haskell.org/D1781
      
      GHC Trac Issues: #11430
      3a1babd6
  4. 15 Jan, 2016 10 commits
    • eir@cis.upenn.edu's avatar
      Fix #11405. · 3c6635ef
      eir@cis.upenn.edu authored
      This adds a new variant of AbsBinds that is used solely for bindings
      with a type signature. This allows for a simpler desugaring that
      does not produce the bogus output that tripped up Core Lint in
      ticket #11405. Should make other desugarings simpler, too.
      3c6635ef
    • eir@cis.upenn.edu's avatar
      Fix typo in error message (#11409) · 80b4c71c
      eir@cis.upenn.edu authored
      80b4c71c
    • eir@cis.upenn.edu's avatar
      Constrained types have kind * in validity check. · bafbde7e
      eir@cis.upenn.edu authored
      This addresses #11405, but a deeper problem lurks.
      Try test dependent/should_compile/T11405 and see comment:3
      on the ticket.
      bafbde7e
    • eir@cis.upenn.edu's avatar
      Fix #11254. · 39ea4b4b
      eir@cis.upenn.edu authored
      This moves the call to tcSubType into the context of the
      checkInstConstraints call, allowing the deferred type error
      somewhere to hang its hat.
      39ea4b4b
    • eir@cis.upenn.edu's avatar
      Fix #11311 · 6c07f142
      eir@cis.upenn.edu authored
      All things of kind *, including * itself, need to have a PtrRep.
      
      Test: dependent/should_compile/T11311
      6c07f142
    • eir@cis.upenn.edu's avatar
      Test #11252 in ghci/scripts/T11252 · d4af57fa
      eir@cis.upenn.edu authored
      This one worked for me out of the box.
      d4af57fa
    • eir@cis.upenn.edu's avatar
      Fix #11355. · e6ca9300
      eir@cis.upenn.edu authored
      Previously, the check for impredicative type applications was
      in the wrong spot.
      
      Test case: typecheck/should_fail/T11355
      e6ca9300
    • Ryan Scott's avatar
      Expand type/kind synonyms in TyVars before deriving-related typechecking · 165ae440
      Ryan Scott authored
      Before, it was possible to have a datatypes such as
      
      ```
      type ConstantT a b = a
      newtype T (f :: * -> *) (a :: ConstantT * f) = T (f a) deriving Functor
      
      data family TFam (f :: * -> *) (a :: *)
      newtype instance TFam f (ConstantT a f) = TFam (f a) deriving Functor
      ```
      
      fail to eta-reduce because either (1) a TyVar had a kind synonym that
      mentioned another TyVar, or (2) an instantiated type was itself a type
      synonym that mentioned another TyVar. A little bit of tweaking to
      `expandTypeSynonyms` and applying it before the eta-reduction check in
      the `deriving` machinery is sufficient to fix this.
      
      Fixes #11416.
      
      Test Plan: ./validate
      
      Reviewers: goldfire, simonpj, austin, bgamari
      
      Reviewed By: simonpj
      
      Subscribers: thomie
      
      Differential Revision: https://phabricator.haskell.org/D1772
      
      GHC Trac Issues: #11416
      165ae440
    • Matthew Pickering's avatar
      Allow pattern synonyms which have several clauses. · 443bf044
      Matthew Pickering authored
      But still disallow empty pattern synonym builder declarations. Handling
      this incorrectly was the cause of #11367.
      
      Test Plan: ./validate
      
      Reviewers: austin, bgamari
      
      Reviewed By: bgamari
      
      Subscribers: thomie
      
      Differential Revision: https://phabricator.haskell.org/D1779
      
      GHC Trac Issues: #11367
      443bf044
    • Peter Trommler's avatar
      Link command line libs to temp so · c6a3e227
      Peter Trommler authored
      Symbols in libraries specified on the GHCis command line are
      not available to compiled modules because shared libraries
      are loaded with local scope. So we link all libraries specified
      on the command line into each temporary shared library.
      
      Test Plan: validate
      
      Reviewers: simonmar, hvr, austin, bgamari
      
      Reviewed By: bgamari
      
      Subscribers: thomie
      
      Differential Revision: https://phabricator.haskell.org/D1631
      
      GHC Trac Issues: #10458
      c6a3e227
  5. 14 Jan, 2016 2 commits
  6. 13 Jan, 2016 2 commits
  7. 09 Jan, 2016 4 commits
  8. 08 Jan, 2016 5 commits
    • Rik Steenkamp's avatar
      Fix test for T9367 (Windows) · 1cdf12c4
      Rik Steenkamp authored
      See c8c44fd9.
      
      Reviewed By: thomie, bgamari
      
      Differential Revision: https://phabricator.haskell.org/D1745
      1cdf12c4
    • Simon Marlow's avatar
      Rename the test-way prof_h to normal_h · 10769a1b
      Simon Marlow authored
      10769a1b
    • Simon Marlow's avatar
      Fix +RTS -h when compiling without -prof · c33e7c2b
      Simon Marlow authored
      Summary:
      Was broken by ce1f1607.  I've added a
      test so that hopefully it won't break again.
      
      Test Plan: validate & new test case
      
      Reviewers: bgamari, austin, erikd
      
      Subscribers: thomie
      
      Differential Revision: https://phabricator.haskell.org/D1746
      
      GHC Trac Issues: #11304
      c33e7c2b
    • Ryan Scott's avatar
      Fix Template Haskell's handling of infix GADT constructors · 01634277
      Ryan Scott authored
      This is the second (and hopefully last) fix needed to make TH handle
      GADTs properly (after D1465). This Diff addresses some issues with infix
      GADT constructors, specifically:
      
      * Before, you could not determine if a GADT constructor was declared
        infix because TH did not give you the ability to determine if there is
        a //user-specified// fixity declaration for that constructor. The
        return type of `reifyFixity` was changed to `Maybe Fixity` so that it
        yields `Just` the fixity is there is a fixity declaration, and
        `Nothing` otherwise (indicating it has `defaultFixity`).
      * `DsMeta`/`Convert` were changed so that infix GADT constructors are
        turned into `GadtC`, not `InfixC` (which should be reserved for
        Haskell98 datatype declarations).
      * Some minor fixes to the TH pretty-printer so that infix GADT
        constructors will be parenthesized in GADT signatures.
      
      Fixes #11345.
      
      Test Plan: ./validate
      
      Reviewers: goldfire, austin, bgamari, jstolarek
      
      Reviewed By: jstolarek
      
      Subscribers: thomie
      
      Differential Revision: https://phabricator.haskell.org/D1744
      
      GHC Trac Issues: #11345
      01634277
    • Simon Marlow's avatar
      Enable stack traces with ghci -fexternal-interpreter -prof · 6be09e88
      Simon Marlow authored
      Summary:
      The main goal here is enable stack traces in GHCi.  After this change,
      if you start GHCi like this:
      
        ghci -fexternal-interpreter -prof
      
      (which requires packages to be built for profiling, but not GHC
      itself) then the interpreter manages cost-centre stacks during
      execution and can produce a stack trace on request.  Call locations
      are available for all interpreted code, and any compiled code that was
      built with the `-fprof-auto` familiy of flags.
      
      There are a couple of ways to get a stack trace:
      
      * `error`/`undefined` automatically get one attached
      * `Debug.Trace.traceStack` can be used anywhere, and prints the current
        stack
      
      Because the interpreter is running in a separate process, only the
      interpreted code is running in profiled mode and the compiler itself
      isn't slowed down by profiling.
      
      The GHCi debugger still doesn't work with -fexternal-interpreter,
      although this patch gets it a step closer.  Most of the functionality
      of breakpoints is implemented, but the runtime value introspection is
      still not supported.
      
      Along the way I also did some refactoring and added type arguments to
      the various remote pointer types in `GHCi.RemotePtr`, so there's
      better type safety and documentation in the bridge code between GHC
      and ghc-iserv.
      
      Test Plan: validate
      
      Reviewers: bgamari, ezyang, austin, hvr, goldfire, erikd
      
      Subscribers: thomie
      
      Differential Revision: https://phabricator.haskell.org/D1747
      
      GHC Trac Issues: #11047, #11100
      6be09e88
  9. 07 Jan, 2016 6 commits
    • Gabor Greif's avatar
      Typos in docs and comments · c78fedde
      Gabor Greif authored
      c78fedde
    • Simon Peyton Jones's avatar
      Test Trac #10625 · 1ee92293
      Simon Peyton Jones authored
      1ee92293
    • Simon Peyton Jones's avatar
      Make demand analysis understand catch · 9915b656
      Simon Peyton Jones authored
      As Trac #11222, and #10712 note, the strictness analyser
      needs to be rather careful about exceptions.  Previously
      it treated them as identical to divergence, but that
      won't quite do.
      
      See Note [Exceptions and strictness] in Demand, which
      explains the deal.
      
      Getting more strictness in 'catch' and friends is a
      very good thing.  Here is the nofib summary, keeping
      only the big ones.
      
      --------------------------------------------------------------------------------
              Program           Size    Allocs   Runtime   Elapsed  TotalMem
      --------------------------------------------------------------------------------
                fasta          -0.1%     -6.9%     -3.0%     -3.0%     +0.0%
                  hpg          -0.1%     -2.0%     -6.2%     -6.2%     +0.0%
             maillist          -0.1%     -0.3%      0.08      0.09     +1.2%
      reverse-complem          -0.1%    -10.9%     -6.0%     -5.9%     +0.0%
               sphere          -0.1%     -4.3%      0.08      0.08     +0.0%
                 x2n1          -0.1%     -0.0%      0.00      0.00     +0.0%
      --------------------------------------------------------------------------------
                  Min          -0.2%    -10.9%    -17.4%    -17.3%     +0.0%
                  Max          -0.0%     +0.0%     +4.3%     +4.4%     +1.2%
       Geometric Mean          -0.1%     -0.3%     -2.9%     -3.0%     +0.0%
      
      On the way I did quite a bit of refactoring in Demand.hs
      9915b656
    • Simon Peyton Jones's avatar
      Turn AThing into ATcTyCon, in TcTyThing · a5cea73c
      Simon Peyton Jones authored
      This change tidies up and simplifies (a bit) the knot-tying
      when kind-checking groups of type and class declarations.
      
      The trouble (shown by Trac #11356) was that we wanted an error message
      (a kind-mismatch) that involved a type mentioned a (AThing k), which
      blew up.
      
      Since we now seem to have TcTyCons, I decided to use them here.
      It's still not great, but it's easier to understand and more robust.
      a5cea73c
    • Simon Peyton Jones's avatar
      Use an Implication in 'deriving' error · 02c1c573
      Simon Peyton Jones authored
      Trac #11437 showed that erroneous constraints from a 'deriving'
      clause need to be wrapped in an Implication to properly scope
      their skolems.
      
      The main change is in TcDeriv.simplifyDeriv; the call to
      buildImplicationFor is new.
      02c1c573
    • Simon Peyton Jones's avatar
      Tidy up tidySkolemInfo · 290a553e
      Simon Peyton Jones authored
      Previously tidySkolemInfo used tidyOpenType, and returned a new
      TidyEnv.  But that's not needed any more, because all the skolems
      should be in scope in the constraint tree.
      
      I also removed a (now-unnecessary) field of UnifyForAllSkol
      290a553e
  10. 06 Jan, 2016 4 commits