summaryrefslogblamecommitdiff
path: root/test/files/pos/attachments-typed-ident/Impls_1.scala
blob: 11d0f6584482f0c898fcc18427d4fdd8d68fe0f0 (plain) (tree)
1
2
3
4
5
6
7
8
9
                                           




                                   
                                  
                       
                                                                    







                                                                                 
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
}