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

fix(rome_js_parser): call expression in optional member chain followed by < #3487

Merged
merged 1 commit into from
Oct 26, 2022

Conversation

MichaReiser
Copy link
Contributor

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

…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
@MichaReiser MichaReiser added the A-Parser Area: parser label Oct 26, 2022
@MichaReiser MichaReiser added this to the 10.0.0 milestone Oct 26, 2022
@MichaReiser MichaReiser requested a review from xunilrj as a code owner October 26, 2022 07:40
@netlify
Copy link

netlify bot commented Oct 26, 2022

Deploy Preview for rometools canceled.

Name Link
🔨 Latest commit e8d59cb
🔍 Latest deploy log https://app.netlify.com/sites/rometools/deploys/6358e454801f030009dad498

@MichaReiser MichaReiser temporarily deployed to netlify-playground October 26, 2022 07:40 Inactive
// * if the parser is at '(': This always parses out as valid arguments.
debug_assert_eq!(p.tokens.position(), start_pos);
m.abandon(p);
break if optional_chain_call {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The main fix is to test for optional_chain_call instead of in_optional_chain. The former is only true for a()?. but the latter can also be true for a()?.b (which has already been handled by the member expression parsing

@github-actions
Copy link

Parser conformance results on ubuntu-latest

js/262

Test result main count This PR count Difference
Total 45879 45879 0
Passed 44939 44939 0
Failed 940 940 0
Panics 0 0 0
Coverage 97.95% 97.95% 0.00%

jsx/babel

Test result main count This PR count Difference
Total 39 39 0
Passed 36 36 0
Failed 3 3 0
Panics 0 0 0
Coverage 92.31% 92.31% 0.00%

symbols/microsoft

Test result main count This PR count Difference
Total 5946 5946 0
Passed 1621 1621 0
Failed 4325 4325 0
Panics 0 0 0
Coverage 27.26% 27.26% 0.00%

ts/babel

Test result main count This PR count Difference
Total 588 588 0
Passed 519 519 0
Failed 69 69 0
Panics 0 0 0
Coverage 88.27% 88.27% 0.00%

ts/microsoft

Test result main count This PR count Difference
Total 16257 16257 0
Passed 12395 12395 0
Failed 3862 3862 0
Panics 0 0 0
Coverage 76.24% 76.24% 0.00%

@github-actions
Copy link

@MichaReiser MichaReiser merged commit d1f2f42 into main Oct 26, 2022
@MichaReiser MichaReiser deleted the fix/parser-optional-chain-call-less-than branch October 26, 2022 08:39
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A-Parser Area: parser
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

🐛 Parser: < inside a chained optional call expression
2 participants
点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载