Skip to content
This repository has been archived by the owner on Aug 31, 2023. It is now read-only.
This repository has been archived by the owner on Aug 31, 2023. It is now read-only.

🐛 some parse failures from a fuzzer #3607

Closed
1 task done
bakkot opened this issue Nov 9, 2022 · 2 comments
Closed
1 task done

🐛 some parse failures from a fuzzer #3607

bakkot opened this issue Nov 9, 2022 · 2 comments
Labels
A-Parser Area: parser S-Bug: confirmed Status: report has been confirmed as a valid bug S-To triage Status: user report of a possible bug that needs to be triaged

Comments

@bakkot
Copy link

bakkot commented Nov 9, 2022

Environment information

CLI:
  Version:              10.0.0
  Color support:        true

Platform:
  CPU Architecture:     x86_64
  OS:                   macos

Environment:
  ROME_LOG_DIR:         unset
  NO_COLOR:             unset
  TERM:                 "xterm-256color"

Rome Configuration:
  Status:               loaded
  Formatter disabled:   false
  Linter disabled:      false

Workspace:
  Open Documents:       0

Discovering running Rome servers...

Server:
  Status:               stopped

What happened?

The following syntactically valid programs are rejected by rome check as invalid, even with all lint rules turned off.

I found these with a fuzzer; prioritize accordingly. If you'd prefer I not submit bugs found by fuzzing, let me know. Alternatively, if you'd prefer I open distinct bugs for each issue, I'm happy to do that.

Of these errors only the first is likely to come up in real code, in my estimation.

chars</^\w*/.exec(str)[0].length;
async: for(a of b) continue async;
async(...null);
class A extends B {
  constructor(c = super()) {}
}
(class extends {}._ {});

Expected result

All of these programs are valid JavaScript and should not be rejected.

Code of Conduct

  • I agree to follow Rome's Code of Conduct
@bakkot bakkot added the S-To triage Status: user report of a possible bug that needs to be triaged label Nov 9, 2022
@MichaReiser MichaReiser added S-Bug: confirmed Status: report has been confirmed as a valid bug A-Parser Area: parser S-To triage Status: user report of a possible bug that needs to be triaged and removed S-To triage Status: user report of a possible bug that needs to be triaged labels Nov 9, 2022
@MichaReiser
Copy link
Contributor

chars</^\w*/.exec(str)[0].length;

Rome parses this correctly when the source type is JS and not JSX. It fails to parse in JSX mode (so does TypeScript). We should add a way for users to disable JSX parsing #3611

async(...null);
(class extends {}._ {});

TypeScript doesn't like these either :D

@MichaReiser
Copy link
Contributor

I'm splitting this into a couple of smaller issues. We don't plan to fix the issues that TypeScript fails to parse as well:

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A-Parser Area: parser S-Bug: confirmed Status: report has been confirmed as a valid bug S-To triage Status: user report of a possible bug that needs to be triaged
Projects
None yet
Development

No branches or pull requests

2 participants