help wanted
Description
After the Javascript case statement optimizations in 1.11.0, a case statement with too many patterns will overwhelm the stack on the Javascript target. The same code worked in 1.10.0.
Reproducing
Calling
pub fn main() -> Nil {
derived_property(0x00A1)
|> string.inspect
|> io.println
}
on https://github.com/NineFX/precious/blob/main/src/precious/derived.gleam on the Javascript target
λ ~/stack/ main* asdf current gleam
Name Version Source Installed
gleam 1.10.0 /Users/sdfsdf9/stack/.tool-versions true
λ ~/stack/ main* gleam run -m stack --target javascript
Compiling stack
Compiled in 0.06s
Running stack.main
FreePVal(Punctuation)
λ ~/stack/ main* asdf set gleam 1.11.1 ;gleam clean ; gleam run -m stack --target javascript
Downloading packages
Downloaded 2 packages in 0.04s
Compiling gleam_stdlib
Compiling gleeunit
Compiling stack
Compiled in 0.16s
Running stack.main
file:///Users/sdfsdf9/stack/build/dev/javascript/stack/stack.mjs:14309
let _pipe = derived_property(0xA1);
^
RangeError: Maximum call stack size exceeded
at main (file:///Users/sdfsdf9/stack/build/dev/javascript/stack/stack.mjs:14309:15)
at file:///Users/sdfsdf9/stack/build/dev/javascript/stack/gleam.main.mjs:2:1
at ModuleJob.run (node:internal/modules/esm/module_job:365:25)
at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:665:26)
at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:99:5)
Node.js v24.3.0