GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||||||||||||||||
GeezerVison is showing github.com — Fix parenthesizer rules for manually constructed binary expressions with `??` and `||`/`&&` mix by Andarist · Pull Request #62311 · microsoft/TypeScript Conversation
Contributor
fixes #62307
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
…ith `??` and `||`/`&&` mix
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Pull Request OverviewThis PR fixes a bug in TypeScript's printer parenthesizer rules for manually constructed binary expressions that mix the nullish coalescing operator ( Key changes:
Reviewed ChangesCopilot reviewed 20 out of 20 changed files in this pull request and generated 8 comments.
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactionsUh oh!
There was an error while loading. Please reload this page. Uh oh!
There was an error while loading. Please reload this page. Uh oh!
There was an error while loading. Please reload this page. Uh oh!
There was an error while loading. Please reload this page. Uh oh!
There was an error while loading. Please reload this page. Uh oh!
There was an error while loading. Please reload this page. Uh oh!
There was an error while loading. Please reload this page. Uh oh!
There was an error while loading. Please reload this page.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. mixing them without parentheses is a special grammar-based syntax error, so one can't simply handle both of those cases using precedence and associativity alone, and for that reason I'm also specialcasing this here
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
Ryan Cavanaugh (RyanCavanaugh)
approved these changes
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Seems right to me. Wesley Wigham (@weswigham) confirm / check Corsa behavior?
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
Wesley Wigham (weswigham)
approved these changes
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Corsa late-adds required parenthesis during printing, rather than upon construction via parenthesizer like strada, so it'll be different to ensure the same in corsa.
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
Member
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page.
|
There was an error while loading. Please reload this page.
|
Starting jobs; this comment will be updated as builds start and complete.
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
…ith `??` and `||`/`&&` mix (#62311)
|
Hey, Jake Bailey (@jakebailey)! I've created #62424 for you. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
…e-5.9 (#62424) Co-authored-by: Mateusz Burzyński <[email protected]>
…ith ?? and ||/&& mix Port of microsoft/TypeScript#62311 When emitting binary expressions, the printer now checks if the parent operator and child operator are a mix of ?? with ||/&&, which requires parentheses per JavaScript spec. This prevents emitting syntactically invalid code like `a || b ?? c` and instead correctly emits `(a || b) ?? c`. Co-authored-by: jakebailey <[email protected]>
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
Manually constructed nullish coalescing + OR AST is missing parentheses when printed
There was an error while loading. Please reload this page.