summaryrefslogtreecommitdiff
path: root/src/compiler
diff options
context:
space:
mode:
authorEugene Burmako <xeno.by@gmail.com>2014-01-21 04:25:44 -0800
committerEugene Burmako <xeno.by@gmail.com>2014-01-21 04:25:44 -0800
commita242101282ba986c4e336b759aaa08a32ca82a7b (patch)
tree6ac44b5195cda51f3a2e54e89c0aa250714797b1 /src/compiler
parent26387cacaa8f78105419044fc33acc8fd8343662 (diff)
parent752f1eb63e931e04fd2818f32b6ca7e68e4298d2 (diff)
downloadscala-a242101282ba986c4e336b759aaa08a32ca82a7b.tar.gz
scala-a242101282ba986c4e336b759aaa08a32ca82a7b.tar.bz2
scala-a242101282ba986c4e336b759aaa08a32ca82a7b.zip
Merge pull request #3392 from xeno-by/topic/untypecheck
deprecates resetAllAttrs and resetLocalAttrs in favor of the new API
Diffstat (limited to 'src/compiler')
-rw-r--r--src/compiler/scala/reflect/macros/contexts/Typers.scala2
-rw-r--r--src/compiler/scala/tools/nsc/ast/TreeBrowsers.scala2
-rw-r--r--src/compiler/scala/tools/nsc/ast/TreeGen.scala2
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Contexts.scala5
-rw-r--r--src/compiler/scala/tools/reflect/ToolBox.scala15
-rw-r--r--src/compiler/scala/tools/reflect/ToolBoxFactory.scala2
6 files changed, 17 insertions, 11 deletions
diff --git a/src/compiler/scala/reflect/macros/contexts/Typers.scala b/src/compiler/scala/reflect/macros/contexts/Typers.scala
index 85204d0f1b..cd3db74016 100644
--- a/src/compiler/scala/reflect/macros/contexts/Typers.scala
+++ b/src/compiler/scala/reflect/macros/contexts/Typers.scala
@@ -49,4 +49,6 @@ trait Typers {
def resetAllAttrs(tree: Tree): Tree = universe.resetAllAttrs(universe.duplicateAndKeepPositions(tree))
def resetLocalAttrs(tree: Tree): Tree = universe.resetLocalAttrs(universe.duplicateAndKeepPositions(tree))
+
+ def untypecheck(tree: Tree): Tree = universe.resetLocalAttrs(universe.duplicateAndKeepPositions(tree))
}
diff --git a/src/compiler/scala/tools/nsc/ast/TreeBrowsers.scala b/src/compiler/scala/tools/nsc/ast/TreeBrowsers.scala
index 429832f22c..eafecf9462 100644
--- a/src/compiler/scala/tools/nsc/ast/TreeBrowsers.scala
+++ b/src/compiler/scala/tools/nsc/ast/TreeBrowsers.scala
@@ -632,7 +632,7 @@ abstract class TreeBrowsers {
Document.group("(" :/: symsToDocument(tparams) :/: "), ") :/:
toDocument(result) :: ")"))
- case global.analyzer.ImportType(expr) =>
+ case ImportType(expr) =>
"ImportType(" + expr.toString + ")"
diff --git a/src/compiler/scala/tools/nsc/ast/TreeGen.scala b/src/compiler/scala/tools/nsc/ast/TreeGen.scala
index 4ac6672727..a87a04472a 100644
--- a/src/compiler/scala/tools/nsc/ast/TreeGen.scala
+++ b/src/compiler/scala/tools/nsc/ast/TreeGen.scala
@@ -37,7 +37,7 @@ abstract class TreeGen extends scala.reflect.internal.TreeGen with TreeDSL {
NoSymbol
newImport NoPosition
setFlag SYNTHETIC
- setInfo analyzer.ImportType(qual)
+ setInfo ImportType(qual)
)
val importTree = (
Import(qual, selector)
diff --git a/src/compiler/scala/tools/nsc/typechecker/Contexts.scala b/src/compiler/scala/tools/nsc/typechecker/Contexts.scala
index 53bc9a2772..598b12b00d 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Contexts.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Contexts.scala
@@ -1353,9 +1353,8 @@ trait Contexts { self: Analyzer =>
override def toString = tree.toString
}
- case class ImportType(expr: Tree) extends Type {
- override def safeToString = "ImportType("+expr+")"
- }
+ type ImportType = global.ImportType
+ val ImportType = global.ImportType
}
object ContextMode {
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)