From bc499ee6de2bbc3ca5c9fa69781f60c160bc8954 Mon Sep 17 00:00:00 2001 From: Rikito Taniguchi Date: Sat, 11 Jun 2022 14:08:48 +0900 Subject: [PATCH] docs: Add a comment to `pathTo` mentioning that it might return `errorTermTree` --- compiler/src/dotty/tools/dotc/interactive/Interactive.scala | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/compiler/src/dotty/tools/dotc/interactive/Interactive.scala b/compiler/src/dotty/tools/dotc/interactive/Interactive.scala index 2cc2e1f5e926..d0cff4c2e281 100644 --- a/compiler/src/dotty/tools/dotc/interactive/Interactive.scala +++ b/compiler/src/dotty/tools/dotc/interactive/Interactive.scala @@ -247,6 +247,11 @@ object Interactive { /** The reverse path to the node that closest encloses position `pos`, * or `Nil` if no such path exists. If a non-empty path is returned it starts with * the tree closest enclosing `pos` and ends with an element of `trees`. + * + * Note that if the given `pos` points out places for incomplete parses, + * this method returns `errorTermTree` (`Literal(Consotant(null)`). + * + * @see https://github.com/lampepfl/dotty/issues/15294 */ def pathTo(trees: List[SourceTree], pos: SourcePosition)(using Context): List[Tree] = pathTo(trees.map(_.tree), pos.span)