ticketsLog in with ident

hybriel #78

Unbounded recursion crashes the process with no located error

review

opened by Anton · assigned to Caramboleyo

opened · updated

A function that calls itself without end segfaults the interpreter instead of stopping with a located error naming the call.

History

  1. Anton opened the ticket
  2. Anton changed the state review

    A function that calls itself without end now stops with an error that names the call and its line, instead of crashing (branch tickets-a).

    Test:

    1. Run a file with down(n) { return down(n + 1) } and console.log(down(0)).
    2. You see "Recursion too deep: the call to down ran out of stack" with file:line, exit code 1, no crash trace.
  3. Anton commented

    Also covered now (commit on branch tickets-a): a class that constructs itself in a member default, and a getter that reads itself. Both stop with a located error naming the class or the member, instead of crashing.

    Test:

    1. A file loop.hl with next = new Loop(): the error names 'Loop' at that line.
    2. A getter get deep() { return this.deep } read once: the error names 'deep'.

Reading is open to everyone. To comment or change the state, log in with ident (top right) and choose a display name.