File tree Expand file tree Collapse file tree 2 files changed +31
-2
lines changed
compiler/src/dotty/tools/dotc/parsing Expand file tree Collapse file tree 2 files changed +31
-2
lines changed Original file line number Diff line number Diff line change @@ -1332,7 +1332,7 @@ object Parsers {
13321332 case DO =>
13331333 in.errorOrMigrationWarning(
13341334 i """ `do <body> while <cond>' is no longer supported,
1335- |use `while {<body> ; <cond>} do ()' instead.
1335+ |use `while ( {<body> ; <cond>}) ()' instead.
13361336 |The statement can be rewritten automatically under -language:Scala2 -migration -rewrite.
13371337 """ )
13381338 val start = in.skipToken()
@@ -1353,7 +1353,7 @@ object Parsers {
13531353 }
13541354 patch(source, cond.span.endPos, " }) ()" )
13551355 }
1356- WhileDo (Block (body :: Nil , cond), Literal (Constant (())))
1356+ WhileDo (Block (body, cond), Literal (Constant (())))
13571357 }
13581358 case TRY =>
13591359 val tryOffset = in.offset
Original file line number Diff line number Diff line change 1+ class Test {
2+ do {
3+ val x = 1
4+ println(x)
5+ } while {
6+ val x = " a"
7+ println(x)
8+ true
9+ }
10+
11+ do {
12+ val x = 1
13+ } while {
14+ val x = " a"
15+ true
16+ }
17+
18+ val x : Int = 3
19+ do {
20+ val x = " "
21+ } while (x == 2 )
22+
23+ do (x == 3 )
24+ while {
25+ val x = " a"
26+ true
27+ }
28+
29+ }
You can’t perform that action at this time.
0 commit comments