1. 15 Jun, 2018 6 commits
    • Sylvain Henry's avatar
      Built-in Natural literals in Core · fe770c21
      Sylvain Henry authored
      Add support for built-in Natural literals in Core.
      
      - Replace MachInt,MachWord, LitInteger, etc. with a single LitNumber
        constructor with a LitNumType field
      - Support built-in Natural literals
      - Add desugar warning for negative literals
      - Move Maybe(..) from GHC.Base to GHC.Maybe for module dependency
        reasons
      
      This patch introduces only a few rules for Natural literals (compared
      to Integer's rules). Factorization of the built-in rules for numeric
      literals will be done in another patch as this one is already big to
      review.
      
      Test Plan:
        validate
        test build with integer-simple
      
      Reviewers: hvr, bgamari, goldfire, Bodigrim, simonmar
      
      Reviewed By: bgamari
      
      Subscribers: phadej, simonpj, RyanGlScott, carter, hsyl20, rwbarton,
      thomie
      
      GHC Trac Issues: #14170, #14465
      
      Differential Revision: https://phabricator.haskell.org/D4212
      fe770c21
    • Kirill Zaborsky's avatar
      Fix #13833: accept type literals with no FlexibleInstances · 42f3b53b
      Kirill Zaborsky authored
      Test Plan: ./validate
      
      Reviewers: bgamari, simonpj
      
      Reviewed By: bgamari, simonpj
      
      Subscribers: simonpj, rwbarton, thomie, carter
      
      GHC Trac Issues: #13833
      
      Differential Revision: https://phabricator.haskell.org/D4823
      42f3b53b
    • Adam Gundry's avatar
      Use data con name instead of parent in lookupRecFieldOcc · 7100850e
      Adam Gundry authored
      Test Plan: new tests rename/should_compile/{T14747,T15149}
      
      Reviewers: simonpj, bgamari
      
      Reviewed By: bgamari
      
      Subscribers: rwbarton, thomie, carter
      
      GHC Trac Issues: #14747, #15149
      
      Differential Revision: https://phabricator.haskell.org/D4821
      7100850e
    • Tao He's avatar
      Add "quantified constraint" context in error message, fix #15231. · 91822e4e
      Tao He authored
      This patch adds "quantified constraint" context in error message when
      UndecidableInstances checking fails for quantified constraints.
      See Trac #15231:comment#1.
      
      This patch also pretty-prints the instance head for better error messages.
      
      Test Plan: make test TEST="T15231"
      
      Reviewers: bgamari, simonpj
      
      Reviewed By: simonpj
      
      Subscribers: simonpj, rwbarton, thomie, carter
      
      GHC Trac Issues: #15231
      
      Differential Revision: https://phabricator.haskell.org/D4819
      91822e4e
    • Ben Gamari's avatar
      testsuite: Make T4442 compile on i386 and mark as broken · b7deeed0
      Ben Gamari authored
      There are some rather suspicious failures in the 64-bit case. See #15184 for
      details.
      b7deeed0
    • Simon Peyton Jones's avatar
      Make better "fake tycons" in error recovery · 2f6069cc
      Simon Peyton Jones authored
      Consider (Trac #15215)
        data T a = MkT ...
        data S a = ...T...MkT....
      
      If there is an error in the definition of 'T' we add a
      "fake type constructor" to the type environment, so that we
      can continue to typecheck 'S'.  But we /were not/ adding
      a fake anything for 'MkT' and so there was an internal
      error when we met 'MkT' in the body of 'S'.
      
      The fix is to add fake tycons for all the 'implicits' of 'T'.
      This is done by mk_fake_tc in TcTyClsDecls.checkValidTyCl,
      which now returns a /list/ of TyCons rather than just one.
      
      On the way I did some refactoring:
      
      * Rename TcTyDecls.tcAddImplicits to tcAddTyConsToGblEnv
        and make it /include/ the TyCons themeselves as well
        as their implicits
      
      * Some incidental refactoring about tcRecSelBinds. The main
        thing is that I've avoided creating a HsValBinds that we
        immediately decompose.  That meant moving some deck chairs
        around.
      
      NB: The new error message for the regression test T15215
      has the opaque error "Illegal constraint in a type:", flagged
      in Trac #14845.  But that's the fault of the latter ticket.
      The fix here not to blame.
      2f6069cc
  2. 14 Jun, 2018 12 commits
    • Ben Gamari's avatar
      Fix binary and haddock submodule commits · 8062d7fd
      Ben Gamari authored
      8062d7fd
    • Vladislav Zavialov's avatar
      Embrace -XTypeInType, add -XStarIsType · d650729f
      Vladislav Zavialov authored
      Summary:
      Implement the "Embrace Type :: Type" GHC proposal,
      .../ghc-proposals/blob/master/proposals/0020-no-type-in-type.rst
      
      GHC 8.0 included a major change to GHC's type system: the Type :: Type
      axiom. Though casual users were protected from this by hiding its
      features behind the -XTypeInType extension, all programs written in GHC
      8+ have the axiom behind the scenes. In order to preserve backward
      compatibility, various legacy features were left unchanged. For example,
      with -XDataKinds but not -XTypeInType, GADTs could not be used in types.
      Now these restrictions are lifted and -XTypeInType becomes a redundant
      flag that will be eventually deprecated.
      
      * Incorporate the features currently in -XTypeInType into the
        -XPolyKinds and -XDataKinds extensions.
      * Introduce a new extension -XStarIsType to control how to parse * in
        code and whether to print it in error messages.
      
      Test Plan: Validate
      
      Reviewers: goldfire, hvr, bgamari, alanz, simonpj
      
      Reviewed By: goldfire, simonpj
      
      Subscribers: rwbarton, thomie, mpickering, carter
      
      GHC Trac Issues: #15195
      
      Differential Revision: https://phabricator.haskell.org/D4748
      d650729f
    • Simon Jakobi's avatar
      Fix deserialization of docs (#15240) · 69b50efe
      Simon Jakobi authored
      We were using Map.fromDistinctAscList to deserialize a
      (Map Name HsDocString). As the Names' Uniques had changed, we
      ended up with an invalid map in which we couldn't lookup certain keys.
      
      Switching to Map.fromList fixed the issue.
      
      Added comments in several places.
      
      Reviewers: alexbiehl, hvr, bgamari
      
      Reviewed By: bgamari
      
      Subscribers: rwbarton, thomie, carter
      
      GHC Trac Issues: #15240
      
      Differential Revision: https://phabricator.haskell.org/D4816
      69b50efe
    • Peter Trommler's avatar
      Mark test broken on powerpc64[le] · 5f5d0c9d
      Peter Trommler authored
      Test num009 fails different results. #15062 lists more issues on other
      platforms. Test T14894 fails because DWARF support is not implemented in
      the PowerPC native code backend. T5435_v_asm_b fails because the runtime
      linker is not implemented for PowerPC 64-bit systems.
      
      Test Plan: validate
      
      Reviewers: bgamari, hvr, erikd, simonmar
      
      Reviewed By: bgamari
      
      Subscribers: rwbarton, thomie, carter
      
      GHC Trac Issues: #13634, #11261, #11259, #15062
      
      Differential Revision: https://phabricator.haskell.org/D4825
      5f5d0c9d
    • Ninjatrappeur's avatar
      Make Control.Exception.throw levity polymorphic. · 8ae7c1b5
      Ninjatrappeur authored
      Test Plan: Validate.
      
      Reviewers: hvr, bgamari, sighingnow
      
      Reviewed By: sighingnow
      
      Subscribers: tdammers, sighingnow, rwbarton, thomie, carter
      
      GHC Trac Issues: #15180
      
      Differential Revision: https://phabricator.haskell.org/D4827
      8ae7c1b5
    • Tao He's avatar
      Disable `-fdefer-out-of-scope-variables` in ghci. · 4a931665
      Tao He authored
      We have already disabled `-fdefer-type-errors` and
      `-fdefer-typed-holes` in ghci.
      This patch disables `-fdefer-out-of-scope-variables` as well.
      
      Fixes Trac #15259, as well as #14963.
      
      Test Plan: make test TEST="T15259 T14963a T14963b T14963c"
      
      Reviewers: bgamari, tdammers
      
      Reviewed By: tdammers
      
      Subscribers: tdammers, rwbarton, thomie, carter
      
      GHC Trac Issues: #15259, #14963
      
      Differential Revision: https://phabricator.haskell.org/D4830
      4a931665
    • Ben Gamari's avatar
      testsuite: Fix T4442 on i386 · ca7653a9
      Ben Gamari authored
      Test Plan: Validate on i386
      
      Reviewers: tdammers
      
      Reviewed By: tdammers
      
      Subscribers: rwbarton, thomie, carter
      
      GHC Trac Issues: #15184
      
      Differential Revision: https://phabricator.haskell.org/D4838
      ca7653a9
    • Ben Gamari's avatar
      testsuite: Add Windows-specific output for T5611 · 56007290
      Ben Gamari authored
      It's not entirely clear why this is necessary, but this currently fails
      on Windows and the difference seems rather minor.
      
      Test Plan: Validate on Windows
      
      Reviewers: Phyx
      
      Subscribers: rwbarton, thomie, carter
      
      Differential Revision: https://phabricator.haskell.org/D4842
      56007290
    • Ben Gamari's avatar
      testsuite: Add -fghci-leak-check to expected output on mingw32 · 36060751
      Ben Gamari authored
      Test Plan: Validate on Windows
      
      Subscribers: rwbarton, thomie, carter
      
      Differential Revision: https://phabricator.haskell.org/D4843
      36060751
    • Tamar Christina's avatar
      Disable T12903 on Darwin due to flakiness · 16c70daf
      Tamar Christina authored
      Test seems to randomly fail on harbormaster and CircleCI. Disabling it
      until it can be fixed.
      
      Test Plan: make test TEST=T12903
      
      Reviewers: austin, bgamari, simonmar, mpickering
      
      Reviewed By: mpickering
      
      Subscribers: mpickering, thomie, qnikst
      
      GHC Trac Issues: #12903
      16c70daf
    • Ben Gamari's avatar
      testsuite: Print summary even if interrupted · a3c0b42e
      Ben Gamari authored
      Fixes #15265.
      
      Reviewers: osa1
      
      Reviewed By: osa1
      
      Subscribers: rwbarton, thomie, carter
      
      GHC Trac Issues: #15265
      
      Differential Revision: https://phabricator.haskell.org/D4841
      a3c0b42e
    • Ömer Sinan Ağacan's avatar
      Do not skip conc004 in GHCi way · b5ccee49
      Ömer Sinan Ağacan authored
      According to the comments it used to allocate too much, but currently I
      get
      
          205,987,176 bytes allocated in the heap
           50,352,200 bytes copied during GC
           14,244,968 bytes maximum residency (6 sample(s))
              172,952 bytes maximum slop
                   36 MB total memory in use (0 MB lost due to fragmentation)
      
      Reviewers: bgamari, tdammers, simonmar
      
      Subscribers: tdammers, rwbarton, thomie, carter
      
      Differential Revision: https://phabricator.haskell.org/D4831
      b5ccee49
  3. 13 Jun, 2018 2 commits
  4. 12 Jun, 2018 1 commit
    • Simon Peyton Jones's avatar
      Refactor TcExpr.tcSeq · aab3c6d1
      Simon Peyton Jones authored
      The function TcExpr.tcSeq seemed much longer that is really
      justifiable; and was set to get worse with the fix to Trac #15242.
      
      This patch refactors the special cases for function applications,
      so that the special case for 'seq' can use the regular tcFunApp,
      which makes the code both clearer and shorter.  And smooths the
      way for #15242.
      
      The special case for 'tagToEnum#' is even more weird and ad-hoc,
      so I refrained from meddling iwth it for now.
      
      I also combined HsUtils.mkHsAppType and mkHsAppTypeOut, so that
      I could have a single 'wrapHsArgs' function, thereby fixing a
      ToDo from Alan Zimmerman.  That means tha tmkHsAppType now has
      an equality predicate, but I guess that's fair enough.
      aab3c6d1
  5. 11 Jun, 2018 3 commits
  6. 10 Jun, 2018 3 commits
  7. 08 Jun, 2018 2 commits
  8. 07 Jun, 2018 11 commits
    • Iavor S. Diatchki's avatar
      Allow Haddock comments before function arguments. · 200c8e04
      Iavor S. Diatchki authored
      Currently, documentation strings on function arguments has to be written
      after the argument (i.e., using `{-^ -}` comments).  This patch allows
      us to use `{-| -}` comments to put the comment string before an
      argument.   The same works for the results of functions.
      
      Reviewers: bgamari
      
      Reviewed By: bgamari
      
      Subscribers: rwbarton, thomie, mpickering, carter
      
      Differential Revision: https://phabricator.haskell.org/D4767
      200c8e04
    • Matthew Pickering's avatar
      Run typeCheckResultAction and renamedResultAction in TcM rather than Hsc · dc8c03b2
      Matthew Pickering authored
      The primary motivation for this is that this allows users to access
      the warnings and error machinery present in TcM. However, it also allows
      users to use TcM actions which means they can typecheck GhcPs which
      could be significantly easier than constructing GhcTc.
      
      Reviewers: bgamari
      
      Reviewed By: bgamari
      
      Subscribers: rwbarton, thomie, carter
      
      GHC Trac Issues: #15229
      
      Differential Revision: https://phabricator.haskell.org/D4792
      dc8c03b2
    • Ryan Scott's avatar
      Fix #15236 by removing parentheses from funTyConName · 3397396a
      Ryan Scott authored
      Currently, `funTyConName` is defined as:
      
      ```lang=haskell
      funTyConName = mkPrimTyConName (fsLit "(->)") funTyConKey funTyCon
      ```
      
      What's strange about this definition is that there are extraneous
      parentheses around `->`, which is quite unlike every other infix
      `Name`. As a result, the `:info (->)` output is totally garbled (see
      Trac #15236).
      
      It's quite straightforward to fix that particular bug by removing the
      extraneous parentheses. However, it turns out that this makes some
      test output involving `Show` instances for `TypeRep` look less
      appealing, since `->` is no longer surrounded with parentheses when
      applied prefix. But neither were any /other/ infix type constructors!
      The right fix there was to change `showTypeable` to put parentheses
      around prefix applications of infix tycons.
      
      Test Plan: ./validate
      
      Reviewers: bgamari, hvr
      
      Reviewed By: bgamari
      
      Subscribers: rwbarton, thomie, carter
      
      GHC Trac Issues: #15236
      
      Differential Revision: https://phabricator.haskell.org/D4799
      3397396a
    • Ryan Scott's avatar
      Don't expose (~#), (~R#), (~P#) from GHC.Prim · 5926b6ed
      Ryan Scott authored
      Currently, the primitive `(~#)`, `(~R#)`, and `(~P#)` type
      constructors are wired in to be exported from `GHC.Prim`. This has
      some unfortunate consequences, however. It turns out that `(~#)` is
      actually a legal infix identifier, so users can make use of unboxed
      equalities in strange ways in user code (see #15209). The other two,
      `(~R#)` and `(~P#)`, can't be used in source code, but they can be
      observed with GHCi's `:browse` command, which is somewhat unnerving.
      
      The fix for both of these problems is simple: just don't wire them
      to be exported from `GHC.Prim`.
      
      Test Plan: make test TEST="T12023 T15209"
      
      Reviewers: bgamari, dfeuer
      
      Reviewed By: bgamari, dfeuer
      
      Subscribers: rwbarton, thomie, carter, dfeuer
      
      GHC Trac Issues: #12023, #15209
      
      Differential Revision: https://phabricator.haskell.org/D4801
      5926b6ed
    • Ben Gamari's avatar
      testsuite: Skip T13838 in ghci way · 04e29fc6
      Ben Gamari authored
      Test Plan: `make slowtest TEST=T13838`
      
      Reviewers: alpmestan, dfeuer
      
      Reviewed By: dfeuer
      
      Subscribers: dfeuer, rwbarton, thomie, carter
      
      GHC Trac Issues: #15238
      
      Differential Revision: https://phabricator.haskell.org/D4802
      04e29fc6
    • Ryan Scott's avatar
      Fix #15243 by fixing incorrect uses of NotPromoted · 569c16a7
      Ryan Scott authored
      In `Convert`, we were incorrectly using `NotPromoted` to
      denote type constructors that were actually intended to be promoted,
      resulting in poor `-ddump-splices` output (as seen in #15243).
      Easily fixed.
      
      Test Plan: make test TEST=T15243
      
      Reviewers: bgamari, goldfire
      
      Reviewed By: bgamari
      
      Subscribers: rwbarton, thomie, carter
      
      GHC Trac Issues: #15243
      
      Differential Revision: https://phabricator.haskell.org/D4809
      569c16a7
    • Ben Gamari's avatar
      testsuite: Add test for #15232 · 5026840f
      Ben Gamari authored
      Subscribers: rwbarton, thomie, carter
      
      GHC Trac Issues: #15232
      
      Differential Revision: https://phabricator.haskell.org/D4807
      5026840f
    • Alec Theriault's avatar
      Move 'HsBangTy' out in constructor arguments · 0361fc03
      Alec Theriault authored
      When run with -haddock, a constructor argument can have both a a
      strictness/unpackedness annotation and a docstring. The parser binds
      'HsBangTy' more tightly than 'HsDocTy', yet for constructor arguments we
      really need the 'HsBangTy' on the outside.
      
      This commit does this shuffling in the 'mkConDeclH98' and 'mkGadtDecl'
      smart constructors.
      
      Test Plan: haddockA038, haddockC038
      
      Reviewers: bgamari, dfeuer
      
      Reviewed By: bgamari
      
      Subscribers: dfeuer, rwbarton, thomie, carter
      
      Differential Revision: https://phabricator.haskell.org/D4727
      0361fc03
    • Andreas Klebinger's avatar
      Check if both branches of an Cmm if have the same target. · efea32cf
      Andreas Klebinger authored
      This for some reason or the other and makes it into the final
      binary. I've added the check to ContFlowOpt as that seems
      like a logical place for this.
      
      In a regular nofib run there were 30 occurences of this pattern.
      
      Test Plan: ci
      
      Reviewers: bgamari, simonmar, dfeuer, jrtc27, tdammers
      
      Reviewed By: bgamari, simonmar
      
      Subscribers: tdammers, dfeuer, rwbarton, thomie, carter
      
      GHC Trac Issues: #15188
      
      Differential Revision: https://phabricator.haskell.org/D4740
      efea32cf
    • Andreas Herrmann's avatar
      Fix unparseable pretty-printing of promoted data cons · 767536cc
      Andreas Herrmann authored
      Previously we would print code which would not round-trip:
      ```
      > :set -XDataKinds
      > :set -XPolyKinds
      > data Proxy k = Proxy
      > _ :: Proxy '[ 'True ]
      error:
        Found hole: _ :: Proxy '['True]
      > _ :: Proxy '['True]
      error:
          Invalid type signature: _ :: ...
          Should be of form <variable> :: <type>
      ```
      
      Test Plan: Validate with T14343
      
      Reviewers: RyanGlScott, goldfire, bgamari, tdammers
      
      Reviewed By: RyanGlScott, bgamari
      
      Subscribers: tdammers, rwbarton, thomie, carter
      
      GHC Trac Issues: #14343
      
      Differential Revision: https://phabricator.haskell.org/D4746
      767536cc
    • Ben Gamari's avatar
      testsuite: Fix dynamic-paper stderr file · 1508600c
      Ben Gamari authored
      The stderr file was empty, yet GHC fails with an error.
      1508600c