1. 25 Jun, 2016 1 commit
    • eir@cis.upenn.edu's avatar
      s/Invisible/Inferred/g s/Visible/Required/g · 5fdb854c
      eir@cis.upenn.edu authored
      This renames VisibilityFlag from
      
      > data VisibilityFlag = Visible | Specified | Invisible
      
      to
      
      > data ArgFlag = Required | Specified | Inferred
      
      The old name was quite confusing, because both Specified
      and Invisible were invisible! The new names are hopefully clearer.
      5fdb854c
  2. 22 Jun, 2016 2 commits
    • Simon Peyton Jones's avatar
      Expand given superclasses more eagerly · ce97b729
      Simon Peyton Jones authored
      This patch fixes Trac #12175, another delicate corner case of
      Note [Instance and Given overlap] in TcInteract.
      
      In #12175 we were not expanding given superclasses eagerly
      enough. It was easy to fix, and is actually rather neater than
      before.
      
      See Note [Eagerly expand given superclasses] in TcCanonical.
      The main change is to move the eager expansion of given superclasses
      to canClassNC.
      ce97b729
    • Gabor Greif's avatar
      More typos in comments [skip ci] · 61995883
      Gabor Greif authored
      61995883
  3. 15 Jun, 2016 2 commits
    • Simon Peyton Jones's avatar
      Major patch to introduce TyConBinder · e368f326
      Simon Peyton Jones authored
      Before this patch, following the TypeInType innovations,
      each TyCon had two lists:
        - tyConBinders :: [TyBinder]
        - tyConTyVars  :: [TyVar]
      
      They were in 1-1 correspondence and contained
      overlapping information.  More broadly, there were many
      places where we had to pass around this pair of lists,
      instead of a single list.
      
      This commit tidies all that up, by having just one list of
      binders in a TyCon:
      
        - tyConBinders :: [TyConBinder]
      
      The new data types look like this:
      
        Var.hs:
           data TyVarBndr tyvar vis = TvBndr tyvar vis
           data VisibilityFlag = Visible | Specified | Invisible
           type TyVarBinder = TyVarBndr TyVar VisibilityFlag
      
        TyCon.hs:
           type TyConBinder = TyVarBndr TyVar TyConBndrVis
      
           data TyConBndrVis
             = NamedTCB VisibilityFlag
             | AnonTCB
      
        TyCoRep.hs:
           data TyBinder
             = Named TyVarBinder
             | Anon Type
      
      Note that Var.TyVarBdr has moved from TyCoRep and has been
      made polymorphic in the tyvar and visiblity fields:
      
           type TyVarBinder = TyVarBndr TyVar VisibilityFlag
              -- Used in ForAllTy
           type TyConBinder = TyVarBndr TyVar TyConBndrVis
              -- Used in TyCon
      
           type IfaceForAllBndr  = TyVarBndr IfaceTvBndr VisibilityFlag
           type IfaceTyConBinder = TyVarBndr IfaceTvBndr TyConBndrVis
               -- Ditto, in interface files
      
      There are a zillion knock-on changes, but everything
      arises from these types.  It was a bit fiddly to get the
      module loops to work out right!
      
      Some smaller points
      ~~~~~~~~~~~~~~~~~~~
      * Nice new functions
          TysPrim.mkTemplateKiTyVars
          TysPrim.mkTemplateTyConBinders
        which help you make the tyvar binders for dependently-typed
        TyCons.  See comments with their definition.
      
      * The change showed up a bug in TcGenGenerics.tc_mkRepTy, where the code
        was making an assumption about the order of the kind variables in the
        kind of GHC.Generics.(:.:).  I fixed this; see TcGenGenerics.mkComp.
      e368f326
    • Simon Peyton Jones's avatar
      Re-add FunTy (big patch) · 77bb0927
      Simon Peyton Jones authored
      With TypeInType Richard combined ForAllTy and FunTy, but that was often
      awkward, and yielded little benefit becuase in practice the two were
      always treated separately.  This patch re-introduces FunTy.  Specfically
      
      * New type
          data TyVarBinder = TvBndr TyVar VisibilityFlag
        This /always/ has a TyVar it.  In many places that's just what
        what we want, so there are /lots/ of TyBinder -> TyVarBinder changes
      
      * TyBinder still exists:
          data TyBinder = Named TyVarBinder | Anon Type
      
      * data Type = ForAllTy TyVarBinder Type
                  | FunTy Type Type
                  |  ....
      
      There are a LOT of knock-on changes, but they are all routine.
      
      The Haddock submodule needs to be updated too
      77bb0927
  4. 13 Jun, 2016 1 commit
    • Simon Peyton Jones's avatar
      Improve typechecking of let-bindings · 15b9bf4b
      Simon Peyton Jones authored
      This major commit was initially triggered by #11339, but it spiraled
      into a major review of the way in which type signatures for bindings
      are handled, especially partial type signatures.  On the way I fixed a
      number of other bugs, namely
         #12069
         #12033
         #11700
         #11339
         #11670
      
      The main change is that I completely reorganised the way in which type
      signatures in bindings are handled. The new story is in TcSigs
      Note [Overview of type signatures].  Some specific:
      
      * Changes in the data types for signatures in TcRnTypes:
        TcIdSigInfo and new TcIdSigInst
      
      * New module TcSigs deals with typechecking type signatures
        and pragmas. It contains code mostly moved from TcBinds,
        which is already too big
      
      * HsTypes: I swapped the nesting of HsWildCardBndrs
        and HsImplicitBndsrs, so that the wildcards are on the
        oustide not the insidde in a LHsSigWcType.  This is just
        a matter of convenient, nothing deep.
      
      There are a host of other changes as knock-on effects, and
      it all took FAR longer than I anticipated :-).  But it is
      a significant improvement, I think.
      
      Lots of error messages changed slightly, some just variants but
      some modest improvements.
      
      New tests
      
      * typecheck/should_compile
          * SigTyVars: a scoped-tyvar test
          * ExPat, ExPatFail: existential pattern bindings
          * T12069
          * T11700
          * T11339
      
      * partial-sigs/should_compile
          * T12033
          * T11339a
          * T11670
      
      One thing to check:
      
      * Small change to output from ghc-api/landmines.
        Need to check with Alan Zimmerman
      15b9bf4b
  5. 09 Jun, 2016 1 commit
    • Facundo Domínguez's avatar
      Improve the error messages for static forms. · e9dfb6e5
      Facundo Domínguez authored
      Now the message explains why closed variables are not closed when
      encountered in the body of (static ...).
      
      This required adding to the local environment the free variables of
      the local bindings in scope. Thus we can analyze and explain why a
      variable is not closed when encountered.
      
      Test Plan: ./validate
      
      Reviewers: austin, simonpj, bgamari
      
      Reviewed By: bgamari
      
      Subscribers: mboes, thomie
      
      Differential Revision: https://phabricator.haskell.org/D2167
      
      GHC Trac Issues: #12003
      e9dfb6e5
  6. 07 Jun, 2016 2 commits
  7. 02 Jun, 2016 1 commit
  8. 24 May, 2016 1 commit
    • Simon Peyton Jones's avatar
      Don't split the arg types in a PatSyn signature · 03d89603
      Simon Peyton Jones authored
      This patch fixes Trac #11977, and #12108, rather satisfactorily
      maily by deleting code!
      
        pattern P :: Eq a => a -> a -> Int
      
      The idea is simply /not/ to split the bit after the '=>' into the
      pattern argument types, but to keep the (a->a->Int) part
      un-decomposed, in the patsig_body_ty field of a TcPatSynInfo.
      
      There is one awkward wrinkle, which is that we can't split the
      implicitly-bound type variables into existential and universal until
      we know which types are arguments and which are part of the result.
      So we postpone the decision until we have the declaration in hand.
      See TcPatSyn Note [The pattern-synonym signature splitting rule]
      03d89603
  9. 18 May, 2016 1 commit
    • niteria's avatar
      Kill varEnvElts in tcPragExpr · 13e40f99
      niteria authored
      I had to refactor some things to take VarSet instead of [Var],
      but I think it's more precise this way.
      
      Test Plan: ./validate
      
      Reviewers: simonmar, simonpj, austin, bgamari, goldfire
      
      Reviewed By: simonpj
      
      Subscribers: thomie
      
      Differential Revision: https://phabricator.haskell.org/D2227
      
      GHC Trac Issues: #4012
      13e40f99
  10. 10 May, 2016 1 commit
  11. 04 May, 2016 1 commit
  12. 02 May, 2016 1 commit
    • Facundo Domínguez's avatar
      StaticPointers: Allow closed vars in the static form. · 36d29f7c
      Facundo Domínguez authored
      Summary:
      With this patch closed variables are allowed regardless of whether
      they are bound at the top level or not.
      
      The FloatOut pass is always performed. When optimizations are
      disabled, only expressions that go to the top level are floated.
      Thus, the applications of the StaticPtr data constructor are always
      floated.
      
      The CoreTidy pass makes sure the floated applications appear in the
      symbol table of object files. It also collects the floated bindings
      and inserts them in the static pointer table.
      
      The renamer does not check anymore if free variables appearing in the
      static form are top-level. Instead, the typechecker looks at the
      tct_closed flag to decide if the free variables are closed.
      
      The linter checks that applications of StaticPtr only occur at the
      top of top-level bindings after the FloatOut pass.
      
      The field spInfoName of StaticPtrInfo has been removed. It used to
      contain the name of the top-level binding that contains the StaticPtr
      application. However, this information is no longer available when the
      StaticPtr is constructed, as the binding name is determined now by the
      FloatOut pass.
      
      Test Plan: ./validate
      
      Reviewers: goldfire, simonpj, austin, hvr, bgamari
      
      Reviewed By: simonpj
      
      Subscribers: thomie, mpickering, mboes
      
      Differential Revision: https://phabricator.haskell.org/D2104
      
      GHC Trac Issues: #11656
      36d29f7c
  13. 29 Apr, 2016 1 commit
  14. 26 Apr, 2016 1 commit
    • niteria's avatar
      Kill varSetElems try_tyvar_defaulting · 94320e1d
      niteria authored
      `varSetElems` introduces unnecessary nondeterminism and we can do
      the same thing deterministically for the same price.
      
      Test Plan: ./validate
      
      Reviewers: goldfire, austin, simonmar, bgamari, simonpj
      
      Reviewed By: simonpj
      
      Subscribers: thomie
      
      Differential Revision: https://phabricator.haskell.org/D2143
      
      GHC Trac Issues: #4012
      94320e1d
  15. 20 Apr, 2016 1 commit
    • niteria's avatar
      Rename FV related functions · 2e33320a
      niteria authored
      This is from Simon's suggestion:
      
      * `tyCoVarsOfTypesAcc` is a terrible name for a function with a
        perfectly decent type `[Type] -> FV`. Maybe `tyCoFVsOfTypes`?
        Similarly others
      
      * `runFVList` is also terrible, but also has a decent type.
        Maybe just `fvVarList` (and `fvVarSet` for `runFVSet`).
      
      * `someVars` could be `mkFVs :: [Var] -> FV`.
      2e33320a
  16. 10 Apr, 2016 1 commit
    • Jason Eisenberg's avatar
      Fix suggestions for unbound variables (#11680) · 470d4d5b
      Jason Eisenberg authored
      When the typechecker generates the error message for an out-of-scope
      variable, it now uses the GlobalRdrEnv with respect to which the
      variable is unbound, not the GlobalRdrEnv which is available at the time
      the error is reported.  Doing so ensures we do not provide suggestions
      which themselves are out-of-scope (because they are bound in a later
      inter-splice group).
      
      Nonetheless, we do note in the error message if an unambiguous, exact
      match to the out-of-scope variable is found in a later inter-splice
      group, and we specify where that match is not in scope.
      
      Test Plan: ./validate
      
      Reviewers: goldfire, austin, bgamari
      
      Reviewed By: goldfire
      
      Subscribers: thomie
      
      Differential Revision: https://phabricator.haskell.org/D2000
      
      GHC Trac Issues: #11680
      470d4d5b
  17. 07 Apr, 2016 1 commit
  18. 04 Apr, 2016 1 commit
    • Eric Seidel's avatar
      Don't infer CallStacks · 7407a66d
      Eric Seidel authored
      We originally wanted CallStacks to be opt-in, but dealing with let
      binders complicated things, forcing us to infer CallStacks. It turns
      out that the inference is actually unnecessary though, we can let the
      wanted CallStacks bubble up to the outer context by refusing to
      quantify over them. Eventually they'll be solved from a given CallStack
      or defaulted to the empty CallStack if they reach the top.
      
      So this patch prevents GHC from quantifying over CallStacks, getting us
      back to the original plan. There's a small ugliness to do with
      PartialTypeSignatures, if the partial theta contains a CallStack
      constraint, we *do* want to quantify over the CallStack; the user asked
      us to!
      
      Note that this means that
      
        foo :: _ => CallStack
        foo = getCallStack callStack
      
      will be an *empty* CallStack, since we won't infer a CallStack for the
      hole in the theta. I think this is the right move though, since we want
      CallStacks to be opt-in. One can always write
      
        foo :: (HasCallStack, _) => CallStack
        foo = getCallStack callStack
      
      to get the CallStack and still have GHC infer the rest of the theta.
      
      Test Plan: ./validate
      
      Reviewers: goldfire, simonpj, austin, hvr, bgamari
      
      Reviewed By: simonpj, bgamari
      
      Subscribers: bitemyapp, thomie
      
      Projects: #ghc
      
      Differential Revision: https://phabricator.haskell.org/D1912
      
      GHC Trac Issues: #11573
      7407a66d
  19. 02 Apr, 2016 1 commit
    • Rik Steenkamp's avatar
      Improve printing of pattern synonym types · 72bd7f7b
      Rik Steenkamp authored
      Add the function `pprPatSynType :: PatSyn -> SDoc` for printing pattern
      synonym types, and remove the ambiguous `patSynType` function. Also,
      the types in a `PatSyn` are now tidy.
      
      Haddock submodule updated to reflect the removal of `patSynType` by
      mpickering.
      
      Fixes: #11213.
      
      Reviewers: goldfire, simonpj, austin, mpickering, bgamari
      
      Reviewed By: simonpj, mpickering
      
      Subscribers: bollmann, simonpj, thomie
      
      Differential Revision: https://phabricator.haskell.org/D1896
      
      GHC Trac Issues: #11213
      72bd7f7b
  20. 31 Mar, 2016 3 commits
    • Simon Peyton Jones's avatar
      Refactor error generation for pattern synonyms · 9fc65bb8
      Simon Peyton Jones authored
      The result of a series of patches on type-error messages for
      pattern synonyms had become a bit baroque. This tidies it up
      a bit.  Still not fantastic, but better.
      9fc65bb8
    • Simon Peyton Jones's avatar
      Make SigSkol take TcType not ExpType · 0ad2021b
      Simon Peyton Jones authored
      For some reason a SigSkol had an ExpType in it, and there were
      lots of places where we needed it to have a TcType.  And was indeed
      always a Check.  All a lot of fuss about nothing.
      
      Delete code, fewer failure points, types are more precise.
      All good.
      0ad2021b
    • Simon Peyton Jones's avatar
      Refactor in TcMatches · bdd90426
      Simon Peyton Jones authored
      * Move the several calls of tauifyMultipleMatches into tcMatches,
        so that it can be called only once, and the invariants are
        clearer
      
      * I discovered in doing this that HsLamCase had a redundant and
        tiresome argument, so I removed it. That in turn allowed some
        modest but nice code simplification
      bdd90426
  21. 24 Mar, 2016 1 commit
    • Rik Steenkamp's avatar
      Add `PatSynSigSkol` and modify `PatSynCtxt` · 997312b0
      Rik Steenkamp authored
      As the type of a pattern synonym cannot in general be represented by a
      value of type Type, we cannot use a value `SigSkol (PatSynCtxt n) (Check
      ty)` to represent the signature of a pattern synonym (this causes
      incorrect signatures to be printed in error messages). Therefore we now
      represent it by a value `PatSynSigSkol n` (instead of incorrect
      signatures we simply print no explicit signature).
      
      Furthermore, we rename `PatSynCtxt` to `PatSynBuilderCtxt`, and use
      `SigSkol (PatSynBuilderCtxt n) (Check ty)` to represent the type of a
      bidirectional pattern synonym when used in an expression context.
      Before, this type was represented by a value `SigSkol (PatSynCtxt n)
      (Check ty)`, which caused incorrect error messages.
      
      Also, in `mk_dict_err` of `typecheck\TcErrors.hs` we now distinguish
      between all enclosing implications and "useful" enclosing implications,
      for better error messages concerning pattern synonyms. See `Note [Useful
      implications]`.
      
      See the Phabricator page for examples.
      
      Reviewers: mpickering, goldfire, simonpj, austin, bgamari
      
      Reviewed By: bgamari
      
      Subscribers: thomie
      
      Differential Revision: https://phabricator.haskell.org/D1967
      
      GHC Trac Issues: #11667
      997312b0
  22. 21 Mar, 2016 1 commit
    • eir@cis.upenn.edu's avatar
      Track specified/invisible more carefully. · 35e93797
      eir@cis.upenn.edu authored
      In particular, this allows correct tracking of specified/invisible
      for variables in Haskell98 data constructors and in pattern synonyms.
      GADT-syntax constructors are harder, and are left until #11721.
      
      This was all inspired by Simon's comments to my fix for #11512,
      which this subsumes.
      
      Test case: ghci/scripts/TypeAppData
      
      [skip ci]  (The test case fails because of an unrelated problem
      fixed in the next commit.)
      35e93797
  23. 15 Mar, 2016 1 commit
    • eir@cis.upenn.edu's avatar
      Refactor visible type application. · 972730cc
      eir@cis.upenn.edu authored
      This replaces the old HsType and HsTypeOut constructors
      with HsAppType and HsAppTypeOut, leading to some simplification.
      (This refactoring addresses #11329.)
      
      This also fixes #11456, which stumbled over HsType (which is
      not an expression).
      
      test case: ghci/scripts/T11456
      
      [skip ci]
      972730cc
  24. 25 Feb, 2016 1 commit
  25. 16 Feb, 2016 2 commits
    • Rik Steenkamp's avatar
      Fix typos · 49c5cb40
      Rik Steenkamp authored
      Reviewers: bgamari, austin
      
      Reviewed By: austin
      
      Subscribers: thomie
      
      Differential Revision: https://phabricator.haskell.org/D1915
      49c5cb40
    • Rik Steenkamp's avatar
      Fix two wrong uses of "data constructor" in error msgs · af5a0e50
      Rik Steenkamp authored
      Replace `NoDataKinds :: PromotionErr` by `NoDataKindsTC` and
      `NoDataKindsDC` (just like there is `NoTypeInTypeTC` and
      `NoTypeInTypeDC`). This allows for a correct error message when a kind
      signature contains a type constructor and `-XDataKinds` is not
      specified.
      
      Apply a small fix to `TcError.hs` where instead of "data constructor" we
      should say "pattern synonym".
      
      Reviewers: austin, goldfire, bgamari
      
      Reviewed By: bgamari
      
      Subscribers: goldfire, thomie
      
      Differential Revision: https://phabricator.haskell.org/D1909
      af5a0e50
  26. 08 Feb, 2016 2 commits
    • Simon Peyton Jones's avatar
      Fix a nasty superclass expansion bug · 43e02d12
      Simon Peyton Jones authored
      This patch fixes Trac #11523.
      
      * The basic problem was that TcRnTypes.superClassesMightHelp was
        returning True of a Derived constraint, and that led to us
        expanding Given superclasses, which produced the same Derived
        constraint again, and so on infinitely.  We really want to do
        this only if there are unsolve /Wanted/ contraints!
      
      * On the way I made TcSMonad.getUnsolvedInerts a bit more
        discriminating about which Derived equalities it returns;
        see Note [Unsolved Derived equalities] in TcSMonad
      
      * Lots of new comments in TcSMonad.
      43e02d12
    • Simon Peyton Jones's avatar
      Document and improve superclass expansion · 8871737d
      Simon Peyton Jones authored
      When investigating Trac #11523 I found that superclass
      expansion was a little over-aggressive; we were sort of
      unrolling each loop twice.
      
      This patch corrects that, and adds explanatory comments.
      8871737d
  27. 04 Feb, 2016 1 commit
    • Georgios Karachalias's avatar
      Overhaul the Overhauled Pattern Match Checker · 28f951ed
      Georgios Karachalias authored
      Overhaul the Overhauled Pattern Match Checker
      
      * Changed the representation of Value Set Abstractions. Instead of
      using a prefix tree, we now use a list of Value Vector Abstractions.
      The set of constraints Delta for every Value Vector Abstraction is the
      oracle state so that we solve everything only once.
      
      * Instead of doing everything lazily, we prune at once (and in general
      everything is much stricter). Hence, an example written with pattern
      guards is checked in almost the same time as the equivalent with
      pattern matching.
      
      * Do not store the covered and the divergent sets at all. Since what we
      only need is a yes/no (does this clause cover anything? Does it force
      any thunk?) We just keep a boolean for each.
      
      * Removed flags `-Wtoo-many-guards` and `-ffull-guard-reasoning`.
      Replaced with `fmax-pmcheck-iterations=n`. Still debatable what should
      the default `n` be.
      
      * When a guard is for sure not going to contribute anything, we treat
      it as such: The oracle is not called and cases `CGuard`, `UGuard` and
      `DGuard` from the paper are not happening at all (the generation of a
      fresh variable, the unfolding of the pattern list etc.). his combined
      with the above seems to be enough to drop the memory increase for test
      T783 down to 18.7%.
      
      * Do not export function `dsPmWarn` (it is now called directly from
      within `checkSingle` and `checkMatches`).
      
      * Make `PmExprVar` hold a `Name` instead of an `Id`. The term oracle
      does not handle type information so using `Id` was a waste of
      time/space.
      
      * Added testcases T11195, T11303b (data families) and T11374
      
      The patch addresses at least the following:
      Trac #11195, #11276, #11303, #11374, #11162
      
      Test Plan: validate
      
      Reviewers: goldfire, bgamari, hvr, austin
      
      Subscribers: simonpj, thomie
      
      Differential Revision: https://phabricator.haskell.org/D1795
      28f951ed
  28. 27 Jan, 2016 1 commit
    • eir@cis.upenn.edu's avatar
      Refactor the typechecker to use ExpTypes. · 00cbbab3
      eir@cis.upenn.edu authored
      The idea here is described in [wiki:Typechecker]. Briefly,
      this refactor keeps solid track of "synthesis" mode vs
      "checking" in GHC's bidirectional type-checking algorithm.
      When in synthesis mode, the expected type is just an IORef
      to write to.
      
      In addition, this patch does a significant reworking of
      RebindableSyntax, allowing much more freedom in the types
      of the rebindable operators. For example, we can now have
      `negate :: Int -> Bool` and
      `(>>=) :: m a -> (forall x. a x -> m b) -> m b`. The magic
      is in tcSyntaxOp.
      
      This addresses tickets #11397, #11452, and #11458.
      
      Tests:
        typecheck/should_compile/{RebindHR,RebindNegate,T11397,T11458}
        th/T11452
      00cbbab3
  29. 25 Jan, 2016 1 commit
    • Simon Peyton Jones's avatar
      Special-case implicit params in superclass expansion · ff21795a
      Simon Peyton Jones authored
      This issue came up in Trac #11480, and is documented in
      Note [When superclasses help] in TcRnTypes.
      
      We were getting a spurious warning
        T11480.hs:1:1: warning:
           solveWanteds: too many iterations (limit = 4)
      
      The fix is easy.  A bit of refactoring along the way.
      
      The original bug report in Trac #11480 appears to work
      fine in HEAD and the 8.0 branch but I added a regression
      test in this commit as well.
      ff21795a
  30. 24 Jan, 2016 1 commit
  31. 22 Jan, 2016 1 commit
  32. 18 Jan, 2016 2 commits
    • Jan Stolarek's avatar
      Replace calls to `ptext . sLit` with `text` · b8abd852
      Jan Stolarek authored
      Summary:
      In the past the canonical way for constructing an SDoc string literal was the
      composition `ptext . sLit`.  But for some time now we have function `text` that
      does the same.  Plus it has some rules that optimize its runtime behaviour.
      This patch takes all uses of `ptext . sLit` in the compiler and replaces them
      with calls to `text`.  The main benefits of this patch are clener (shorter) code
      and less dependencies between module, because many modules now do not need to
      import `FastString`.  I don't expect any performance benefits - we mostly use
      SDocs to report errors and it seems there is little to be gained here.
      
      Test Plan: ./validate
      
      Reviewers: bgamari, austin, goldfire, hvr, alanz
      
      Subscribers: goldfire, thomie, mpickering
      
      Differential Revision: https://phabricator.haskell.org/D1784
      b8abd852
    • Simon Peyton Jones's avatar
      Implement scoped type variables in pattern synonyms · e2c7b7ee
      Simon Peyton Jones authored
      This fixes Trac #11351.   The implementation is pretty
      simple, happily.
      
      I took the opportunity to re-order the prov/req context
      in builder-ids, which was confusingly backwards.
      e2c7b7ee