stackoverflow when compiling list literal
I have list of around 1000 items that compiles fine with fsc, but when using fable, I get an error with a loop like the following:
arp.Compiler.Text.Range, FSharp.Compiler.Syntax.SynExpr, FSharp.Compiler.Syntax.SynExpr, Microsoft.FSharp.Core.Unit)
at FSharp.Compiler.CheckComputationExpressions.tryTcSequenceExprBody@1935(TcFileState, TcEnv, OverallTy, FSharp.Compiler.Text.Range, TcGlobals, Boolean, Boolean, TcEnv, TType, UnscopedTyparEnv, FSharp.Compiler.Syntax.SynExpr)
at FSharp.Compiler.CheckComputationExpressions.tcSequenceExprBodyAsSequenceOrStatement@2209(TcFileState, TcEnv, OverallTy, FSharp.Compiler.Text.Range, TcGlobals, Boolean, Boolean, TcEnv, TType, UnscopedTyparEnv, FSharp.Compiler.Syntax.SynExpr)
at FSharp.Compiler.CheckComputationExpressions.tcSequenceExprBody@2199(TcFileState, TcEnv, OverallTy, FSharp.Compiler.Text.Range, TcGlobals, Boolean, Boolean, TcEnv, TType, UnscopedTyparEnv, FSharp.Compiler.Syntax.SynExpr)
at FSharp.Compiler.CheckComputationExpressions.tryTcSequenceExprBody$cont@2038-3(TcFileState, TcEnv, OverallTy, FSharp.Compiler.Text.Range, TcGlobals, Boolean, Boolean, TcEnv, TType, UnscopedTyparEnv, FSharp.Compiler.Syntax.DebugPointAtSequential, FSharp.Compiler.Text.Range, FSharp.Compiler.Syntax.SynExpr, FSharp.Compiler.Syntax.SynExpr, Microsoft.FSharp.Core.Unit)
at FSharp.Compiler.CheckComputationExpressions.tryTcSequenceExprBody@1935(TcFileState, TcEnv, OverallTy, FSharp.Compiler.Text.Range, TcGlobals, Boolean, Boolean, TcEnv, TType, UnscopedTyparEnv, FSharp.Compiler.Syntax.SynExpr)
If I split the expression into multiple subexpression of a smaller size, and yield! them, it compiles. This is not necessarily a common use case, but I happen to have a built up a long list of heuristic overrides I plan to move to a db. It was convenient up until now to use the fsharp types and just plug in each override. But given that it compiles with fsc, maybe the function calling this could be made stack safe.
Also, I'm not testing with the latest, as I haven't been able to try upgrading yet, so perhaps this is fixed in main.
- Fable version: 4.24.0
Hello @joprice,
could you please provide a reproduction snippet?
Here's a repro on the largeCE branch https://github.com/joprice/fable-repro/blob/largeCE/Program.fs. I narrowed it down to around 281 items where it starts to crash.
Something interesting I noticed is that after a crash, if I decrease the size of the CE even below that level, it continued to crash until I cleaned during watch mode, so I wonder if something gets corrupted with the incremental build under such an event.