diff options
author | odersky <odersky@gmail.com> | 2016-12-20 17:18:30 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-12-20 17:18:30 +0100 |
commit | 098c50ac83eb4d18b23a1ed888cf601053c46ae6 (patch) | |
tree | d5c45fd83ebccf3c8dc923e41e695723a3c04a1a /compiler/src/dotty/tools/dotc/core/Symbols.scala | |
parent | afa83099a2300fcd09afe6514f9112c75f9fb4dc (diff) | |
parent | a7d17e286760879a35dfaeeadca1dbad2aa85dfc (diff) | |
download | dotty-098c50ac83eb4d18b23a1ed888cf601053c46ae6.tar.gz dotty-098c50ac83eb4d18b23a1ed888cf601053c46ae6.tar.bz2 dotty-098c50ac83eb4d18b23a1ed888cf601053c46ae6.zip |
Merge pull request #1832 from dotty-staging/fix-1810
Fix #1812, Symbols.mapSymbols shouldn't replace denotations
Diffstat (limited to 'compiler/src/dotty/tools/dotc/core/Symbols.scala')
-rw-r--r-- | compiler/src/dotty/tools/dotc/core/Symbols.scala | 24 |
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 } |