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
importscala.annotation.implicitNotFound@implicitNotFound("""Could not find an implicit Show for type ${T}, predicate ${P} and result ${R}. | You may want to define it as an implicit function that is polymorphic function over R.""".stripMargin)
traitShow[T, P, R]
When I run scalafmt like this:
sbt:bug-reports> clean
[success] Total time: 0 s, completed 20/01/2020, 11:35:50 am
sbt:bug-reports> scalafmtCheck
[info] Checking 1 Scala sources...
[warn] /Users/jason/source/bug-reports/src/main/scala/Show.scala isn't formatted properly![error] 1 files must be formatted[error] (Compile / scalafmtCheck) 1 files must be formatted[error] Total time: 0 s, completed 20/01/2020, 11:35:55 amsbt:bug-reports> scalafmt[info] Formatting 1 Scala sources...[success] Total time: 0 s, completed 20/01/2020, 11:36:01 amsbt:bug-reports> scalafmtCheck[success] Total time: 0 s, completed 20/01/2020, 11:36:09 amsbt:bug-reports> clean[success] Total time: 0 s, completed 20/01/2020, 11:36:13 amsbt:bug-reports> scalafmtCheck[info] Checking 1 Scala sources...[warn] /Users/jason/source/bug-reports/src/main/scala/Show.scala isn't formatted properly!
[error] 1 files must be formatted
[error] (Compile / scalafmtCheck) 1 files must be formatted
[error] Total time: 0 s, completed 20/01/2020, 11:36:16 am
sbt:bug-reports> scalafmt
[info] Formatting 1 Scala sources...
[success] Total time: 0 s, completed 20/01/2020, 11:36:22 am
sbt:bug-reports> scalafmtCheck
[success] Total time: 0 s, completed 20/01/2020, 11:36:27 am
sbt:bug-reports> clean
[success] Total time: 0 s, completed 20/01/2020, 11:39:53 am
sbt:bug-reports> scalafmtCheck
[info] Checking 1 Scala sources...
[warn] /Users/jason/source/bug-reports/src/main/scala/Show.scala isn't formatted properly![error] 1 files must be formatted[error] (Compile / scalafmtCheck) 1 files must be formatted[error] Total time: 0 s, completed 20/01/2020, 11:39:56 am
Problem
Scalafmt formats code like this:
importscala.annotation.implicitNotFound@implicitNotFound(
"""Could not find an implicit Show for type ${T}, predicate ${P} and result ${R}. | You may want to define it as an implicit function that is polymorphic function over R.""".stripMargin
)
traitShow[T, P, R]
Which then checks ok until sbt clean is run and then it fails again. Doing another scalafmt causes it to go back to the original and again after sbt clean it will fail again.
I can't get this past CI as no matter what format I use it will initially be considered invalid.
Expectation
I would like the formatted output to look like this:
importscala.annotation.implicitNotFound@implicitNotFound(
"""Could not find an implicit Show for type ${T}, predicate ${P} and result ${R}. | You may want to define it as an implicit function that is polymorphic function over R.""".stripMargin
)
traitShow[T, P, R]
Workaround
importscala.annotation.implicitNotFound@implicitNotFound("""Could not find an implicit Show for type ${T}, predicate ${P} and result ${R}. You may want to define it as an implicit function that is polymorphic function over R.""")
traitShow[T, P, R]
~/source/bug-reports scalafmt/non-idempotent-annotation
❯ scalafmt -version
scalafmt 2.3.3-RC2+27-f5eb4b87-SNAPSHOT
~/source/bug-reports scalafmt/non-idempotent-annotation
❯ scalafmt --test
--- /Users/jason/source/bug-reports/src/main/scala/Show.scala
+++ /Users/jason/source/bug-reports/src/main/scala/Show.scala-formatted
@@ -2,4 +2,6 @@
-@implicitNotFound("""Could not find an implicit Show for type ${T}, predicate ${P} and result ${R}.
- | You may want to define it as an implicit function that is polymorphic function over R.""".stripMargin)
+@implicitNotFound(
+ """Could not find an implicit Show for type ${T}, predicate ${P} and result ${R}.
+ | You may want to define it as an implicit function that is polymorphic function over R.""".stripMargin
+)
trait Show[T, P, R]
error: --test failed
~/source/bug-reports scalafmt/non-idempotent-annotation
❯ scalafmt
Reformatting...
100.0% [##########] 327 source files formatted
~/source/bug-reports scalafmt/non-idempotent-annotation*
❯ scalafmt --test
--- /Users/jason/source/bug-reports/src/main/scala/Show.scala
+++ /Users/jason/source/bug-reports/src/main/scala/Show.scala-formatted
@@ -2,6 +2,4 @@
-@implicitNotFound(
- """Could not find an implicit Show for type ${T}, predicate ${P} and result ${R}.
- | You may want to define it as an implicit function that is polymorphic function over R.""".stripMargin
-)
+@implicitNotFound("""Could not find an implicit Show for type ${T}, predicate ${P} and result ${R}.
+ | You may want to define it as an implicit function that is polymorphic function over R.""".stripMargin)
trait Show[T, P, R]
error: --test failed
~/source/bug-reports scalafmt/non-idempotent-annotation*
❯ scalafmt
Reformatting...
100.0% [##########] 327 source files formatted
This template is a guideline, not a strict requirement.
Steps
Given code like this:
When I run scalafmt like this:
Problem
Scalafmt formats code like this:
Which then checks ok until
sbt clean
is run and then it fails again. Doing anotherscalafmt
causes it to go back to the original and again aftersbt clean
it will fail again.I can't get this past CI as no matter what format I use it will initially be considered invalid.
Expectation
I would like the formatted output to look like this:
Workaround
Notes
Possibly related to #192
Repo that reproduces this bug here https://github.com/steinybot/bug-reports/tree/scalafmt/non-idempotent-annotation
The text was updated successfully, but these errors were encountered: