@@ -316,25 +316,35 @@ trait Symbols { this: Context =>
316
316
newNakedSymbol[original.ThisName ](original.coord)
317
317
}
318
318
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) =>
323
320
val odenot = original.denot
324
321
val oinfo = original.info match {
325
322
case ClassInfo (pre, _, parents, decls, selfInfo) =>
326
323
assert(original.isClass)
327
324
ClassInfo (pre, copy.asClass, parents, decls.cloneScope, selfInfo)
328
325
case oinfo => oinfo
329
326
}
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
+
330
338
copy.denot = odenot.copySymDenotation(
331
339
symbol = copy,
332
340
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 ,
335
343
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
+
337
346
}
347
+
338
348
copies
339
349
}
340
350
0 commit comments