summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorVlad Ureche <vlad.ureche@gmail.com>2015-08-23 14:51:39 +0200
committerVlad Ureche <vlad.ureche@gmail.com>2015-08-24 12:58:19 +0200
commit9d73937bb30c84a258ec523259353cbdb272cb2a (patch)
tree750df3b5d1cd6b726f8a9ea32680922a4b99ff62 /src
parent79171ce68e4cb6953faba31770ec77ccc23c76a9 (diff)
downloadscala-9d73937bb30c84a258ec523259353cbdb272cb2a.tar.gz
scala-9d73937bb30c84a258ec523259353cbdb272cb2a.tar.bz2
scala-9d73937bb30c84a258ec523259353cbdb272cb2a.zip
Re-enable tree checkers
My expectation is that tree checkers are re-typechecking the trees and making sure they are consistent. Unfortunately, following patch aced32d05c97651534f468bc9a475ea5f6ae75b8, the call to clearType() was removed, thus the typer no longer recursed inside the trees, rendering the type checkers framework useless. This is an attempt to make the tree checkers run again, by resetting the type of a tree before the call to super.typed, thus allowing the typer to actually visit the entire tree (not just the outer package definition). The work was prompted by SI-9442, where the type checkers would gladly allow validate the inconsistent trees.
Diffstat (limited to 'src')
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/TreeCheckers.scala9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/TreeCheckers.scala b/src/compiler/scala/tools/nsc/typechecker/TreeCheckers.scala
index a7d48ceb89..e8db8309f1 100644
--- a/src/compiler/scala/tools/nsc/typechecker/TreeCheckers.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/TreeCheckers.scala
@@ -262,7 +262,14 @@ abstract class TreeCheckers extends Analyzer {
checkedTyped(tree, mode, pt)
)
private def checkedTyped(tree: Tree, mode: Mode, pt: Type): Tree = {
- val typed = wrap(tree)(super.typed(tree, mode, pt))
+ val typed = wrap(tree)(super.typed(tree.clearType(), mode, pt))
+
+ // Vlad: super.typed returns null for package defs, why is that?
+ if (typed eq null)
+ return tree
+
+ if (typed.tpe ne null)
+ assert(!typed.tpe.isErroneous, "Tree has erroneous type: " + typed)
if (tree ne typed)
treesDiffer(tree, typed)