diff options
author | paltherr <paltherr@epfl.ch> | 2003-03-28 16:05:34 +0000 |
---|---|---|
committer | paltherr <paltherr@epfl.ch> | 2003-03-28 16:05:34 +0000 |
commit | 5ee5a01aadb13ce19eb2aa96354bf1fb13340808 (patch) | |
tree | b632c8cbd9baf13b43211c0c6df51f1f68b0008d /sources/scalac/symtab/Type.java | |
parent | 2ed373a5c30472fe76583bde8c38fd6ff8461cb2 (diff) | |
download | scala-5ee5a01aadb13ce19eb2aa96354bf1fb13340808.tar.gz scala-5ee5a01aadb13ce19eb2aa96354bf1fb13340808.tar.bz2 scala-5ee5a01aadb13ce19eb2aa96354bf1fb13340808.zip |
- Added method bound
- Changed the erasure of some array types
Diffstat (limited to 'sources/scalac/symtab/Type.java')
-rw-r--r-- | sources/scalac/symtab/Type.java | 28 |
1 files changed, 22 insertions, 6 deletions
diff --git a/sources/scalac/symtab/Type.java b/sources/scalac/symtab/Type.java index 69f406ff13..571e12061a 100644 --- a/sources/scalac/symtab/Type.java +++ b/sources/scalac/symtab/Type.java @@ -258,6 +258,17 @@ public class Type implements Modifiers, Kinds, TypeTags { } } + /** The upper bound of this type. + */ + public Type bound() { + switch (this) { + case TypeRef(Type pre, Symbol sym, Type[] args): + if (sym.kind == ALIAS || sym.kind == TYPE) + return pre.memberInfo(sym).bound(); + } + return this; + } + /** The this is a this-type, named-type, applied type or single-type, its prefix, * otherwise NoType. */ @@ -2001,12 +2012,17 @@ public class Type implements Modifiers, Kinds, TypeTags { Name fullname = sym.fullName(); if (fullname == Names.scala_Array && args.length == 1 /*&& args[0].unalias().symbol().kind != TYPE Q: why needed?*/) { - return UnboxedArrayType(args[0].erasure()); - } else { - for (int i = 0; i < boxedFullName.length; i++) { - if (boxedFullName[i] == fullname) return unboxedType[i]; - } - } + Global global = Global.instance; + Type bound = args[0].bound(); + if (bound.symbol() != global.definitions.ANY_CLASS && + bound.symbol() != global.definitions.ANYVAL_CLASS) + { + return UnboxedArrayType(args[0].erasure()); + } + } + for (int i = 0; i < boxedFullName.length; i++) { + if (boxedFullName[i] == fullname) return unboxedType[i]; + } } } return this; |