Closed
Description
The following style if/else statements are failing to compile on Dotty version 0.19.0-RC1
minimized code
object Main {
def main(args: Array[String]): Unit = {
if (args.length > 0)
{
println(args)
} else {
println("Hello world!")
}
}
}
expectation
This should compile as it does in Scala 2.12
actual
This fails to compile:
[error] -- Error: D:\code\dotty-cont\dottyplayground\src\main\scala\Main.scala:7:8 -----
[error] 7 | } else { [error] | ^^^^ [error] | end of statement expected but else found [error] -- [E040] Syntax Error: D:\code\dotty-cont\dottyplayground\src\main\scala\Main.scala:7:13
[error] 7 | } else { [error] | ^ [error] | ';' expected, but '{' found [error] two errors found
[error] (Compile / compileIncremental) Compilation failed
[error] Total time: 5 s, completed Oct 13, 2019 9:12:30 PM
The workaround is simple but this behavior is unexpected.