@@ -101,15 +101,17 @@ class TreeChecker {
101101 def ownerMatches (symOwner : Symbol , ctxOwner : Symbol ): Boolean =
102102 symOwner == ctxOwner ||
103103 ctxOwner.isWeakOwner && ownerMatches(symOwner, ctxOwner.owner)
104- if (! ownerMatches(tree.symbol.owner, ctx.owner)) {
105- assert(ownerMatches(tree.symbol.owner, ctx.owner),
106- i " bad owner; ${tree.symbol} has owner ${tree.symbol.owner}, expected was ${ctx.owner}\n " +
107- i " owner chain = ${tree.symbol.ownersIterator.toList}%, %, ctxOwners = ${ctx.outersIterator.map(_.owner).toList}%, % " )
108- }
104+ assert(ownerMatches(tree.symbol.owner, ctx.owner),
105+ i " bad owner; ${tree.symbol} has owner ${tree.symbol.owner}, expected was ${ctx.owner}\n " +
106+ i " owner chain = ${tree.symbol.ownersIterator.toList}%, %, ctxOwners = ${ctx.outersIterator.map(_.owner).toList}%, % " )
109107 }
110108
111109 override def typedClassDef (cdef : untpd.TypeDef , cls : ClassSymbol )(implicit ctx : Context ) = {
112110 val TypeDef (_, _, impl @ Template (constr, _, _, _)) = cdef
111+ assert(cdef.symbol == cls)
112+ assert(impl.symbol.owner == cls)
113+ assert(constr.symbol.owner == cls)
114+ assert(cls.primaryConstructor == constr.symbol, i " mismatch, primary constructor ${cls.primaryConstructor}, in tree = ${constr.symbol}" )
113115 checkOwner(impl)
114116 checkOwner(impl.constr)
115117 super .typedClassDef(cdef, cls)
0 commit comments