File tree 5 files changed +27
-2
lines changed
compiler/src/dotty/tools/dotc 5 files changed +27
-2
lines changed Original file line number Diff line number Diff line change @@ -1630,7 +1630,11 @@ object SymDenotations {
1630
1630
myBaseTypeCachePeriod = Nowhere
1631
1631
}
1632
1632
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 =
1634
1638
if myMemberCache != null then myMemberCache.remove(sym.name)
1635
1639
if ! sym.flagsUNSAFE.is(Private ) then
1636
1640
invalidateMemberNamesCache()
@@ -1831,7 +1835,7 @@ object SymDenotations {
1831
1835
/** Enter a symbol in given `scope` without potentially replacing the old copy. */
1832
1836
def enterNoReplace (sym : Symbol , scope : MutableScope )(using Context ): Unit =
1833
1837
scope.enter(sym)
1834
- invalidateMemberCaches (sym)
1838
+ invalidateMemberCachesFor (sym)
1835
1839
1836
1840
/** Replace symbol `prev` (if defined in current class) by symbol `replacement`.
1837
1841
* 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 =>
1231
1231
if (isDerivedValueClass(cls)) cls.setFlag(Final )
1232
1232
cls.info = avoidPrivateLeaks(cls)
1233
1233
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.
1234
1235
cls.setNoInitsFlags(parentsKind(parents), untpd.bodyKind(rest))
1235
1236
val ctorStable =
1236
1237
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