提交 9fc3952a 编写于 作者: B Brett V. Forsgren 提交者: GitHub
上级 2ccf874a
...@@ -394,6 +394,7 @@ let LowerSeqExpr g amap overallExpr = ...@@ -394,6 +394,7 @@ let LowerSeqExpr g amap overallExpr =
| None -> | None ->
None None
(*
| Expr.LetRec(binds,e2,m,_) | Expr.LetRec(binds,e2,m,_)
when // Restriction: only limited forms of "let rec" in sequence expressions can be handled by assignment to state local values when // Restriction: only limited forms of "let rec" in sequence expressions can be handled by assignment to state local values
...@@ -422,7 +423,7 @@ let LowerSeqExpr g amap overallExpr = ...@@ -422,7 +423,7 @@ let LowerSeqExpr g amap overallExpr =
Some res4 Some res4
| None -> | None ->
None None
*)
| Expr.Match (spBind,exprm,pt,targets,m,ty) when targets |> Array.forall (fun (TTarget(vs,_e,_spTarget)) -> isNil vs) -> | Expr.Match (spBind,exprm,pt,targets,m,ty) when targets |> Array.forall (fun (TTarget(vs,_e,_spTarget)) -> isNil vs) ->
// lower all the targets. abandon if any fail to lower // lower all the targets. abandon if any fail to lower
let tgl = targets |> Array.map (fun (TTarget(_vs,e,_spTarget)) -> Lower false isTailCall noDisposeContinuationLabel currentDisposeContinuationLabel e) |> Array.toList let tgl = targets |> Array.map (fun (TTarget(_vs,e,_spTarget)) -> Lower false isTailCall noDisposeContinuationLabel currentDisposeContinuationLabel e) |> Array.toList
......
...@@ -572,6 +572,7 @@ module InfiniteSequenceExpressionsExecuteWithFiniteResources = ...@@ -572,6 +572,7 @@ module InfiniteSequenceExpressionsExecuteWithFiniteResources =
yield! seqThreeRecCapturingOne r yield! seqThreeRecCapturingOne r
} }
//
// These tests will stackoverflow or out-of-memory if the above functions are not compiled to "sequence epression tailcalls", // These tests will stackoverflow or out-of-memory if the above functions are not compiled to "sequence epression tailcalls",
// i.e. by compiling them to a state machine // i.e. by compiling them to a state machine
let tests() = let tests() =
...@@ -697,8 +698,22 @@ module InfiniteSequenceExpressionsExecuteWithFiniteResources = ...@@ -697,8 +698,22 @@ module InfiniteSequenceExpressionsExecuteWithFiniteResources =
*) *)
InfiniteSequenceExpressionsExecuteWithFiniteResources.tests() // Tests disabled due to bug https://github.com/Microsoft/visualfsharp/issues/3743
//InfiniteSequenceExpressionsExecuteWithFiniteResources.tests()
// This is the additional test case related to bug https://github.com/Microsoft/visualfsharp/issues/3743
let TestRecFuncInSeq() =
let factorials =
[ for x in 0..10 do
let rec factorial x =
match x with
| 0 -> 1
| x -> x * factorial(x - 1)
yield factorial x
]
for f in factorials do printf "%i" f
TestRecFuncInSeq()
(*--------------------------------------------------------------------------- (*---------------------------------------------------------------------------
!* wrap up !* wrap up
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册