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

πŸ› Parser: < inside a chained optional call expression #3486

Closed
1 task done
Boshen opened this issue Oct 26, 2022 · 2 comments Β· Fixed by #3487
Closed
1 task done

πŸ› Parser: < inside a chained optional call expression #3486

Boshen opened this issue Oct 26, 2022 · 2 comments Β· Fixed by #3487
Labels
A-Parser Area: parser S-Bug: confirmed Status: report has been confirmed as a valid bug
Milestone

Comments

@Boshen
Copy link
Contributor

Boshen commented Oct 26, 2022

Environment information

PlayGround

What happened?

item => String(item)?.indexOf(filterIdPrefix) < 0

errored with

  βœ– expected an identifier but instead found '<'

Expected result

It should parse

Code of Conduct

  • I agree to follow Rome's Code of Conduct
@Boshen Boshen changed the title πŸ› Parser: < inside a chained expression within a arrow expression πŸ› Parser: < inside a chained expression within an arrow expression Oct 26, 2022
@MichaReiser MichaReiser added S-Bug: confirmed Status: report has been confirmed as a valid bug A-Parser Area: parser labels Oct 26, 2022
@MichaReiser
Copy link
Contributor

This is an interesting one. For some reason, the parser starts an unnecessary JsStaticMemberExpression for the whole left side of the binary expression

@MichaReiser
Copy link
Contributor

Minimal repro: playground

@MichaReiser MichaReiser changed the title πŸ› Parser: < inside a chained expression within an arrow expression πŸ› Parser: < inside a chained optional call expression Oct 26, 2022
MichaReiser pushed a commit that referenced this issue Oct 26, 2022
…d by `<`

This PR fixes a false diagnostic for call expressions that are part of an optional chain (static member) that are then followed by a binary `<` expression.

```
String(item)?.b <aBcd;
```

The problem is that the error recovery code for `a.test?.` incorrectly kicked in which should not happen if what followed after the call expression is a valid static member expression in an optional chain.

fixes #3486
@ematipico ematipico added this to the 10.0.0 milestone Oct 26, 2022
@MichaReiser MichaReiser moved this to Done in Rome 2022 Oct 26, 2022
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
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

3 participants