Skip to content

Commit 78526f6

Browse files
committed
fix scala#1484: incorrect position in while loop
1 parent 3588832 commit 78526f6

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

compiler/src/dotty/tools/dotc/ast/Desugar.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -953,12 +953,12 @@ object desugar {
953953
else Apply(ref(tupleTypeRef.classSymbol.companionModule.valRef), ts)
954954
case WhileDo(cond, body) =>
955955
// { <label> def while$(): Unit = if (cond) { body; while$() } ; while$() }
956-
val call = Apply(Ident(nme.WHILE_PREFIX), Nil)
956+
val call = Apply(Ident(nme.WHILE_PREFIX), Nil).withPos(tree.pos)
957957
val rhs = If(cond, Block(body, call), unitLiteral)
958958
labelDefAndCall(nme.WHILE_PREFIX, rhs, call)
959959
case DoWhile(body, cond) =>
960960
// { label def doWhile$(): Unit = { body; if (cond) doWhile$() } ; doWhile$() }
961-
val call = Apply(Ident(nme.DO_WHILE_PREFIX), Nil)
961+
val call = Apply(Ident(nme.DO_WHILE_PREFIX), Nil).withPos(tree.pos)
962962
val rhs = Block(body, If(cond, call, unitLiteral))
963963
labelDefAndCall(nme.DO_WHILE_PREFIX, rhs, call)
964964
case ForDo(enums, body) =>

0 commit comments

Comments
 (0)