1. 06 Jan, 2015 1 commit
    • Simon Peyton Jones's avatar
      Make the location in TcLclEnv and CtLoc into a RealSrcSpan · d2b6e767
      Simon Peyton Jones authored
      Previously it was a SrcSpan, which can be an UnhelpulSrcSpan,
      but actually for TcLclEnv and CtLoc we always know it is
      a real source location, and it's good to make the types
      reflect that fact.
      
      There is a continuing slight awkwardness (not new with this
      patch) about what "file name" to use for GHCi code.  Current
      we say "<interactive>" which seems just about OK.
      d2b6e767
  2. 03 Jan, 2015 2 commits
  3. 31 Dec, 2014 2 commits
    • Simon Peyton Jones's avatar
      When solving one Given from another, use the depth to control which way round · d8d00318
      Simon Peyton Jones authored
      See Note [Replacement vs keeping].
      
      There's a bit further to go with this change (to report unused givens).
      But it's already an improvement; see the latent bug described in the Note.
      d8d00318
    • Simon Peyton Jones's avatar
      Eliminate the final two calls to xCtEvidence · fd97d2a7
      Simon Peyton Jones authored
      I always found calls to TcCanonical.xCtEvidence hard to grok; and I
      found that we only had two left. This patch eliminates them, along
      with xCtEvidence, its accompanying comments, and the auxiliary
      XEvTerm type.
      
      The two remaining calls were these:
      
       * One was in newSCWorkFromFlavored, where we'd already done
         case-splitting for given/wanted/derived.  So inlining the xCtEvidence
         made the code simpler, clearer, and faster.
      
       * The other was in canTuple; here all of xCtEvidence's functionality
         was needed, but inlining again made a net gain in code size and
         clarity.
      fd97d2a7
  4. 30 Dec, 2014 2 commits
  5. 29 Dec, 2014 1 commit
    • Peter Trommler's avatar
      Fix system linker on Mac OS X · b32c2276
      Peter Trommler authored
      Summary:
      Flag `-l:` is GNU ld specific and not supported by the
      Mac OS X link editor. So we create a temporary file name
      lib<tmpname>.<so_ext> and link with the standard -l<tmpname>
      option on Linux and OS X.
      
      Fixes #9875
      
      Test Plan: validate on Mac OS X
      
      Reviewers: austin, hvr, ezyang
      
      Reviewed By: ezyang
      
      Subscribers: carter, thomie, ezyang
      
      Differential Revision: https://phabricator.haskell.org/D579
      
      GHC Trac Issues: #9875
      b32c2276
  6. 28 Dec, 2014 2 commits
    • Erik de Castro Lopo's avatar
      LlvmCodeGen cross-compiling fixes (#9895) · 58ac9c8f
      Erik de Castro Lopo authored
      Summary:
      * Throw an error when cross-compiling without a target definition.
        When cross compiling via LLVM, a target 'datalayout' and 'triple' must
        be defined or LLVM will generate code for the compile host instead of
        the compile target.
      
      * Add aarch64-unknown-linux-gnu target.
        The datalayout and triple lines were found by using clang to compile a
        small C program and -emit-llvm to get the LLVM IR output.
      Signed-off-by: Erik de Castro Lopo's avatarErik de Castro Lopo <erikd@mega-nerd.com>
      
      Test Plan: validate
      
      Reviewers: rwbarton, carter, hvr, bgamari, austin
      
      Reviewed By: austin
      
      Subscribers: carter, thomie, garious
      
      Differential Revision: https://phabricator.haskell.org/D585
      
      GHC Trac Issues: #9895
      58ac9c8f
    • cactus's avatar
      Support pattern synonyms in GHCi (fixes #9900) · 0cc0cc86
      cactus authored
      This involves recognizing lines starting with `"pattern "` as declarations,
      keeping non-exported pattern synonyms in `deSugar`, and including
      pattern synonyms in the result of `hscDeclsWithLocation`.
      0cc0cc86
  7. 27 Dec, 2014 1 commit
  8. 24 Dec, 2014 1 commit
    • rwbarton's avatar
      Fix linker interaction between Template Haskell and HPC (#9762) · 3e3aa925
      rwbarton authored
      Summary:
      I'm not really happy about perpetuating the hackish fix for #8696,
      but at least in the context of building with -fhpc, the performance
      cost should be negligible.
      
      I'm suspicious about PlainModuleInitLabel and the Windows stuff too,
      but I don't know what it does / can't test it (respectively) so I'll
      leave those alone for now.
      
      Hopefully out-of-process TH will save us from these hacks some day.
      
      The test is an adaptation of T8696. It's a bit more awkward since
      I couldn't think of a way to get cross-module tickbox references
      without optimizations (inlining), but ghci doesn't permit -O for
      some reason.
      
      Test Plan: harbormaster; validate
      
      Reviewers: austin
      
      Reviewed By: austin
      
      Subscribers: carter, thomie
      
      Differential Revision: https://phabricator.haskell.org/D583
      
      GHC Trac Issues: #9762
      
      Conflicts:
      	testsuite/tests/ghci/scripts/all.T
      3e3aa925
  9. 23 Dec, 2014 9 commits
    • Simon Peyton Jones's avatar
      Test earlier for self-import (Trac #9032) · edd233ac
      Simon Peyton Jones authored
      This patch makes the renamer check for self-import, especially when
      dependencies change, because the typechecker can fall over if that
      happens.
      
      I'm still uneasy about *indirect* self-import, but I'll leave that for
      another day
      edd233ac
    • Simon Peyton Jones's avatar
      A bit of refactoring to TcErrors · 679a6618
      Simon Peyton Jones authored
      This replaces a bunch of boolean flags in ReportErrCtxt with
      an algebraic data type to say how to handle expression holes
      and type holes
      
      No change in functionality; I just found myself unable to understand
      the code easily, when thinking about something else.  Result is
      quite nice, I think.
      679a6618
    • Simon Peyton Jones's avatar
      Comments only · c407b5a6
      Simon Peyton Jones authored
      c407b5a6
    • Simon Peyton Jones's avatar
    • Simon Peyton Jones's avatar
      Eliminate so-called "silent superclass parameters" · a6f0f5ab
      Simon Peyton Jones authored
      The purpose of silent superclass parameters was to solve the
      awkward problem of superclass dictinaries being bound to bottom.
      See THE PROBLEM in Note [Recursive superclasses] in TcInstDcls
      
      Although the silent-superclass idea worked,
      
        * It had non-local consequences, and had effects even in Haddock,
          where we had to discard silent parameters before displaying
          instance declarations
      
        * It had unexpected peformance costs, shown up by Trac #3064 and its
          test case.  In monad-transformer code, when constructing a Monad
          dictionary you had to pass an Applicative dictionary; and to
          construct that you neede a Functor dictionary. Yet these extra
          dictionaries were often never used.  (All this got much worse when
          we added Applicative as a superclass of Monad.) Test T3064
          compiled *far* faster after silent superclasses were eliminated.
      
        * It introduced new bugs.  For example SilentParametersOverlapping,
          T5051, and T7862, all failed to compile because of instance overlap
          directly because of the silent-superclass trick.
      
      So this patch takes a new approach, which I worked out with Dimitrios
      in the closing hours before Christmas.  It is described in detail
      in THE PROBLEM in Note [Recursive superclasses] in TcInstDcls.
      
      Seems to work great!
      
      Quite a bit of knock-on effect
      
       * The main implementation work is in tcSuperClasses in TcInstDcls
         Everything else is fall-out
      
       * IdInfo.DFunId no longer needs its n-silent argument
         * Ditto IDFunId in IfaceSyn
         * Hence interface file format changes
      
       * Now that DFunIds do not have silent superclass parameters, printing
         out instance declarations is simpler. There is tiny knock-on effect
         in Haddock, so that submodule is updated
      
       * I realised that when computing the "size of a dictionary type"
         in TcValidity.sizePred, we should be rather conservative about
         type functions, which can arbitrarily increase the size of a type.
         Hence the new datatype TypeSize, which has a TSBig constructor for
         "arbitrarily big".
      
       * instDFunType moves from TcSMonad to Inst
      
       * Interestingly, CmmNode and CmmExpr both now need a non-silent
         (Ord r) in a couple of instance declarations. These were previously
         silent but must now be explicit.
      
       * Quite a bit of wibbling in error messages
      a6f0f5ab
    • Simon Peyton Jones's avatar
      Add a small comment · 625dd7b6
      Simon Peyton Jones authored
      625dd7b6
    • Sergei Trofimovich's avatar
      dwarf: sync getIdFromTrivialExpr with exprIsTrivial (test break028 and others) · 30fdf86e
      Sergei Trofimovich authored
      Summary:
      The bug manifests when built with
          EXTRA_HC_OPTS += -g
      
      +++ ./ghci.debugger/scripts/break028.run.stderr 2014-12-19 23:08:46.199876621 +0000
      @@ -0,0 +1,11 @@
      +ghc-stage2: panic! (the 'impossible' happened)
      +  (GHC version 7.9.20141219 for x86_64-unknown-linux):
      +       getIdFromTrivialExpr x_alJ
      +
      +Please report this as a GHC bug:  http://www.haskell.org/ghc/reportabug
      +
      +
      +<interactive>:3:1: Not in scope: ‘g’
      +
      +<interactive>:3:3: Not in scope: data constructor ‘False’
      Signed-off-by: default avatarSergei Trofimovich <siarheit@google.com>
      
      Reviewers: simonmar, austin, scpmw
      
      Reviewed By: scpmw
      
      Subscribers: carter, thomie
      
      Differential Revision: https://phabricator.haskell.org/D580
      30fdf86e
    • thomasw's avatar
      Rename NamedWildcards flag to NamedWildCards · 089222c9
      thomasw authored
      Summary:
      Mind the capital C. As there is already a flag RecordWildCards with a capital
      C, we should at least try to be consistent in the spelling of WildCards.
      
      Test Plan: validate
      
      Reviewers: goldfire, simonpj, austin
      
      Reviewed By: simonpj, austin
      
      Subscribers: carter, thomie
      
      Differential Revision: https://phabricator.haskell.org/D584
      089222c9
    • thomasw's avatar
      Fix panic on :kind _ in GHCi (Trac #9879) · 6eb86a56
      thomasw authored
      Summary:
      Running `:kind _` in GHCi produced a panic, fix it by extracting the
      wildcards. Now, `:kind _` produces `_ :: k0`. Unfortunately, a `0` is
      added after the kind is tidied and I haven't found a way to get rid of
      it...
      
      This does not fix the other panic involving TemplateHaskell mentioned
      in #9879.
      
      Test Plan: new test GHCiWildcardKind should pass
      
      Reviewers: austin, simonpj
      
      Reviewed By: austin
      
      Subscribers: simonpj, carter, thomie, monoidal
      
      Differential Revision: https://phabricator.haskell.org/D572
      
      GHC Trac Issues: #9879
      6eb86a56
  10. 22 Dec, 2014 4 commits
  11. 20 Dec, 2014 4 commits
  12. 19 Dec, 2014 2 commits
  13. 18 Dec, 2014 3 commits
    • Simon Peyton Jones's avatar
      6ec9e958
    • Adam Gundry's avatar
      Amend TcPluginM interface · 726ea08a
      Adam Gundry authored
      Summary:
      Expose some new functions in TcPluginM and remove one, in the light of
      experience writing plugins.  In particular, I've removed lookupRdrName
      because using it to import modules containing instances leads to subtle
      bugs; I've expanded on the lookupRdrNameInModuleForPlugins comments.
      
      Test Plan: validate
      
      Reviewers: simonpj, austin
      
      Reviewed By: austin
      
      Subscribers: goldfire, ezyang, carter, thomie, yav, gridaphobe
      
      Differential Revision: https://phabricator.haskell.org/D553
      
      Conflicts:
      	compiler/typecheck/TcSMonad.hs
      726ea08a
    • Iavor S. Diatchki's avatar
      Add a provenance field to universal coercions. · 1d4e94d1
      Iavor S. Diatchki authored
      Universal coercions allow casting between arbitrary types, so it is a
      good idea to keep track where they came from, which now we can do by
      using the provenance field in `UnivCo`.
      
      This is also handy for type-checker plugins that provide functionality
      beyond what's expressible by GHC's standard coercions:  such plugins
      can generate universal coercions, but they should still tag them,
      so that if something goes wrong we can link the casts to the plugin.
      1d4e94d1
  14. 17 Dec, 2014 6 commits
    • Gabor Greif's avatar
      Typo in note · 7719b637
      Gabor Greif authored
      7719b637
    • Gabor Greif's avatar
      Typos in comments · ae1f2718
      Gabor Greif authored
      ae1f2718
    • eir@cis.upenn.edu's avatar
      Performance enhancements in TcFlatten. · 922168fd
      eir@cis.upenn.edu authored
      This commit fixes some performance regressions introduced by 0cc47eb9,
      adding more `Coercible` magic to the solver. See Note
      [flatten_many performance] in TcFlatten for more info.
      
      The improvements do not quite restore the old numbers. Given that
      the solver is really more involved now, I am accepting this regression.
      
      The way forward (I believe) would be to have *two* flatteners: one
      that deals only with nominal equalities and thus never checks roles,
      and the more general one. A nice design of keeping this performant
      without duplicating code eludes me, but someone else is welcome
      to take a stab.
      922168fd
    • Simon Peyton Jones's avatar
      Fix egregious bug in the new canonicalisation code for AppTy · 517908fc
      Simon Peyton Jones authored
      Fixes Trac #9892.
      
      Must form part of 7.10.1
      517908fc
    • Simon Peyton Jones's avatar
      Improve TidyPgm.hasCafRefs to account for Integer literals (Trac #8525) · 6b11bab6
      Simon Peyton Jones authored
      See Note [Disgusting computation of CafRefs] in TidyPgm.
      
      Also affects CoreUtils.rhsIsStatic.
      
      The real solution here is to compute CAF and arity information
      from the STG-program, and feed it back to tidied program for
      the interface file and later GHCi clients.  A battle for another
      day.
      
      But at least this commit reduces the number of gratuitous CAFs, and
      hence SRT entries.  And kills off a batch of ASSERT failures.
      6b11bab6
    • Simon Peyton Jones's avatar
      Fix GHCi/GHC-API tidying and modules (Trac #9424, #9426) · 67a0cab6
      Simon Peyton Jones authored
      There were two related bugs here
      
      Trac #9426
         We must increment the ic_mod_index field of the InteractiveContext
         if we have new instances, because we maek DFunIds that should be
         distinct from previous ones.  Previously we were only incrementing
         when defining new user-visible Ids.
      
         The main change is in HscTypes.extendInteractiveContext, which now
         alwyas bumps the ic_mod_index.  I also added a specialised
         extendInteractiveContextWithIds for the case where we are *only*
         adding new user-visible Ids.
      
      Trac #9424
         In HscMain.hscDeclsWithLocations we were failing to use the
         *tidied* ClsInsts; but the un-tidied ones are LocalIds which
         causes a later ASSERT error.
      
         On the way I realised that, to behave consistently, the tcg_insts
         and tcg_fam_insts field of TcGblEnv should really only contain
         instances from the current GHCi command, not all the ones to date.
         That in turn meant I had to move the code for deleting replacement
         instances from addLocalInst, addLocalFamInst to
         HscTypes.extendInteractiveContext
      67a0cab6