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 {
56
56
registry(name) = sym
57
57
}
58
58
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 object dissappeared from $symd" )
68
+ }
59
69
60
70
def transformSym (symd : SymDenotation )(implicit ctx : Context ): SymDenotation = {
61
71
val sym = symd.symbol
@@ -69,6 +79,8 @@ class TreeChecker extends Phase with SymTransformer {
69
79
testDuplicate(sym, seenClasses, " class" )
70
80
}
71
81
82
+ checkCompanion(symd)
83
+
72
84
symd
73
85
}
74
86
You can’t perform that action at this time.
0 commit comments