summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2003-08-14 18:42:38 +0000
committerMartin Odersky <odersky@gmail.com>2003-08-14 18:42:38 +0000
commitfb39bdf496902c7ea8548987bb28d03013e01c4c (patch)
treeb3092fc1b5354f8fde9e2956da4ea5270b705927
parentdf43fa3f64f2bff8321246684e731243b0fe93ea (diff)
downloadscala-fb39bdf496902c7ea8548987bb28d03013e01c4c.tar.gz
scala-fb39bdf496902c7ea8548987bb28d03013e01c4c.tar.bz2
scala-fb39bdf496902c7ea8548987bb28d03013e01c4c.zip
*** empty log message ***
-rw-r--r--sources/scalac/typechecker/Analyzer.java54
1 files changed, 28 insertions, 26 deletions
diff --git a/sources/scalac/typechecker/Analyzer.java b/sources/scalac/typechecker/Analyzer.java
index 8ee5cd2b20..86a9461f27 100644
--- a/sources/scalac/typechecker/Analyzer.java
+++ b/sources/scalac/typechecker/Analyzer.java
@@ -2119,38 +2119,40 @@ public class Analyzer extends Transformer implements Modifiers, Kinds {
// convert type to constructor
Symbol tsym = TreeInfo.methSymbol(fn1);
- assert tsym.isType() : tsym;
- Type tp = fn1.type.unalias();
- switch (tp) {
- case TypeRef(Type pre, Symbol c, Type[] argtypes):
- if (c.kind == CLASS) {
- c.initialize();
- Tree fn0 = fn1;
- fn1 = gen.mkRef(tree.pos, pre, c.allConstructors());
- if (tsym == c) {
- switch (fn0) {
- case AppliedType(_, Tree[] targs):
- fn1 = gen.TypeApply(fn1, targs);
+ if (tsym.kind != ERROR) {
+ assert tsym.isType() : tsym;
+ Type tp = fn1.type.unalias();
+ switch (tp) {
+ case TypeRef(Type pre, Symbol c, Type[] argtypes):
+ if (c.kind == CLASS) {
+ c.initialize();
+ Tree fn0 = fn1;
+ fn1 = gen.mkRef(tree.pos, pre, c.allConstructors());
+ if (tsym == c) {
+ switch (fn0) {
+ case AppliedType(_, Tree[] targs):
+ fn1 = gen.TypeApply(fn1, targs);
+ }
+ } else {
+ // it was an alias type
+ // todo: handle overloaded constructors
+ fn1 = gen.TypeApply(
+ fn1, gen.mkTypes(tree.pos, argtypes));
+ if (tsym.typeParams().length != 0 &&
+ !(fn0 instanceof AppliedType))
+ fn1.type = Type.PolyType(
+ tsym.typeParams(), fn1.type);
}
+ //System.out.println(TreeInfo.methSymbol(fn1) + ":" + tp + " --> " + fn1.type + " of " + fn1);//DEBUG
} else {
- // it was an alias type
- // todo: handle overloaded constructors
- fn1 = gen.TypeApply(
- fn1, gen.mkTypes(tree.pos, argtypes));
- if (tsym.typeParams().length != 0 &&
- !(fn0 instanceof AppliedType))
- fn1.type = Type.PolyType(
- tsym.typeParams(), fn1.type);
+ error(tree.pos,
+ tsym + " is not a class; cannot be instantiated");
}
- //System.out.println(TreeInfo.methSymbol(fn1) + ":" + tp + " --> " + fn1.type + " of " + fn1);//DEBUG
- } else {
+ break;
+ default:
error(tree.pos,
tsym + " is not a class; cannot be instantiated");
}
- break;
- default:
- error(tree.pos,
- tsym + " is not a class; cannot be instantiated");
}
}