File tree Expand file tree Collapse file tree 5 files changed +27
-2
lines changed
compiler/src/dotty/tools/dotc Expand file tree Collapse file tree 5 files changed +27
-2
lines changed Original file line number Diff line number Diff line change @@ -1630,7 +1630,11 @@ object SymDenotations {
16301630 myBaseTypeCachePeriod = Nowhere
16311631 }
16321632
1633- def invalidateMemberCaches (sym : Symbol )(using Context ): Unit =
1633+ def invalidateMemberCaches ()(using Context ): Unit =
1634+ myMemberCachePeriod = Nowhere
1635+ invalidateMemberNamesCache()
1636+
1637+ def invalidateMemberCachesFor (sym : Symbol )(using Context ): Unit =
16341638 if myMemberCache != null then myMemberCache.remove(sym.name)
16351639 if ! sym.flagsUNSAFE.is(Private ) then
16361640 invalidateMemberNamesCache()
@@ -1831,7 +1835,7 @@ object SymDenotations {
18311835 /** Enter a symbol in given `scope` without potentially replacing the old copy. */
18321836 def enterNoReplace (sym : Symbol , scope : MutableScope )(using Context ): Unit =
18331837 scope.enter(sym)
1834- invalidateMemberCaches (sym)
1838+ invalidateMemberCachesFor (sym)
18351839
18361840 /** Replace symbol `prev` (if defined in current class) by symbol `replacement`.
18371841 * If `prev` is not defined in current class, do nothing.
Original file line number Diff line number Diff line change @@ -1231,6 +1231,7 @@ class Namer { typer: Typer =>
12311231 if (isDerivedValueClass(cls)) cls.setFlag(Final )
12321232 cls.info = avoidPrivateLeaks(cls)
12331233 cls.baseClasses.foreach(_.invalidateBaseTypeCache()) // we might have looked before and found nothing
1234+ cls.invalidateMemberCaches() // we might have checked for a member when parents were not known yet.
12341235 cls.setNoInitsFlags(parentsKind(parents), untpd.bodyKind(rest))
12351236 val ctorStable =
12361237 if cls.is(Trait ) then cls.is(NoInits )
Original file line number Diff line number Diff line change 1+ case class Parser (ctx : Context ) extends BasicSupport
2+
Original file line number Diff line number Diff line change 1+ // BasicSupport.scala
2+ trait BasicSupport :
3+ self : Parser =>
4+
5+ object SymOps extends SymOps [ctx.type ](ctx)
6+ export SymOps ._
7+
8+ def parse (sym : ctx.Symbol ): Int =
9+ sym.getVisibility()
10+
Original file line number Diff line number Diff line change 1+ // Context.scala
2+ trait Context :
3+ type Symbol
4+
5+ trait SymOps [C <: Context ](val c : C ):
6+ extension (sym : c.Symbol )
7+ def getVisibility (): Int = 0
8+
You can’t perform that action at this time.
0 commit comments