FSharp.Linq.ComposableQuery icon indicating copy to clipboard operation
FSharp.Linq.ComposableQuery copied to clipboard

yield!

Open jamescheney opened this issue 11 years ago • 0 comments
trafficstars

The following code (run against the db.People database in the tests) fails at run time

let test3' =   query { for u in db.People do
                       if 0 <= u.Age then
                        yield! (query {yield u}) }

with the following error:

System.ArgumentException: Type mismatch when building 'cond': types of true and false branches differ. Expected 'Microsoft.FSharp.Linq.QuerySource2[People,System.Object]', but received type 'Microsoft.FSharp.Linq.QuerySource2[People,System.Linq.IQueryable]'. Parameter name: receivedType at Microsoft.FSharp.Quotations.PatternsModule.checkTypesSR[a](Type expectedType, Type receivedType, a name, String threeHoleSR) at Microsoft.FSharp.Quotations.PatternsModule.mkIfThenElse(FSharpExpr e, FSharpExpr t, FSharpExpr f) at Microsoft.FSharp.Quotations.FSharpExpr.IfThenElse(FSharpExpr guard, FSharpExpr thenExpr, FSharpExpr elseExpr) at FSharpComposableQuery.QueryImpl.toExp@371(QueryBuilder this, Exp exp) at FSharpComposableQuery.QueryImpl.QueryBuilder.toExpr(Exp exp) at FSharpComposableQuery.QueryImpl.QueryBuilder.Norm[T](FSharpExpr`1 expr) at <StartupCode$FSI_0047>.$FSI_0047.main@() Stopped due to error

It seems that we are not treating yield! / query.yieldFrom as a recognized operator, and the rewritingperformed by Query.removeRunAs seems to break something (or perhaps, not do enough due diligence to fix up the type information).

jamescheney avatar Sep 02 '14 16:09 jamescheney