-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Closed
Closed
Copy link
Description
Compiler version
3.3.0-RC5
Minimized code
// BadRewrite.scala
//> using scala "3.3.0-RC5"
//> using options "-rewrite", "-no-indent"
def test[T](body:T):T = body
object Test:
test:
println("test 1")Output
when we call scala-cli compile BadRewrite.scala our file is rewriten to:
//Result clearly incorrect
//> using scala "3.3.0-RC5"
//> using options "-rewrite", "-no-indent"
def test[T](name:String)(body:T):T = body
object Test {
test {
println("test 1")
}and it clearly misses single bracket. It happens only when you use "optional braces for method arguments" as last thing in block.
If we add anything after call on the same level (here object Test) it will produce proper result:
object Test:
test:
println("test 1")
val dummy = 2 //even comment is enough!!translates to
//Result as expected
object Test {
test {
println("test 1")
}
val dummy = 2 //even comment is enough!!
}Weird Behavior of End Marker
object Test:
test:
println("test 1")
end Testtranslates to:
object Test {
test {
println("test 1")
} // end Testbut with extra \n:
object Test:
test:
println("test 1")
end Testtranslates to:
object Test {
test {
println("test 1")
}
end Test