1. 15 Nov, 2018 1 commit
    • Simon Peyton Jones's avatar
      Smarter HsType pretty-print for promoted datacons · ae2c9b40
      Simon Peyton Jones authored
      Fix Trac #15898, by being smarter about when to print
      a space before a promoted data constructor, in a HsType.
      I had to implement a mildly tiresome function
          HsType.lhsTypeHasLeadingPromotionQuote
      It has multiple cases, of course, but it's very simple.
      
      The patch improves the error-message output in a bunch of
      cases, and (to my surprise) actually fixes a bug in the
      output of T14343 (Trac #14343), thus
      
        -  In the expression: _ :: Proxy '('( 'True,  'False),  'False)
        +  In the expression: _ :: Proxy '( '( 'True, 'False), 'False)
      
      I discovered that there were two copies of the PromotionFlag
      type (a boolean, with helpfully named data cons), one in
      IfaceType and one in HsType.  So I combined into one,
      PromotionFlag, and moved it to BasicTypes.  That's why
      quite a few files are touched, but it's all routine.
      ae2c9b40
  2. 29 Oct, 2018 1 commit
    • Tobias Dammers's avatar
      Finish fix for #14880. · 5e45ad10
      Tobias Dammers authored
      The real change that fixes the ticket is described in
      Note [Naughty quantification candidates] in TcMType.
      
      Fixing this required reworking candidateQTyVarsOfType, the function
      that extracts free variables as candidates for quantification.
      One consequence is that we now must be more careful when quantifying:
      any skolems around must be quantified manually, and quantifyTyVars
      will now only quantify over metavariables. This makes good sense,
      as skolems are generally user-written and are listed in the AST.
      
      As a bonus, we now have more control over the ordering of such
      skolems.
      
      Along the way, this commit fixes #15711 and refines the fix
      to #14552 (by accepted a program that was previously rejected,
      as we can now accept that program by zapping variables to Any).
      
      This commit also does a fair amount of rejiggering kind inference
      of datatypes. Notably, we now can skip the generalization step
      in kcTyClGroup for types with CUSKs, because we get the
      kind right the first time. This commit also thus fixes #15743 and
       #15592, which both concern datatype kind generalisation.
      (#15591 is also very relevant.) For this aspect of the commit, see
      Note [Required, Specified, and Inferred in types] in TcTyClsDecls.
      
      Test cases: dependent/should_fail/T14880{,-2},
                  dependent/should_fail/T15743[cd]
                  dependent/should_compile/T15743{,e}
                  ghci/scripts/T15743b
                  polykinds/T15592
                  dependent/should_fail/T15591[bc]
                  ghci/scripts/T15591
      5e45ad10
  3. 24 Oct, 2018 1 commit
    • Alec Theriault's avatar
      Trigger multiline mode in GHCi on '\case' (#13087) · eaf15934
      Alec Theriault authored
      Summary:
      In ALR, 'ITlcase' should expect an opening curly. This is probably a forgotten
      edge case in ALR, since `maybe_layout` (which handles the non-ALR layout)
      already deals with the 'ITlcase' token properly.
      
      Test Plan: make TEST=T10453 && make TEST=T13087
      
      Reviewers: bgamari, RyanGlScott
      
      Reviewed By: RyanGlScott
      
      Subscribers: RyanGlScott, rwbarton, carter
      
      GHC Trac Issues: #10453, #13087
      
      Differential Revision: https://phabricator.haskell.org/D5236
      eaf15934
  4. 02 Oct, 2018 1 commit
  5. 01 Oct, 2018 1 commit
    • 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
  6. 23 Sep, 2018 1 commit
    • 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
  7. 28 Aug, 2018 1 commit
    • Ryan Scott's avatar
      Rename kind vars in left-to-right order in bindHsQTyVars · 102284e7
      Ryan Scott authored
      Summary:
      When renaming kind variables in an `LHsQTyVars`, we were
      erroneously putting all of the kind variables in the binders
      //after// the kind variables in the body, resulting in #15568. The
      fix is simple: just swap the order of these two around.
      
      Test Plan: make test TEST=T15568
      
      Reviewers: simonpj, bgamari, goldfire
      
      Reviewed By: goldfire
      
      Subscribers: goldfire, rwbarton, carter
      
      GHC Trac Issues: #15568
      
      Differential Revision: https://phabricator.haskell.org/D5108
      102284e7
  8. 15 Jul, 2018 1 commit
  9. 05 Jul, 2018 1 commit
  10. 20 Jun, 2018 1 commit
    • Ryan Scott's avatar
      Allow :info for (~) in GHCi · f4dce6cf
      Ryan Scott authored
      `(~)` is not an identifier according to GHC's parser, which
      is why GHCi's `:info` command wouldn't work on it. To rectify this,
      we apply the same fix that was put in place for `(->)`: add `(~)` to
      GHC's `identifier` parser production.
      
      Test Plan: make test TEST=T10059
      
      Reviewers: bgamari
      
      Reviewed By: bgamari
      
      Subscribers: rwbarton, thomie, mpickering, carter
      
      GHC Trac Issues: #10059
      
      Differential Revision: https://phabricator.haskell.org/D4877
      f4dce6cf
  11. 14 Jun, 2018 1 commit
    • 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
  12. 07 Jun, 2018 1 commit
    • 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
  13. 26 May, 2018 1 commit
  14. 02 Apr, 2018 1 commit
  15. 08 Mar, 2018 1 commit
  16. 03 Mar, 2018 1 commit
    • Ryan Scott's avatar
      Parenthesize (() :: Constraint) in argument position · 99c556d2
      Ryan Scott authored
      Summary:
      A simple oversight in the pretty-printer lead to a special
      case for `() :: Constraint` not being parenthesized correctly when
      used in an argument position. Easily fixed with a `maybeParen`.
      
      Test Plan: make test TEST=T14796
      
      Reviewers: alanz, goldfire, bgamari, simonpj
      
      Reviewed By: bgamari, simonpj
      
      Subscribers: simonpj, rwbarton, thomie, carter
      
      GHC Trac Issues: #14796
      
      Differential Revision: https://phabricator.haskell.org/D4408
      99c556d2
  17. 01 Feb, 2018 1 commit
    • Julian Priestley's avatar
      Don't add targets that can't be found in GHCi · 0bff9e67
      Julian Priestley authored
      When using the :add command in haxlsh/ghci, a module/file that can't
      be found is still added to the list of targets, resulting in an error
      message for the bad module/file for every subsequent usage of the
      command. The add command should verify that the module/file can be
      found before adding it to the list of targets.
      
      Also add a ":show targets" command to show the currently added list of
      commands, and an ":unadd" command to remove a target.
      
      Test Plan:
      Add a new GHCi testcase that checks that :add doesn't remember either
      files or modules that could not be found, and that both the new :show
      and :unadd commands work as expected.
      
      Reviewers: simonmar, bgamari
      
      Reviewed By: simonmar
      
      Subscribers: rwbarton, thomie, carter
      
      GHC Trac Issues: #14676
      
      Differential Revision: https://phabricator.haskell.org/D4321
      0bff9e67
  18. 26 Jan, 2018 1 commit
  19. 19 Oct, 2017 1 commit
    • Ryan Scott's avatar
      Disable -XRebindableSyntax when running internal GHCi expressions · e023e78b
      Ryan Scott authored
      Summary:
      It's well known that `-XRebindableSyntax` doesn't play
      nicely with some of the internal expressions that GHCi runs. #13385
      was one example where this problem arose, which was fixed at the time
      by simply avoiding the use of `do`-notation in these internal GHCi
      expressions. That seemed to work, but it was a technique that proved
      not to scale, as #14342 demonstrated //another// example where
      `-XRebindableSyntax` can bite.
      
      Instead of delicately arranging the internal GHCi expressions to
      avoid anything that might be covered under `-XRebindableSyntax`,
      this patch takes the much more direct approach of disabling
      `-XRebindableSyntax` entirely when running any internal GHCi
      expression. This shouldn't hurt, since nothing internal to GHCi was
      taking advantage of the extension in the first place, and moreover,
      we can have greater confidence that some other obscure
      `-XRebindableSyntax` corner case won't pop up in the future. As an
      added bonus, this lets us once again use `do`-notation in the code
      that had to be changed when #13385 was (hackily) fixed before.
      
      Test Plan: make test TEST=T14342
      
      Reviewers: bgamari, austin
      
      Subscribers: rwbarton, thomie
      
      GHC Trac Issues: #14342
      
      Differential Revision: https://phabricator.haskell.org/D4086
      e023e78b
  20. 03 Oct, 2017 1 commit
    • Ryan Scott's avatar
      Track the order of user-written tyvars in DataCon · ef26182e
      Ryan Scott authored
      After typechecking a data constructor's type signature, its type
      variables are partitioned into two distinct groups: the universally
      quantified type variables and the existentially quantified type
      variables. Then, when prompted for the type of the data constructor,
      GHC gives this:
      
      ```lang=haskell
      MkT :: forall <univs> <exis>. (...)
      ```
      
      For H98-style datatypes, this is a fine thing to do. But for GADTs,
      this can sometimes produce undesired results with respect to
      `TypeApplications`. For instance, consider this datatype:
      
      ```lang=haskell
      data T a where
        MkT :: forall b a. b -> T a
      ```
      
      Here, the user clearly intended to have `b` be available for visible
      type application before `a`. That is, the user would expect
      `MkT @Int @Char` to be of type `Int -> T Char`, //not//
      `Char -> T Int`. But alas, up until now that was not how GHC
      operated—regardless of the order in which the user actually wrote
      the tyvars, GHC would give `MkT` the type:
      
      ```lang=haskell
      MkT :: forall a b. b -> T a
      ```
      
      Since `a` is universal and `b` is existential. This makes predicting
      what order to use for `TypeApplications` quite annoying, as
      demonstrated in #11721 and #13848.
      
      This patch cures the problem by tracking more carefully the order in
      which a user writes type variables in data constructor type
      signatures, either explicitly (with a `forall`) or implicitly
      (without a `forall`, in which case the order is inferred). This is
      accomplished by adding a new field `dcUserTyVars` to `DataCon`, which
      is a subset of `dcUnivTyVars` and `dcExTyVars` that is permuted to
      the order in which the user wrote them. For more details, refer to
      `Note [DataCon user type variables]` in `DataCon.hs`.
      
      An interesting consequence of this design is that more data
      constructors require wrappers. This is because the workers always
      expect the first arguments to be the universal tyvars followed by the
      existential tyvars, so when the user writes the tyvars in a different
      order, a wrapper type is needed to swizzle the tyvars around to match
      the order that the worker expects. For more details, refer to
      `Note [Data con wrappers and GADT syntax]` in `MkId.hs`.
      
      Test Plan: ./validate
      
      Reviewers: austin, goldfire, bgamari, simonpj
      
      Reviewed By: goldfire, simonpj
      
      Subscribers: ezyang, goldfire, rwbarton, thomie
      
      GHC Trac Issues: #11721, #13848
      
      Differential Revision: https://phabricator.haskell.org/D3687
      ef26182e
  21. 14 Sep, 2017 2 commits
    • Richard Eisenberg's avatar
      Fix #13963. · 8f99cd67
      Richard Eisenberg authored
      This commit fixes several things:
      
      1. RuntimeRep arg suppression was overeager for *visibly*-quantified
      RuntimeReps, which should remain.
      
      2. The choice of whether to used a Named TyConBinder or an anonymous
      was sometimes wrong. Now, we do an extra little pass right before
      constructing the tycon to fix these.
      
      3. TyCons that normally cannot appear unsaturated can appear unsaturated
      in :kind. But this fact was not propagated into the type checker.
      It now is.
      8f99cd67
    • Richard Eisenberg's avatar
      Fix #13407 by suppressing invisibles better. · 04bb8736
      Richard Eisenberg authored
      Previously, the iface-invisible-suppresser assumed that all
      invisible things are up front. Not true!
      
      test case: ghci/scripts/T13407
      04bb8736
  22. 05 Sep, 2017 1 commit
    • Ryan Scott's avatar
      Fix egregious duplication of vars in RnTypes · b9ac9e05
      Ryan Scott authored
      `RnTypes` contains a fairly intricate algorithm to extract
      the kind and type variables of an HsType. This algorithm carefully
      maintains the separation between type variables and kind variables
      so that the difference between `-XPolyKinds` and `-XTypeInType` can
      be respected.
      
      But after doing all this, `rmDupsInRdrTyVars` stupidly just
      concatenated the lists of type and kind variables at the end. If a
      variable were used as both a type and a kind, the algorithm would
      produce *both*! This led to all kinds of problems, including #13988.
      
      This is mostly Richard Eisenberg's patch. The only original
      contribution I made was adapting call sites of `rnImplicitBndrs` to
      work with the new definition of `rmDupsInRdrTyVars`. That is,
      `rnImplicitBndrs` checks for variables that are illegally used in
      both type and kind positions without using `-XTypeInType`, but in
      order to check this, one cannot have filtered duplicate variables out
      before passing them to `rnImplicitBndrs`. To accommodate for this, I
      needed to concoct variations on the existing `extract-` functions in
      `RnTypes` which do not remove duplicates, and use those near
      `rnImplicitBndrs` call sites.
      
      test case: ghci/scripts/T13988
      
      Test Plan: make test TEST=T13988
      
      Reviewers: goldfire, simonpj, austin, bgamari
      
      Reviewed By: goldfire, simonpj
      
      Subscribers: rwbarton, thomie
      
      GHC Trac Issues: #13988
      
      Differential Revision: https://phabricator.haskell.org/D3902
      b9ac9e05
  23. 17 Aug, 2017 1 commit
    • Ryan Scott's avatar
      Remove unneeded reqlibs for mtl and parsec in the GHC testsuite · 03853475
      Ryan Scott authored
      Now that `mtl` and `parsec` are boot libraries, there's no need to
      qualify various tests in the testsuite with `reqlib('mtl')` or
      `reqlib('parsec')`.
      
      Test Plan: make test TEST="T4809 tcfail126 T4355 tc232 tc223 tc220
      tc217 tc183 T5303 DoParamM qq005 qq006 galois_raytrace T1074 mod133
      T3787 T4316 prog011 drvfail006 drvfail008"
      
      Reviewers: bgamari, austin
      
      Subscribers: rwbarton, thomie
      
      Differential Revision: https://phabricator.haskell.org/D3855
      03853475
  24. 15 Aug, 2017 1 commit
    • Ryan Scott's avatar
      Don't drop GHCi-defined functions with -fobject-code enabled · ddb870bf
      Ryan Scott authored
      The desugarer was using `targetRetainsAllBindings` as a litmus test for
      determining if a function was defined in interactive mode (and thus
      should be exported). However, there is a corner case where one can be in
      interactive mode and have `targetRetainsAllBindings` return `False`: if
      `-fobject-code` is enabled (since the target will no longer be
      `HscInteractive`). In such a scenario, we should fall back on a
      different test for determining if we are in a GHCi session. I chose to
      use `isInteractiveModule`, which appears to do the trick.
      
      Test Plan: make test TEST=T12091
      
      Reviewers: austin, bgamari
      
      Subscribers: rwbarton, thomie
      
      GHC Trac Issues: #12091
      
      Differential Revision: https://phabricator.haskell.org/D3849
      ddb870bf
  25. 02 Jun, 2017 1 commit
    • Ryan Scott's avatar
      Make GHCi work when RebindableSyntax is enabled · 2abe54e1
      Ryan Scott authored
      Previously, we were running some blocks of code at the start of every
      GHCi sessions which use do-notation, something which doesn't work well
      if you start GHCi with the `-XRebindableSyntax` flag on. This tweaks the
      code to avoid the use of do-notation so that `-XRebindableSyntax` won't
      reject it.
      
      Test Plan: make test TEST=T13385
      
      Reviewers: austin, bgamari
      
      Reviewed By: bgamari
      
      Subscribers: rwbarton, thomie
      
      GHC Trac Issues: #13385
      
      Differential Revision: https://phabricator.haskell.org/D3621
      2abe54e1
  26. 20 May, 2017 1 commit
  27. 25 Apr, 2017 2 commits
    • Ryan Scott's avatar
      Only pretty-print binders in closed type families with -fprint-explicit-foralls · da792e47
      Ryan Scott authored
      Previously, we were unconditionally pretty-printing all type variable
      binders when pretty-printing closed type families (e.g., in the output
      of `:info` in GHCi). This threw me for a loop, so let's guard this behind
      the `-fprint-explicit-foralls` flag.
      
      Test Plan: make test TEST=T13420
      
      Reviewers: goldfire, austin, bgamari
      
      Reviewed By: bgamari
      
      Subscribers: rwbarton, thomie
      
      GHC Trac Issues: #13420
      
      Differential Revision: https://phabricator.haskell.org/D3497
      da792e47
    • Simon Marlow's avatar
      Don't setProgramDynFlags on every :load · 914842e5
      Simon Marlow authored
      Summary:
      setProgramDynFlags invalidates the whole module graph, forcing
      everything to be re-summarised (including preprocessing) on every
      :reload.
      
      Looks like this was a bad regression in 8.0, but we didn't notice
      because there was no test for it.  Now there is!
      
      Test Plan:
      * validate
      * new unit test
      
      Reviewers: bgamari, triple, austin, niteria, erikd, jme
      
      Subscribers: rwbarton, thomie
      
      Differential Revision: https://phabricator.haskell.org/D3398
      914842e5
  28. 23 Apr, 2017 1 commit
  29. 02 Apr, 2017 1 commit
  30. 27 Mar, 2017 1 commit
  31. 17 Mar, 2017 1 commit
  32. 26 Feb, 2017 2 commits
    • rwbarton's avatar
      tests: remove extra_files.py (#12223) · 3415bcaa
      rwbarton authored
      The script I used is included as testsuite/driver/kill_extra_files.py,
      though at this point it is for mostly historical interest.
      
      Some of the tests in libraries/hpc relied on extra_files.py, so this
      commit includes an update to that submodule.
      
      One test in libraries/process also relies on extra_files.py, but we
      cannot update that submodule so easily, so for now we special-case it
      in the test driver.
      3415bcaa
    • rwbarton's avatar
      tests: manually move some extra_files into *.T files · 98119f5a
      rwbarton authored
      Some of the *.T files were in libraries/hpc, so this contains an
      update to that submodule.
      98119f5a
  33. 02 Feb, 2017 1 commit
    • Ben Gamari's avatar
      Add support for StaticPointers in GHCi · eedb3df0
      Ben Gamari authored
      Here we add support to GHCi for StaticPointers. This process begins by
      adding remote GHCi messages for adding entries to the static pointer
      table. We then collect binders needing SPT entries after linking and
      send the interpreter a message adding entries with the appropriate
      fingerprints.
      
      Test Plan: `make test TEST=StaticPtr`
      
      Reviewers: facundominguez, mboes, simonpj, simonmar, goldfire, austin,
      hvr, erikd
      
      Reviewed By: simonpj, simonmar
      
      Subscribers: RyanGlScott, simonpj, thomie
      
      Differential Revision: https://phabricator.haskell.org/D2504
      
      GHC Trac Issues: #12356
      eedb3df0
  34. 22 Jan, 2017 1 commit
    • thomie's avatar
      Remove clean_cmd and extra_clean usage from .T files · 5d38fb69
      thomie authored
      The `clean_cmd` and `extra_clean` setup functions don't do anything.
      Remove them from .T files.
      
      Created using https://github.com/thomie/refactor-ghc-testsuite. This
      diff is a test for the .T-file parser/processor/pretty-printer in that
      repository.
      
          find . -name '*.T' -exec ~/refactor-ghc-testsuite/Main "{}" \;
      
      Tests containing inline comments or multiline strings are not modified.
      
      Preparation for #12223.
      
      Test Plan: Harbormaster
      
      Reviewers: austin, hvr, simonmar, mpickering, bgamari
      
      Reviewed By: mpickering
      
      Subscribers: mpickering
      
      Differential Revision: https://phabricator.haskell.org/D3000
      
      GHC Trac Issues: #12223
      5d38fb69
  35. 27 Dec, 2016 1 commit
    • Peter Trommler's avatar
      Testsuite: Skip failing tests on PowerPC 64-bit · 4dec7d19
      Peter Trommler authored
      The Power ISA says the result of a division by zero is undefined.  So
      ignore stdout on PowerPC 64-bit systems.
      
      Disable ext-interp tests on 64-bit PowerPC.  We don't have support for
      PowerPC 64-bit ELF in the RTS linker, which is needed for the external
      interpreter.
      
      Test Plan: ./validate
      
      Reviewers: austin, simonmar, hvr, erikd, bgamari
      
      Reviewed By: bgamari
      
      Subscribers: thomie
      
      Differential Revision: https://phabricator.haskell.org/D2782
      4dec7d19
  36. 13 Dec, 2016 1 commit
  37. 08 Dec, 2016 1 commit