diff options
author | schinz <schinz@epfl.ch> | 2003-03-06 12:20:29 +0000 |
---|---|---|
committer | schinz <schinz@epfl.ch> | 2003-03-06 12:20:29 +0000 |
commit | 675b4262a252c8889a410f514d9edd562774bc34 (patch) | |
tree | 78845e65d22f9fec3db9d04caff873fab276b86d /sources/scalac/checkers | |
parent | 37666f93772287c867bf58362db77fa0cb99b7d1 (diff) | |
download | scala-675b4262a252c8889a410f514d9edd562774bc34.tar.gz scala-675b4262a252c8889a410f514d9edd562774bc34.tar.bz2 scala-675b4262a252c8889a410f514d9edd562774bc34.zip |
- check that TypeRefs are applied with enough a...
- check that TypeRefs are applied with enough arguments
Diffstat (limited to 'sources/scalac/checkers')
-rw-r--r-- | sources/scalac/checkers/CheckTypes.java | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/sources/scalac/checkers/CheckTypes.java b/sources/scalac/checkers/CheckTypes.java index cfe2bd656d..1f22084144 100644 --- a/sources/scalac/checkers/CheckTypes.java +++ b/sources/scalac/checkers/CheckTypes.java @@ -11,11 +11,15 @@ package scalac.checkers; import scalac.ast.Tree; import scalac.util.Name; import scalac.symtab.Type; +import scalac.symtab.Symbol; +import scalac.symtab.Kinds; import scalac.Global; import scalac.util.Debug; /** - * Check that all tree nodes have a type. + * Check the following properties: + * 1. all tree nodes have a type, + * 2. TypeRefs supply the correct number of arguments. * * @author Michel Schinz * @version 1.0 @@ -26,5 +30,19 @@ public class CheckTypes extends Checker { public void check(Tree tree) { verify(tree, tree.type != null, "non-null type", "type of tree is not null"); + + if (tree.type != null) { + switch (tree.type) { + case TypeRef(Type pre, Symbol sym, Type[] args): + if (sym.kind == Kinds.CLASS) + verify(tree, + sym.typeParams().length == args.length, + "enough arguments for TypeRefs", + "Type " + Debug.show(sym) + + " expects " + sym.typeParams().length + " type arguments" + + " but is given " + args.length); + break; + } + } } } |