diff options
author | Eugene Burmako <xeno.by@gmail.com> | 2014-01-10 01:36:06 +0100 |
---|---|---|
committer | Eugene Burmako <xeno.by@gmail.com> | 2014-01-21 12:24:51 +0300 |
commit | 752f1eb63e931e04fd2818f32b6ca7e68e4298d2 (patch) | |
tree | 4101e34d71d3e8393d959de6fff7717d983747f7 /src/compiler/scala/tools/reflect | |
parent | 97286d761a5eaf18cc7018aa162866232a87ed91 (diff) | |
download | scala-752f1eb63e931e04fd2818f32b6ca7e68e4298d2.tar.gz scala-752f1eb63e931e04fd2818f32b6ca7e68e4298d2.tar.bz2 scala-752f1eb63e931e04fd2818f32b6ca7e68e4298d2.zip |
deprecates resetAllAttrs and resetLocalAttrs in favor of the new API
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.
Diffstat (limited to 'src/compiler/scala/tools/reflect')
-rw-r--r-- | src/compiler/scala/tools/reflect/ToolBox.scala | 15 | ||||
-rw-r--r-- | src/compiler/scala/tools/reflect/ToolBoxFactory.scala | 2 |
2 files changed, 11 insertions, 6 deletions
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) |