1. 04 Oct, 2018 7 commits
    • Simon Peyton Jones's avatar
      Better pretty-printing of forall types · 37ef7031
      Simon Peyton Jones authored
      Currently forall-types with a lot of type variables,
      or type variables with big kinds, are pretty-printed too
      horizontally, and dribble off to the right in an illegible
      way.
      
      This patch treats the type variables as a group, and uses
      'fsep' to lay them out decently.
      37ef7031
    • Simon Peyton Jones's avatar
      Fail fast on pattern synonyms · 9ebfa03d
      Simon Peyton Jones authored
      We were recovering too eagerly from errors in pattern-synonym
      type inference, leading to a cascade of confusing follow up errors
      (Trac #15685, #15692).
      
      The underlying issue is that a pattern synonym should have a closed,
      fixed type, with no unification variables in it.  But it wasn't!
      
      Fixing this made me change the interface to simplifyInfer slightly.
      Instead of /emitting/ a residual implication constraint, it
      now /returns/ it, so that the caller can decide what to do.
      9ebfa03d
    • Simon Peyton Jones's avatar
      Do not mark CoVars as dead in the occur-anal · 02b303ee
      Simon Peyton Jones authored
      For years we have been marking CoVars as dead, becuase we
      don't gather occurrence info from types.  This is obviously
      wrong and caused Trac #15695.
      
      See Note [Do not mark CoVars as dead] in OccurAnal.
      02b303ee
    • Simon Peyton Jones's avatar
      Make Lint check that for CoVars more carefully · e7ff9344
      Simon Peyton Jones authored
      Check than an Id of type (t1 ~# t2) is a CoVar; if not,
      it ends up in the wrong simplifier environment, with
      strange consequences. (Trac #15648)
      e7ff9344
    • Simon Peyton Jones's avatar
      Better comments and debug-print only · 43c2ffe7
      Simon Peyton Jones authored
      43c2ffe7
    • Simon Peyton Jones's avatar
      Better -ddump-types · e9e66402
      Simon Peyton Jones authored
      The debug flag -ddump-types is supposed to show the type
      of Ids, and the kinds of type constructors.  It was doing
      the former but not the latter -- instead it was using
      showTyTying, which is actually less helpful when debugging.
      
      This patch changes it to print the kind and roles of the thing.
      
      I also made -ddump-types show pattern synonyms
      e9e66402
    • Vladislav Zavialov's avatar
      Parse the (!) type operator and allow type operators in existential context · bd789853
      Vladislav Zavialov authored
      Summary:
      Improve the way `(!)`, `(~)`, and other type operators are handled in the parser,
      fixing two issues at once:
      
      1. `(!)` can now be used as a type operator
         that respects fixity and precedence (#15457)
      2. Existential context of a data constructor
         no longer needs parentheses (#15675)
      
      In addition to that, with this patch it is now trivial to adjust precedence of
      the `{-# UNPACK #-}` pragma, as suggested in
      https://ghc.haskell.org/trac/ghc/ticket/14761#comment:7
      
      There was a small change to API Annotations. Before this patch, `(~)` was a
      strange special case that produced an annotation unlike any other type
      operator. After this patch, when `(~)` or `(!)` are used to specify strictness they
      produce AnnTilde and AnnBang annotations respectively, and when they are used
      as type operators, they produce no annotations.
      
      Test Plan: Validate
      
      Reviewers: simonpj, bgamari, alanz, RyanGlScott
      
      Reviewed By: RyanGlScott
      
      Subscribers: RyanGlScott, rwbarton, mpickering, carter
      
      GHC Trac Issues: #15457, #15675
      
      Differential Revision: https://phabricator.haskell.org/D5180
      bd789853
  2. 03 Oct, 2018 4 commits
    • Joachim Breitner's avatar
      Make GHC (the library) flexible in the choice of integer library · fc2ff6dd
      Joachim Breitner authored
      Summary:
      We have more and more users of GHC as a library, for example the
      Haskell-to-WebAssembly-compiler https://github.com/tweag/asterius.
      These need to make different decisions about various aspects of
      code generation than the host compiler, and ideally GHC-the-library
      allows them to set the `DynFlags` as needed.
      
      This patch adds a new `DynFlag` that configures which `integer`
      library to use. This flag is initialized by `cIntegerLibraryType`
      (as before), and is only used in `CorePrep` to decide whether to
      use `S#` or not.
      
      The other code paths that were varying based on `cIntegerLibraryType`
      are no now longer varying: The trick is to use `integer-wired-in`
      as the `-this-unit-id` when compiling either `integer-gmp` or
      `integer-simple`.
      
      Test Plan: Validate is happy.
      
      Reviewers: hvr, bgamari
      
      Reviewed By: bgamari
      
      Subscribers: TerrorJack, adamse, simonpj, rwbarton, carter
      
      GHC Trac Issues: #13477
      
      Differential Revision: https://phabricator.haskell.org/D5079
      fc2ff6dd
    • Ben Gamari's avatar
      distrib: Remove mention of no-longer-existent make target · 3dedffa2
      Ben Gamari authored
      Summary:
      `show-install-setup` used to be defined by `distrib/Makefile` which hasn't been
      used in a very long time and was removed from the tree in
      a1c008b3.
      
      Reviewers: monoidal
      
      Reviewed By: monoidal
      
      Subscribers: rwbarton, carter
      
      Differential Revision: https://phabricator.haskell.org/D5194
      3dedffa2
    • Tamar Christina's avatar
      Drop accidental write-attributes request · deceb21b
      Tamar Christina authored
      Summary:
      The new filesystem code accidentally asks for write attributes
      permissions when doing read-only access.
      
      I believe this is what's causing the GHC 8.6.1 tarballs to fail
      when installed to a privileged location.
      I haven't been able to reproduce the issue yet, but this permission
      bit is wrong anyway.
      
      Test Plan: I'm still trying to workout how to test that this works,
      changing the permissions on the folder doesn't seem to reproduce
      the error on a tarball I made from before the change.
      
      Reviewers: bgamari, tdammers
      
      Reviewed By: bgamari
      
      Subscribers: tdammers, monoidal, rwbarton, carter
      
      GHC Trac Issues: #15667
      
      Differential Revision: https://phabricator.haskell.org/D5177
      deceb21b
    • Ryan Scott's avatar
      Drop GHC 8.2 compatibility · a838ae37
      Ryan Scott authored
      Summary:
      GHC 8.6.1 is out, so now GHC's support window only extends
      back to GHC 8.4. This means we can delete gobs of code that were
      only used for GHC 8.2 support. Hooray!
      
      Test Plan: ./validate
      
      Reviewers: bgamari, Phyx, erikd
      
      Reviewed By: bgamari, Phyx
      
      Subscribers: rwbarton, erikd, carter
      
      Differential Revision: https://phabricator.haskell.org/D5192
      a838ae37
  3. 02 Oct, 2018 4 commits
  4. 01 Oct, 2018 9 commits
    • Ryan Scott's avatar
      Quantify class variables first in associated families' kinds · a57fa247
      Ryan Scott authored
      Summary:
      Previously, `kcLHsQTyVars` would always quantify class-bound
      variables invisibly in the kinds of associated types, resulting in
      #15591. We counteract this by explicitly passing the class-bound
      variables to `kcLHsQTyVars` and quantifying over the ones that are
      mentioned in the associated type such that (1) they are specified,
      and (2) they come before other kind variables.
      See `Note [Kind variable ordering for associated types]`.
      
      Test Plan: make test TEST=T15591
      
      Reviewers: goldfire, simonpj, bgamari
      
      Reviewed By: simonpj
      
      Subscribers: rwbarton, carter
      
      GHC Trac Issues: #15591
      
      Differential Revision: https://phabricator.haskell.org/D5159
      a57fa247
    • Ryan Scott's avatar
      Fix #15637 by using VTA more in GND · 309438e9
      Ryan Scott authored
      Summary:
      The code that GND was generating before could crumple over
      if it derived an instance for a class with an ambiguous type variable
      in the class head, such as the example in #15637. The solution is
      straightforward: simply instantiate all variables bound by the class
      head explicitly using visible type application, which will nip any
      ambiguity in the bud.
      
      Test Plan: make test TEST=T15637
      
      Reviewers: bgamari, simonpj, goldfire
      
      Reviewed By: simonpj
      
      Subscribers: simonpj, rwbarton, carter
      
      GHC Trac Issues: #15637
      
      Differential Revision: https://phabricator.haskell.org/D5148
      309438e9
    • Ben Gamari's avatar
      circleci: Run slowtest with multiple threads · 64475db0
      Ben Gamari authored
      64475db0
    • Ben Gamari's avatar
      0ac86cb7
    • Ben Gamari's avatar
      ghc-prim: Add missing changelog entry · 4578548f
      Ben Gamari authored
      4578548f
    • Ben Gamari's avatar
      primops: Fix documentation of compactAllocateBlock# · d1577621
      Ben Gamari authored
      Pointed out by @andrewthad.
      d1577621
    • Alp Mestanogullari's avatar
      ghc-bin.cabal.in: add a 'threaded' flag for hadrian · 99eb4595
      Alp Mestanogullari authored
      Summary:
      hadrian will explicitly enable this flag, but more importantly needs it
      as otherwise we just never end up passing -threaded to GHC when building
      a new GHC binary. We could quite likely unconditionally pass -threaded,
      as the corresponding logic for GhcThreaded in mk/config.mk.in seems to
      always lead to it being set to True, but we instead leave a way out for
      anyone in need of a GHC linked against a non-threaded runtime system in
      the future.
      
      Test Plan: T8242 (with a GHC built by hadrian)
      
      Reviewers: bgamari
      
      Reviewed By: bgamari
      
      Subscribers: rwbarton, carter
      
      Differential Revision: https://phabricator.haskell.org/D5146
      99eb4595
    • Ben Gamari's avatar
      CodeGen: Teach CodeGen about aliasing of XMM/YMM/ZMM registers · 139ef7e1
      Ben Gamari authored
      Reviewers: simonmar
      
      Reviewed By: simonmar
      
      Subscribers: rwbarton, carter
      
      Differential Revision: https://phabricator.haskell.org/D5186
      139ef7e1
    • Zejun Wu's avatar
      Always check the relocation value for x86_64 · e44c992f
      Zejun Wu authored
      Summary:
      Always check that no overflow happens during relocation for x86_64.
      It's not safe to assume the result returned by `ocAllocateSymbolExtras` is
      always valid if we allocate it neither in lower 2G nor in a contiguous range
      with the image.
      
      There are also some minor fixes in this diff:
      
      * `off >= 0x7fffffffL` should be `>`
      * use of unaligned pointer is undefined behavior, use `memcpy` instead, gcc
        will be able to optimize it to `mov %edx, (%rax)`.
      
      Test Plan:
      build ghci with:
      
      ```
      DYNAMIC_GHC_PROGRAMS = NO
      DYNAMIC_BY_DEFAULT = NO
      ```
      
      and play with it.
      
        ./validate
      
      Reviewers: simonmar, austin, bgamari, erikd
      
      Reviewed By: simonmar
      
      Subscribers: alpmestan, rwbarton, carter
      
      Differential Revision: https://phabricator.haskell.org/D5168
      e44c992f
  5. 28 Sep, 2018 3 commits
    • Simon Marlow's avatar
      Add -fkeep-cafs · df67f95b
      Simon Marlow authored
      Summary:
      I noticed while playing around with
      https://github.com/fbsamples/ghc-hotswap/ that the main binary needs to
      have a custom main function to set `config.keep_cafs = true` when
      initialising the runtime. This is pretty annoying, it means an extra
      C file with some cryptic incantations in it, and a `-no-hs-main` flag.
      
      So I've replaced this with a link-time flag to GHC, `-fkeep-cafs` that
      does the same thing.
      
      Test Plan:
      New unit test that tests for the RTS's GC'd CAFs assertion, and also
      the -keep-cafs flag.
      
      Reviewers: bgamari, osa1, erikd, noamz
      
      Reviewed By: osa1
      
      Subscribers: rwbarton, carter
      
      Differential Revision: https://phabricator.haskell.org/D5183
      df67f95b
    • Neil Mitchell's avatar
    • Ryan Scott's avatar
      Normalise EmptyCase types using the constraint solver · e72d7880
      Ryan Scott authored
      Summary:
      Certain `EmptyCase` expressions were mistakently producing
      warnings since their types did not have as many type families reduced
      as they could have. The most direct way to fix this is to normalise
      these types initially using the constraint solver to solve for any
      local equalities that may be in scope.
      
      Test Plan: make test TEST=T14813
      
      Reviewers: simonpj, bgamari, goldfire
      
      Reviewed By: simonpj
      
      Subscribers: rwbarton, carter
      
      GHC Trac Issues: #14813
      
      Differential Revision: https://phabricator.haskell.org/D5094
      e72d7880
  6. 27 Sep, 2018 2 commits
  7. 26 Sep, 2018 3 commits
    • Simon Peyton Jones's avatar
      Fix constant-folding for Integer shifts · d25fa45e
      Simon Peyton Jones authored
      In this patch
          commit 869f69fd
          Author: Simon Peyton Jones <simonpj@microsoft.com>
          Date:   Wed Dec 11 18:19:34 2013 +0000
      
          Guarding against silly shifts
      
      we deal with silly shifts like (Sll 1 9223372036854775807).  But
      I only dealt with primops that Int# and Word#.
      
      Alas, the same problem affects shifts of Integer, as Trac #15673
      showed.  Fortunately, the problem is easy to fix.
      d25fa45e
    • Simon Peyton Jones's avatar
      Fix Lint of unsaturated type families · 4bdb10ca
      Simon Peyton Jones authored
      GHC allows types to have unsaturated type synonyms and type families,
      provided they /are/ saturated if you expand all type synonyms.
      
      TcValidity carefully checked this; see check_syn_tc_app.  But
      Lint only did half the job, adn that led to Trac #15664.
      
      This patch just teaches Core Lint to be as clever as TcValidity.
      4bdb10ca
    • Simon Peyton Jones's avatar
      Expand the Note on let-bound skolems · a7441347
      Simon Peyton Jones authored
      a7441347
  8. 25 Sep, 2018 3 commits
  9. 24 Sep, 2018 1 commit
  10. 23 Sep, 2018 4 commits
    • Ryan Scott's avatar
      Add a recursivity check in nonVoid · e68b439f
      Ryan Scott authored
      Summary:
      Previously `nonVoid` outright refused to call itself
      recursively to avoid the risk of hitting infinite loops when
      checking recurisve types. But this is too conservative—we //can//
      call `nonVoid` recursively as long as we incorporate a way to detect
      the presence of recursive types, and bail out if we do detect one.
      Happily, such a mechanism already exists in the form of `checkRecTc`,
      so let's use it.
      
      Test Plan: make test TEST=T15584
      
      Reviewers: simonpj, bgamari
      
      Reviewed By: simonpj
      
      Subscribers: rwbarton, carter
      
      GHC Trac Issues: #15584
      
      Differential Revision: https://phabricator.haskell.org/D5116
      e68b439f
    • Simon Peyton Jones's avatar
      Fix get getIdFromTrivialExpr · 2dbf88b3
      Simon Peyton Jones authored
      This bug, discovered by Trac #15325, has been lurking since
      
        commit 1c9fd3f1
        Author: Simon Peyton Jones <simonpj@microsoft.com>
        Date:   Thu Dec 3 12:57:54 2015 +0000
      
          Case-of-empty-alts is trivial (Trac #11155)
      
      I'd forgotttnen to modify getIdFromTrivialExpr when I
      modified exprIsTrivial.   Easy to fix, though.
      2dbf88b3
    • Simon Peyton Jones's avatar
      Comments only · ab44ff81
      Simon Peyton Jones authored
      ab44ff81
    • Simon Peyton Jones's avatar
      Don't look up unnecessary return in LastStmt · 4bde71df
      Simon Peyton Jones authored
      This fixes Trac #15607. The general pattern is well
      established (e.g. see the guard_op binding in rnStmt
      of BodyStme), but we weren't using it for LastStmt.
      4bde71df