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
It looks like Tokens#last doesn't throw on empty Tokens. Scalafmt should handle empty tokens:
defnBeforeTemplate(leftOwner).filter(_.tokens.nonEmpty).map { x =>
val policyEnd = Policy.End.On(x.tokens.last)
delayedBreakPolicy(policyEnd)(forceNewlineBeforeExtends)
}
==> X org.scalafmt.FormatTests.unit/Annotations.stat:59: #1640 | 0.001s org.scalafmt.util.FormatException: java.util.NoSuchElementException: last of empty IndexedSeq
at org.scalafmt.FormatTests.run(FormatTests.scala:56)
at org.scalafmt.FormatTests.$anonfun$new$3(FormatTests.scala:33)
at org.scalafmt.FormatTests.$anonfun$new$3$adapted(FormatTests.scala:33)
at org.scalafmt.util.CanRunTests.$anonfun$runTest$2(CanRunTests.scala:19)
Caused by: java.util.NoSuchElementException: last of empty IndexedSeq
at scala.collection.IndexedSeqOps.last(IndexedSeq.scala:110)
at scala.collection.IndexedSeqOps.last$(IndexedSeq.scala:105)
at scala.meta.tokens.Tokens.last(Tokens.scala:29)
at org.scalafmt.internal.Router.$anonfun$getSplitsImpl$118(Router.scala:838)
at scala.Option.map(Option.scala:242)
at org.scalafmt.internal.Router.getSplitsImpl(Router.scala:837)
The text was updated successfully, but these errors were encountered:
Unit tests fail on the Scala 2 community build.
Configuration (required)
HEAD
Problem
Notes
It looks like
Tokens#last
doesn't throw on emptyTokens
. Scalafmt should handle empty tokens:(I didn't pursue a fix.)
Noticed at scala/community-build#1680 (comment)
The text was updated successfully, but these errors were encountered: