Skip to content

Commit

Permalink
Revert to old definition if isSelfSym
Browse files Browse the repository at this point in the history
  • Loading branch information
odersky committed Jan 11, 2023
1 parent 7f41414 commit 60cb909
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions compiler/src/dotty/tools/dotc/core/SymDenotations.scala
Original file line number Diff line number Diff line change
Expand Up @@ -702,8 +702,21 @@ object SymDenotations {
flagsUNSAFE.is(Provisional) // do not force the info to check the flag

/** Is this the denotation of a self symbol of some class?
*/
final def isSelfSym(using Context): Boolean = is(SelfName)
* This is the case if one of two conditions holds:
* 1. It is the symbol referred to in the selfInfo part of the ClassInfo
* which is the type of this symbol's owner.
* 2. This symbol is owned by a class, it's selfInfo field refers to a type
* (indicating the self definition does not introduce a name), and the
* symbol's name is "_".
* TODO: Find a more robust way to characterize self symbols, maybe by
* spending a Flag on them?
*/
final def isSelfSym(using Context): Boolean = owner.infoOrCompleter match {
case ClassInfo(_, _, _, _, selfInfo) =>
selfInfo == symbol ||
selfInfo.isInstanceOf[Type] && name == nme.WILDCARD
case _ => false
}

/** Is this definition contained in `boundary`?
* Same as `ownersIterator contains boundary` but more efficient.
Expand Down

0 comments on commit 60cb909

Please sign in to comment.