diff options
author | schinz <schinz@epfl.ch> | 2003-03-12 14:19:30 +0000 |
---|---|---|
committer | schinz <schinz@epfl.ch> | 2003-03-12 14:19:30 +0000 |
commit | 2142b86eceb2ed291610f2138ff0b3c8fbcda692 (patch) | |
tree | 00270dd08723429cbfd12ddc5dd697cd50b67962 /sources | |
parent | 7254471b0b3aeadb35df99b61f5a00e18abc00ae (diff) | |
download | scala-2142b86eceb2ed291610f2138ff0b3c8fbcda692.tar.gz scala-2142b86eceb2ed291610f2138ff0b3c8fbcda692.tar.bz2 scala-2142b86eceb2ed291610f2138ff0b3c8fbcda692.zip |
- check that no syntactic representation of typ...
- check that no syntactic representation of types remain in the tree
(since all syntactic types have to be replaced by TypeTerm after
analysis)
Diffstat (limited to 'sources')
-rw-r--r-- | sources/scalac/checkers/CheckTypes.java | 25 |
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; + } } } } |