From 348c8fac9f897f9661f84e32949b8a4e0c99e93a Mon Sep 17 00:00:00 2001 From: Eugene Burmako Date: Tue, 25 Dec 2012 02:37:31 +0100 Subject: adds c.introduceTopLevel The first in the family of mutators for the global symbol table, `introduceTopLevel` is capable of creating synthetic top-level classes and modules. The addition of nme.EMPTY_PACKAGE_NAME is necessary to let programmers insert definitions into the empty package. That's explicitly discouraged in the docs, but at times might come in handy. This patch introduce workarounds to avoid incompatibilities with SBT. First of all SBT doesn't like VirtualFiles having JFile set to null. Secondly SBT gets confused when someone depends on synthetic files added by c.introduceTopLevel. Strictly speaking these problems require changes to SBT, and that will be done later. However the main target of the patch is paradise/macros, which needs to be useful immediately, therefore we apply workarounds. --- test/files/pos/annotated-treecopy/Impls_Macros_1.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test/files/pos/annotated-treecopy') diff --git a/test/files/pos/annotated-treecopy/Impls_Macros_1.scala b/test/files/pos/annotated-treecopy/Impls_Macros_1.scala index d92fbca380..cf58bc3dfd 100644 --- a/test/files/pos/annotated-treecopy/Impls_Macros_1.scala +++ b/test/files/pos/annotated-treecopy/Impls_Macros_1.scala @@ -21,7 +21,7 @@ object Macros { // normalize argument name var b1 = new Transformer { override def transform(tree: Tree): Tree = tree match { - case Ident(x) if (x==n) => Ident(newTermName("_arg")) + case Ident(x) if (x==n) => Ident(TermName("_arg")) case tt @ TypeTree() if tt.original != null => TypeTree(tt.tpe) setOriginal transform(tt.original) // without the fix to LazyTreeCopier.Annotated, we would need to uncomment the line below to make the macro work // that's because the pattern match in the input expression gets expanded into Typed(, TypeTree()) -- cgit v1.2.3