summaryrefslogtreecommitdiff
path: root/src/reflect/scala/reflect/macros
diff options
context:
space:
mode:
authorEugene Burmako <xeno.by@gmail.com>2014-06-28 19:12:48 +0200
committerEugene Burmako <xeno.by@gmail.com>2014-07-10 11:49:09 +0300
commit70afd0544e86456515caee62a3eaac41882d892f (patch)
tree25b2bde31186a95202e94d57769c515c976f89f2 /src/reflect/scala/reflect/macros
parentfbfce33cb03bc2b41dd0f46fa9f4630036b4f2ca (diff)
downloadscala-70afd0544e86456515caee62a3eaac41882d892f.tar.gz
scala-70afd0544e86456515caee62a3eaac41882d892f.tar.bz2
scala-70afd0544e86456515caee62a3eaac41882d892f.zip
relaxes attachment-matching rules
It came as a surprise recently, but attachments.contains/get/update/remove require the class of the payload to match the provided tag exactly, not taking subclassing into account. This commit fixes the oversight.
Diffstat (limited to 'src/reflect/scala/reflect/macros')
-rw-r--r--src/reflect/scala/reflect/macros/Attachments.scala2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/reflect/scala/reflect/macros/Attachments.scala b/src/reflect/scala/reflect/macros/Attachments.scala
index 5ccdc15a03..b5c340645a 100644
--- a/src/reflect/scala/reflect/macros/Attachments.scala
+++ b/src/reflect/scala/reflect/macros/Attachments.scala
@@ -35,7 +35,7 @@ abstract class Attachments { self =>
def all: Set[Any] = Set.empty
private def matchesTag[T: ClassTag](datum: Any) =
- classTag[T].runtimeClass == datum.getClass
+ classTag[T].runtimeClass.isInstance(datum)
/** An underlying payload of the given class type `T`. */
def get[T: ClassTag]: Option[T] =