aboutsummaryrefslogtreecommitdiff
path: root/compiler/src
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/src')
-rw-r--r--compiler/src/dotty/tools/dotc/core/Symbols.scala24
1 files changed, 17 insertions, 7 deletions
diff --git a/compiler/src/dotty/tools/dotc/core/Symbols.scala b/compiler/src/dotty/tools/dotc/core/Symbols.scala
index d355686ab..5d0dd2123 100644
--- a/compiler/src/dotty/tools/dotc/core/Symbols.scala
+++ b/compiler/src/dotty/tools/dotc/core/Symbols.scala
@@ -316,10 +316,7 @@ trait Symbols { this: Context =>
newNakedSymbol[original.ThisName](original.coord)
}
val ttmap1 = ttmap.withSubstitution(originals, copies)
- (originals, copies).zipped foreach {(original, copy) =>
- copy.denot = original.denot // preliminary denotation, so that we can access symbols in subsequent transform
- }
- (originals, copies).zipped foreach {(original, copy) =>
+ (originals, copies).zipped foreach { (original, copy) =>
val odenot = original.denot
val oinfo = original.info match {
case ClassInfo(pre, _, parents, decls, selfInfo) =>
@@ -327,14 +324,27 @@ trait Symbols { this: Context =>
ClassInfo(pre, copy.asClass, parents, decls.cloneScope, selfInfo)
case oinfo => oinfo
}
+
+ val completer = new LazyType {
+ def complete(denot: SymDenotation)(implicit ctx: Context): Unit = {
+ denot.info = oinfo // needed as otherwise we won't be able to go from Sym -> parents & etc
+ // Note that this is a hack, but hack commonly used in Dotty
+ // The same thing is done by other completers all the time
+ denot.info = ttmap1.mapType(oinfo)
+ denot.annotations = odenot.annotations.mapConserve(ttmap1.apply)
+ }
+ }
+
copy.denot = odenot.copySymDenotation(
symbol = copy,
owner = ttmap1.mapOwner(odenot.owner),
- initFlags = odenot.flags &~ Frozen | Fresh,
- info = ttmap1.mapType(oinfo),
+ initFlags = odenot.flags &~ (Frozen | Touched) | Fresh,
+ info = completer,
privateWithin = ttmap1.mapOwner(odenot.privateWithin), // since this refers to outer symbols, need not include copies (from->to) in ownermap here.
- annotations = odenot.annotations.mapConserve(ttmap1.apply))
+ annotations = odenot.annotations)
+
}
+
copies
}