1. 24 Jun, 2016 4 commits
    • Simon Peyton Jones's avatar
      Fix renamer panic · 393928db
      Simon Peyton Jones authored
      This patch fixes Trac #12216 and #12127.  The 'combine' function
      in 'imp_occ_env' in RnNames.filterImports checked for an empty
      field-selector list, which was (a) unnecessary and (b) wrong.
      
      I've elaborated the comments.
      
      This does NOT fix #11959 which is related but not the same
      (it concerns bundling of pattern synonyms).
      393928db
    • Simon Peyton Jones's avatar
      Comments around invisibility · c871ce49
      Simon Peyton Jones authored
      Very minor
      c871ce49
    • Simon Peyton Jones's avatar
      Improve typechecking of instance defaults · d2958bd0
      Simon Peyton Jones authored
      In an instance declaration when you don't specify the code for a
      method, GHC fills in from the default binding in the class.
      The type of the default method can legitmiately be ambiguous ---
      see Note [Default methods in instances] in TcInstDcls --- so
      typechecking it can be tricky.
      
      Trac #12220 showed that although we were dealing with that ambiguity
      for /vanilla/ default methods, we were not doing so for /generic/
      default methods.  Moreover we were dealing with it clumsily, by
      generating post-typechecked code.
      
      This patch fixes the bug AND deletes code!  We now use the same code
      path for both vanilla and generic default methods; and generate
      /pre-typechecked/ code in both cases.  The key trick is that we can use
      Visible Type Application to deal with the ambiguity, which wasn't
      possible before.  Hooray.
      
      There is a small hit to performance in compiler/perf/T1969 which
      consists of nothing BUT instance declarations with several default
      methods to fill, which we now have to typecheck. The actual hit is
      from 724 -> 756 or 4% in that extreme example.  Real world programs
      have vastly fewer instance decls.
      d2958bd0
    • thomie's avatar
      df9611ee
  2. 23 Jun, 2016 11 commits
    • eir@cis.upenn.edu's avatar
      Release notes for #11975 and #10963 · 4ae950fb
      eir@cis.upenn.edu authored
      4ae950fb
    • eir@cis.upenn.edu's avatar
      Fix #10963 and #11975 by adding new cmds to GHCi. · 8035d1a5
      eir@cis.upenn.edu authored
      See the user's guide entry or the Note [TcRnExprMode] in TcRnDriver.
      
      Test cases: ghci/scripts/T{10963,11975}
      8035d1a5
    • eir@cis.upenn.edu's avatar
      Fix #11974 by adding a more smarts to TcDefaults. · 9a34bf19
      eir@cis.upenn.edu authored
      Test cases:
        typecheck/should_compile/T11974
        typecheck/should_fail/T11974b
      9a34bf19
    • eir@cis.upenn.edu's avatar
      Very confusing typo in error message. · 7f5d5603
      eir@cis.upenn.edu authored
      7f5d5603
    • niteria's avatar
      Remove Ord TyCon · bb740218
      niteria authored
      After 35d1564c: Provide Uniquable version of SCC we
      can remove this. We want to remove it because when used
      it can introduce unnecessary nondeterminism.
      
      GHC Trac: #4012
      bb740218
    • niteria's avatar
      Provide Uniquable version of SCC · 35d1564c
      niteria authored
      We want to remove the `Ord Unique` instance because there's
      no way to implement it in deterministic way and it's too
      easy to use by accident.
      
      We sometimes compute SCC for datatypes whose Ord instance
      is implemented in terms of Unique. The Ord constraint on
      SCC is just an artifact of some internal data structures.
      We can have an alternative implementation with a data
      structure that uses Uniquable instead.
      
      This does exactly that and I'm pleased that I didn't have
      to introduce any duplication to do that.
      
      Test Plan:
      ./validate
      I looked at performance tests and it's a tiny bit better.
      
      Reviewers: bgamari, simonmar, ezyang, austin, goldfire
      
      Subscribers: thomie
      
      Differential Revision: https://phabricator.haskell.org/D2359
      
      GHC Trac Issues: #4012
      35d1564c
    • Facundo Domínguez's avatar
      Have Core linter accept programs using StaticPointers and -fhpc. · 7fc20b02
      Facundo Domínguez authored
      Summary:
      This patch uses collectArgsTicks instead of collectArgs to test that
      StaticPtr only occurs at the top of RHSs of top-level expressions.
      
      Ticks introduced by -fhpc would interfere otherwise.
      
      Test Plan: ./validate
      
      Reviewers: thomie, austin, goldfire, bgamari, simonpj
      
      Reviewed By: simonpj
      
      Differential Revision: https://phabricator.haskell.org/D2355
      
      GHC Trac Issues: #12207
      7fc20b02
    • Simon Peyton Jones's avatar
      Narrow the use of record wildcards slightly · 2f8cd14f
      Simon Peyton Jones authored
      In reviewing the fix to Trac #12130 I found the wild-card
      fill-in code for ".." notation in record constructions hard
      to understand.  It went to great contortions (including the
      find_tycon code) to allow
          data T = C { x, y :: Int }
          f x = C { .. }
      to expand to
          f x = C { x = x, y = y }
      where 'y' is an /imported function/!  That seems way over the top
      for what record wildcards are supposed to do.
      
      So I have narrowed the record-wildcard expansion to include only
      /locally-bound/ variables; i.e. not top level, and certainly not
      imported.
      
      I don't think anyone is using record wildcards in this bizarre way, so
      I don't expect any fallout. Even if there is, you can easily
      initialise fields with eponymous but imported values by hand.
      
      An intermediate position would be to allow /local/ top-level
      definitions.  But I doubt anyone is doing that either.
      
      Let's see if there's any fallout.  It's a local change, easy to
      revert, so I've just gone ahead to save everyone's time.
      2f8cd14f
    • Simon Peyton Jones's avatar
      Narrow the warning for simplifiable constraints · 643706e4
      Simon Peyton Jones authored
      In Trac #11948 I added the warning
          -Wsimplifiable-class-constraints
      which warns if the class constraints in a type signature are
      simplifiable.
      
      But in fact the fragility it warns about only happens with
      NoMonoLocalBinds, so this patch switches off the warning if
      you have MonoLocalBinds (and suggests using it in the error
      message).
      
      See Note [Simplifiable given constraints] in TcValidity.
      643706e4
    • Simon Peyton Jones's avatar
      Remove unused import · e556f768
      Simon Peyton Jones authored
      e556f768
    • Simon Peyton Jones's avatar
      Give lookupGRE_Name a better API · 3e0af469
      Simon Peyton Jones authored
      lookupGRE_Name should return either zero or one GREs, never
      several. This is a consequence of INVARIANT 1 on GlobalRdrEnv.
      
      So it's better if it returns a Maybe; the panic on multiple results
      is put in one place, instead of being scattered or ignored.
      
      Just refactoring, no change in behaviour
      3e0af469
  3. 22 Jun, 2016 13 commits
    • Simon Peyton Jones's avatar
      Test Trac #12163 · 210a2e12
      Simon Peyton Jones authored
      210a2e12
    • Simon Peyton Jones's avatar
      Expand given superclasses more eagerly · ce97b729
      Simon Peyton Jones authored
      This patch fixes Trac #12175, another delicate corner case of
      Note [Instance and Given overlap] in TcInteract.
      
      In #12175 we were not expanding given superclasses eagerly
      enough. It was easy to fix, and is actually rather neater than
      before.
      
      See Note [Eagerly expand given superclasses] in TcCanonical.
      The main change is to move the eager expansion of given superclasses
      to canClassNC.
      ce97b729
    • Simon Peyton Jones's avatar
      Remove unused arg to tcSuperClasses · a1b33596
      Simon Peyton Jones authored
      We don't need the FamInstEnvs argument any more.
      Just a tiny refactor.
      a1b33596
    • Simon Peyton Jones's avatar
      Improve error message in deriving( Functor ) · cc92a446
      Simon Peyton Jones authored
      Fixes Trac #12163.  Pretty simple.
      cc92a446
    • Simon Peyton Jones's avatar
      Comments only · 7e7aeab2
      Simon Peyton Jones authored
      7e7aeab2
    • Simon Marlow's avatar
      Accept new (lower) allocations for T7257 · 15641b07
      Simon Marlow authored
      15641b07
    • niteria's avatar
      Make the Ord Module independent of Unique order (2nd try) · 348f2dbb
      niteria authored
      The `Ord Module` instance currently uses `Unique`s for comparison.
      We don't want to use the `Unique` order because it can introduce
      nondeterminism.
      This switches `Ord ModuleName` and `Ord UnitId` to use lexicographic
      ordering making `Ord Module` deterministic transitively.
      
      I've run `nofib` and it doesn't make a measurable difference.
      
      See also Note [ModuleEnv determinism and performance].
      
      This fixes #12191 - the regression, that the previous version of this
      patch had.
      
      Test Plan:
      ./validate
      run nofib: P112
      
      Reviewers: simonmar, bgamari, austin
      
      Subscribers: thomie
      
      Differential Revision: https://phabricator.haskell.org/D2354
      
      GHC Trac Issues: #4012, #12191
      348f2dbb
    • niteria's avatar
      Don't error on GCC inlining warning in rts · 93f40cb9
      niteria authored
      The warning for reference:
      ```
      rts/RaiseAsync.c: In function ‘throwToMsg’:
      
      rts/SMPClosureOps.h:65:0: error:
           error: inlining failed in call to ‘lockClosure’: call is unlikely
      and code size would grow
      
      rts/RaiseAsync.c:305:0: error:  error: called from here
      
      rts/SMPClosureOps.h:65:0: error:
           error: inlining failed in call to ‘lockClosure’: call is unlikely
      and code size would grow
      ```
      
      This warning triggers on `gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-16)`
      and it doesn't trigger with new GCCs.
      
      Test Plan: build ghc/rts
      
      Reviewers: bgamari, simonmar, austin
      
      Subscribers: thomie
      
      Differential Revision: https://phabricator.haskell.org/D2353
      93f40cb9
    • Gabor Greif's avatar
      More typos in comments [skip ci] · 61995883
      Gabor Greif authored
      61995883
    • Gabor Greif's avatar
      Typos in comments [skip ci] · 4e7d8350
      Gabor Greif authored
      4e7d8350
    • Simon Marlow's avatar
      9d62d09a
    • Simon Marlow's avatar
      Fix build breakage due to rebase · c0583a9e
      Simon Marlow authored
      c0583a9e
    • Simon Marlow's avatar
      Second attempt to fix sizeExpr · a47b62cb
      Simon Marlow authored
      Summary:
      Background:
      * sizeExpr was calculating expressions like ((e `cast` T) x) wrongly
      * Fixing it caused regressions in compile performance, and one nofib
        program (k-nucleotide)
      
      I managed to fix the source of the compiler regressions.  I think it was
      due to traceTc not being inlined, which I fixed in a more robust way by
      putting an export list on TcRnMonad.
      
      The k-nucleotide regression is more difficult.  I don't think anything
      is actually going wrong, but this program has been highly tuned and is
      quite sensitive to changing in inlining behaviour.  I managed to recover
      most of the performance by manual lambda-lifting which makes it a bit
      less fragile, but the end result was a bit slower.  I don't think this
      is disastrous, the program is pretty horrible to begin with and we could
      probably make a faster one by starting from scratch.
      
      Test Plan: validate, nofib
      
      Reviewers: simonpj, bgamari, niteria, austin, erikd
      
      Subscribers: thomie
      
      Differential Revision: https://phabricator.haskell.org/D2338
      
      GHC Trac Issues: #11564
      a47b62cb
  4. 21 Jun, 2016 5 commits
    • niteria's avatar
      Make checkFamInstConsistency less expensive · 12306294
      niteria authored
      Doing canonicalization on every comparison turned
      out to be very expensive.
      
      Caching the canonicalization through the smart `modulePair` constructor
      gives `8%` reduction in allocations on `haddock.compiler` and
      `8.5%` reduction in allocations on `haddock.Cabal`.
      Possibly other things as well, but it's really visible in Haddock.
      
      Test Plan: ./validate
      
      Reviewers: jstolarek, simonpj, austin, simonmar, bgamari
      
      Reviewed By: simonpj, simonmar
      
      Subscribers: thomie
      
      Differential Revision: https://phabricator.haskell.org/D2350
      
      GHC Trac Issues: #12191
      12306294
    • Simon Peyton Jones's avatar
      Delete commented-out code · 97a50f82
      Simon Peyton Jones authored
      Richard: in a previous commit I combined the two case for
      
         decideQuantification
      
      This commit just deletes the old code. I'm afraid it'll leave you
      with a merge conflict though, with your stuff on generalisation.
      97a50f82
    • Simon Peyton Jones's avatar
      Don't quantify over Refl in a RULE · d09e982c
      Simon Peyton Jones authored
      This fixes Trac #12212.  It's quite hard to provoke, but I've
      added a standalone test case that does so.
      
      The issue is explained in Note [Evidence foralls] in Specialise.
      d09e982c
    • Gabor Greif's avatar
      Typos in comments · 7301404d
      Gabor Greif authored
      7301404d
    • Simon Marlow's avatar
      ee3bde79
  5. 20 Jun, 2016 7 commits
    • thomie's avatar
      Testsuite: assume timeout_prog always exists · e170d197
      thomie authored
      Merge the following functions into one:
        * rawSystem
        * rawSystemWithTimeout
        * runCmd
        * runCmdFor
        * runCmdExitCode
      
      I don't know why this wasn't done before.
      e170d197
    • thomie's avatar
      Testsuite: delete dead code + cleanup · ebaf26b7
      thomie authored
      * Set config settings directly in mk/test.mk, instead of indirectly in
        config/ghc
      * passing --hpcdir for WAY=hpc is unnecessary
      ebaf26b7
    • thomie's avatar
      Testsuite: remove `-Wno-warn-tabs` from default flags · 135fc86c
      thomie authored
      This allows the removal of the override_flags stuff in testlib.py.
      135fc86c
    • thomie's avatar
      Testsuite: delete TEST_HC_OPTS_NO_RECOMP · 82f7f182
      thomie authored
      The previous commits removed `-fforce-recomp` from TEST_HC_OPTS, so
      TEST_HC_OPTS_NO_RECOMP = TEST_HC_OPTS.
      82f7f182
    • thomie's avatar
      Testsuite: remove `-fforce-recomp` from default flags (#11980) · 3b49f8fa
      thomie authored
      There is no need for this flag anymore, since each test runs in a
      newly created directory. Removing it cleans up testlib.py a bit.
      
      There is a small risk that this renders some tests useless. It's hard to
      know. Those tests should have specified -fforce-recomp` explicitly
      anyway, so I'm not going to worry about it. I've fixed the ones that
      failed without -fforce-recomp.
      
      Reviewed by: bgamari
      
      Differential Revision: https://phabricator.haskell.org/D2346
      3b49f8fa
    • thomie's avatar
      Testsuite: mark tests expect broken · 1d938aa3
      thomie authored
      * CgStaticPointers, GcStaticPointers, ListStaticPointers,
        TcStaticPointers01, TcStaticPointers02:  #12207
      * T11535: #12210
      * ffi017/ffi021: #12209
      * T11108: #11108
      * T9646: #9646
      1d938aa3
    • thomie's avatar
      Testsuite: *do* replace backslashes in config.libdir · 1ddc10bb
      thomie authored
      See `Note [Replacing backward slashes in config.libdir]`
      
      There is one caveat: in ae4acbd1
      I mentioned:
      
        > Changing backwards slashes to forward slashes apparently confuses
        > msys2/mingw magic path handling.
      
      I can not reproduce that problem anymore, however.
      
      This patch validates for me, and fixes all tests that use config.libdir
      for WAY=ghci. We'll see how it goes.
      1ddc10bb