scala3
scala3 copied to clipboard
Missing indentation warning
Code
The following compiles without warnings.
class Foo:
def sum(xs: List[Int]): Int = loop(0, xs)
def loop(sum: Int, xs: List[Int]): Int =
xs match
case head :: tail => loop(sum + head, tail)
case Nil => sum
Output
Foo will have both public methods sum and loop, but the syntax seems to suggest that loop is local.
Expectation
Should warn about misaligned indentation.