Skip to content

Commit 858d52c

Browse files
committed
Tighten matchSymbol again
Revert to the original definition. For a while this was changed so that a tree would match if its source symbol matched the required symbol but this yields to many trees (e.g. primary constructor of a class in addition to the class itself). (reverted from commit 349d79b)
1 parent 349d79b commit 858d52c

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

compiler/src/dotty/tools/dotc/interactive/Interactive.scala

+3-1
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ object Interactive {
7373

7474
/** Check if `tree` matches `sym`.
7575
* This is the case if the symbol defined by `tree` equals `sym`,
76+
* or the source symbol of tree equals sym,
7677
* or `include` is `overridden`, and `tree` is overridden by `sym`,
7778
* or `include` is `overriding`, and `tree` overrides `sym`.
7879
*/
@@ -81,7 +82,8 @@ object Interactive {
8182
def overrides(sym1: Symbol, sym2: Symbol) =
8283
sym1.owner.derivesFrom(sym2.owner) && sym1.overriddenSymbol(sym2.owner.asClass) == sym2
8384

84-
( sym.exists && sym == tree.symbol
85+
( sym == tree.symbol
86+
|| sym.exists && sym == sourceSymbol(tree.symbol)
8587
|| include != 0 && sym.name == tree.symbol.name && sym.owner != tree.symbol.owner
8688
&& ( (include & Include.overridden) != 0 && overrides(sym, tree.symbol)
8789
|| (include & Include.overriding) != 0 && overrides(tree.symbol, sym)

0 commit comments

Comments
 (0)