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 {
1332
1332
case DO =>
1333
1333
in.errorOrMigrationWarning(
1334
1334
i """ `do <body> while <cond>' is no longer supported,
1335
- |use `while {<body> ; <cond>} do ()' instead.
1335
+ |use `while ( {<body> ; <cond>}) ()' instead.
1336
1336
|The statement can be rewritten automatically under -language:Scala2 -migration -rewrite.
1337
1337
""" )
1338
1338
val start = in.skipToken()
@@ -1353,7 +1353,7 @@ object Parsers {
1353
1353
}
1354
1354
patch(source, cond.span.endPos, " }) ()" )
1355
1355
}
1356
- WhileDo (Block (body :: Nil , cond), Literal (Constant (())))
1356
+ WhileDo (Block (body, cond), Literal (Constant (())))
1357
1357
}
1358
1358
case TRY =>
1359
1359
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