File tree Expand file tree Collapse file tree 2 files changed +11
-7
lines changed
compiler/src/dotty/tools/dotc/core Expand file tree Collapse file tree 2 files changed +11
-7
lines changed Original file line number Diff line number Diff line change @@ -138,6 +138,12 @@ object Scopes {
138
138
def next (): Symbol = { val r = e.sym; e = lookupNextEntry(e); r }
139
139
}
140
140
141
+ /** Does this scope contain a reference to `sym` when looking up `name`? */
142
+ final def contains (name : Name , sym : Symbol )(using Context ): Boolean =
143
+ var e = lookupEntry(name)
144
+ while e != null && e.sym != sym do e = lookupNextEntry(e)
145
+ e != null
146
+
141
147
/** The denotation set of all the symbols with given name in this scope
142
148
* Symbols occur in the result in reverse order relative to their occurrence
143
149
* in `this.toList`.
Original file line number Diff line number Diff line change @@ -2361,19 +2361,17 @@ object SymDenotations {
2361
2361
stillValidInOwner(denot)
2362
2362
}
2363
2363
2364
- private [SymDenotations ] def stillValidInOwner (denot : SymDenotation )(using Context ): Boolean = try {
2364
+ private [SymDenotations ] def stillValidInOwner (denot : SymDenotation )(using Context ): Boolean = try
2365
2365
val owner = denot.owner.denot
2366
- stillValid(owner) && (
2366
+ stillValid(owner)
2367
+ && (
2367
2368
! owner.isClass
2368
2369
|| owner.isRefinementClass
2369
2370
|| owner.is(Scala2x )
2370
- || ( owner.unforcedDecls.lookupAll (denot.name) contains denot.symbol)
2371
+ || owner.unforcedDecls.contains (denot.name, denot.symbol)
2371
2372
|| denot.isSelfSym
2372
2373
|| denot.isLocalDummy)
2373
- }
2374
- catch {
2375
- case ex : StaleSymbol => false
2376
- }
2374
+ catch case ex : StaleSymbol => false
2377
2375
2378
2376
/** Explain why symbol is invalid; used for debugging only */
2379
2377
def traceInvalid (denot : Denotation )(using Context ): Boolean = {
You can’t perform that action at this time.
0 commit comments