diff options
author | Paul Phillips <paulp@improving.org> | 2013-01-29 11:23:59 -0800 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2013-01-29 13:10:48 -0800 |
commit | 5c00f4137fbc02a6bfcb3eb52d225e26b4373615 (patch) | |
tree | fb0fb1c54e213016d8f4bf1fe8b6fd1770ff4760 /src/reflect | |
parent | f389f6a18f5812a08f324222432ba45a5b15aa18 (diff) | |
parent | d392d56d6bf8b0ae9072b354e4ec68becd0df679 (diff) | |
download | scala-5c00f4137fbc02a6bfcb3eb52d225e26b4373615.tar.gz scala-5c00f4137fbc02a6bfcb3eb52d225e26b4373615.tar.bz2 scala-5c00f4137fbc02a6bfcb3eb52d225e26b4373615.zip |
Merge remote-tracking branch 'origin/2.10.x' into pr/merge-210
* commit 'd392d56d6bf8b0ae9072b354e4ec68becd0df679':
SI-4602 Disable unreliable test of fsc path absolutization
Update a checkfile from a recent fix.
SI-7018 Fix memory leak in Attachments.
SI-4733 - fsc no longer creates a single temp directory for all users.
Bumped partest MaxPermSize to 128m.
SI-6891 Fix value class + tailrec crasher.
Ill-scoped reference checking in TreeCheckers
Make value classes TreeCheckers friendly
SI-4602 Make fsc absolutize source file names
SI-6863 Fix verify error in captured var inited from expr with try/catch
SI-6932 Remove Batchable trait plus minor clean-ups
Fix SI-6932 by enabling linearization of callback execution for the internal execution context of Future
SI-6443 Expand test coverage with varargs, by-name.
SI-6443 Widen dependent param types in uncurry
Conflicts:
src/reflect/scala/reflect/internal/Trees.scala
test/partest
Diffstat (limited to 'src/reflect')
-rw-r--r-- | src/reflect/scala/reflect/internal/Symbols.scala | 2 | ||||
-rw-r--r-- | src/reflect/scala/reflect/internal/Trees.scala | 24 | ||||
-rw-r--r-- | src/reflect/scala/reflect/macros/Attachments.scala | 14 |
3 files changed, 34 insertions, 6 deletions
diff --git a/src/reflect/scala/reflect/internal/Symbols.scala b/src/reflect/scala/reflect/internal/Symbols.scala index 0969d9e3fa..745a665062 100644 --- a/src/reflect/scala/reflect/internal/Symbols.scala +++ b/src/reflect/scala/reflect/internal/Symbols.scala @@ -1690,6 +1690,8 @@ trait Symbols extends api.Symbols { self: SymbolTable => @inline final def map(f: Symbol => Symbol): Symbol = if (this eq NoSymbol) this else f(this) + final def toOption: Option[Symbol] = if (exists) Some(this) else None + // ------ cloneing ------------------------------------------------------------------- /** A clone of this symbol. */ diff --git a/src/reflect/scala/reflect/internal/Trees.scala b/src/reflect/scala/reflect/internal/Trees.scala index 3c2249bfb5..9b185c1c2d 100644 --- a/src/reflect/scala/reflect/internal/Trees.scala +++ b/src/reflect/scala/reflect/internal/Trees.scala @@ -1469,6 +1469,22 @@ trait Trees extends api.Trees { self: SymbolTable => if (tree.hasSymbolField) { subst(from, to) tree match { + case _: DefTree => + val newInfo = symSubst(tree.symbol.info) + if (!(newInfo =:= tree.symbol.info)) { + debuglog(sm""" + |TreeSymSubstituter: updated info of symbol ${tree.symbol} + | Old: ${showRaw(tree.symbol.info, printTypes = true, printIds = true)} + | New: ${showRaw(newInfo, printTypes = true, printIds = true)}""") + tree.symbol updateInfo newInfo + } + case _ => + // no special handling is required for Function or Import nodes here. + // as they don't have interesting infos attached to their symbols. + // Subsitution of the referenced symbol of Return nodes is handled + // in .ChangeOwnerTraverser + } + tree match { case Ident(name0) if tree.symbol != NoSymbol => treeCopy.Ident(tree, tree.symbol.name) case Select(qual, name0) if tree.symbol != NoSymbol => @@ -1526,6 +1542,14 @@ trait Trees extends api.Trees { self: SymbolTable => t1 } } + trait TreeStackTraverser extends Traverser { + import collection.mutable + val path: mutable.Stack[Tree] = mutable.Stack() + abstract override def traverse(t: Tree) = { + path push t + try super.traverse(t) finally path.pop() + } + } def duplicateAndKeepPositions(tree: Tree) = new Duplicator(focusPositions = false) transform tree diff --git a/src/reflect/scala/reflect/macros/Attachments.scala b/src/reflect/scala/reflect/macros/Attachments.scala index a77cebf415..eeb87fafcc 100644 --- a/src/reflect/scala/reflect/macros/Attachments.scala +++ b/src/reflect/scala/reflect/macros/Attachments.scala @@ -44,17 +44,19 @@ abstract class Attachments { self => * Replaces an existing payload of the same type, if exists. */ def update[T: ClassTag](attachment: T): Attachments { type Pos = self.Pos } = - new NonemptyAttachments(this.pos, remove[T].all + attachment) + new NonemptyAttachments[Pos](this.pos, remove[T].all + attachment) /** Creates a copy of this attachment with the payload of the given class type `T` removed. */ def remove[T: ClassTag]: Attachments { type Pos = self.Pos } = { val newAll = all filterNot matchesTag[T] if (newAll.isEmpty) pos.asInstanceOf[Attachments { type Pos = self.Pos }] - else new NonemptyAttachments(this.pos, newAll) + else new NonemptyAttachments[Pos](this.pos, newAll) } +} - private class NonemptyAttachments(override val pos: Pos, override val all: Set[Any]) extends Attachments { - type Pos = self.Pos - def withPos(newPos: Pos) = new NonemptyAttachments(newPos, all) - } +// SI-7018: This used to be an inner class of `Attachments`, but that led to a memory leak in the +// IDE via $outer pointers. +private final class NonemptyAttachments[P >: Null](override val pos: P, override val all: Set[Any]) extends Attachments { + type Pos = P + def withPos(newPos: Pos) = new NonemptyAttachments(newPos, all) } |