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 behavior with '**' operator #5238

Closed
liuhanqu opened this issue Oct 10, 2018 · 0 comments
Closed

incorrect behavior with '**' operator #5238

liuhanqu opened this issue Oct 10, 2018 · 0 comments
Labels
lang:javascript Issues affecting JS locked-due-to-inactivity Please open a new issue and fill out the template instead of commenting. priority:high Code is printed in a way that alters the AST, breaks syntax, or is a significant regression. Urgent! status:has pr Issues with an accompanying pull request. These issues will probably be fixed soon! type:bug Issues identifying ugly output, or a defect in the program
Milestone

Comments

@liuhanqu
Copy link

Prettier 1.14.3
Playground link

--parser babylon

Input:

const n = 19
const val = (n % 10) ** 2

Output:

const n = 19;
const val = n % 10 ** 2;

Expected behavior:

val === 81
@lydell lydell added type:bug Issues identifying ugly output, or a defect in the program priority:high Code is printed in a way that alters the AST, breaks syntax, or is a significant regression. Urgent! lang:javascript Issues affecting JS labels Oct 10, 2018
@j-f1 j-f1 added the help wanted We're a small group who can't get to every issue promptly. We’d appreciate help fixing this issue! label Oct 10, 2018
@ikatyang ikatyang added status:has pr Issues with an accompanying pull request. These issues will probably be fixed soon! and removed help wanted We're a small group who can't get to every issue promptly. We’d appreciate help fixing this issue! labels Oct 11, 2018
j-f1 pushed a commit that referenced this issue Oct 12, 2018
Fixes #5238.

cc @duailibe for the [original change](#4413). I basically undid that PR because it didn't look to me like `shouldFlatten` made sense as the place to introduce the behavior it was going for, but I might have misunderstood something.
@ikatyang ikatyang added this to the 1.15 milestone Oct 25, 2018
@lock lock bot added the locked-due-to-inactivity Please open a new issue and fill out the template instead of commenting. label Jan 23, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Jan 23, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
lang:javascript Issues affecting JS locked-due-to-inactivity Please open a new issue and fill out the template instead of commenting. priority:high Code is printed in a way that alters the AST, breaks syntax, or is a significant regression. Urgent! status:has pr Issues with an accompanying pull request. These issues will probably be fixed soon! type:bug Issues identifying ugly output, or a defect in the program
Projects
None yet
Development

No branches or pull requests

4 participants