You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The parentheses should remain as they're required for the syntax to be valid. Maybe this is a nuance of functions passed to class constructors.
Workaround
Other than disabling the RedundantBraces rewrite, the only other workaround I've found is to add a // format: off comment to disable scalafmt on this code.
The text was updated successfully, but these errors were encountered:
I have the same issue, where redundant braces are removed, where they are required by the syntax. Specifically in two cases.
code with multiple parameter sets followed by dot notation call (a(x)(y)).call(...)
is rewritten to invalid syntax: a(x)(y).call(...)
braces are removed also from constructors with 0 parameters: ClassA()
is rewritten to: ClassA
While this is ok in scala, it is an issue when using native Java classes.
Configuration (required)
Command-line parameters (required)
Steps
Given code like this:
Problem
Scalafmt removes the parentheses around the function passed to the
Foo
constructor, like this:Expectation
The parentheses should remain as they're required for the syntax to be valid. Maybe this is a nuance of functions passed to class constructors.
Workaround
Other than disabling the
RedundantBraces
rewrite, the only other workaround I've found is to add a// format: off
comment to disable scalafmt on this code.The text was updated successfully, but these errors were encountered: