Closed
Description
Dotty's REPL does not wrap the expression to evaluate in parens (like Scala's REPL). But because of #1424, wrapping expressions in parentheses can be needed to preserve behavior.
That bug is still open but confusingly titled, and the actual issue is hidden. Hence the separate one.
TL;DR. Dotty's REPL rejects(x: Any) => println(1)
but accepts ((x: Any) => println(1))
. Martin suggested a fix in #1424 (comment)
So it seems the REPL has to special case closures in any case.
So closures have to be put in parentheses by the REPL anyway.
I'm not sure if closures need special casing, or you can just wrap every expression in parentheses. Of course, definitions can't be wrapped :-|.
scala> x => println(1)
-- [E080] Syntax Error: <console>:5:1 ------------------------------------------
5 | x => println(1)
| ^
| missing parameter type for parameter x, expected = ?
longer explanation available when compiling with `-explain`
scala> (x: Any) => println(1)
-- Error: <console>:1:0 --------------------------------------------------------
1 |(x: Any) => println(1)
|^^^^^^^^
|not a legal self type clause
Metadata
Metadata
Assignees
Labels
No labels