anchor.diff:                  let isYield = not (customOperationMaintainsVarSpaceUsingBind nm)
                   translatedCtxt (transNoQueryOps (SynExpr.YieldOrReturn ((isYield, false), varSpaceExpr, mClause)))
               
  -            let rec consumeClauses (varSpace: LazyWithContext<_, _>) dataCompPrior compClausesExpr lastUsesBind =
  -
  -                // Substitute 'yield <var-space>' into the context
  -
  -                let patvs, _env = varSpace.Force comp.Range
  -                let varSpaceSimplePat = mkSimplePatForVarSpace mClause patvs
  -                let varSpacePat = mkPatForVarSpace mClause patvs
  -
  -                match compClausesExpr with 
  -                
  -                // Detect one custom operation... This clause will always match at least once...
  -                | OptionalSequential (CustomOperationClause (nm, (opName, _maintainsVarSpaceUsingBind, _maintainsVarSpace, _allowInto, isLikeZip, isLikeJoin, isLikeGroupJoin, _, methInfo), opExpr, mClause, optionalIntoPat), optionalCont) ->
  -
  -                    // Record the resolution of the custom operation for posterity
  -                    let item = Item.CustomOperation (opName, (fun () -> customOpUsageText nm), Some methInfo)
  -
  -                    // FUTURE: consider whether we can do better than emptyTyparInst here, in order to display instantiations
  -                    // of type variables in the quick info provided in the IDE.
  -                    CallNameResolutionSink cenv.tcSink (nm.idRange, env.NameEnv, item, item, emptyTyparInst, ItemOccurence.Use, env.eAccessRights)
  -
  -                    if isLikeZip || isLikeJoin || isLikeGroupJoin then
  -                        errorR(Error(FSComp.SR.tcBinaryOperatorRequiresBody(nm.idText, Option.get (customOpUsageText nm)), nm.idRange))
  -                        match optionalCont with 
  -                        | None -> 
  -                            // we are about to drop the 'opExpr' AST on the floor. we've already reported an error. attempt to get name resolutions before dropping it
  -                            RecordNameAndTypeResolutions_IdeallyWithoutHavingOtherEffects cenv env tpenv opExpr
  -                            dataCompPrior
  -                        | Some contExpr -> consumeClauses varSpace dataCompPrior contExpr lastUsesBind 
  -                    else
  -
  -                        let maintainsVarSpace = customOperationMaintainsVarSpace nm
  -                        let maintainsVarSpaceUsingBind = customOperationMaintainsVarSpaceUsingBind nm
  -
  -                        let expectedArgCount = expectedArgCountForCustomOperator nm 
  -
  -                        let dataCompAfterOp = 
  -                            match opExpr with 
  -                            | StripApps(SingleIdent nm, args) -> 
  -                                if args.Length = expectedArgCount then 
  -                                    // Check for the [<ProjectionParameter>] attribute on each argument position
  -                                    let args = args |> List.mapi (fun i arg -> 
  -                                        if isCustomOperationProjectionParameter (i+1) nm then 
  -                                            SynExpr.Lambda (false, false, varSpaceSimplePat, arg, arg.Range.MakeSynthetic())
  -                                        else arg)
  -                                    mkSynCall methInfo.DisplayName mClause (dataCompPrior :: args)
  -                                else 
  -                                    errorR(Error(FSComp.SR.tcCustomOperationHasIncorrectArgCount(nm.idText, expectedArgCount, args.Length), nm.idRange))
  -                                    mkSynCall methInfo.DisplayName mClause ([ dataCompPrior ] @ List.init expectedArgCount (fun i -> arbExpr("_arg" + string i, mClause))) 
  -                            | _ -> failwith "unreachable"
  -
  -                        match optionalCont with 
  -                        | None -> 
  -                            match optionalIntoPat with 
  -                            | Some intoPat -> errorR(Error(FSComp.SR.tcIntoNeedsRestOfQuery(), intoPat.Range))
  -                            | None -> ()
  -                            dataCompAfterOp
  -
  -                        | Some contExpr -> 
  -
  -                                // select a.Name into name; ...
  -                                // distinct into d; ...
  -                                //
  -                                // Rebind the into pattern and process the rest of the clauses
  -                                match optionalIntoPat with 
  -                                | Some intoPat -> 
  -                                    if not (customOperationAllowsInto nm) then 
  -                                        error(Error(FSComp.SR.tcOperatorDoesntAcceptInto(nm.idText), intoPat.Range))
  -
  -                                    // Rebind using either for ... or let!....
  -                                    let rebind = 
  -                                        if maintainsVarSpaceUsingBind then 
  -                                            SynExpr.LetOrUseBang (NoSequencePointAtLetBinding, false, false, intoPat, dataCompAfterOp, [], contExpr, intoPat.Range) 
  -                                        else 
  -                                            SynExpr.ForEach (NoSequencePointAtForLoop, SeqExprOnly false, false, intoPat, dataCompAfterOp, contExpr, intoPat.Range)
  -
  -                                    trans true q emptyVarSpace rebind id
  -
  -                                // select a.Name; ...
  -                                // distinct; ...
  -                                //
  -                                // Process the rest of the clauses
  -                                | None -> 
  -                                    if maintainsVarSpace || maintainsVarSpaceUsingBind then
  -                                        consumeClauses varSpace dataCompAfterOp contExpr maintainsVarSpaceUsingBind
  -                                    else
  -                                        consumeClauses emptyVarSpace dataCompAfterOp contExpr false 
  -
  -                // No more custom operator clauses in compClausesExpr, but there may be clauses like join, yield etc. 
  -                // Bind/iterate the dataCompPrior and use compClausesExpr as the body.
  -                | _ -> 
  -                    // Rebind using either for ... or let!....
  -                    let rebind = 
  -                        if lastUsesBind then 
  -                            SynExpr.LetOrUseBang (NoSequencePointAtLetBinding, false, false, varSpacePat, dataCompPrior, [], compClausesExpr, compClausesExpr.Range) 
  -                        else 
  -                            SynExpr.ForEach (NoSequencePointAtForLoop, SeqExprOnly false, false, varSpacePat, dataCompPrior, compClausesExpr, compClausesExpr.Range)
  -                    
  -                    trans true q varSpace rebind id
  -
  -            // Now run the consumeClauses
  -            Some (consumeClauses varSpace dataCompPriorToOp comp false)
  +
  +            // Now run the consumeCustomOpClauses
  +            Some (consumeCustomOpClauses q varSpace dataCompPriorToOp comp false mClause)
   
           | SynExpr.Sequential (sp, true, innerComp1, innerComp2, m) -> 
   
  
positive.code:                 let hasBindReturnN = not (isNil (TryFindIntrinsicOrExtensionMethInfo ResultCollectionSettings.AtMostOneResult cenv env bindRange ad bindReturnNName builderTy))
                  if hasBindReturnN && Option.isSome (convertSimpleReturnToExpr varSpace innerComp) then 
                      let consumePat = SynPat.Tuple(false, pats, letPat.Range)
                      Some (transBind q varSpace bindRange bindNName sources consumePat letSpBind innerComp translatedCtxt)
  
                  else
  
negative.code: 
          | _ -> None
  
      and consumeCustomOpClauses q (varSpace: LazyWithContext<_, _>) dataCompPrior compClausesExpr lastUsesBind mClause =
  
                  // Substitute 'yield <var-space>' into the context
  
                  let patvs, _env = varSpace.Force comp.Range
                  let varSpaceSimplePat = mkSimplePatForVarSpace mClause patvs
                  let varSpacePat = mkPatForVarSpace mClause patvs
  
                  match compClausesExpr with 
                  
                  // Detect one custom operation... This clause will always match at least once...
                  | OptionalSequential (CustomOperationClause (nm, (opName, _maintainsVarSpaceUsingBind, _maintainsVarSpace, _allowInto, isLikeZip, isLikeJoin, isLikeGroupJoin, _, methInfo), opExpr, mClause, optionalIntoPat), optionalCont) ->
  
                      // Record the resolution of the custom operation for posterity
                      let item = Item.CustomOperation (opName, (fun () -> customOpUsageText nm), Some methInfo)
  
                      // FUTURE: consider whether we can do better than emptyTyparInst here, in order to display instantiations
                      // of type variables in the quick info provided in the IDE.
                      CallNameResolutionSink cenv.tcSink (nm.idRange, env.NameEnv, item, item, emptyTyparInst, ItemOccurence.Use, env.eAccessRights)
  
                      if isLikeZip || isLikeJoin || isLikeGroupJoin then
                          errorR(Error(FSComp.SR.tcBinaryOperatorRequiresBody(nm.idText, Option.get (customOpUsageText nm)), nm.idRange))
                          match optionalCont with 
                          | None -> 
                              // we are about to drop the 'opExpr' AST on the floor. we've already reported an error. attempt to get name resolutions before dropping it
                              RecordNameAndTypeResolutions_IdeallyWithoutHavingOtherEffects cenv env tpenv opExpr
                              dataCompPrior
                          | Some contExpr -> consumeCustomOpClauses q varSpace dataCompPrior contExpr lastUsesBind mClause
                      else
  
                          let maintainsVarSpace = customOperationMaintainsVarSpace nm
                          let maintainsVarSpaceUsingBind = customOperationMaintainsVarSpaceUsingBind nm
  
                          let expectedArgCount = expectedArgCountForCustomOperator nm 
  
                          let dataCompAfterOp = 
                              match opExpr with 
                              | StripApps(SingleIdent nm, args) -> 
                                  if args.Length = expectedArgCount then 
                                      // Check for the [<ProjectionParameter>] attribute on each argument position
                                      let args = args |> List.mapi (fun i arg -> 
                                          if isCustomOperationProjectionParameter (i+1) nm then 
                                              SynExpr.Lambda (false, false, varSpaceSimplePat, arg, arg.Range.MakeSynthetic())
                                          else arg)
                                      mkSynCall methInfo.DisplayName mClause (dataCompPrior :: args)
                                  else 
                                      errorR(Error(FSComp.SR.tcCustomOperationHasIncorrectArgCount(nm.idText, expectedArgCount, args.Length), nm.idRange))
                                      mkSynCall methInfo.DisplayName mClause ([ dataCompPrior ] @ List.init expectedArgCount (fun i -> arbExpr("_arg" + string i, mClause))) 
                              | _ -> failwith "unreachable"
  
                          match optionalCont with 
                          | None -> 
                              match optionalIntoPat with 
                              | Some intoPat -> errorR(Error(FSComp.SR.tcIntoNeedsRestOfQuery(), intoPat.Range))
                              | None -> ()
                              dataCompAfterOp
  
                          | Some contExpr -> 
  
                                  // select a.Name into name; ...
                                  // distinct into d; ...
                                  //
                                  // Rebind the into pattern and process the rest of the clauses
                                  match optionalIntoPat with 
                                  | Some intoPat -> 
                                      if not (customOperationAllowsInto nm) then 
                                          error(Error(FSComp.SR.tcOperatorDoesntAcceptInto(nm.idText), intoPat.Range))
  
                                      // Rebind using either for ... or let!....
                                      let rebind = 
                                          if maintainsVarSpaceUsingBind then 
                                              SynExpr.LetOrUseBang (NoSequencePointAtLetBinding, false, false, intoPat, dataCompAfterOp, [], contExpr, intoPat.Range) 
                                          else 
                                              SynExpr.ForEach (NoSequencePointAtForLoop, SeqExprOnly false, false, intoPat, dataCompAfterOp, contExpr, intoPat.Range)
  
                                      trans true q emptyVarSpace rebind id
  
                                  // select a.Name; ...
                                  // distinct; ...
                                  //
                                  // Process the rest of the clauses
                                  | None -> 
                                      if maintainsVarSpace || maintainsVarSpaceUsingBind then
                                          consumeCustomOpClauses q varSpace dataCompAfterOp contExpr maintainsVarSpaceUsingBind mClause
                                      else
                                          consumeCustomOpClauses q emptyVarSpace dataCompAfterOp contExpr false mClause
  
                  // No more custom operator clauses in compClausesExpr, but there may be clauses like join, yield etc. 
                  // Bind/iterate the dataCompPrior and use compClausesExpr as the body.
                  | _ -> 
                      // Rebind using either for ... or let!....
                      let rebind = 
                          if lastUsesBind then 
                              SynExpr.LetOrUseBang (NoSequencePointAtLetBinding, false, false, varSpacePat, dataCompPrior, [], compClausesExpr, compClausesExpr.Range) 
                          else 
                              SynExpr.ForEach (NoSequencePointAtForLoop, SeqExprOnly false, false, varSpacePat, dataCompPrior, compClausesExpr, compClausesExpr.Range)
                      
                      trans true q varSpace rebind id
      and transNoQueryOps comp =
          trans true false emptyVarSpace comp id
  
  