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

object MyAttachment

object Macros {
  def impl(c: Context) = {
    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
}