diff options
author | Eugene Burmako <xeno.by@gmail.com> | 2012-09-14 15:23:51 +0200 |
---|---|---|
committer | Eugene Burmako <xeno.by@gmail.com> | 2012-09-15 00:55:27 +0200 |
commit | 210f8c8f108aaf650a5be640c4db0d2336193f33 (patch) | |
tree | 6939dd3043ff7dd2af840e9d8a66b2e612c6d78d /src/reflect/scala/reflect/internal/StdAttachments.scala | |
parent | ed913c2963c472440b06a3a4cfa3d2853cea21d4 (diff) | |
download | scala-210f8c8f108aaf650a5be640c4db0d2336193f33.tar.gz scala-210f8c8f108aaf650a5be640c4db0d2336193f33.tar.bz2 scala-210f8c8f108aaf650a5be640c4db0d2336193f33.zip |
SI-6372 cleans up the API of Attachments
Previously Attachments allowed multiple attachments that
correspond to the same attachment type.
This created a potential for confusion, given that Attachments.get
only searched for the first attachment of a given type.
Hence I made Attachments.add overwrite previously existing attachments
of a given type and renamed it to Attachments.update, so that the name
suits the intention better.
Diffstat (limited to 'src/reflect/scala/reflect/internal/StdAttachments.scala')
-rw-r--r-- | src/reflect/scala/reflect/internal/StdAttachments.scala | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/reflect/scala/reflect/internal/StdAttachments.scala b/src/reflect/scala/reflect/internal/StdAttachments.scala index 60b3a6f436..5f6a3bf777 100644 --- a/src/reflect/scala/reflect/internal/StdAttachments.scala +++ b/src/reflect/scala/reflect/internal/StdAttachments.scala @@ -10,7 +10,7 @@ trait StdAttachments { trait Attachable { protected var rawatt: base.Attachments { type Pos = Position } = NoPosition def attachments = rawatt - def addAttachment(attachment: Any): this.type = { rawatt = rawatt.add(attachment); 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 } // cannot be final due to SynchronizedSymbols |