remexre / extlint

An extensible linter for OCaml programs.
3 stars 0 forks source link

Large lists cause `recursion limit exceeded` #2

Open remexre opened 6 years ago

remexre commented 6 years ago

See https://github.com/serde-rs/json/issues/334 -- at root, the issue is just as much that OCaml parses lists into conses implicitly, such that [1; 2; 3] is indistinguishable from 1::2::3::[]. This means long list literals become a very large cons chain.

For example,

let lst1 = ['H'; 'e'; 'l'; 'l'; 'o'; ' '; 'w'; 'o'; 'r'; 'l'; 'd'; '!'; ' '; 'H'; 'o';
 'w'; ' '; 'a'; 'r'; 'e'; ' '; 'y'; 'o'; 'u'; ' '; 't'; 'o'; 'd'; 'a'; 'y';
 '?'; ' '; ' '; 'I'; ' '; 'h'; 'o'; 'p'; 'e'; ' '; 'a'; 'l'; 'l'; ' '; 'i';
 's'; ' '; 'w'; 'e'; 'l'; 'l'; '.'; ' ']

currently causes a crash.

remexre commented 6 years ago

"Fixed" by forking serde_json to remexre/json. Clearly, not ideal, so this'll remain open.