The following code is somewhat weird looking but valid Scala (compiles in version 2.13.6)
import scala.concurrent.{ExecutionContext, Future,
}
trait Test {
val ec: ExecutionContext
val fut: Future[Any]
}
However, it causes the following error when running Scalastyle: [error] [...]/Test.scala: Expected identifier, but got Token(RBRACE,},90,})
I only found out about it because our ScalaFmt config apparently generates this if an import line would otherwise not quite fit.
Some additional remarks:
- The error disappears if I remove the comma after Future.
- A dangling comma followed by the closing brace on the same line causes a compile error (similar to dangling comma rules in Lists and such, I think), so that case isn't relevant.
The main issue is that the error means scalastyle doesn't parse the rest of the file so any actual style warnings are hidden.