Skip to content

Commit 349d79b

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).
1 parent 068582c commit 349d79b

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

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

+1-3
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,6 @@ 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,
7776
* or `include` is `overridden`, and `tree` is overridden by `sym`,
7877
* or `include` is `overriding`, and `tree` overrides `sym`.
7978
*/
@@ -82,8 +81,7 @@ object Interactive {
8281
def overrides(sym1: Symbol, sym2: Symbol) =
8382
sym1.owner.derivesFrom(sym2.owner) && sym1.overriddenSymbol(sym2.owner.asClass) == sym2
8483

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

0 commit comments

Comments
 (0)