Skip to content

Trailing commas lead to very confusing scalastyle errors #72

Open
@steinybot

Description

@steinybot

Trailing commas lead to very confusing errors. Trailing commas were added in SIP-27 (Scala 2.12.2). I don't actually use them intentionally but it can take a very long time to find it since scalac passes but scalastyle fails without any line information and usually on an unrelated token.

For example:

[error] MySpec.scala: illegal start of simple expression: Token(RPAREN,),295,))
import org.scalatest.FlatSpec
import org.scalatest.prop.GeneratorDrivenPropertyChecks

class MySpec extends FlatSpec with GeneratorDrivenPropertyChecks {

  case class Foo(a: String, b: Int)

  Foo(
    "hello",
    123,
  )
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions