Open
Description
Consider the example below.
Note that f1
has an indentation region with a code block as a first statement.
IMO such syntax is quite misleading and it's easy to be confused.
Even if you use indentaion-based syntax f1
very much looks like a method definition with some badly-indented println(2)
(like in f2
)
It's especially easy to misread if there is a new line after the code block.
If such code exists in some project one could think that it's something wrong with the formatting and unindent println(2)
breaking the semantics
object O:
def f1(): Unit =
{
println(1)
}
println(2)
def f2(): Unit =
{
println(3)
}
println(4)
def f3(): Unit =
{
println(5)
}
println(6)