Hello! Scala compiler allows trailing comma in the lambda body, function body and constructors. Is it bug or correct behavior? Looks a little weird.
In a SIP-27 I've read:
Following Dr. Martin Odersky’s suggestion, the proposal is that trailing commas are only supported in comma-separated elements that are enclosed by parentheses, square brackets or curly braces (), ], and }, respectively).
Is function bodies comma-separated elements?
reproduction steps
List(1, 2, 3).map {
a => a + 1,
}
class A() {
println("a"),
}
def b() = {
println("b"),
}
new A()
b()
problem
Code compiles
expectation
Code doesn't compile
Related scalameta/scalafmt#1410 (comment)