diff options
Diffstat (limited to 'tests/pending/run/t6992')
-rw-r--r-- | tests/pending/run/t6992/Macros_1.scala | 75 | ||||
-rw-r--r-- | tests/pending/run/t6992/Test_2.scala | 14 |
2 files changed, 0 insertions, 89 deletions
diff --git a/tests/pending/run/t6992/Macros_1.scala b/tests/pending/run/t6992/Macros_1.scala deleted file mode 100644 index f578f2b3c..000000000 --- a/tests/pending/run/t6992/Macros_1.scala +++ /dev/null @@ -1,75 +0,0 @@ -import scala.language.experimental.macros -import scala.reflect.macros.whitebox.Context - -object Macros { - def foo(name: String): Any = macro foo_impl - def foo_impl(c: Context)(name: c.Expr[String]) = { - import c.universe._ - - val Literal(Constant(lit: String)) = name.tree - val anon = newTypeName(c.fresh) - - c.Expr(Block( - ClassDef( - Modifiers(Flag.FINAL), anon, Nil, Template( - Nil, noSelfType, List( - DefDef(Modifiers(), termNames.CONSTRUCTOR, List(), List(List()), TypeTree(), Block(List(pendingSuperCall), Literal(Constant(())))), - TypeDef(Modifiers(), TypeName(lit), Nil, TypeTree(typeOf[Int])) - ) - ) - ), - Apply(Select(New(Ident(anon)), termNames.CONSTRUCTOR), Nil) - )) - } - - def bar(name: String): Any = macro bar_impl - def bar_impl(c: Context)(name: c.Expr[String]) = { - import c.universe._ - - val Literal(Constant(lit: String)) = name.tree - val anon = newTypeName(c.fresh) - - c.Expr(Block( - ClassDef( - Modifiers(Flag.FINAL), anon, Nil, Template( - Nil, noSelfType, List( - DefDef(Modifiers(), termNames.CONSTRUCTOR, List(), List(List()), TypeTree(), Block(List(pendingSuperCall), Literal(Constant(())))), - DefDef( - Modifiers(), TermName(lit), Nil, Nil, TypeTree(), - c.literal(42).tree - ) - ) - ) - ), - Apply(Select(New(Ident(anon)), termNames.CONSTRUCTOR), Nil) - )) - } - - def baz(name: String): Any = macro baz_impl - def baz_impl(c: Context)(name: c.Expr[String]) = { - import c.universe._ - - val Literal(Constant(lit: String)) = name.tree - val anon = newTypeName(c.fresh) - val wrapper = newTypeName(c.fresh) - - c.Expr(Block( - ClassDef( - Modifiers(), anon, Nil, Template( - Nil, emptyValDef, List( - DefDef(Modifiers(), termNames.CONSTRUCTOR, List(), List(List()), TypeTree(), Block(List(pendingSuperCall), Literal(Constant(())))), - DefDef( - Modifiers(), TermName(lit), Nil, Nil, TypeTree(), - c.literal(42).tree - ) - ) - ) - ), - ClassDef( - Modifiers(Flag.FINAL), wrapper, Nil, - Template(Ident(anon) :: Nil, noSelfType, DefDef(Modifiers(), termNames.CONSTRUCTOR, List(), List(List()), TypeTree(), Block(List(pendingSuperCall), Literal(Constant(())))) :: Nil) - ), - Apply(Select(New(Ident(wrapper)), termNames.CONSTRUCTOR), Nil) - )) - } -}
\ No newline at end of file diff --git a/tests/pending/run/t6992/Test_2.scala b/tests/pending/run/t6992/Test_2.scala deleted file mode 100644 index 5d1a64eac..000000000 --- a/tests/pending/run/t6992/Test_2.scala +++ /dev/null @@ -1,14 +0,0 @@ -import scala.language.reflectiveCalls - -object Test extends dotty.runtime.LegacyApp { - val foo = Macros.foo("T") - val ttpe = scala.reflect.runtime.universe.weakTypeOf[foo.T] - println(ttpe) - println(ttpe.typeSymbol.info) - - val bar = Macros.bar("test") - println(bar.test) - - val baz = Macros.baz("test") - println(baz.test) -}
\ No newline at end of file |