Skip to content

Commit 9fc3952

Browse files
authored
undo #3536 (#3746) (#3749)
* undo #3536 * undo #3536
1 parent 2ccf874 commit 9fc3952

File tree

2 files changed

+19
-3
lines changed

2 files changed

+19
-3
lines changed

src/fsharp/LowerCallsAndSeqs.fs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -394,6 +394,7 @@ let LowerSeqExpr g amap overallExpr =
394394
| None ->
395395
None
396396

397+
(*
397398
| Expr.LetRec(binds,e2,m,_)
398399
when // Restriction: only limited forms of "let rec" in sequence expressions can be handled by assignment to state local values
399400
@@ -422,7 +423,7 @@ let LowerSeqExpr g amap overallExpr =
422423
Some res4
423424
| None ->
424425
None
425-
426+
*)
426427
| Expr.Match (spBind,exprm,pt,targets,m,ty) when targets |> Array.forall (fun (TTarget(vs,_e,_spTarget)) -> isNil vs) ->
427428
// lower all the targets. abandon if any fail to lower
428429
let tgl = targets |> Array.map (fun (TTarget(_vs,e,_spTarget)) -> Lower false isTailCall noDisposeContinuationLabel currentDisposeContinuationLabel e) |> Array.toList

tests/fsharp/core/seq/test.fsx

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -572,6 +572,7 @@ module InfiniteSequenceExpressionsExecuteWithFiniteResources =
572572
yield! seqThreeRecCapturingOne r
573573
}
574574

575+
//
575576
// These tests will stackoverflow or out-of-memory if the above functions are not compiled to "sequence epression tailcalls",
576577
// i.e. by compiling them to a state machine
577578
let tests() =
@@ -697,8 +698,22 @@ module InfiniteSequenceExpressionsExecuteWithFiniteResources =
697698
698699
*)
699700

700-
InfiniteSequenceExpressionsExecuteWithFiniteResources.tests()
701-
701+
// Tests disabled due to bug https://github.com/Microsoft/visualfsharp/issues/3743
702+
//InfiniteSequenceExpressionsExecuteWithFiniteResources.tests()
703+
704+
// This is the additional test case related to bug https://github.com/Microsoft/visualfsharp/issues/3743
705+
let TestRecFuncInSeq() =
706+
let factorials =
707+
[ for x in 0..10 do
708+
let rec factorial x =
709+
match x with
710+
| 0 -> 1
711+
| x -> x * factorial(x - 1)
712+
yield factorial x
713+
]
714+
715+
for f in factorials do printf "%i" f
716+
TestRecFuncInSeq()
702717

703718
(*---------------------------------------------------------------------------
704719
!* wrap up

0 commit comments

Comments
 (0)