Closed
Description
As originally noted by Scala book author @cayhorstmann on gitter, the fewer braces variant is circulating in the population.
Compiler version
3.0.3-RC1
Minimized code
➜ ~/projects/dotty/bin/scala -language:experimental.fewerBraces
scala> List(42).foreach:
val res0: (Int => Any) => Unit = Lambda$1372/0x00000008010e8000@17ec5e2a
scala> import util.control.Breaks.*
scala> breakable:
val res1: (=> Unit) => Unit = Lambda$1413/0x00000008010fd208@5a4b8e25
scala> class C:
| end C
// defined class C
Output
It's not so much the output as the input. I hope REPL would wait for more.
The compiler allows empty indentation:
def f = List(42).foreach:
end f
// package may not be empty, class template may be empty
package p:
class C:
end C
end p
Expectation
The def f
with empty indentation requires either end f
or eof
. Expect it to require a block expr and not happily eta-expand.
In REPL, it should work like class C:
.
Spec requires a touch-up for the ArgExpr, but feature is still behind a flag.