Skip to content

Nondeterministic line number in error reporting for RangeError message #1758

@s-kybound

Description

@s-kybound
test('Simple arrow function infinite recursion represents CallExpression well', () => {
  return expectParsedError('(x => x(x)(x))(x => x(x)(x));').toMatchInlineSnapshot(
    `"Line 1: RangeError: Maximum call stack size exceeded"`
  )
}, 30000)

test('Simple function infinite recursion represents CallExpression well', () => {
  return expectParsedError('function f(x) {return x(x)(x);} f(f);').toMatchInlineSnapshot(
    `"RangeError: Maximum call stack size exceeded"`
  )
}, 30000)

I refer to these 2 testcases in src/__tests__/index.ts. Developers have noted that the first test case seems to have non-determinstic behaviour, sometimes showing the line number and sometimes not - this is due to the line number sometimes showing as -1 instead of 1. We have currently pushed a stop-gap fix to this issue.

Additionally, it is strange that both test cases result in different error messages.

Metadata

Metadata

Assignees

Labels

minorless important than important but more than nice-to-have

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions