Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect rejection of non-top-level undefined declarations #370

Open
gibson042 opened this issue Nov 23, 2024 · 2 comments
Open

Incorrect rejection of non-top-level undefined declarations #370

gibson042 opened this issue Nov 23, 2024 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@gibson042
Copy link

There are details at tc39/test262#4332 , but the summary is that QuickJS incorrectly rejects as invalid attempts to create scoped declarations named undefined.

For example, this should print "START" and then "PASS", but instead throws a SyntaxError before anything happens (which is only warranted when such a declaration appears at the top-level scope):

print('START');
{
  const undefined = 1;
  print(undefined === 1 ? 'PASS' : 'FAIL');
}

It may also be worth noting that the analogous NaN and Infinity cases are handled correctly.

@chqrlie
Copy link
Collaborator

chqrlie commented Nov 23, 2024

Hi @gibson042,

This is a bug and we shall fix it, but it is sad to see how many special cases need to be handled explicitly to emulate side effects of historical implementations in useless corner cases.

Thank you for this report.

@chqrlie chqrlie self-assigned this Nov 23, 2024
@chqrlie chqrlie added the bug Something isn't working label Nov 23, 2024
@bnoordhuis
Copy link
Contributor

The test case passes with quickjs-ng, I believe due to commit quickjs-ng/quickjs@dfe5675

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants