scalameta / scalafmt

Code formatter for Scala
http://scalameta.org/scalafmt
Apache License 2.0
1.42k stars 276 forks source link

Invalid state for bit operations #4116

Closed timothyklim closed 1 month ago

timothyklim commented 1 month ago

Steps

Given code like this:

(~validByte).toByte

Problem

Scalafmt formats code like this:

~validByte.toByte

and makes code broken because for scalac its like ~(validByte.toByte) and expression become as Int type.

Expectation

I would like the formatted output to look like this:

(~validByte).toByte

Notes

version: 3.8.3

kitbellew commented 1 month ago

@timothyklim do you believe your submission, as formulated, is reproducible? would you perhaps like to revise it to include everything that was mandatory in the issue template?

timothyklim commented 1 month ago

@timothyklim do you believe your submission, as formulated, is reproducible? would you perhaps like to revise it to include everything that was mandatory in the issue template?

Sorry sorry, I forgot that part:

version = 3.8.3

rewrite.rules = [RedundantParens]

runner.dialect = scala3future
timothyklim commented 1 month ago

version = 3.8.3

version = 3.8.2 works fine with that code