diff options
author | Dmitry Petrashko <dmitry.petrashko@gmail.com> | 2015-04-27 19:01:00 +0200 |
---|---|---|
committer | Dmitry Petrashko <dmitry.petrashko@gmail.com> | 2015-04-30 14:26:08 +0200 |
commit | f322c989c6e7919662a151421cb96c96eefe5251 (patch) | |
tree | a86f8e6f3a9abf680e7bca869e726e9c05306756 | |
parent | d75d8721bc86ae99c487228fa9d6175098c19197 (diff) | |
download | dotty-f322c989c6e7919662a151421cb96c96eefe5251.tar.gz dotty-f322c989c6e7919662a151421cb96c96eefe5251.tar.bz2 dotty-f322c989c6e7919662a151421cb96c96eefe5251.zip |
LazyValues: minor post-erasure changes.
-rw-r--r-- | src/dotty/tools/dotc/transform/LazyVals.scala | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/dotty/tools/dotc/transform/LazyVals.scala b/src/dotty/tools/dotc/transform/LazyVals.scala index 1afee6b0e..9972efc90 100644 --- a/src/dotty/tools/dotc/transform/LazyVals.scala +++ b/src/dotty/tools/dotc/transform/LazyVals.scala @@ -68,7 +68,8 @@ class LazyVals extends MiniPhaseTransform with IdentityDenotTransformer { case None => tree case Some(data) => val template = tree.rhs.asInstanceOf[Template] - ClassDef(tree.symbol.asClass, template.constr, data.defs.mapConserve(transformFollowingDeep) ::: template.body) + val newTemplate = cpy.Template(template)(body = data.defs ::: template.body) + cpy.TypeDef(tree)(rhs = newTemplate) //(ctx.withMode(Mode.FutureDefsOK)) } } } @@ -168,7 +169,7 @@ class LazyVals extends MiniPhaseTransform with IdentityDenotTransformer { val containerSymbol = ctx.newSymbol(claz, containerName, (x.mods &~ containerFlagsMask | containerFlags).flags, tpe, coord = x.symbol.coord).enteredAfter(this) val containerTree = ValDef(containerSymbol, initValue(tpe)) - if (x.tpe.isNotNull && tpe <:< defn.AnyRefType) { // can use 'null' value instead of flag + if (x.tpe.isNotNull && tpe <:< defn.ObjectType) { // can use 'null' value instead of flag val slowPath = DefDef(x.symbol.asTerm, mkDefNonThreadSafeNonNullable(containerSymbol, x.rhs)) Thicket(List(containerTree, slowPath)) } |