summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/typechecker/Typers.scala
diff options
context:
space:
mode:
authorJason Zaugg <jzaugg@gmail.com>2014-01-08 12:15:04 +0100
committerJason Zaugg <jzaugg@gmail.com>2014-01-08 12:15:04 +0100
commitc91d373a78f0c503ddc635bce1974c1b58008219 (patch)
tree6684aa71ca15df39eae276c6115ee8f04a1f3497 /src/compiler/scala/tools/nsc/typechecker/Typers.scala
parent2c770ae31a71d5beece4753ce4d43265036ee477 (diff)
downloadscala-c91d373a78f0c503ddc635bce1974c1b58008219.tar.gz
scala-c91d373a78f0c503ddc635bce1974c1b58008219.tar.bz2
scala-c91d373a78f0c503ddc635bce1974c1b58008219.zip
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.
Diffstat (limited to 'src/compiler/scala/tools/nsc/typechecker/Typers.scala')
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Typers.scala11
1 files changed, 8 insertions, 3 deletions
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