@@ -316,25 +316,35 @@ trait Symbols { this: Context =>
316316 newNakedSymbol[original.ThisName ](original.coord)
317317 }
318318 val ttmap1 = ttmap.withSubstitution(originals, copies)
319- (originals, copies).zipped foreach {(original, copy) =>
320- copy.denot = original.denot // preliminary denotation, so that we can access symbols in subsequent transform
321- }
322- (originals, copies).zipped foreach {(original, copy) =>
319+ (originals, copies).zipped foreach { (original, copy) =>
323320 val odenot = original.denot
324321 val oinfo = original.info match {
325322 case ClassInfo (pre, _, parents, decls, selfInfo) =>
326323 assert(original.isClass)
327324 ClassInfo (pre, copy.asClass, parents, decls.cloneScope, selfInfo)
328325 case oinfo => oinfo
329326 }
327+
328+ val completer = new LazyType {
329+ def complete (denot : SymDenotation )(implicit ctx : Context ): Unit = {
330+ denot.info = oinfo // needed as otherwise we won't be able to go from Sym -> parents & etc
331+ // Note that this is a hack, but hack commonly used in Dotty
332+ // The same thing is done by other completers all the time
333+ denot.info = ttmap1.mapType(oinfo)
334+ denot.annotations = odenot.annotations.mapConserve(ttmap1.apply)
335+ }
336+ }
337+
330338 copy.denot = odenot.copySymDenotation(
331339 symbol = copy,
332340 owner = ttmap1.mapOwner(odenot.owner),
333- initFlags = odenot.flags &~ Frozen | Fresh ,
334- info = ttmap1.mapType(oinfo) ,
341+ initFlags = odenot.flags &~ ( Frozen | Touched ) | Fresh ,
342+ info = completer ,
335343 privateWithin = ttmap1.mapOwner(odenot.privateWithin), // since this refers to outer symbols, need not include copies (from->to) in ownermap here.
336- annotations = odenot.annotations.mapConserve(ttmap1.apply))
344+ annotations = odenot.annotations)
345+
337346 }
347+
338348 copies
339349 }
340350
0 commit comments