anchor.diff:  
           | _ -> 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
   
  
positive.code:             else None
  
          match innerCompReturn with 
          | Some innerExpr when 
                (let bindName = bindName + "Return"
                 not (isNil (TryFindIntrinsicOrExtensionMethInfo ResultCollectionSettings.AtMostOneResult cenv env bindRange ad bindName  builderTy))) ->
  
              let bindName = bindName + "Return"
          
              // Build the `BindReturn` call
              let consumeExpr = SynExpr.MatchLambda(false, consumePat.Range, [Clause(consumePat, None, innerExpr, innerRange, SequencePointAtTarget)], spBind, innerRange)
              translatedCtxt (mkSynCall bindName bindRange (bindArgs @ [consumeExpr]))
  
          | _ -> 
  
  
negative.code:                 // Check the second part is a simple return
                  match convertSimpleReturnToExpr varSpace innerComp2 with
                  | None -> None
                  | Some (innerExpr2, optionalCont) -> Some (SynExpr.Sequential (sp, true, innerComp1, innerExpr2, m), optionalCont)
              else
                  None
  
  