summaryrefslogtreecommitdiff
path: root/sources
diff options
context:
space:
mode:
Diffstat (limited to 'sources')
-rw-r--r--sources/scalac/checkers/CheckTypes.java25
1 files changed, 24 insertions, 1 deletions
diff --git a/sources/scalac/checkers/CheckTypes.java b/sources/scalac/checkers/CheckTypes.java
index 1f22084144..fb2cb9face 100644
--- a/sources/scalac/checkers/CheckTypes.java
+++ b/sources/scalac/checkers/CheckTypes.java
@@ -19,7 +19,8 @@ import scalac.util.Debug;
/**
* Check the following properties:
* 1. all tree nodes have a type,
- * 2. TypeRefs supply the correct number of arguments.
+ * 2. TypeRefs supply the correct number of arguments,
+ * 3. type terms are represented as TypeTerm nodes.
*
* @author Michel Schinz
* @version 1.0
@@ -28,6 +29,13 @@ import scalac.util.Debug;
public class CheckTypes extends Checker {
public CheckTypes(Global global) { super(global); }
+ public void checkIsTypeTerm(Tree tree, Tree tpe) {
+ verify(tree,
+ tpe == Tree.Empty || tpe instanceof Tree.TypeTerm,
+ "no syntactic types",
+ "`tpe' part of tree is not an instance of TypeTerm");
+ }
+
public void check(Tree tree) {
verify(tree, tree.type != null, "non-null type", "type of tree is not null");
@@ -43,6 +51,21 @@ public class CheckTypes extends Checker {
+ " but is given " + args.length);
break;
}
+
+ switch (tree) {
+ case ClassDef(_, _, _, _, Tree tpe, _):
+ checkIsTypeTerm(tree, tpe); break;
+ case ModuleDef(_, _, Tree tpe, _):
+ checkIsTypeTerm(tree, tpe); break;
+ case ValDef(_, _, Tree tpe, _):
+ checkIsTypeTerm(tree, tpe); break;
+ case DefDef(_, _, _, _, Tree tpe, _):
+ checkIsTypeTerm(tree, tpe); break;
+ case Typed(_, Tree tpe):
+ checkIsTypeTerm(tree, tpe); break;
+ case Super(Tree tpe):
+ checkIsTypeTerm(tree, tpe); break;
+ }
}
}
}