Skip to content
Snippets Groups Projects
  1. Jun 05, 2018
    • Ryan Scott's avatar
      Introduce DerivingVia · 8ed8b037
      Ryan Scott authored
      This implements the `DerivingVia` proposal put forth in
      https://github.com/ghc-proposals/ghc-proposals/pull/120.
      
      This introduces the `DerivingVia` deriving strategy. This is a
      generalization of `GeneralizedNewtypeDeriving` that permits the user
      to specify the type to `coerce` from.
      
      The major change in this patch is the introduction of the
      `ViaStrategy` constructor to `DerivStrategy`, which takes a type
      as a field. As a result, `DerivStrategy` is no longer a simple
      enumeration type, but rather something that must be renamed and
      typechecked. The process by which this is done is explained more
      thoroughly in section 3 of this paper
      ( https://www.kosmikus.org/DerivingVia/deriving-via-paper.pdf ),
      although I have inlined the relevant parts into Notes where possible.
      
      There are some knock-on changes as well. I took the opportunity to
      do some refactoring of code in `TcDeriv`, especially the
      `mkNewTypeEqn` function, since it was bundling all of the logic for
      (1) deriving instances for newtypes and
      (2) `GeneralizedNewtypeDeriving`
      into one huge broth. `DerivingVia` reuses much of part (2), so that
      was factored out as much as possible.
      
      Bumps the Haddock submodule.
      
      Test Plan: ./validate
      
      Reviewers: simonpj, bgamari, goldfire, alanz
      
      Subscribers: alanz, goldfire, rwbarton, thomie, mpickering, carter
      
      GHC Trac Issues: #15178
      
      Differential Revision: https://phabricator.haskell.org/D4684
      8ed8b037
  2. Jun 04, 2018
    • Simon Jakobi's avatar
      Serialize docstrings to ifaces, display them with new GHCi :doc command · 85309a3c
      Simon Jakobi authored and Ben Gamari's avatar Ben Gamari committed
      If `-haddock` is set, we now extract docstrings from the renamed ast
      and serialize them in the .hi-files.
      
      This includes some of the changes from D4749 with the notable
      exceptions of the docstring lexing and renaming.
      
      A currently limited and experimental GHCi :doc command can be used
      to display docstrings for declarations.
      
      The formatting of pretty-printed docstrings is changed slightly,
      causing some changes in testsuite/tests/haddock.
      
      Test Plan: ./validate
      
      Reviewers: alexbiehl, hvr, gershomb, harpocrates, bgamari
      
      Reviewed By: alexbiehl
      
      Subscribers: rwbarton, thomie, carter
      
      Differential Revision: https://phabricator.haskell.org/D4758
      85309a3c
    • Simon Peyton Jones's avatar
      Implement QuantifiedConstraints · 7df58960
      Simon Peyton Jones authored
      We have wanted quantified constraints for ages and, as I hoped,
      they proved remarkably simple to implement.   All the machinery was
      already in place.
      
      The main ticket is Trac #2893, but also relevant are
        #5927
        #8516
        #9123 (especially!  higher kinded roles)
        #14070
        #14317
      
      The wiki page is
        https://ghc.haskell.org/trac/ghc/wiki/QuantifiedConstraints
      which in turn contains a link to the GHC Proposal where the change
      is specified.
      
      Here is the relevant Note:
      
      Note [Quantified constraints]
      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      The -XQuantifiedConstraints extension allows type-class contexts like
      this:
      
        data Rose f x = Rose x (f (Rose f x))
      
        instance (Eq a, forall b. Eq b => Eq (f b))
              => Eq (Rose f a)  where
          (Rose x1 rs1) == (Rose x2 rs2) = x1==x2 && rs1 >= rs2
      
      Note the (forall b. Eq b => Eq (f b)) in the instance contexts.
      This quantified constraint is needed to solve the
       [W] (Eq (f (Rose f x)))
      constraint which arises form the (==) definition.
      
      Here are the moving parts
        * Language extension {-# LANGUAGE QuantifiedConstraints #-}
          and add it to ghc-boot-th:GHC.LanguageExtensions.Type.Extension
      
        * A new form of evidence, EvDFun, that is used to discharge
          such wanted constraints
      
        * checkValidType gets some changes to accept forall-constraints
          only in the right places.
      
        * Type.PredTree gets a new constructor ForAllPred, and
          and classifyPredType analyses a PredType to decompose
          the new forall-constraints
      
        * Define a type TcRnTypes.QCInst, which holds a given
          quantified constraint in the inert set
      
        * TcSMonad.InertCans gets an extra field, inert_insts :: [QCInst],
          which holds all the Given forall-constraints.  In effect,
          such Given constraints are like local instance decls.
      
        * When trying to solve a class constraint, via
          TcInteract.matchInstEnv, use the InstEnv from inert_insts
          so that we include the local Given forall-constraints
          in the lookup.  (See TcSMonad.getInstEnvs.)
      
        * topReactionsStage calls doTopReactOther for CIrredCan and
          CTyEqCan, so they can try to react with any given
          quantified constraints (TcInteract.matchLocalInst)
      
        * TcCanonical.canForAll deals with solving a
          forall-constraint.  See
             Note [Solving a Wanted forall-constraint]
             Note [Solving a Wanted forall-constraint]
      
        * We augment the kick-out code to kick out an inert
          forall constraint if it can be rewritten by a new
          type equality; see TcSMonad.kick_out_rewritable
      
      Some other related refactoring
      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      
      * Move SCC on evidence bindings to post-desugaring, which fixed
        #14735, and is generally nicer anyway because we can use
        existing CoreSyn free-var functions.  (Quantified constraints
        made the free-vars of an ev-term a bit more complicated.)
      
      * In LookupInstResult, replace GenInst with OneInst and NotSure,
        using the latter for multiple matches and/or one or more
        unifiers
      7df58960
    • Tao He's avatar
      Fix broken test T14547. · d8efb098
      Tao He authored
      Phab:D4571 lags behind HEAD for too many commits. The commit of
      Phab:4571 1f88f541 brought some
      unintentional changes (not belong to [Phab:4571's Diff
      16314](https://phabricator.haskell.org/differential/diff/16314/)) into
      ghc-head, breaking T14557.
      
      Let's fix that.
      
      Test Plan: make test TEST="T14547"
      
      Reviewers: bgamari
      
      Reviewed By: bgamari
      
      Subscribers: rwbarton, thomie, carter
      
      GHC Trac Issues: #15222
      
      Differential Revision: https://phabricator.haskell.org/D4778
      d8efb098
    • Simon Peyton Jones's avatar
      Expand type synonyms when Linting a forall · 9d600ea6
      Simon Peyton Jones authored
      Trac #14939 showed a type like
         type Alg cls ob = ob
         f :: forall (cls :: * -> Constraint) (b :: Alg cls *). b
      
      where the kind of the forall looks like (Alg cls *), with a
      free cls. This tripped up Core Lint.
      
      I fixed this by making Core Lint a bit more forgiving, expanding
      type synonyms if necessary.
      
      I'm worried that this might not be the whole story; notably
      typeKind looks suspect.  But it certainly fixes this problem.
      9d600ea6
  3. Jun 03, 2018
    • Ben Gamari's avatar
      testsuite: Really mark T14547 as broken · 4dd1895b
      Ben Gamari authored
      4dd1895b
    • Ben Gamari's avatar
      testsuite: Mark T14547 as broken · b564eb7e
      Ben Gamari authored
      b564eb7e
    • Ryan Scott's avatar
      Add tests for #8128 and #8740 · 90e99c4c
      Ryan Scott authored
      Commit 08073e16 (#11066) ended up
      fixing these, fortunately enough.
      90e99c4c
    • Tao He's avatar
      Improve exhaustiveness checking for literal values and patterns, fix #14546 · 1f88f541
      Tao He authored
      Currently, we parse both the **integral literal** value and the patterns
      as `OverLit HsIntegral`.  For example:
      
      ```
        case 0::Int of
            0 -> putStrLn "A"
            1 -> putStrLn "B"
            _ -> putStrLn "C"
      ```
      
      When checking the exhaustiveness of pattern matching, we translate the
      `0` in value position as `PmOLit`, but translate the `0` and `1` in
      pattern position as `PmSLit`. The inconsistency leads to the failure of
      `eqPmLit` to detect the equality and report warning of "Pattern match is
      redundant" on pattern `0`, as reported in #14546. In this patch we
      remove the specialization of `OverLit` patterns, and keep the overloaded
      number literal in pattern as it is to maintain the consistency.  Now we
      can capture the exhaustiveness of pattern `0` and the redundancy of
      pattern `1` and `_`.
      
      For **string literals**, we parse the string literals as `HsString`.
      When  `OverloadedStrings` is enabled, it further be turned as `HsOverLit
      HsIsString`, whether it's type is `String` or not. For example:
      
      ```
        case "foo" of
            "foo" -> putStrLn "A"
            "bar" -> putStrLn "B"
            "baz" -> putStrLn "C"
      ```
      
      Previously, the overloaded string values are translated to `PmOLit` and
      the non-overloaded string values are translated to `PmSLit`. However the
      string patterns, both overloaded and non-overloaded, are translated to
      list of characters. The inconsistency leads to wrong warnings about
      redundant and non-exhaustive pattern matching warnings, as reported
      in #14546.
      
      In order to catch the redundant pattern in following case:
      
      ```
        case "foo" of
            ('f':_) -> putStrLn "A"
            "bar" -> putStrLn "B"
      ```
      
      In this patch, we translate non-overloaded string literals, both in
      value position and pattern position, as list of characters. For
      overloaded string literals, we only translate it to list of characters
      only when it's type is `stringTy`, since we know nothing about the
      `toString` methods.  But we know that if two overloaded strings are
      syntax equal, then they are equal. Then if it's type is not `stringTy`,
      we just translate it to `PmOLit`. We can still capture the
      exhaustiveness of pattern `"foo"` and the redundancy of pattern `"bar"`
      and `"baz"` in the following code:
      
      ```
      {-# LANGUAGE OverloadedStrings #-}
      main = do
        case "foo" of
            "foo" -> putStrLn "A"
            "bar" -> putStrLn "B"
            "baz" -> putStrLn "C"
      ```
      
      Test Plan: make test TEST="T14546"
      
      Reviewers: bgamari, simonpj
      
      Reviewed By: bgamari, simonpj
      
      Subscribers: simonpj, thomie, carter
      
      GHC Trac Issues: #14546
      
      Differential Revision: https://phabricator.haskell.org/D4571
      1f88f541
    • Tobias Dammers's avatar
      Turn "inaccessible code" error into a warning · 08073e16
      Tobias Dammers authored and Ben Gamari's avatar Ben Gamari committed
      With GADTs, it is possible to write programs such that the type
      constraints make some code branches inaccessible.
      
      Take, for example, the following program ::
      
          {-# LANGUAGE GADTs #-}
      
          data Foo a where
           Foo1 :: Foo Char
           Foo2 :: Foo Int
      
          data TyEquality a b where
                  Refl :: TyEquality a a
      
          checkTEQ :: Foo t -> Foo u -> Maybe (TyEquality t u)
          checkTEQ x y = error "unimportant"
      
          step2 :: Bool
          step2 = case checkTEQ Foo1 Foo2 of
                   Just Refl -> True -- Inaccessible code
                   Nothing -> False
      
      Clearly, the `Just Refl` case cannot ever be reached, because the `Foo1`
      and `Foo2` constructors say `t ~ Char` and `u ~ Int`, while the `Refl`
      constructor essentially mandates `t ~ u`, and thus `Char ~ Int`.
      
      Previously, GHC would reject such programs entirely; however, in
      practice this is too harsh. Accepting such code does little harm, since
      attempting to use the "impossible" code will still produce errors down
      the chain, while rejecting it means we cannot legally write or generate
      such code at all.
      
      Hence, we turn the error into a warning, and provide
      `-Winaccessible-code` to control GHC's behavior upon encountering this
      situation.
      
      Test Plan: ./validate
      
      Reviewers: bgamari
      
      Reviewed By: bgamari
      
      Subscribers: rwbarton, thomie, carter
      
      GHC Trac Issues: #11066
      
      Differential Revision: https://phabricator.haskell.org/D4744
      08073e16
    • Ryan Scott's avatar
      Fix a bad interaction between GADTs and COMPLETE sets · 4d800448
      Ryan Scott authored
      As observed in #14059 (starting at comment 5), the error
      messages surrounding a program involving GADTs and a `COMPLETE` set
      became worse between 8.2 and 8.4. The culprit was a new validity
      check in 8.4 which filters out `COMPLETE` set candidates if a return
      type of any conlike in the set doesn't match the type of the
      scrutinee. However, this check was too conservative, since it removed
      perfectly valid `COMPLETE` sets that contained GADT constructors,
      which quite often have return types that don't match the type of a
      scrutinee.
      
      To fix this, I adopted the most straightforward possible solution of
      only performing this validity check on //pattern synonym//
      constructors, not //data// constructors.
      
      Note that this does not fix #14059 entirely, but instead simply fixes
      a particular buglet that was discovered in that ticket.
      
      Test Plan: make test TEST=T14059
      
      Reviewers: bgamari, mpickering
      
      Reviewed By: mpickering
      
      Subscribers: rwbarton, thomie, carter
      
      GHC Trac Issues: #14059
      
      Differential Revision: https://phabricator.haskell.org/D4752
      4d800448
    • Tobias Dammers's avatar
      Handle abi-depends correctly in ghc-pkg · 1626fe60
      Tobias Dammers authored and Ben Gamari's avatar Ben Gamari committed
      When inferring the correct abi-depends, we now look at all the package
      databases in the stack, up to and including the current one, because
      these are the ones that the current package can legally depend on. While
      doing so, we will issue warnings:
      
      - In verbose mode, we warn about every package that declares
        abi-depends:, whether we actually end up overriding them with the
        inferred ones or not ("possibly broken abi-depends").
      
      - Otherwise, we only warn about packages whose declared abi-depends
        does not match what we inferred ("definitely broken abi-depends").
      
      Reviewers: bgamari
      
      Reviewed By: bgamari
      
      Subscribers: rwbarton, thomie, carter
      
      GHC Trac Issues: #14381
      
      Differential Revision: https://phabricator.haskell.org/D4729
      1626fe60
    • Ryan Scott's avatar
      Fix #15214 by listing (~) in isBuiltInOcc_maybe · 21e9d4f5
      Ryan Scott authored
      This changes an obscure error (which mistakenly mentions
      Template Haskell) to one that makes more sense.
      
      Test Plan: make test TEST=T15214
      
      Reviewers: bgamari, mpickering
      
      Reviewed By: bgamari, mpickering
      
      Subscribers: mpickering, rwbarton, thomie, carter
      
      GHC Trac Issues: #15214
      
      Differential Revision: https://phabricator.haskell.org/D4768
      21e9d4f5
    • Ryan Scott's avatar
      Fix #13777 by improving the underdetermined CUSK error message · ac91d073
      Ryan Scott authored
      The error message that GHC emits from underdetermined CUSKs
      is rather poor, since:
      
      1. It may print an empty list of user-written variables if there
          are none in the declaration.
      2. It may not mention any `forall`-bound, underdetermined
          variables in the result kind.
      
      To resolve these issues, this patch:
      
      1. Doesn't bother printing a herald about user-written
          variables if there are none.
      2. Prints the result kind to advertise any
          underdetermination it may exhibit.
      
      Test Plan: make test TEST=T13777
      
      Reviewers: goldfire, bgamari
      
      Reviewed By: goldfire
      
      Subscribers: rwbarton, thomie, carter
      
      GHC Trac Issues: #13777
      
      Differential Revision: https://phabricator.haskell.org/D4771
      ac91d073
    • lazac's avatar
      Extended the plugin system to run plugins on more representations · c2783ccf
      lazac authored and Ben Gamari's avatar Ben Gamari committed
      Extend GHC plugins to access parsed, type checked representation,
      interfaces that are loaded. And splices that are evaluated. The goal is
      to enable development tools to access the GHC representation in the
      pre-existing build environment.
      
      See the full proposal here:
      https://ghc.haskell.org/trac/ghc/wiki/ExtendedPluginsProposal
      
      Reviewers: goldfire, bgamari, ezyang, angerman, mpickering
      
      Reviewed By: mpickering
      
      Subscribers: ezyang, angerman, mpickering, ulysses4ever, rwbarton, thomie, carter
      
      GHC Trac Issues: #14709
      
      Differential Revision: https://phabricator.haskell.org/D4342
      c2783ccf
  4. Jun 02, 2018
    • Ben Gamari's avatar
      testsuite: Don't assume location of bash · e0f33a6e
      Ben Gamari authored
      e0f33a6e
    • Ben Gamari's avatar
      vectorise: Put it out of its misery · faee23bb
      Ben Gamari authored and Ben Gamari's avatar Ben Gamari committed
      Poor DPH and its vectoriser have long been languishing; sadly it seems there is
      little chance that the effort will be rekindled. Every few years we discuss
      what to do with this mass of code and at least once we have agreed that it
      should be archived on a branch and removed from `master`. Here we do just that,
      eliminating heaps of dead code in the process.
      
      Here we drop the ParallelArrays extension, the vectoriser, and the `vector` and
      `primitive` submodules.
      
      Test Plan: Validate
      
      Reviewers: simonpj, simonmar, hvr, goldfire, alanz
      
      Reviewed By: simonmar
      
      Subscribers: goldfire, rwbarton, thomie, mpickering, carter
      
      Differential Revision: https://phabricator.haskell.org/D4761
      faee23bb
    • Ben Gamari's avatar
      Conservatively estimate levity in worker/wrapper · f0c1eb8b
      Ben Gamari authored and Ben Gamari's avatar Ben Gamari committed
      The worker/wrapper transform needs to determine the levity of the result to
      determine whether it needs to introduce a lambda to preserve laziness of the
      result. For this is previously used isUnliftedType. However, this may fail in
      the presence of levity polymorphism.
      
      We now instead use isLiftedType_maybe, assuming that a lambda is needed if the
      levity of the result cannot be determined.
      
      Fixes #15186.
      
      Test Plan: make test=T15186
      
      Reviewers: simonpj, goldfire, tdammers
      
      Reviewed By: simonpj
      
      Subscribers: rwbarton, thomie, carter
      
      GHC Trac Issues: #15186
      
      Differential Revision: https://phabricator.haskell.org/D4755
      f0c1eb8b
    • Ben Gamari's avatar
      testsuite: Add test for #15186 · c983a1db
      Ben Gamari authored and Ben Gamari's avatar Ben Gamari committed
      Summary: Currently broken.
      
      Test Plan: Validate
      
      Subscribers: rwbarton, thomie, carter
      
      GHC Trac Issues: #15186
      
      Differential Revision: https://phabricator.haskell.org/D4757
      c983a1db
  5. May 31, 2018
  6. May 30, 2018
    • Ben Gamari's avatar
      testsuite: Fix hashbangs · 50301093
      Ben Gamari authored
      50301093
    • Matthew Pickering's avatar
      Implement "An API for deciding whether plugins should cause recompilation" · 1d1e2b77
      Matthew Pickering authored
      This patch implements the API proposed as pull request #108 for plugin
      authors to influence the recompilation checker.
      
      It adds a new field to a plugin which computes a `FingerPrint`. This is
      recorded in interface files and if it changes then we recompile the
      module. There are also helper functions such as `purePlugin` and
      `impurePlugin` for constructing plugins which have simple recompilation
      semantics but in general, an author can compute a hash as they wish.
      
      Fixes #12567 and #7414
      
      https://github.com/ghc-proposals/ghc-proposals/blob/master/proposals/002
      2-plugin-recompilation.rst
      
      Reviewers: bgamari, ggreif
      
      Reviewed By: bgamari
      
      Subscribers: rwbarton, thomie, carter
      
      GHC Trac Issues: #7414, #12567
      
      Differential Revision: https://phabricator.haskell.org/D4366
      1d1e2b77
    • Matthías Páll Gissurarson's avatar
      Improved Valid Hole Fits · e0b44e2e
      Matthías Páll Gissurarson authored and Ben Gamari's avatar Ben Gamari committed
      I've changed the name from `Valid substitutions` to `Valid hole fits`,
      since "substitution" already has a well defined meaning within the
      theory. As part of this change, the flags and output is reanamed, with
      substitution turning into hole-fit in most cases. "hole fit" was already
      used internally in the code, it's clear and shouldn't cause any
      confusion.
      
      In this update, I've also reworked how we manage side-effects in the
      hole we are considering.
      
      This allows us to consider local bindings such as where clauses and
      arguments to functions, suggesting e.g. `a` for `head (x:xs) where head
      :: [a] -> a`.
      
      It also allows us to find suggestions such as `maximum` for holes of
      type `Ord a => a -> [a]`, and `max` when looking for a match for the
      hole in `g = foldl1 _`, where `g :: Ord a => [a] -> a`.
      
      We also show much improved output for refinement hole fits, and
      fixes #14990. We now show the correct type of the function, but we also
      now show what the arguments to the function should be e.g. `foldl1 (_ ::
      Integer -> Integer -> Integer)` when looking for `[Integer] -> Integer`.
      
      I've moved the bulk of the code from `TcErrors.hs` to a new file,
      `TcHoleErrors.hs`, since it was getting too big to not live on it's own.
      
      This addresses the considerations raised in #14969, and takes proper
      care to set the `tcLevel` of the variables to the right level before
      passing it to the simplifier.
      
      We now also zonk the suggestions properly, which improves the output of
      the refinement hole fits considerably.
      
      This also filters out suggestions from the `GHC.Err` module, since even
      though `error` and `undefined` are indeed valid hole fits, they are
      "trivial", and almost never useful to the user.
      
      We now find the hole fits using the proper manner, namely by solving
      nested implications. This entails that the givens are passed along using
      the implications the hole was nested in, which in turn should mean that
      there will be fewer weird bugs in the typed holes.
      
      I've also added a new sorting method (as suggested by SPJ) and sort by
      the size of the types needed to turn the hole fits into the type of the
      hole. This gives a reasonable approximation to relevance, and is much
      faster than the subsumption check. I've also added a flag to toggle
      whether to use this new sorting algorithm (as is done by default) or the
      subsumption algorithm. This fixes #14969
      
      I've also added documentation for these new flags and update the
      documentation according to the new output.
      
      Reviewers: bgamari, goldfire
      
      Reviewed By: bgamari
      
      Subscribers: simonpj, rwbarton, thomie, carter
      
      GHC Trac Issues: #14969, #14990, #10946
      
      Differential Revision: https://phabricator.haskell.org/D4444
      e0b44e2e
    • Tao He's avatar
      Put the `ev_binds` of main function inside `runMainIO` · 49e423e9
      Tao He authored
      This ensures that the deferred type error can be emitted correctly.
      
      For `main` function in `Main` module, we have
      
          :Main.main = GHC.TopHandler.runMainIO main
      
      When the type of `main` is not `IO t` and the
      `-fdefer-type-errors` is enabled, the `ev_binds`
      of `main` function will contain deferred type
      errors.
      
      Previously, the `ev_binds` are bound to `runMainIO main`,
      rather than `main`, the type error exception at runtime
      cannot be handled properly. See Trac #13838.
      
      This patch fix that.
      
      Test Plan: make test TEST="T13838"
      
      Reviewers: bgamari
      
      Reviewed By: bgamari
      
      Subscribers: rwbarton, thomie, carter
      
      GHC Trac Issues: #13838
      
      Differential Revision: https://phabricator.haskell.org/D4708
      49e423e9
    • Alp Mestanogullari's avatar
      T14732 now passes with the profasm way · c65159dc
      Alp Mestanogullari authored and Ben Gamari's avatar Ben Gamari committed
      Simon PJ recently fixed the problem behind this failure
      so we can now expect this test to pass in all ways again.
      
      The fixes got introduced in the following commits:
        86bba7d5
        d191db48
      
      Test Plan: T14732 (profasm way)
      
      Reviewers: bgamari, RyanGlScott, simonpj
      
      Reviewed By: RyanGlScott, simonpj
      
      Subscribers: simonpj, RyanGlScott, rwbarton, thomie, carter
      
      GHC Trac Issues: #15163
      
      Differential Revision: https://phabricator.haskell.org/D4725
      c65159dc
  7. May 29, 2018
  8. May 28, 2018
    • Tamar Christina's avatar
      Clean up Windows testsuite failures · 60fb2b21
      Tamar Christina authored
      Summary:
      Another round and attempt at getting these down to 0.
      
      We really should re-enable the CI and not wait for those cloud based ones.
      
      I've disabled the backpack tests on windows as they are too broad, they test
      as much the shell as they do the compiler.
      
      The perf tests have been too long to track down. but the numbers are horrible
      but I don't see them getting fixed so just have to accept them.
      
      T9293 has new windows specific output because a Dyn way only flag was added.
      This will of course not work on non-Dyn way builds.
      
      Test Plan: ./validate
      
      Reviewers: bgamari, hvr, simonmar
      
      Reviewed By: bgamari
      
      Subscribers: rwbarton, thomie, carter
      
      GHC Trac Issues: #15107
      
      Differential Revision: https://phabricator.haskell.org/D4668
      60fb2b21
  9. May 27, 2018
  10. May 26, 2018
  11. May 25, 2018
    • Simon Marlow's avatar
      Add -fghci-leak-check to check for space leaks · 5b6ef59f
      Simon Marlow authored
      Summary:
      (re-applying this patch now that D4659 is committed)
      
      Space leaks in GHCi emerge from time to time and tend to come back again
      after they get fixed. This is an attempt to limit regressions by
      
      * adding a reliable detection for some classes of space leaks in GHCi
      * turning on leak checking for all GHCi tests in the test suite, so that
        we'll notice if the leak appears again.
      
      The idea for detecting space leaks is quite simple:
      
      * find some data that we expect to be GC'd later, make a weak pointer to it
      * when we expect the data to be dead, do a `performGC` and then check
        the status of the weak pointer.
      
      It would be nice to apply this trick to lots of things in GHC,
      e.g. ensuring that HsSyn is not retained after the desugarer, or
      ensuring that CoreSyn from the previous simplifier pass is not retained.
      
      Test Plan: validate
      
      Reviewers: bgamari, simonpj, erikd, niteria
      
      Subscribers: thomie, carter
      
      GHC Trac Issues: #15111
      5b6ef59f
  12. May 24, 2018
    • Ryan Scott's avatar
      Clean up the conflicting data family instances error message · 979f085c
      Ryan Scott authored
      Summary:
      The way we were pretty-printing conflicting data family
      instances in an error message was far from ideal:
      
      1. If a data type had no constructors, it would print an equals sign
         with nothing to the right of it.
      2. It would try to print GADTs using Haskell98 syntax.
      3. It eta-reduced away some type variables from the LHS.
      
      This patch addresses these three issues:
      
      1. We no longer print constructors at all in this error message.
         There's really no reason to do so in the first place, since
         duplicate data family instances always conflict, regardless of
         their constructors.
      2. Since we no longer print constructors, we no longer have to
         worry about whether we're using GADT or Haskell98 syntax.
      3. I've put in a fix to ensure that type variables are no longer
         eta-reduced away from the LHS.
      
      Test Plan: make test TEST=T14179
      
      Reviewers: goldfire, bgamari
      
      Reviewed By: bgamari
      
      Subscribers: rwbarton, thomie, carter
      
      GHC Trac Issues: #14179
      
      Differential Revision: https://phabricator.haskell.org/D4711
      979f085c
    • Ryan Scott's avatar
      Check for mismatched class methods during typechecking · 1879d9d2
      Ryan Scott authored
      Summary:
      Template Haskell provides a wormhole through which you can
      sneak methods that don't belong to a class into an instance for that
      class, bypassing the renamer's validity checks. The solution adopted
      here is to mirror the treatment for associated type family instances,
      which have an additional check in the typechecker which catch
      mismatched associated type families that were snuck through using
      Template Haskell. I've put a similar check for class methods into
      `tcMethods`.
      
      Test Plan: make test TEST=T12387
      
      Reviewers: bgamari, simonpj
      
      Reviewed By: bgamari, simonpj
      
      Subscribers: simonpj, rwbarton, thomie, carter
      
      GHC Trac Issues: #12387
      
      Differential Revision: https://phabricator.haskell.org/D4710
      1879d9d2
    • Ben Gamari's avatar
      testsuite: Bump OS X performance numbers · 49691c4f
      Ben Gamari authored
      Sadly I can't easily determine the cause of T13701's regression since the tree
      was broken.
      49691c4f
  13. May 23, 2018
    • Simon Peyton Jones's avatar
      Use dischargeFunEq consistently · a32c8f75
      Simon Peyton Jones authored
      Trac #15122 turned out to be interesting.
      
      * Were calling dischargeFmv in three places.
      
      * In all three cases we dealt with the Given case
        separately.
      
      * In two of the three cases the Given code was right,
        (albeit duplicated).
      
      * In the third case (in TcCanonical.canCFunEqCan), we had
           ; case flav of
               Given -> return () -- nothing more to do.
        which was utterly wrong.
      
      The solution is easy: move the Given-case handling into
      dischargeFmv (now reenamed dischargeFunEq), and delete it
      from the call sites.
      
      Result: less code, easier to understand (dischargeFunEq handles
      all three cases, not just two out of three), and Trac #15122 is fixed.
      a32c8f75
  14. May 22, 2018
Loading