From f8f98ccfb4f32540bf16c6f920b61c9c7ce6d91c Mon Sep 17 00:00:00 2001 From: Dale Wijnand Date: Wed, 31 Jan 2024 12:56:02 +0000 Subject: [PATCH] Filter findDefinitions, to avoid using the wrong one Tested by giving exportTerm0 and exportTerm1 difference filenames, resulting in different locations and breakage. [Cherry-picked 0ee03ef7ba6c105d88d7b701cbbcc60d1e1a3afd] --- .../src/main/dotty/tools/pc/PcDefinitionProvider.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/presentation-compiler/src/main/dotty/tools/pc/PcDefinitionProvider.scala b/presentation-compiler/src/main/dotty/tools/pc/PcDefinitionProvider.scala index c4266ce5d709..0de81ec39711 100644 --- a/presentation-compiler/src/main/dotty/tools/pc/PcDefinitionProvider.scala +++ b/presentation-compiler/src/main/dotty/tools/pc/PcDefinitionProvider.scala @@ -124,7 +124,7 @@ class PcDefinitionProvider( val isLocal = sym.source == pos.source if isLocal then val defs = - Interactive.findDefinitions(List(sym), driver, false, false) + Interactive.findDefinitions(List(sym), driver, false, false).filter(_.source == sym.source) defs.headOption match case Some(srcTree) => val pos = srcTree.namePos