summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEugene Burmako <xeno.by@gmail.com>2012-12-13 02:20:47 +0100
committerEugene Burmako <xeno.by@gmail.com>2012-12-13 10:48:22 +0100
commit098e8a084adbebca1f2e57e1aacbf6d9a3a87e7d (patch)
tree45d9b5fa5d768402e7eb51ae6a755dea2cb89e6f /src
parenta6f10cf7f4245f2dfcf2fef5fab5255b6fca119f (diff)
downloadscala-098e8a084adbebca1f2e57e1aacbf6d9a3a87e7d.tar.gz
scala-098e8a084adbebca1f2e57e1aacbf6d9a3a87e7d.tar.bz2
scala-098e8a084adbebca1f2e57e1aacbf6d9a3a87e7d.zip
typedIdent no longer destroys attachments
When transforming Idents to qualified Selects, typedIdent used to forget about carrying original attachments to the resulting tree. Not anymore.
Diffstat (limited to 'src')
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Typers.scala2
-rw-r--r--src/reflect/scala/reflect/internal/StdAttachments.scala1
2 files changed, 2 insertions, 1 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
index 76fd07f63a..8441d450a6 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
@@ -5159,7 +5159,7 @@ trait Typers extends Modes with Adaptations with Tags {
val tree1 = (
if (qual == EmptyTree) tree
// atPos necessary because qualifier might come from startContext
- else atPos(tree.pos)(Select(qual, name))
+ else atPos(tree.pos)(Select(qual, name) setAttachments tree.attachments)
)
val (tree2, pre2) = makeAccessible(tree1, defSym, pre, qual)
// assert(pre.typeArgs isEmpty) // no need to add #2416-style check here, right?
diff --git a/src/reflect/scala/reflect/internal/StdAttachments.scala b/src/reflect/scala/reflect/internal/StdAttachments.scala
index 1df91a67b0..b782353ed3 100644
--- a/src/reflect/scala/reflect/internal/StdAttachments.scala
+++ b/src/reflect/scala/reflect/internal/StdAttachments.scala
@@ -10,6 +10,7 @@ trait StdAttachments {
trait Attachable {
protected var rawatt: scala.reflect.macros.Attachments { type Pos = Position } = NoPosition
def attachments = rawatt
+ def setAttachments(attachments: scala.reflect.macros.Attachments { type Pos = Position }): this.type = { rawatt = attachments; this }
def updateAttachment[T: ClassTag](attachment: T): this.type = { rawatt = rawatt.update(attachment); this }
def removeAttachment[T: ClassTag]: this.type = { rawatt = rawatt.remove[T]; this }