summaryrefslogtreecommitdiff
path: root/sources/scalac/symtab/Type.java
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2003-07-31 09:57:59 +0000
committerMartin Odersky <odersky@gmail.com>2003-07-31 09:57:59 +0000
commit03449ed20a3cca9e8d974c7efeff6b4e01ecb66d (patch)
treedb1153ac4bffac098d6d6d053f727992f1a2e4da /sources/scalac/symtab/Type.java
parentbe21ca1267f48e8fd14d5e32f3c7a4d814005eef (diff)
downloadscala-03449ed20a3cca9e8d974c7efeff6b4e01ecb66d.tar.gz
scala-03449ed20a3cca9e8d974c7efeff6b4e01ecb66d.tar.bz2
scala-03449ed20a3cca9e8d974c7efeff6b4e01ecb66d.zip
*** empty log message ***
Diffstat (limited to 'sources/scalac/symtab/Type.java')
-rw-r--r--sources/scalac/symtab/Type.java21
1 files changed, 17 insertions, 4 deletions
diff --git a/sources/scalac/symtab/Type.java b/sources/scalac/symtab/Type.java
index 7dcf109456..7b27647e22 100644
--- a/sources/scalac/symtab/Type.java
+++ b/sources/scalac/symtab/Type.java
@@ -53,6 +53,7 @@ public class Type implements Modifiers, Kinds, TypeTags, EntryTags {
*/
public case TypeRef(Type pre, Symbol sym, Type[] args) {
assert pre.isLegalPrefix() || pre == ErrorType : pre + "#" + sym;
+ assert sym.kind == ERROR || sym.isType() : pre + "#" + sym;
}
/** parts_1 with ... with parts_n { members }
@@ -159,7 +160,7 @@ public class Type implements Modifiers, Kinds, TypeTags, EntryTags {
Position.NOPOS, Names.COMPOUND_NAME.toTypeName(), Symbol.NONE,
SYNTHETIC | ABSTRACTCLASS);
res.tsym.setInfo(res);
- res.tsym.constructor().setInfo(
+ res.tsym.primaryConstructor().setInfo(
Type.MethodType(Symbol.EMPTY_ARRAY, Type.NoType));
return res;
}
@@ -419,7 +420,7 @@ public class Type implements Modifiers, Kinds, TypeTags, EntryTags {
if (sym.kind == ALIAS)
return unalias().parents();
else if (sym.kind == CLASS) {
- assert sym.typeParams().length == args.length : sym + " " + ArrayApply.toString(args);//debug
+ assert sym.typeParams().length == args.length : sym + " " + ArrayApply.toString(args) + " " + sym.primaryConstructor().info();//debug
return subst(asSeenFrom(sym.info().parents(), pre, sym.owner()),
sym.typeParams(), args);
} else
@@ -508,7 +509,7 @@ public class Type implements Modifiers, Kinds, TypeTags, EntryTags {
/** If this type is overloaded, its alternative types,
* otherwise an array consisting of this type itself.
*/
- public Type[] alternatives() {
+ public Type[] alternativeTypes() {
switch (this) {
case OverloadedType(_, Type[] alttypes):
return alttypes;
@@ -517,6 +518,18 @@ public class Type implements Modifiers, Kinds, TypeTags, EntryTags {
}
}
+ /** If this type is overloaded, its alternative symbols,
+ * otherwise an empty array.
+ */
+ public Symbol[] alternativeSymbols() {
+ switch (this) {
+ case OverloadedType(Symbol[] alts, _):
+ return alts;
+ default:
+ return Symbol.EMPTY_ARRAY;
+ }
+ }
+
/** If type is a this type of a module class, transform to singletype of
* module.
*/
@@ -2440,7 +2453,7 @@ public class Type implements Modifiers, Kinds, TypeTags, EntryTags {
else return sym.typeConstructor();
}
- default: throw new ApplicationError();
+ default: throw new ApplicationError(sym + " has wrong kind: " + sym.kind);
}
case CompoundType(Type[] parents, _):
if (parents.length > 0) return parents[0].erasure();