Nested Linq expression trees result in quotation related calls
- Dominant language
- F#
- Stars
- 4.3k
- Forks
- 876
- Avg merge
- 4d 11h
- Merged PRs (30d)
- 131
Description
Trying to extract a Linq expression which contains a nested Linq expression results in expression with Quotation related calls.
#### Repro steps
```fsharp
open System
open System.Linq.Expressions
type LinqExpr =
static member fromFunc<'T, 'U>(e : Expression>) = e
let expr = LinqExpr.fromFunc(fun () -> LinqExpr.fromFunc(fun y -> y + 1))
val it : Expression>>> =
unitVar0 => fromFunc(QuotationToLambdaExpression(SubstHelper(NewDelegate (Func`2, y, Call (None, op_Addition, [y, Value (1)])), new [] {}, new [] {})))
{Body = fromFunc(QuotationToLambdaExpression(SubstHelper(NewDelegate (Func`2, y, Call (None, op_Addition, [y, Value (1)])), new [] {}, new [] {})));
CanReduce = false;
Name = null;
NodeType = Lambda;
Parameters = seq [unitVar0];
ReturnType = System.Linq.Expressions.Expression`1[System.Func`2[System.Int32,System.Int32]];
TailCall = false;
Type = System.Func`2[Microsoft.FSharp.Core.Unit,System.Linq.Expressions.Expression`1[System.Func`2[System.Int32,System.Int32]]];}
```
#### Expected behavior
The resulting expression tree should not contain quotation related calls, but probably use an `ExpressionType.Quote` for the nested expression.
#### Actual behavior
Expression tree contains this expression tree:
```fsharp
QuotationToLambdaExpression(SubstHelper(NewDelegate (Func`2, y, Call (None, op_Addition, [y, Value (1)])), new [] {}, new [] {}))
```
#### Known workarounds
None.
#### Related information
Provide any related information
* Windows 10
* .NET Framework, any version
* Visual Studio 2015/2017
* Severity: low
Contributor guide
Assessment
This issue has not been assessed yet.