Skip to content
Browse files

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.
  • Loading branch information...
1 parent 2c770ae commit c91d373a78f0c503ddc635bce1974c1b58008219 @retronym retronym committed Jan 8, 2014
Showing with 8 additions and 3 deletions.
  1. +8 −3 src/compiler/scala/tools/nsc/typechecker/Typers.scala
View
11 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

0 comments on commit c91d373

Please sign in to comment.
Something went wrong with that request. Please try again.