diff options
author | paltherr <paltherr@epfl.ch> | 2003-09-10 15:15:56 +0000 |
---|---|---|
committer | paltherr <paltherr@epfl.ch> | 2003-09-10 15:15:56 +0000 |
commit | 7d2cf8f17d468826c945998f366abb2c5bb6961c (patch) | |
tree | 878fd09a500252894408b21e48c1edcf04ac06d8 /sources/scalac/symtab/Type.java | |
parent | 957c42dadf55e3b67511077acfc4dd05e9a76b1d (diff) | |
download | scala-7d2cf8f17d468826c945998f366abb2c5bb6961c.tar.gz scala-7d2cf8f17d468826c945998f366abb2c5bb6961c.tar.bz2 scala-7d2cf8f17d468826c945998f366abb2c5bb6961c.zip |
- Changed array erasure rule.
Array[a] with a <: Any still remains boxed
Diffstat (limited to 'sources/scalac/symtab/Type.java')
-rw-r--r-- | sources/scalac/symtab/Type.java | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/sources/scalac/symtab/Type.java b/sources/scalac/symtab/Type.java index 03bee60328..2b05469f58 100644 --- a/sources/scalac/symtab/Type.java +++ b/sources/scalac/symtab/Type.java @@ -2520,10 +2520,12 @@ public class Type implements Modifiers, Kinds, TypeTags, EntryTags { if ((sym.flags & MODUL) == 0) { Name fullname = sym.fullName(); if (fullname == Names.scala_Array && args.length == 1) { - Type bound = upperBound(args[0]); + Type item = args[0].unalias(); + Type bound = item.upperBound(); // todo: check with Philippe if this is what we want. - if (bound.symbol() != Global.instance.definitions.ANY_CLASS && - bound.symbol() != Global.instance.definitions.ANYVAL_CLASS) + if (item.symbol().isClass() || + (bound.symbol() != Global.instance.definitions.ANY_CLASS && + bound.symbol() != Global.instance.definitions.ANYVAL_CLASS)) { return UnboxedArrayType(args[0].erasure()); } @@ -2536,13 +2538,13 @@ public class Type implements Modifiers, Kinds, TypeTags, EntryTags { return this; } //where - private Type upperBound(Type tp) { - switch (tp) { + private Type upperBound() { + switch (this) { case TypeRef(Type pre, Symbol sym, Type[] args): if (sym.kind == ALIAS || sym.kind == TYPE) - return upperBound(pre.memberInfo(sym)); + return pre.memberInfo(sym).upperBound(); } - return tp; + return this; } /** Return the erasure of this type. |