scala3 icon indicating copy to clipboard operation
scala3 copied to clipboard

REPL does not consider fewerBraces for deciding when input ends

Open odersky opened this issue 3 years ago • 1 comments

Compiler version

Scala 3.2.0-RC2

Minimized example

scala> import language.experimental.fewerBraces
                                                                                                  
scala> val x: Option[Int] = Some(1)
     | 
val x: Option[Int] = Some(1)
                                                                                                  
scala> x.fold:
val res0: (=> Any) => (Int => Any) => Any = Lambda$68352/733603257@523cb0f9

Output

The REPL returns a result after the :

Expectation

It should accept an argument on the next line.

Another Example:

If I try to put the expression in an object, it fails elsewhere:

scala> object Test:
     |   x.fold:
     |     22
     |   .apply: n =>
-- Error: ----------------------------------------------------------------------
4 |  .apply: n =>
  |            ^^
  |            end of statement expected but '=>' found

Expectation is again that it should let me continue after the =>.

odersky avatar Jul 21 '22 14:07 odersky

The first example looks like a duplicate of #13097.

griggt avatar Jul 22 '22 00:07 griggt

I think this was fixed in #16466.

odersky avatar Dec 14 '22 13:12 odersky