From 752f1eb63e931e04fd2818f32b6ca7e68e4298d2 Mon Sep 17 00:00:00 2001 From: Eugene Burmako Date: Fri, 10 Jan 2014 01:36:06 +0100 Subject: deprecates resetAllAttrs and resetLocalAttrs in favor of the new API MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We now have c.untypecheck, which is supposed to be a counterpart of c.typecheck in the sense that it goes back from typed trees to untyped ones: http://stackoverflow.com/questions/20936509/scala-macros-what-is-the-difference-between-typed-aka-typechecked-an-untyped. Let’s hope that c.untypecheck will soon be able to solve our problems with partially/incorrectly attributed trees emitted by macros: https://groups.google.com/forum/#!topic/scala-internals/TtCTPlj_qcQ. --- src/compiler/scala/tools/reflect/ToolBox.scala | 15 +++++++++------ src/compiler/scala/tools/reflect/ToolBoxFactory.scala | 2 ++ 2 files changed, 11 insertions(+), 6 deletions(-) (limited to 'src/compiler/scala/tools/reflect') diff --git a/src/compiler/scala/tools/reflect/ToolBox.scala b/src/compiler/scala/tools/reflect/ToolBox.scala index 236b868842..4c1bc794bc 100644 --- a/src/compiler/scala/tools/reflect/ToolBox.scala +++ b/src/compiler/scala/tools/reflect/ToolBox.scala @@ -72,19 +72,22 @@ trait ToolBox[U <: scala.reflect.api.Universe] { def inferImplicitView(tree: u.Tree, from: u.Type, to: u.Type, silent: Boolean = true, withMacrosDisabled: Boolean = false, pos: u.Position = u.NoPosition): u.Tree /** Recursively resets symbols and types in a given tree. - * - * Note that this does not revert the tree to its pre-typer shape. - * For more info, read up https://issues.scala-lang.org/browse/SI-5464. + * WARNING: Don't use this API, go for [[untypecheck]] instead. */ + @deprecated("Use `tb.untypecheck` instead", "2.11.0") def resetAllAttrs(tree: u.Tree): u.Tree /** Recursively resets locally defined symbols and types in a given tree. - * - * Note that this does not revert the tree to its pre-typer shape. - * For more info, read up https://issues.scala-lang.org/browse/SI-5464. + * WARNING: Don't use this API, go for [[untypecheck]] instead. */ + @deprecated("Use `tb.untypecheck` instead", "2.11.0") def resetLocalAttrs(tree: u.Tree): u.Tree + /** + * @see [[scala.reflect.macros.Typers.untypecheck]] + */ + def untypecheck(tree: u.Tree): u.Tree + /** .. */ def parse(code: String): u.Tree diff --git a/src/compiler/scala/tools/reflect/ToolBoxFactory.scala b/src/compiler/scala/tools/reflect/ToolBoxFactory.scala index af13b7d0ba..4a8c91bd1b 100644 --- a/src/compiler/scala/tools/reflect/ToolBoxFactory.scala +++ b/src/compiler/scala/tools/reflect/ToolBoxFactory.scala @@ -401,6 +401,8 @@ abstract class ToolBoxFactory[U <: JavaUniverse](val u: U) { factorySelf => uttree } + def untypecheck(tree: u.Tree): u.Tree = resetLocalAttrs(tree) + def parse(code: String): u.Tree = withCompilerApi { compilerApi => import compilerApi._ if (compiler.settings.verbose) println("parsing "+code) -- cgit v1.2.3