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

Add literal.binPrefix setting to format binary literals. #4183

Merged
merged 2 commits into from
Aug 23, 2024
Merged

Add literal.binPrefix setting to format binary literals. #4183

merged 2 commits into from
Aug 23, 2024

Conversation

charpov
Copy link
Contributor

@charpov charpov commented Aug 23, 2024

Add formatting to handle binary literals, which were added in Scala 3.5.0.
Those are of the form 0b111 or 0b111L and so are susceptible to both literals.binPrefix and literals.long.

The 3.5.0 release uses 0B111 in its examples, but the original SIP 42 uses 0b111. I chose 0b as the default, as it looks a lot nicer to me.

There is a new test file (binary.stat) and the documentation was updated (it's missing a since comment).

The changes address my own feature request: fixes #4176.

Those are of the form 0b111 or 0b111L and so are susceptible to both
literals.binPrefix and literals.long.
Copy link
Collaborator

@kitbellew kitbellew left a comment

Choose a reason for hiding this comment

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

thank you, nice and clean!

@charpov
Copy link
Contributor Author

charpov commented Aug 23, 2024

I've added the version number and made the suggested code changes.

@kitbellew kitbellew merged commit 5d44bfc into scalameta:main Aug 23, 2024
9 checks passed
@charpov charpov deleted the format-bin-literals branch August 23, 2024 18:12
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.

Add a literals.binary setting
2 participants