This repository was archived by the owner on Jun 15, 2023. It is now read-only.
This repository was archived by the owner on Jun 15, 2023. It is now read-only.
Formatter hangs on deeply nested function calls #261
Closed
Description
Steps to reproduce
Put the following in a file (say, Hang.res
):
let foo = () =>
bar(x =>
bar(x =>
bar(x =>
bar(x =>
bar(x =>
bar(x =>
bar(x =>
bar(x =>
bar(x =>
bar(x =>
bar(x =>
bar(x =>
bar(x =>
bar(x =>
bar(x => x)
))))))))))))))
Run:
bsc -format Hang.res
Expected result
The source is indented properly and printed to stdout
Actual result
The process hangs, loads CPU to 100%, eats one GB of RAM after another, then after 1m30s or so crashes with out-of-memory.
The source (if put back into the context), compiles fine. Just formatting causes the problem.
Machine info
$ node --version
v12.16.3
$ bsc -version
BuckleScript 9.0.0 ( Using OCaml:4.06.1+BS )
$ uname -a
Linux archxx 5.10.6-arch1-1 #1 SMP PREEMPT Sat, 09 Jan 2021 18:22:35 +0000 x86_64 GNU/Linux
Metadata
Metadata
Assignees
Labels
No labels