Skip to content

Commit

Permalink
Tighten matchSymbol again
Browse files Browse the repository at this point in the history
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)
  • Loading branch information
odersky committed Feb 5, 2018
1 parent 349d79b commit 858d52c
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion compiler/src/dotty/tools/dotc/interactive/Interactive.scala
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ object Interactive {

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

( sym.exists && sym == tree.symbol
( sym == tree.symbol
|| sym.exists && sym == sourceSymbol(tree.symbol)
|| include != 0 && sym.name == tree.symbol.name && sym.owner != tree.symbol.owner
&& ( (include & Include.overridden) != 0 && overrides(sym, tree.symbol)
|| (include & Include.overriding) != 0 && overrides(tree.symbol, sym)
Expand Down

0 comments on commit 858d52c

Please sign in to comment.