Skip to content

Commit 9e9206d

Browse files
committed
Positioned#initialPos: Union the position of every children
Previously we missed some children, one consequence of this is that the position of the typed tree corresponding to the lambda "z => 1" did not contain the position of "z".
1 parent da7d723 commit 9e9206d

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,8 @@ abstract class Positioned extends DotClass with Product {
123123

124124
private def unionPos(pos: Position, xs: List[_]): Position = xs match {
125125
case (p: Positioned) :: xs1 => unionPos(pos union p.pos, xs1)
126+
case (xs0: List[_]) :: xs1 => unionPos(unionPos(pos, xs0), xs1)
127+
case _ :: xs1 => unionPos(pos, xs1)
126128
case _ => pos
127129
}
128130

0 commit comments

Comments
 (0)