diff options
author | Jason Zaugg <jzaugg@gmail.com> | 2013-09-04 07:14:27 -0700 |
---|---|---|
committer | Jason Zaugg <jzaugg@gmail.com> | 2013-09-04 07:14:27 -0700 |
commit | d46519da657ada39d9928308709cdb80ddcd53ce (patch) | |
tree | 22f9f9144842107a264b0d0bb33f3d74d8530c85 /test/files | |
parent | 068b9a36cb651fea9782f8e1c46d64a81d0f369a (diff) | |
parent | 9772ec8b2f15fd8c2971413d90006beb8bf0d2b7 (diff) | |
download | scala-d46519da657ada39d9928308709cdb80ddcd53ce.tar.gz scala-d46519da657ada39d9928308709cdb80ddcd53ce.tar.bz2 scala-d46519da657ada39d9928308709cdb80ddcd53ce.zip |
Merge pull request #2888 from xeno-by/topic/typed-annotated
typedAnnotated no longer emits nulls
Diffstat (limited to 'test/files')
-rw-r--r-- | test/files/run/typed-annotated.check | 1 | ||||
-rw-r--r-- | test/files/run/typed-annotated/Macros_1.scala | 17 | ||||
-rw-r--r-- | test/files/run/typed-annotated/Test_2.scala | 3 |
3 files changed, 21 insertions, 0 deletions
diff --git a/test/files/run/typed-annotated.check b/test/files/run/typed-annotated.check new file mode 100644 index 0000000000..d81cc0710e --- /dev/null +++ b/test/files/run/typed-annotated.check @@ -0,0 +1 @@ +42 diff --git a/test/files/run/typed-annotated/Macros_1.scala b/test/files/run/typed-annotated/Macros_1.scala new file mode 100644 index 0000000000..dd18c63d90 --- /dev/null +++ b/test/files/run/typed-annotated/Macros_1.scala @@ -0,0 +1,17 @@ +import scala.reflect.macros.Context +import language.experimental.macros + +class ann extends scala.annotation.StaticAnnotation + +object Macros { + def impl(c: Context) = { + import c.universe._ + // val tpt = Annotated(Apply(Select(New(Ident(newTypeName("ann"))), nme.CONSTRUCTOR), List()), Ident(newTypeName("Int"))) + val tpt = Annotated(Apply(Select(New(Ident(newTypeName("ann"))), nme.CONSTRUCTOR), List()), TypeTree(weakTypeOf[Int])) + c.Expr[Unit](Block( + List(ValDef(Modifiers(), newTermName("x"), tpt, Literal(Constant(42)))), + Apply(Ident(newTermName("println")), List(Ident(newTermName("x")))))) + } + + def foo = macro impl +}
\ No newline at end of file diff --git a/test/files/run/typed-annotated/Test_2.scala b/test/files/run/typed-annotated/Test_2.scala new file mode 100644 index 0000000000..acfddae942 --- /dev/null +++ b/test/files/run/typed-annotated/Test_2.scala @@ -0,0 +1,3 @@ +object Test extends App { + Macros.foo +}
\ No newline at end of file |