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