1. 03 Oct, 2017 4 commits
    • Takenobu Tani's avatar
      user-guide: fix examples of ghci commands · 83e438ee
      Takenobu Tani authored
      Fix examples of ghci commands:
        * correct typos
        * add top-level binding without let statement
        * modify Time.getClockTime to Data.Time.getZonedTime
        * modify Directory.setCurrentDirectory
        * modify ghc version number
      Test Plan: build
      Reviewers: austin, bgamari
      Reviewed By: bgamari
      Subscribers: rwbarton, thomie
      Differential Revision: https://phabricator.haskell.org/D3852
      (cherry picked from commit 33856696)
    • Takenobu Tani's avatar
      user-guide: add `:type +d` and `:type +v` in release highlight · 61c7b3d4
      Takenobu Tani authored
      Add new ghci command to release highlight and fix link anchor.
      This commit is for ghc-8.2 branch.
      Test Plan: build
      Reviewers: austin, bgamari
      Reviewed By: bgamari
      Subscribers: rwbarton, thomie
      GHC Trac Issues: #11975
      Differential Revision: https://phabricator.haskell.org/D3850
      (cherry picked from commit 82ee71fa)
    • Ben Gamari's avatar
      Model divergence of retry# as ThrowsExn, not Diverges · 6a328506
      Ben Gamari authored
      The demand signature of the retry# primop previously had a Diverges
      result.  However, this caused the demand analyser to conclude that a
      program of the shape,
          catchRetry# (... >> retry#)
      would diverge. Of course, this is plainly wrong; catchRetry#'s sole
      reason to exist is to "catch" the "exception" thrown by retry#. While
      catchRetry#'s demand signature correctly had the ExnStr flag set on its
      first argument, indicating that it should catch divergence, the logic
      associated with this flag doesn't apply to Diverges results. This
      resulted in #14171.
      The solution here is to treat the divergence of retry# as an exception.
      Namely, give it a result type of ThrowsExn rather than Diverges.
      Updates stm submodule for tests.
      Test Plan: Validate with T14171
      Reviewers: simonpj, austin
      Subscribers: rwbarton, thomie
      GHC Trac Issues: #14171, #8091
      Differential Revision: https://phabricator.haskell.org/D3919
      (cherry picked from commit 10a1a478)
    • niteria's avatar
      [RTS] Make -po work · 18d66feb
      niteria authored
      db2a6676 added `-po` option, but
      the part that parses it was missing.
      Test Plan:
      On a simple file:
      ./inplace/bin/ghc-stage2 A.hs -prof -main-is A; ./A +RTS -P -potest
      produced test.prof file and didn't produce A.prof file.
      ./A +RTS -P
      produced A.prof file
      Reviewers: simonmar, bgamari, austin, erikd
      Reviewed By: bgamari
      Subscribers: rwbarton, thomie
      Differential Revision: https://phabricator.haskell.org/D3946
      (cherry picked from commit b6b56dd1)
  2. 02 Oct, 2017 4 commits
  3. 30 Sep, 2017 1 commit
    • Ben Gamari's avatar
      Use libpthread instead of libthr on FreeBSD · fd201db6
      Ben Gamari authored
      Since #847 we have used libthr due to reported hangs with FreeBSD's
      KSE-based M:N pthread implementation. However, this was nearly 12 years
      ago and today libpthread seems to work fine. Moreover, adding -lthr to
      the linker flags break when used in conjunction with -r when gold is
      used (since -l and -r are incompatible although BFD ld doesn't
      Test Plan: Validate on FreeBSD
      Reviewers: kgardas, austin
      Subscribers: rwbarton, thomie
      GHC Trac Issues: #847
      Differential Revision: https://phabricator.haskell.org/D3773
      (cherry picked from commit d8051c6c)
  4. 29 Sep, 2017 2 commits
    • Ben Gamari's avatar
      configure: Make sure we try all possible linkers · 5bce35ca
      Ben Gamari authored
      Previously if we had both ld.lld and ld.gold installed but a gcc which
      didn't support -fuse-ld=lld we would fail when trying ld.lld and fall
      immediately back to plain ld. Now we will try ld.gold as well. This was
      brought to light by #14280, where using ld.bfd resulted in a broken
      stage2 compiler.
      Test Plan: Configure
      Reviewers: angerman, hvr, austin
      Reviewed By: angerman
      Subscribers: rwbarton, thomie, erikd
      GHC Trac Issues: #14280
      Differential Revision: https://phabricator.haskell.org/D4038
      (cherry picked from commit a10729f0)
    • Ben Gamari's avatar
      includes/rts: Drop trailing comma · e84d76d3
      Ben Gamari authored
      This trailing comma snuck in in a recent patch. There is nothing wrong with the
      comma; it's perfectly valid C99, yet nevertheless Mac OS X's dtrace utility
      chokes on it with,
          dtrace: failed to compile script rts/RtsProbes.d:
                  "includes/rts/EventLogFormat.h", line 245: syntax error near "}"
          make[1]: *** [rts/dist/build/RtsProbes.h] Error 1
      (cherry picked from commit be514a69)
  5. 28 Sep, 2017 1 commit
    • Simon Marlow's avatar
      mkDataConRep: fix bug in strictness signature (#14290) · a0671e2d
      Simon Marlow authored
      The strictness signature for a data con wrapper wasn't including any
      dictionary arguments, which meant that bangs on the fields of a
      constructor with an existential context would be moved to the wrong
      fields.  See T14290 for an example.
      Test Plan:
      * New test T14290
      * validate
      Reviewers: simonpj, niteria, austin, bgamari, erikd
      Reviewed By: simonpj, bgamari
      Subscribers: rwbarton, thomie
      GHC Trac Issues: #14290
      Differential Revision: https://phabricator.haskell.org/D4040
      (cherry picked from commit 5935acdb)
  6. 27 Sep, 2017 4 commits
  7. 26 Sep, 2017 5 commits
  8. 19 Sep, 2017 16 commits
    • Ben Gamari's avatar
      Revert "Improve error messages around kind mismatches." · 00c959e6
      Ben Gamari authored
      This reverts commit eb870ae0.
      This reverts commit 6a024a55.
      There was some disagreement in #11198 regarding whether this patch was
      in fact the right solution to the issue at hand.
    • Alan Zimmerman's avatar
      Option "-ddump-rn-ast" dumps imports and exports too · 31bf2003
      Alan Zimmerman authored
      Previously the renamed source decls only were dumped, now the imports, exports
      and doc_hdr are too.
      Test Plan: ./validate
      Reviewers: bgamari, austin
      Reviewed By: bgamari
      Subscribers: rwbarton, thomie
      GHC Trac Issues: #14197
      Differential Revision: https://phabricator.haskell.org/D3949
      (cherry picked from commit 2fe6f6ba)
    • Ben Gamari's avatar
      SetLevels: Substitute in ticks in lvlMFE · 9565e526
      Ben Gamari authored
      Previously SetLevels.lvlMFE would fail to substitute in ticks, unlike
      lvlExpr.  This lead to #13481. Fix this.
      Test Plan: `make test TEST=T12622 WAY=ghci`
      Reviewers: austin, simonpj
      Reviewed By: simonpj
      Subscribers: simonpj, rwbarton, thomie
      GHC Trac Issues: #13481
      Differential Revision: https://phabricator.haskell.org/D3920
      (cherry picked from commit cd857dd4)
    • Ben Gamari's avatar
      rts: Add heap breakdown type for -hT · 3b2fc86a
      Ben Gamari authored
      Test Plan: Build, program with `-eventlog`, try running with `+RTS -h`
      Reviewers: austin, erikd, simonmar
      Subscribers: rwbarton, thomie
      GHC Trac Issues: #14096
      Differential Revision: https://phabricator.haskell.org/D3922
      (cherry picked from commit 24e50f98)
    • Ben Gamari's avatar
      eventlog: Clean up profiling heap breakdown type · 46367997
      Ben Gamari authored
      Reviewers: austin, erikd, simonmar
      Subscribers: rwbarton, thomie
      GHC Trac Issues: #14096
      Differential Revision: https://phabricator.haskell.org/D3923
      (cherry picked from commit 822abbb1)
    • David Feuer's avatar
      Deal with unbreakable blocks in Applicative Do · 55b27a32
      David Feuer authored
      The renamer wasn't able to deal with more than a couple strict
      patterns in a row with `ApplicativeDo` when using the heuristic
      splitter. Update it to work with them properly.
      Reviewers: simonmar, austin, bgamari, hvr
      Reviewed By: simonmar
      Subscribers: RyanGlScott, lippling, rwbarton, thomie
      GHC Trac Issues: #14163
      Differential Revision: https://phabricator.haskell.org/D3900
      (cherry picked from commit 011e15aa)
    • Ben Gamari's avatar
      Better document TypeRep patterns · 14195b09
      Ben Gamari authored
      As pointed out in #14199 these are rather non-trivial; extra
      documentation is in order.
      [skip ci]
      Test Plan: Read it
      Reviewers: dfeuer, austin, hvr
      Subscribers: rwbarton, thomie
      GHC Trac Issues: #14199
      Differential Revision: https://phabricator.haskell.org/D3943
      (cherry picked from commit f9bf621c)
    • Simon Peyton Jones's avatar
      Really fix Trac #14158 · 13cd53df
      Simon Peyton Jones authored
      I dug more into how #14158 started working. I temporarily reverted the
      patch that "fixed" it, namely
          commit a6c448b4
          Author: Simon Peyton Jones <simonpj@microsoft.com>
          Date:   Mon Aug 28 17:33:59 2017 +0100
          Small refactor of getRuntimeRep
      Sure enough, there was a real bug, described in the new
      TcExpr Note [Visible type application zonk]
      In general, syntactic substituion should be kind-preserving!
      Maybe we should check that invariant...
      (cherry picked from commit 2c133b67)
    • Simon Peyton Jones's avatar
      Fix subtle bug in TcTyClsDecls.mkGADTVars · 8fda8ade
      Simon Peyton Jones authored
      This bug was revealed by Trac #14162.  In a GADT-style data-family
      instance we ended up a data constructor whose type mentioned
      an out-of-scope variable.  (This variable was in the kind of
      a variable in the kind of a variable.)
      Only Lint complained about this (actually only when the
      data constructor was injected into the bindings by CorePrep).
      So it doesn't matter much -- but it's a solid bug and might
      bite us some day.
      It took me quite a while to unravel because the test case was itself
      quite tricky.  But the fix is easy; just add a missing binding to the
      substitution we are building up.  It's in the regrettably-subtle
      mkGADTVars function.
      (cherry picked from commit 3a27e34f)
    • Alan Zimmerman's avatar
      Renamer now preserves location for IEThingWith list items · a153d2f2
      Alan Zimmerman authored
      Prior to this, in the RenamedSource for
          module Renaming.RenameInExportedType
            MyType (NT)
            ) where
          data MyType = MT Int | NT
      The (NT) was given the location of MyType earlier on the line in the
      export list.
      Also the location was discarded for any field labels, and replaced with
      a `noLoc`.
      Test Plan: ./validate
      Reviewers: bgamari, austin
      Reviewed By: bgamari
      Subscribers: rwbarton, thomie
      GHC Trac Issues: #14189
      Differential Revision: https://phabricator.haskell.org/D3968
      (cherry picked from commit 9498c50e)
    • Ryan Scott's avatar
      Fix #14228 by marking SumPats as non-irrefutable · fb519018
      Ryan Scott authored
      `isIrrefutableHsPat` should always return `False` for unboxed sum
      patterns (`SumPat`s), since they always have at least one other
      corresponding pattern of the same arity (since the minimum arity for a
      `SumPat` is 2). Failure to do so causes incorrect code to be generated
      for pattern synonyms that use unboxed sums, as shown in #14228.
      Test Plan: make test TEST=T14228
      Reviewers: austin, bgamari, simonpj
      Reviewed By: simonpj
      Subscribers: simonpj, rwbarton, thomie
      GHC Trac Issues: #14228
      Differential Revision: https://phabricator.haskell.org/D3951
      (cherry picked from commit f4d50a0e)
    • Ben Gamari's avatar
      Add a Note describing #14128 · 6cf6a69c
      Ben Gamari authored
      I prematurely committed the D3892 before adding a Note. Fix this.
      (cherry picked from commit 6f1ccaa5)
    • Ben Gamari's avatar
      testsuite: Add test for #14128 · 90979616
      Ben Gamari authored
      Reviewers: austin, goldfire
      Subscribers: rwbarton, thomie
      GHC Trac Issues: #14128
      Differential Revision: https://phabricator.haskell.org/D3890
      (cherry picked from commit 248ad303)
    • Ben Gamari's avatar
      desugar: Ensure that a module's dep_orphs doesn't contain itself · 609f4854
      Ben Gamari authored
      Consider that we have two modules, A and B, both with hs-boot files,
        * A.hs contains a SOURCE import of B
        * B.hs-boot contains a SOURCE import of A
        * A.hs-boot declares an orphan instance
        * A.hs defines the orphan instance
      In this case, B's dep_orphs will contain A due to its SOURCE import of
      A.  Consequently, A will contain itself in its imp_orphs due to its
      import of B.  This fact would end up being recorded in A's interface
      file. This would then break the invariant asserted by calculateAvails
      that a module does not itself in its dep_orphs. This was the cause
      of #14128.
      The solution is to remove self-references from imp_orphs when
      constructing dep_orphs; we already did a similar thing for dep_mods. I
      believe we should do the same for dep_finsts, although I'm treating this
      as a separate bug.
      Reviewers: austin
      Subscribers: rwbarton, thomie
      Differential Revision: https://phabricator.haskell.org/D3892
      (cherry picked from commit db3a8e16)
    • Richard Eisenberg's avatar
      Test #11672 in typecheck/should_fail/T11672. · 71724092
      Richard Eisenberg authored
      I believe this was fixed with the fix for #11198.
      (cherry picked from commit 9a549756)
    • Ben Gamari's avatar
      Fix tests · eb870ae0
      Ben Gamari authored
  9. 31 Aug, 2017 1 commit
    • Richard Eisenberg's avatar
      Improve error messages around kind mismatches. · 6a024a55
      Richard Eisenberg authored
      Previously, when canonicalizing (or unifying, in uType) a
      heterogeneous equality, we emitted a kind equality and used the
      resulting coercion to cast one side of the heterogeneous equality.
      While sound, this led to terrible error messages. (See the bugs
      listed below.) The problem is that using the coercion built from
      the emitted kind equality is a bit like a wanted rewriting a wanted.
      The solution is to keep heterogeneous equalities as irreducible.
      See Note [Equalities with incompatible kinds] in TcCanonical.
      This commit also removes a highly suspicious switch to FM_SubstOnly
      when flattening in the kinds of a type variable. I have no idea
      why this was there, other than as a holdover from pre-TypeInType.
      I've not left a Note because there is simply no reason I can conceive
      of that the FM_SubstOnly should be there.
      One challenge with this patch is that the emitted derived equalities
      might get emitted several times: when a heterogeneous equality is
      in an implication and then gets floated out from the implication,
      the Derived is present both in and out of the implication. This
      causes a duplicate error message. (Test case:
      typecheck/should_fail/T7368) Solution: track the provenance of
      Derived constraints and refuse to float out a constraint that has
      an insoluble Derived.
      Lastly, this labels one test (dependent/should_fail/RAE_T32a)
      as expect_broken, because the problem is really #12919. The
      different handling of constraints in this patch exposes the error.
      This fixes bugs #11198, #12373, #13530, and #13610.
      test cases:
      (cherry picked from commit 8e15e3d3)
  10. 29 Aug, 2017 2 commits
    • Tamar Christina's avatar
      Fix decomposition error on Windows · 625bea00
      Tamar Christina authored
      Fix the path decomposition error that occurs when the Symlink resolver
      fails. `Win32.try` throws an exception, so catch it and assume the path
      isn't a symlink to use the old behavior.
      Test Plan: ./validate
      Reviewers: austin, bgamari
      Reviewed By: bgamari
      Subscribers: rwbarton, thomie
      GHC Trac Issues: #14159
      Differential Revision: https://phabricator.haskell.org/D3891
      (cherry picked from commit 3c6b2fc3)
    • Simon Peyton Jones's avatar
      Small refactor of getRuntimeRep · cbf47238
      Simon Peyton Jones authored
      Instead of using a string argument, use HasDebugCallStack.
      (Oddly, some functions were using both!)
      Plus, use getRuntimeRep rather than getRuntimeRep_maybe when
      if the caller panics on Nothing. Less code, and a better debug
      (cherry picked from commit a6c448b4)