1. 27 Apr, 2018 9 commits
    • Simon Peyton Jones's avatar
      Make out-of-scope errors more prominent · 08003e7f
      Simon Peyton Jones authored
      Generally, when the type checker reports an error, more serious
      ones suppress less serious ones.
      
      A "variable out of scope" error is arguably the most serious of all,
      so this patch moves it to the front of the list instead of the end.
      
      This patch also fixes Trac #14149, which had
      -fdefer-out-of-scope-variables, but also had a solid type error.
      As things stood, the type error was not reported at all, and
      compilation "succeeded" with error code 0.  Yikes.
      
      Note that
      
      - "Hole errors" (including out of scope) are never suppressed.
        (maybeReportHoleError vs maybeReportError in TcErorrs)
        They can just get drowned by the noise.
      
      - But with the new orientation, out of scope errors will suppress
        type errors.  That would be easy to change.
      08003e7f
    • Simon Peyton Jones's avatar
      Refactor tcExtendLocalFamInst a bit · 0c01224b
      Simon Peyton Jones authored
      This patch just pulls out FamInst.loadDependentFamInstModules
      as a separate function, and adds better comments.
      
      Provoked by Trac #14759, comment:10.
      0c01224b
    • Simon Peyton Jones's avatar
      Comments only: the FVAnn invariant · 69119b20
      Simon Peyton Jones authored
      69119b20
    • Simon Peyton Jones's avatar
      Minor refactoring in Exitify · 512f5038
      Simon Peyton Jones authored
      No change in behaviour here, just some modest
      refactoring as I tried to understand the code
      better.
      512f5038
    • Simon Peyton Jones's avatar
      Add missing stdout file for T14955 · 56bbe1e4
      Simon Peyton Jones authored
      Accidentally omitted from Trac #14955 commit.
      56bbe1e4
    • Alan Zimmerman's avatar
      TTG : complete for balance of hsSyn AST · c3823cba
      Alan Zimmerman authored
      Summary:
      - remove PostRn/PostTc fields
      - remove the HsVect In/Out distinction for Type, Class and Instance
      - remove PlaceHolder in favour of NoExt
      - Simplify OutputableX constraint
      
      Updates haddock submodule
      
      Test Plan: ./validate
      
      Reviewers: goldfire, bgamari
      
      Subscribers: goldfire, thomie, mpickering, carter
      
      Differential Revision: https://phabricator.haskell.org/D4625
      c3823cba
    • Simon Peyton Jones's avatar
      Rename a local variable · 313720a4
      Simon Peyton Jones authored
      313720a4
    • Simon Peyton Jones's avatar
      Refactor in OccurAnal · 705dcb0d
      Simon Peyton Jones authored
      * (+++)                    -->  andUDs
      * combineAltsUsageDetails  -->  orUDs
      * combineUsageDetailsList  -->  andUDsList
      * Change some andUDsList to a fold for efficiency
      
      No change in behaviour
      705dcb0d
    • Simon Peyton Jones's avatar
      Comments only · 693857f3
      Simon Peyton Jones authored
      693857f3
  2. 26 Apr, 2018 1 commit
    • Simon Peyton Jones's avatar
      Do not unpack class dictionaries with INLINABLE · 3d38e828
      Simon Peyton Jones authored
      Matthew Pickering uncovered a bad performance hole in the way
      that single-method dictionaries work, described in Trac #14955.
      
      See Note [Do not unpack class dictionaries] in WwLib.
      
      I tried to fix this 6 years ago, but got it slightly wrong.  This patch
      fixes it, which makes a dramatic improvement in the test case.
      
      Nofib highlights: not much happening:
      
        Program           Size    Allocs   Runtime   Elapsed  TotalMem
      -----------------------------------------------------------------
            VSM          -0.3%     +2.7%     -7.4%     -7.4%      0.0%
      cacheprof          -0.0%     +0.1%     +0.3%     +0.7%      0.0%
        integer          -0.0%     +1.1%     +7.5%     +7.5%      0.0%
            tak          -0.1%     -0.2%     0.024     0.024      0.0%
      -----------------------------------------------------------------
            Min          -4.4%     -0.2%     -7.4%     -7.4%     -8.0%
            Max          +0.6%     +2.7%     +7.5%     +7.5%      0.0%
      Geom Mean          -0.1%     +0.0%     +0.1%     +0.1%     -0.2%
      
      I investigated VSM.  The patch unpacks class dictionaries a bit more
      than before (i.e. does so if there is no INLINABLE pragma). And that
      gives better code in VSM (less dictionary selection etc), but one closure
      gets one word bigger.
      
      I'll accept these changes in exchange for more robust performance.
      
      Some ghci.debugger output wobbled around (order of bindings
      being displayed). I have no idea why; but I accepted the changes.
      3d38e828
  3. 25 Apr, 2018 2 commits
    • Andrey Mokhov's avatar
      Update Hadrian submodule · 625eea93
      Andrey Mokhov authored
        * Link to Quick Start guide
        * Update README.md (hadrian/578)
        * Fix AppVeyor (hadrian/577)
        * Fix CircleCI
        * Generic library rules (hadrian/571)
        * Fix lint error (hadrian/575)
        * Fix missing libHSghc-8.5-0.a (hadrian/574)
        * Fix the path to touchy (hadrian/572)
        * Fix integer-gmp build (hadrian/568)
        * Undo fs*.h workaround
        * Fix copying of fs*.h files during RTS registration (hadrian/566)
        * Fix Windows build, improve error reporting (hadrian/565)
        * Fix Windows build (hadrian/563)
        * Fix boot and configure on AppVeyor (hadrian/561)
        * Preliminary bindist (hadrian/558, hadrian/555)
        * Unregister stage0 package first if it needs to be
          cloned (hadrian/552)
        * Fix Circle CI (hadrian/553)
        * Fix warnings (hadrian/547)
        * Merge pull request hadrian/542 from Mistuke/fix-specific-file
        * Use Cabal directly in place of ghc-cabal + make build root
          configurable (hadrian/531)
        * Add user-defined flavour example for turning off dynamic
          linking (hadrian/535)
        * Add clean routines for fs (hadrian/533)
        * Add 'git' to nativeBuildInputs in shell.nix (hadrian/530)
        * Add extra include paths when invoking ghc-cabal (hadrian/526)
        * Merge pull request hadrian/528 from snowleopard/bump-cabal
        * Merge pull request hadrian/521 from snowleopard/drop-chmod
        * Change permission bits for build.cabal.sh,
          fixes hadrian/517 (hadrian/520)
        * Pin nixpkgs and all-cabal-hashes in shell.nix (hadrian/511)
        * Add troubleshooting section
      625eea93
    • Ömer Sinan Ağacan's avatar
      Stable.c: minor refactoring, add/update some comments · acb73617
      Ömer Sinan Ağacan authored
      Test Plan: Passes validate
      
      Reviewers: simonmar, bgamari, erikd
      
      Subscribers: thomie, carter
      
      GHC Trac Issues: #10296
      
      Differential Revision: https://phabricator.haskell.org/D4627
      acb73617
  4. 24 Apr, 2018 3 commits
  5. 23 Apr, 2018 3 commits
  6. 22 Apr, 2018 1 commit
  7. 21 Apr, 2018 3 commits
  8. 20 Apr, 2018 10 commits
    • Tobias Dammers's avatar
      Remove unnecessary check in simplCast · 2a5bdd9a
      Tobias Dammers authored
      The coercion optimizer will take care of it anyway, and the check is
      prohibitively expensive.
      
      See Trac #14737.
      
      Reviewers: bgamari
      
      Subscribers: simonpj, thomie, carter
      
      Differential Revision: https://phabricator.haskell.org/D4568
      2a5bdd9a
    • Ben Gamari's avatar
      base: Add a test for T10412 · da743852
      Ben Gamari authored
      Expects the current behavior, will be updated by D4593 to reflect
      desired behavior.
      
      Reviewers: hvr
      
      Subscribers: thomie, carter
      
      GHC Trac Issues: #10412
      
      Differential Revision: https://phabricator.haskell.org/D4610
      da743852
    • Matthew Pickering's avatar
      Fix implementation of rnIfaceBndr · 698db813
      Matthew Pickering authored
      Reviewers: ezyang, bgamari
      
      Reviewed By: bgamari
      
      Subscribers: thomie, carter
      
      GHC Trac Issues: #15041
      
      Differential Revision: https://phabricator.haskell.org/D4600
      698db813
    • Matthew Pickering's avatar
      Remove broken top-level shell.nix · 430e6fed
      Matthew Pickering authored
      There is a maintained shell.nix file in the hadrian submodule. This
      has long since been broken anyway.
      
      Reviewers: bgamari
      
      Reviewed By: bgamari
      
      Subscribers: thomie, carter
      
      GHC Trac Issues: #15045
      
      Differential Revision: https://phabricator.haskell.org/D4599
      430e6fed
    • Simon Peyton Jones's avatar
      comments only · f6db0b20
      Simon Peyton Jones authored
      f6db0b20
    • Simon Peyton Jones's avatar
      Inline wrappers earlier · 8b10b896
      Simon Peyton Jones authored
      This patch has a single significant change:
      
        strictness wrapper functions are inlined earlier,
        in phase 2 rather than phase 0.
      
      As shown by Trac #15056, this gives a better chance for RULEs to fire.
      Before this change, a function that would have inlined early without
      strictness analyss was instead inlining late. Result: applying
      "optimisation" made the program worse.
      
      This does not make too much difference in nofib, but I've stumbled
      over the problem more than once, so even a "no-change" result would be
      quite acceptable.  Here are the headlines:
      
      --------------------------------------------------------------------------------
              Program           Size    Allocs   Runtime   Elapsed  TotalMem
      --------------------------------------------------------------------------------
            cacheprof          -0.5%     -0.5%     +2.5%     +2.5%      0.0%
               fulsom          -1.0%     +2.6%     -0.1%     -0.1%      0.0%
                 mate          -0.6%     +2.4%     -0.9%     -0.9%      0.0%
              veritas          -0.7%    -23.2%     0.002     0.002      0.0%
      --------------------------------------------------------------------------------
                  Min          -1.4%    -23.2%    -12.5%    -15.3%      0.0%
                  Max          +0.6%     +2.6%     +4.4%     +4.3%    +19.0%
       Geometric Mean          -0.7%     -0.2%     -1.4%     -1.7%     +0.2%
      
      * A worthwhile reduction in binary size.
      
      * Runtimes are not to be trusted much but look as if they
        are moving the right way.
      
      * A really big win in veritas, described in comment:1 of
        Trac #15056; more fusion rules fired.
      
      * I investigated the losses in 'mate' and 'fulsom'; see #15056.
      8b10b896
    • Tobias Dammers's avatar
      Caching coercion roles in NthCo and coercionKindsRole refactoring · 2fbe0b51
      Tobias Dammers authored
      While addressing nonlinear behavior related to coercion roles,
      particularly `NthCo`, we noticed that coercion roles are recalculated
      often even though they should be readily at hand already in most cases.
      This patch adds a `Role` to the `NthCo` constructor so that we can cache
      them rather than having to recalculate them on the fly.
      https://ghc.haskell.org/trac/ghc/ticket/11735#comment:23 explains the
      approach.
      
      Performance improvement over GHC HEAD, when compiling Grammar.hs (see below):
      
      GHC 8.2.1:
      ```
      ghc Grammar.hs  176.27s user 0.23s system 99% cpu 2:56.81 total
      ```
      
      before patch (but with other optimizations applied):
      ```
      ghc Grammar.hs -fforce-recomp  175.77s user 0.19s system 100% cpu 2:55.78 total
      ```
      
      after:
      ```
      ../../ghc/inplace/bin/ghc-stage2 Grammar.hs  10.32s user 0.17s system 98% cpu 10.678 total
      ```
      
      Introduces the following regressions:
      
      - perf/compiler/parsing001 (possibly false positive)
      - perf/compiler/T9872
      - perf/compil...
      2fbe0b51
    • Ryan Scott's avatar
      Bump transformers submodule · b41a42e3
      Ryan Scott authored
      This brings in a commit which migrates Contravariant instances from
      base to transformers.
      b41a42e3
    • Azel's avatar
      Fixes isAlphaNum re. isAlpha/isNumber and doc fix (trac issue #10412) · a26983a3
      Azel authored
      
      
      Corrects the inconsistency between Data.Char.isAlphaNum,
      Data.Char.isAlpha and Data.Char.isNumber. Indeed, isAlphaNum was
      returning True not only when isAlpha or isNumber returned True but
      also when isMark did. The selectors for the Mn, Mc and Me general
      categories where removed from the macro generating u_iswalnum in
      ubconfc.
      
      Also, Data.Char.isAlphaNum's documentation was changed to state that
      isAlphaNum returns true not only for Unicode number digits but for
      Unicode numbers in general in Unicode.hs.
      Signed-off-by: Azel's avatarARJANEN Loïc Jean David <arjanen.loic@gmail.com>
      
      Reviewers: hvr, ekmett, lelf, bgamari
      
      Reviewed By: bgamari
      
      Subscribers: thomie, carter
      
      GHC Trac Issues: #10412
      
      Differential Revision: https://phabricator.haskell.org/D4593
      a26983a3
    • Ryan Scott's avatar
      Lint types in newFamInst · 257c13d8
      Ryan Scott authored
      We weren't linting the types used in `newFamInst`, which
      might have been why #15012 went undiscovered for so long. Let's fix
      that.
      
      One has to be surprisingly careful with expanding type synonyms in
      `lintType`, since in the offending program (simplified):
      
      ```lang=haskell
      type FakeOut a = Int
      
      type family TF a
      type instance TF Int = FakeOut a
      ```
      
      If one expands type synonyms, then `FakeOut a` will expand to
      `Int`, which masks the issue (that `a` is unbound). I added an
      extra Lint flag to configure whether type synonyms should be
      expanded or not in Lint, and disabled this when calling `lintTypes`
      from `newFamInst`.
      
      As evidence that this works, I ran it on the offending program
      from #15012, and voilà:
      
      ```
      $ ghc3/inplace/bin/ghc-stage2 Bug.hs -dcore-lint
      [1 of 1] Compiling Foo              ( Bug.hs, Bug.o )
      ghc-stage2: panic! (the 'impossible' happened)
        (GHC version 8.5.20180417 for x86_64-unknown-linux):
              Core Lint error
        <no location info>: warning:
            In the type ‘... (Rec0 (FakeOut b_a1Qt))))’
            @ b_a1Qt is out of scope
      ```
      
      Test Plan: make test TEST=T15057
      
      Reviewers: simonpj, goldfire, bgamari
      
      Reviewed By: bgamari
      
      Subscribers: thomie, carter
      
      GHC Trac Issues: #15057
      
      Differential Revision: https://phabricator.haskell.org/D4611
      257c13d8
  9. 19 Apr, 2018 8 commits
    • Ben Gamari's avatar
      boot: Fix computation of TOP · 8fa688a8
      Ben Gamari authored
      Test Plan: Run `./boot`, check to make sure that
      `libraries/ghc-prim/GNUmakefile` is sane
      
      Subscribers: thomie, carter, sjakobi
      
      Differential Revision: https://phabricator.haskell.org/D4580
      8fa688a8
    • Ben Gamari's avatar
      configure: Use -Werror to check for existence of -no-pie · cbd73bbb
      Ben Gamari authored
      Clang throws a warning instead of an error when it is passed -no-pie,
      
          clang: warning: argument unused during compilation: '-nopie'
          [-Wunused-command-line-argument]
      
      Consequently configure concludes that it supports -no-pie. However, this
      will fail when used with -Werror. The solution is to simply use -Werror
      in the configure check.
      
      Thanks to @goldfire for reporting this.
      
      Reviewers: hvr
      
      Subscribers: thomie, carter, goldfire
      
      Differential Revision: https://phabricator.haskell.org/D4557
      cbd73bbb
    • Ben Gamari's avatar
      parsec: Make version hack compatible with Windows · 3c3e7310
      Ben Gamari authored
      Fixes D4609 on Windows by bumping parsec submodule.
      3c3e7310
    • Alp Mestanogullari's avatar
      testsuite: Fix `./validate --slow` · d9d80151
      Alp Mestanogullari authored
      This fixes all unexpected passes and unexpected failures from a
      `./validate --slow` run I did last week. I commented on many
      tickets and created a few more as I was going through the failing
      tests. A summary of the entire process is available at:
      
        https://gist.github.com/alpmestan/c371840968f086c8dc5b56af8325f0a9
      
      This is part of an attempt to have `./validate --slow` pass,
      tracked in #14890. Another patch will be necessary for the unexpected
      stats failures.
      
      Test Plan: ./validate --slow (not green yet)
      
      Reviewers: bgamari, simonmar
      
      Subscribers: thomie, carter
      
      Differential Revision: https://phabricator.haskell.org/D4546
      d9d80151
    • Ryan Scott's avatar
      Bump base to version 4.12.0.0 · 8f19ecc9
      Ryan Scott authored
      Summary: Bumps several submodules.
      
      Test Plan: ./validate
      
      Reviewers: hvr, bgamari
      
      Reviewed By: bgamari
      
      Subscribers: thomie, carter
      
      GHC Trac Issues: #15018
      
      Differential Revision: https://phabricator.haskell.org/D4609
      8f19ecc9
    • Ryan Scott's avatar
      Fix #15012 with a well-placed use of Any · b08a6d75
      Ryan Scott authored
      Previously, derived `Generic1` instances could have associated `Rep1`
      type family instances with unbound variables, such as in the following
      example:
      
      ```lang=haskell
      data T a = MkT (FakeOut a) deriving Generic1
      type FakeOut a = Int
      
      ==>
      
      instance Generic1 T where
        type Rep1 T = ... (Rec0 (FakeOut a))
      ```
      
      Yikes! To avoid this, we simply map the last type variable in a
      derived `Generic1` instance to `Any`.
      
      Test Plan: make test TEST=T15012
      
      Reviewers: bgamari
      
      Reviewed By: bgamari
      
      Subscribers: simonpj, thomie, carter
      
      GHC Trac Issues: #15012
      
      Differential Revision: https://phabricator.haskell.org/D4602
      b08a6d75
    • Tao He's avatar
      Better error message for empty character literal, for Trac #13450. · cac8be61
      Tao He authored
      For empty character literal, the `''`, report error message properly
      rather than just throw a "parser error" with wrong error location.
      
      Test Plan: make test TEST="T13450 T13450TH"
      
      Reviewers: goldfire, bgamari
      
      Reviewed By: bgamari
      
      Subscribers: thomie, mpickering, carter
      
      GHC Trac Issues: #13450
      
      Differential Revision: https://phabricator.haskell.org/D4594
      cac8be61
    • Ömer Sinan Ağacan's avatar
      Add a test for #14815: · f7f567d5
      Ömer Sinan Ağacan authored
      Because the program doesn't have any binders that -XStrict can make
      strict, the desugarer output should be identical when it's compiled with
      and without -XStrict. This wasn't the case with GHC 8.2.2, but
      apparently it was fixed some time between 8.2.2 and 8.4.1. We now add a
      test case to make sure it stays fixed.
      
      Reviewers: bgamari
      
      Reviewed By: bgamari
      
      Subscribers: simonpj, rwbarton, thomie, carter
      
      GHC Trac Issues: #14815
      
      Differential Revision: https://phabricator.haskell.org/D4531
      f7f567d5