From c91d373a78f0c503ddc635bce1974c1b58008219 Mon Sep 17 00:00:00 2001 From: Jason Zaugg Date: Wed, 8 Jan 2014 12:15:04 +0100 Subject: SI-8111 Expand the comment with a more detailed TODO As everone knows, undo/reset/retype/rollback are bandaids; we should try to treat the disease more directly. --- src/compiler/scala/tools/nsc/typechecker/Typers.scala | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala index 5092fdd68f..e09a509839 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala @@ -3275,9 +3275,14 @@ trait Typers extends Modes with Adaptations with Tags { // are transplanted underneath synthetic temporary vals. // // Here, we keep track of the symbols owned by `context.owner` to enable us to - // rollback. Note that duplicating trees would not be enough to fix this problem, - // we would also need to clone local symbols in the duplicated tree to truly isolate - // things. + // rollback, so that we don't end up with "orphaned" symbols. + // + // TODO: Find a better way! + // + // Note that duplicating trees would not be enough to fix this problem, we would also need to + // clone local symbols in the duplicated tree to truly isolate things (in the spirit of BodyDuplicator), + // or, better yet, disentangle the logic in `transformNamedApplication` so that we could + // determine whether names/defaults is viable *before* transforming trees. def ownerOf(sym: Symbol) = if (sym == null || sym == NoSymbol) NoSymbol else sym.owner val symsOwnedByContextOwner = tree.collect { case t @ (_: DefTree | _: Function) if ownerOf(t.symbol) == context.owner => t.symbol -- cgit v1.2.3