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

Code formatted by 2.4.1 does not compile #1718

Closed
mpilquist opened this issue Feb 17, 2020 · 1 comment · Fixed by #1715
Closed

Code formatted by 2.4.1 does not compile #1718

mpilquist opened this issue Feb 17, 2020 · 1 comment · Fixed by #1715

Comments

@mpilquist
Copy link

When we upgraded to 2.4.1 on FS2, Scalafmt changed braces to parens. This included assignment statements of the form IO { x = ??? } where some var s is in scope. These were reformatted as IO(x = ???), which does not compile.

Scalafmt also errored out initially:

[error] /Users/mpilquist/Development/oss/fs2/core/shared/src/test/scala/fs2/StreamSpec.scala:2044: error: Unable to format file due to bug in scalafmt
[error]         assert(s.map(f).toList == s.toList.map(f))
[error]                      ^: /Users/mpilquist/Development/oss/fs2/core/shared/src/test/scala/fs2/StreamSpec.scala

In this block:

    "map" - {
      "map.toList == toList.map" in forAll { (s: Stream[Pure, Int], f: Int => Int) =>
        assert(s.map(f).toList == s.toList.map(f))
      }

Changing the f param to forAll to Function1[Int, Int] fixed.

See See https://github.com/functional-streams-for-scala/fs2/pull/1796/commits for full details -- the commits alternate from changes by Scalafmt to manual workarounds.

  • Version: 2.4.1
  • Integration: SBT
  • Configuration:
version = "2.4.1"

style = default

maxColumn = 100

rewrite.rules = [
  AvoidInfix
  RedundantBraces
  RedundantParens
  AsciiSortImports
  PreferCurlyFors
]

rewrite.neverInfix.excludeFilters = [until
  to
  by
  eq
  ne
  "should.*"
  "contain.*"
  "must.*"
  in
  be
  taggedAs
  thrownBy
  synchronized
  have
  when
  size
  theSameElementsAs]

@kitbellew
Copy link
Collaborator

@mpilquist fixed by #1715, will be released in v2.4.2 soon.

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 a pull request may close this issue.

2 participants