summaryrefslogtreecommitdiff
path: root/test/files/pos/attachments-typed-ident/Impls_1.scala
blob: f24ea88a5d4166e0c3f53bae8edd8382f32a94be (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import scala.reflect.macros.BlackboxContext
import language.experimental.macros

object MyAttachment

object Macros {
  def impl(c: BlackboxContext) = {
    import c.universe._
    val ident = Ident(TermName("bar")) updateAttachment MyAttachment
    assert(ident.attachments.get[MyAttachment.type].isDefined, ident.attachments)
    val typed = c.typecheck(ident)
    assert(typed.attachments.get[MyAttachment.type].isDefined, typed.attachments)
    c.Expr[Int](typed)
  }

  def foo = macro impl
}