Skip to content

Fix swapping of >>= and <<= in constants#850

Closed
jschwe wants to merge 2 commits intomozilla:masterfrom
jschwe:fix_shift_equals_constants
Closed

Fix swapping of >>= and <<= in constants#850
jschwe wants to merge 2 commits intomozilla:masterfrom
jschwe:fix_shift_equals_constants

Conversation

@jschwe
Copy link
Copy Markdown
Contributor

@jschwe jschwe commented Jun 22, 2023

ShlEq is shift left equals, i.e. <<=, so it was previously mapped the wrong way.

syn::BinOp::ShlEq(..) => ">>=",
syn::BinOp::ShrEq(..) => "<<=",
syn::BinOp::ShlEq(..) => "<<=",
syn::BinOp::ShrEq(..) => ">>=",
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Looks good but would there be any chance to add a test for this?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Upon looking at this again, I don't think it is possible to use <<= in constants at all, since the left hand side must be a variable. So probably these cases could also be an unreachable!() instead.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Let's merge this since it's trivial, it's not a big deal.

@emilio emilio closed this in aeea9c6 Aug 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants