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




                                   
                          
                       
                                                                    
                                                                                 
                                  





                                                                                 
import scala.reflect.macros.blackbox.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
}