summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorIulian Dragos <jaguarul@gmail.com>2008-06-11 09:50:19 +0000
committerIulian Dragos <jaguarul@gmail.com>2008-06-11 09:50:19 +0000
commit9b17332f11212b608ce7de6093d1f15c28e5bc1b (patch)
tree38bb40a3cbd23974692dce394937ade4d67e1663 /src
parent740c36ace1b1efd328bc887a935b4e1ce2a6f1ef (diff)
downloadscala-9b17332f11212b608ce7de6093d1f15c28e5bc1b.tar.gz
scala-9b17332f11212b608ce7de6093d1f15c28e5bc1b.tar.bz2
scala-9b17332f11212b608ce7de6093d1f15c28e5bc1b.zip
Fixed #999.
Diffstat (limited to 'src')
-rw-r--r--src/compiler/scala/tools/nsc/backend/icode/GenICode.scala2
-rw-r--r--src/compiler/scala/tools/nsc/backend/icode/TypeKinds.scala31
2 files changed, 20 insertions, 13 deletions
diff --git a/src/compiler/scala/tools/nsc/backend/icode/GenICode.scala b/src/compiler/scala/tools/nsc/backend/icode/GenICode.scala
index 95c7876408..32dcf06365 100644
--- a/src/compiler/scala/tools/nsc/backend/icode/GenICode.scala
+++ b/src/compiler/scala/tools/nsc/backend/icode/GenICode.scala
@@ -1053,7 +1053,7 @@ abstract class GenICode extends SubComponent {
private def genLoadQualifier(tree: Tree, ctx: Context): Context =
tree match {
case Select(qualifier, _) =>
- genLoad(qualifier, ctx, ANY_REF_CLASS) // !!
+ genLoad(qualifier, ctx, toTypeKind(qualifier.tpe))
case _ =>
abort("Unknown qualifier " + tree)
}
diff --git a/src/compiler/scala/tools/nsc/backend/icode/TypeKinds.scala b/src/compiler/scala/tools/nsc/backend/icode/TypeKinds.scala
index 4e2527bc3e..35675f5417 100644
--- a/src/compiler/scala/tools/nsc/backend/icode/TypeKinds.scala
+++ b/src/compiler/scala/tools/nsc/backend/icode/TypeKinds.scala
@@ -412,7 +412,11 @@ trait TypeKinds { self: ICodes =>
/** Return the TypeKind of the given type */
def toTypeKind(t: Type): TypeKind = t.normalize match {
- case ThisType(sym) => REFERENCE(sym)
+ case ThisType(sym) =>
+ if (sym == definitions.ArrayClass)
+ AnyRefReference
+ else
+ REFERENCE(sym)
case SingleType(pre, sym) =>
primitiveTypeMap get sym match {
@@ -426,17 +430,7 @@ trait TypeKinds { self: ICodes =>
case TypeRef(_, sym, args) =>
primitiveTypeMap get sym match {
case Some(k) => k
- case None =>
- if (sym == definitions.ArrayClass)
- ARRAY(toTypeKind(args.head))
- else {
- if (sym.isClass)
- REFERENCE(sym)
- else {
- assert(sym.isType, sym) // it must be compiling Array[a]
- AnyRefReference
- }
- }
+ case None => arrayOrClassType(sym, args)
}
case ClassInfoType(_, _, sym) =>
@@ -459,6 +453,19 @@ trait TypeKinds { self: ICodes =>
abort("Unknown type: " + t)
}
+ /** Return the type kind of a class, possibly an array type.
+ */
+ private def arrayOrClassType(sym: Symbol, targs: List[Type]): TypeKind = {
+ if (sym == definitions.ArrayClass)
+ ARRAY(toTypeKind(targs.head))
+ else if (sym.isClass)
+ REFERENCE(sym)
+ else {
+ assert(sym.isType, sym) // it must be compiling Array[a]
+ AnyRefReference
+ }
+ }
+
/** A map from scala primitive Types to ICode TypeKinds */
private var primitiveTypeMap: Map[Symbol, TypeKind] = null