1. 11 May, 2015 11 commits
    • Edward Z. Yang's avatar
      Support stage 1 Template Haskell (non-quasi) quotes, fixes #10382. · f16ddcee
      Edward Z. Yang authored
      Summary:
      This commit adds stage 1 support for Template Haskell
      quoting, e.g. [| ... expr ... |], which is useful
      for authors of quasiquoter libraries that do not actually
      need splices.  The TemplateHaskell extension now does not
      unconditionally fail; it only fails if the renamer encounters
      a splice that it can't run.
      
      In order to make sure the referenced data structures
      are consistent, template-haskell is now a boot library.
      There are some minor BC changes to template-haskell to make it boot
      on GHC 7.8.
      
      Note for reviewer: big diff changes are simply code
      being moved out of an ifdef; there was no other substantive
      change to that code.
      Signed-off-by: default avatarEdward Z. Yang <ezyang@cs.stanford.edu>
      
      Test Plan: validate
      
      Reviewers: simonpj, austin, goldfire
      
      Subscribers: bgamari, thomie
      
      Differential Revision: https://phabricator.haskell.org/D876
      
      GHC Trac Issues: #10382
      f16ddcee
    • Alan Zimmerman's avatar
      ApiAnnotations : PatBind gives wrong SrcSpan for the pattern. · ecc3d6be
      Alan Zimmerman authored
      Summary:
      The production for decl_no_th starts
      
          decl_no_th :: { Located (OrdList (LHsDecl RdrName)) }
                  : sigdecl               { $1 }
      
                  | '!' aexp rhs  {% do { let { e = sLL $1 $> (SectionR (sL1 $1 (HsVar bang_RDR)) $2) };
                                          pat <- checkPattern empty e;
          ...
      
      The e value should be just the pattern, excluding the rhs, but the span
      created includes the rhs.
      
      Test Plan: ./validate
      
      Reviewers: hvr, austin
      
      Reviewed By: austin
      
      Subscribers: bgamari, thomie, mpickering
      
      Differential Revision: https://phabricator.haskell.org/D873
      
      GHC Trac Issues: #10358
      ecc3d6be
    • Alan Zimmerman's avatar
      ApiAnnotations : pquals production adds AnnVbar in the wrong place · fe38195e
      Alan Zimmerman authored
      Summary:
      The Parser.y production for pquals is
      
          pquals :: { Located [[LStmt RdrName (LHsExpr RdrName)]] }
              : squals '|' pquals
                               {% addAnnotation (gl $ last $ unLoc $1) AnnVbar (gl $2) >>
                                  return (sLL $1 $> (reverse (unLoc $1) : unLoc $3)) }
              | squals         { L (getLoc $1) [reverse (unLoc $1)] }
      
      The squals are returned in reverse order, so the AnnVbar should be
      attached to the head of the list, not the last.
      
      Test Plan: ./validate
      
      Reviewers: hvr, austin
      
      Reviewed By: austin
      
      Subscribers: thomie, mpickering
      
      Differential Revision: https://phabricator.haskell.org/D869
      
      GHC Trac Issues: #10357
      fe38195e
    • Austin Seipp's avatar
      Fix build breakage from 9736c042 · f35d621d
      Austin Seipp authored
      This was a snaffu caused by my in-tree patch actually differing from the
      Phab one slightly. Whoops.
      Signed-off-by: default avatarAustin Seipp <austin@well-typed.com>
      f35d621d
    • Alan Zimmerman's avatar
      ApiAnnotations : BooleanFormula construction discards original · 24707d72
      Alan Zimmerman authored
      Summary:
      The MINIMAL pragma is captured in the parser using a BooleanFormula.
      
      The constructors (mkBool,mkAnd,mkOr) are smart and try to minimise the
      boolean formula as it is constructed.
      
      This discards the original information, making round tripping
      impossible.
      
      Note: there is another version which provides a more API Annotations
      friendly version of the MINIMAL pragma, but this requires changes to
      haddock, which will cause problems for 7.10.2.
      
      See https://github.com/alanz/ghc/tree/wip/10287
      
      Test Plan: ./validate
      
      Reviewers: hvr, austin
      
      Reviewed By: austin
      
      Subscribers: bgamari, Fuuzetsu, thomie, mpickering
      
      Differential Revision: https://phabricator.haskell.org/D837
      
      GHC Trac Issues: #10287
      24707d72
    • Austin Seipp's avatar
      compiler: make sure we reject -O + HscInterpreted · 9736c042
      Austin Seipp authored
      When using GHCi, we explicitly reject optimization, because the
      compilers optimization passes can introduce unboxed tuples, which the
      interpreter is not able to handle. But this goes the other way too: using
      GHCi on optimized code may cause the optimizer to float out breakpoints
      that the interpreter introduces. This manifests itself in weird ways,
      particularly if you as an API client use custom DynFlags to introduce
      optimization in combination with HscInterpreted.
      
      It turns out we weren't checking for consistent DynFlag settings when
      doing `setSessionDynFlags`, as #10052 showed. While the main driver
      handled it in `DynFlags` via `parseDynamicFlags`, we didn't check this
      elsewhere.
      
      This does a little refactoring to split out some of the common code, and
      immunizes the various `DynFlags` utilities in the `GHC` module from this
      particular bug. We should probably be checking other general invariants
      too.
      
      This fixes #10052, and adds some notes about the behavior in `GHC` and
      `FloatOut`
      
      As a bonus, expose `warningMsg` from `ErrUtils` as a helper since it
      didn't exist (somehow).
      Signed-off-by: default avatarAustin Seipp <austin@well-typed.com>
      
      Reviewed By: edsko
      
      Differential Revision: https://phabricator.haskell.org/D727
      
      GHC Trac Issues: #10052
      9736c042
    • Simon Marlow's avatar
      More accurate allocation stats for :set +s · cf7573b8
      Simon Marlow authored
      The point of this commit is to make the memory allocation statistic
      from :set +s in GHCi a lot more accurate.  Currently it uses the total
      allocation figure calculated by the RTS, which is only updated during
      GC, so can be wrong by an arbitrary amount.  The fix is to the the
      per-thread allocation counter that was introduced for allocation
      limits.
      
      This required changes to the GHC API, because we now have to return
      the allocation value from each evaluation.  Rather than just change
      the API, I introduced a new API and deprecated the old one.  The new
      one is simpler and more extensible, so hopefully we won't need to make
      this transition in the future.  See GHC.hs for details.
      cf7573b8
    • Austin Seipp's avatar
      haddock: update submodule to fix #10206 · 2666ba36
      Austin Seipp authored
      Signed-off-by: default avatarAustin Seipp <austin@well-typed.com>
      2666ba36
    • Joachim Breitner's avatar
      IdInfo comment update · 27aa733a
      Joachim Breitner authored
      occInfo and callArityInfo is like demandInfo and oneShotInfo: Data about
      how the Id is used. [skip ci]
      27aa733a
    • Alan Zimmerman's avatar
      ApiAnnotations : mkGadtDecl discards annotations for HsFunTy · e4032b19
      Alan Zimmerman authored
      Summary:
      When mkGadtDecl is presented wih a HsFunTy it discards the SrcSpan, thus
      disconnecting any annotations on the HsFunTy.
      
      ```
      mkGadtDecl names (L ls (HsForAllTy imp Nothing qvars cxt tau))
        = return $ mk_gadt_con names
        where
          (details, res_ty)           -- See Note [Sorting out the result type]
            = case tau of
                L _ (HsFunTy (L l (HsRecTy flds)) res_ty)
                                                  -> (RecCon (L l flds), res_ty)
                _other                                    -> (PrefixCon [], tau)
      ...
      ```
      
      This can be triggered by the following
      
      ```
      {-# LANGUAGE GADTs #-}
      module GADTRecords2 (H1(..)) where
      
      -- | h1
      data H1 a b where
        C3 :: (Num a) => { field :: a -- ^ hello docs
                         } -> H1 Int Int
      ```
      
      Test Plan: ./validate
      
      Reviewers: hvr, austin
      
      Reviewed By: austin
      
      Subscribers: bgamari, thomie, mpickering
      
      Differential Revision: https://phabricator.haskell.org/D848
      
      GHC Trac Issues: #10309
      e4032b19
    • Alan Zimmerman's avatar
      Api Annotations: RdrHsSyn.mkAtDefault causes annotations to be disconnected. · 811b72ad
      Alan Zimmerman authored
      Summary:
      The code for mkAtDefault is as follows.
      
          mkATDefault (L loc (TyFamInstDecl { tfid_eqn = L _ e }))
                | TyFamEqn { tfe_tycon = tc, tfe_pats = pats, tfe_rhs = rhs } <- e
                = do { tvs <- checkTyVars (ptext (sLit "default")) equalsDots tc (hswb_cts pats)
                     ; return (L loc (TyFamEqn { tfe_tycon = tc
                                               , tfe_pats = tvs
                                               , tfe_rhs = rhs })) }
      
      An associated type in a class of the form
      
          type FoldableConstraint t x = ()
      
      has an AnnEqual attached to the location in tfid_eqn. Since the location
      is discarded, this annotation is then disconnected from the AST.
      
      Test Plan: ./validate
      
      Reviewers: hvr, austin
      
      Reviewed By: austin
      
      Subscribers: bgamari, thomie, mpickering
      
      Differential Revision: https://phabricator.haskell.org/D842
      
      GHC Trac Issues: #10307
      811b72ad
  2. 09 May, 2015 6 commits
  3. 08 May, 2015 4 commits
  4. 07 May, 2015 4 commits
  5. 06 May, 2015 11 commits
  6. 05 May, 2015 2 commits
  7. 04 May, 2015 2 commits