diff options
-rw-r--r-- | compiler/src/dotty/tools/dotc/parsing/Scanners.scala | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/compiler/src/dotty/tools/dotc/parsing/Scanners.scala b/compiler/src/dotty/tools/dotc/parsing/Scanners.scala index 4b1d02093..65d3fb66c 100644 --- a/compiler/src/dotty/tools/dotc/parsing/Scanners.scala +++ b/compiler/src/dotty/tools/dotc/parsing/Scanners.scala @@ -192,7 +192,9 @@ object Scanners { /** Returns the closest docstring preceding the position supplied */ def getDocComment(pos: Int): Option[Comment] = { def closest(c: Comment, docstrings: List[Comment]): Comment = docstrings match { - case x :: xs if (c.pos.end < x.pos.end && x.pos.end <= pos) => closest(x, xs) + case x :: xs => + if (c.pos.end < x.pos.end && x.pos.end <= pos) closest(x, xs) + else closest(c, xs) case Nil => c } |