1. 29 Sep, 2017 1 commit
    • 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)
      e84d76d3
  2. 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)
      a0671e2d
  3. 27 Sep, 2017 4 commits
  4. 26 Sep, 2017 5 commits
  5. 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.
      00c959e6
    • Alan Zimmerman's avatar
      Option "-ddump-rn-ast" dumps imports and exports too · 31bf2003
      Alan Zimmerman authored
      Summary:
      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)
      31bf2003
    • 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)
      9565e526
    • 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)
      3b2fc86a
    • 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)
      46367997
    • 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)
      55b27a32
    • 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)
      14195b09
    • 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)
      13cd53df
    • 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)
      8fda8ade
    • 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)
      a153d2f2
    • 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)
      fb519018
    • 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)
      6cf6a69c
    • 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)
      90979616
    • 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)
      609f4854
    • 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)
      71724092
    • Ben Gamari's avatar
      Fix tests · eb870ae0
      Ben Gamari authored
      eb870ae0
  6. 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:
      typecheck/should_fail/{T8262,T8603,tcail122,T12373,T13530,T13610}
      
      (cherry picked from commit 8e15e3d3)
      6a024a55
  7. 29 Aug, 2017 3 commits
    • Tamar Christina's avatar
      Fix decomposition error on Windows · 625bea00
      Tamar Christina authored
      Summary:
      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)
      625bea00
    • 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
      stack.
      
      (cherry picked from commit a6c448b4)
      cbf47238
    • Simon Peyton Jones's avatar
      Use a well-kinded substitution to instantiate · d913594f
      Simon Peyton Jones authored
      In tcDataConPat we were creating an ill-kinded substitution
      -- or at least one that is well kinded only after you have solved
      other equalities.  THat led to a crash, because the instantiated
      data con type was ill-kinded.
      
      This patch guarantees that the instantiating substitution is
      well-kinded.
      
      Fixed Trac #14154
      
      (cherry picked from commit 4455c86d)
      d913594f
  8. 25 Aug, 2017 9 commits
    • Simon Peyton Jones's avatar
      Do not discard insolubles in implications · a0558a5a
      Simon Peyton Jones authored
      Trac #14000 showed up two errors
      
      * In TcRnTypes.dropInsolubles we dropped all implications, which
        might contain the very insolubles we wanted to keep.  This was
        an outright error, and is why the out-of-scope error was actually
        lost altogether in Trac #14000
      
      * In TcSimplify.simplifyInfer, if there are definite (insoluble)
        errors, it's better to suppress the following ambiguity test,
        because the type may be bogus anyway.  See TcSimplify
        Note [Quantification with errors].  This fix seems a bit clunky,
        but it'll do for now.
      
      (cherry picked from commit 452755de)
      a0558a5a
    • Dmitry Malikov's avatar
      Fix string escaping in JSON · 17782568
      Dmitry Malikov authored
      It seems to that double quotes is not escaped well at the moment.
      
      We'd noticed this with @alexbiehl during the work on https://github.com/haskell/haddock/pull/645
      (cherry picked from commit e8fe12f8)
      17782568
    • Ben Gamari's avatar
      Ensure that we always link against libm · 71797e5e
      Ben Gamari authored
      ld.gold is particularly picky that we declare all of our link
      dependencies on Nix. See #14022.
      
      Test Plan: Validate on Nix
      
      Reviewers: austin
      
      Subscribers: hvr, rwbarton, thomie
      
      GHC Trac Issues: #14022
      
      Differential Revision: https://phabricator.haskell.org/D3787
      
      (cherry picked from commit 0e3c1016)
      71797e5e
    • Ryan Scott's avatar
      Fix #13947 by checking for unbounded names more · 45588a00
      Ryan Scott authored
      Commit 2484d4da accidentally dropped a
      call to `isUnboundName` in an important location. This re-adds it.
      
      Fixes #13947.
      
      Test Plan: make test TEST=T13947
      
      Reviewers: adamgundry, austin, bgamari
      
      Reviewed By: adamgundry
      
      Subscribers: rwbarton, thomie
      
      GHC Trac Issues: #13947
      
      Differential Revision: https://phabricator.haskell.org/D3718
      
      (cherry picked from commit 85ac65c5)
      45588a00
    • Richard Eisenberg's avatar
      Fix #11963 by checking for more mixed type/kinds · 18dee891
      Richard Eisenberg authored
      This is a straightforward fix -- there were just some omitted
      checks.
      
      test case: typecheck/should_fail/T11963
      
      (cherry picked from commit 10d13b62)
      18dee891
    • Ryan Scott's avatar
      Fix #14125 by normalizing data family instances more aggressively · c541129c
      Ryan Scott authored
      Summary:
      Commit 3540d1e1 inadvertently broke
      the ability for newtype instances to be used as marshallable types in FFI
      declarations. The reason is a bit silly: an extra check was added for type
      synonyms with no type families on the RHS in `normalise_tc_app`, but this check
      would only skip over type families, not //data// families, since the predicate
      being used was `not . isTypeFamilyCon`.
      
      The fix is simple: just use `not . isFamilyCon` instead so that data families
      are also skipped by this check.
      
      Test Plan: make test TEST=T14125
      
      Reviewers: goldfire, simonpj, austin, bgamari
      
      Reviewed By: simonpj
      
      Subscribers: rwbarton, thomie
      
      GHC Trac Issues: #14125
      
      Differential Revision: https://phabricator.haskell.org/D3865
      
      (cherry picked from commit 6982ee99)
      c541129c
    • Edward Z. Yang's avatar
      Fix incorrect retypecheck loop in -j (#14075) · 122b0141
      Edward Z. Yang authored
      The parallel codepath was incorrectly retypechecking the
      hs-boot ModIface prior to typechecking the hs file,
      which was inconsistent with the non-parallel case.  The
      non-parallel case gets it right: you don't want to retypecheck
      the hs-boot file itself (forwarding its declarations to hs)
      because you need it to be consistently knot-tied with itself
      when you compare the interfaces.
      Signed-off-by: default avatarEdward Z. Yang <ezyang@cs.stanford.edu>
      
      Test Plan: validate
      
      Reviewers: bgamari, simonpj, austin
      
      Reviewed By: bgamari
      
      Subscribers: duog, rwbarton, thomie
      
      GHC Trac Issues: #14075
      
      Differential Revision: https://phabricator.haskell.org/D3815
      
      (cherry picked from commit 4717ce86)
      122b0141
    • Ben Gamari's avatar
      KnownUniques: Handle DataCon wrapper names · fe535056
      Ben Gamari authored
      For some reason these weren't handled. I seem to remember thinking I had
      a reason for omitting them when writing the original patch, but I don't
      recall what that reason was at this point and clearly workers do show up
      in interface files.
      
      Test Plan: Validate against T14051
      
      Reviewers: austin
      
      Subscribers: rwbarton, thomie, RyanGlScott
      
      GHC Trac Issues: #14051
      
      Differential Revision: https://phabricator.haskell.org/D3805
      
      (cherry picked from commit 5a7af95a)
      fe535056
    • Ben Gamari's avatar
      CNF: Implement compaction for small pointer arrays · 67129048
      Ben Gamari authored
      Test Plan: Validate
      
      Reviewers: austin, erikd, simonmar, dfeuer
      
      Reviewed By: dfeuer
      
      Subscribers: rwbarton, andrewthad, thomie, dfeuer
      
      GHC Trac Issues: #13860, #13857
      
      Differential Revision: https://phabricator.haskell.org/D3888
      
      (cherry picked from commit 5f3d2d3b)
      67129048