File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed
src/dotty/tools/dotc/transform Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -56,6 +56,16 @@ class TreeChecker extends Phase with SymTransformer {
5656 registry(name) = sym
5757 }
5858
59+ def checkCompanion (symd : SymDenotation )(implicit ctx : Context ): Unit = {
60+ val cur = symd.linkedClass
61+ val prev = ctx.atPhase(ctx.phase.prev) {
62+ implicit ctx =>
63+ symd.symbol.linkedClass
64+ }
65+
66+ if (prev.exists)
67+ assert(cur.exists, i " companion disappeared from $symd" )
68+ }
5969
6070 def transformSym (symd : SymDenotation )(implicit ctx : Context ): SymDenotation = {
6171 val sym = symd.symbol
@@ -69,6 +79,8 @@ class TreeChecker extends Phase with SymTransformer {
6979 testDuplicate(sym, seenClasses, " class" )
7080 }
7181
82+ checkCompanion(symd)
83+
7284 symd
7385 }
7486
You can’t perform that action at this time.
0 commit comments