summaryrefslogtreecommitdiff
path: root/src/compiler
diff options
context:
space:
mode:
authorIulian Dragos <jaguarul@gmail.com>2007-11-20 16:29:15 +0000
committerIulian Dragos <jaguarul@gmail.com>2007-11-20 16:29:15 +0000
commitb574ca87cc56235cc9cae219f6d68b024bd43410 (patch)
tree8c64665f4937e7e078dac7b36074d7fb6d9e6612 /src/compiler
parentdca86389ac01286db3bb4b7a46ac8014744bda31 (diff)
downloadscala-b574ca87cc56235cc9cae219f6d68b024bd43410.tar.gz
scala-b574ca87cc56235cc9cae219f6d68b024bd43410.tar.bz2
scala-b574ca87cc56235cc9cae219f6d68b024bd43410.zip
Fixed backend to correctly handle type paramete...
Fixed backend to correctly handle type parameters (when compiling scala.Array[a]).
Diffstat (limited to 'src/compiler')
-rw-r--r--src/compiler/scala/tools/nsc/Global.scala1
-rw-r--r--src/compiler/scala/tools/nsc/backend/icode/ICodes.scala5
-rw-r--r--src/compiler/scala/tools/nsc/backend/icode/TypeKinds.scala28
3 files changed, 18 insertions, 16 deletions
diff --git a/src/compiler/scala/tools/nsc/Global.scala b/src/compiler/scala/tools/nsc/Global.scala
index f98c1d50ec..626b9bf885 100644
--- a/src/compiler/scala/tools/nsc/Global.scala
+++ b/src/compiler/scala/tools/nsc/Global.scala
@@ -448,7 +448,6 @@ class Global(var settings: Settings, var reporter: Reporter) extends Trees
phase = firstPhase
definitions.init // needs firstPhase and phase to be defined != NoPhase,
// that's why it is placed here.
- icodes.init
/** Deprecation warnings occurred */
var deprecationWarnings: Boolean = false
diff --git a/src/compiler/scala/tools/nsc/backend/icode/ICodes.scala b/src/compiler/scala/tools/nsc/backend/icode/ICodes.scala
index 46d0c9ab0a..277ca38527 100644
--- a/src/compiler/scala/tools/nsc/backend/icode/ICodes.scala
+++ b/src/compiler/scala/tools/nsc/backend/icode/ICodes.scala
@@ -64,10 +64,7 @@ abstract class ICodes extends AnyRef
val global: ICodes.this.global.type = ICodes.this.global
}
- var AnyRefReference: TypeKind = _
- def init = {
- AnyRefReference = REFERENCE(global.definitions.AnyRefClass)
- }
+ lazy val AnyRefReference: TypeKind = REFERENCE(global.definitions.ObjectClass)
import global.settings
if (settings.XO.value) {
diff --git a/src/compiler/scala/tools/nsc/backend/icode/TypeKinds.scala b/src/compiler/scala/tools/nsc/backend/icode/TypeKinds.scala
index 5518781403..555895b1d9 100644
--- a/src/compiler/scala/tools/nsc/backend/icode/TypeKinds.scala
+++ b/src/compiler/scala/tools/nsc/backend/icode/TypeKinds.scala
@@ -129,7 +129,7 @@ trait TypeKinds { self: ICodes =>
def maxType(other: TypeKind): TypeKind = other match {
case UNIT => UNIT
case REFERENCE(a) if a == definitions.AllClass => UNIT
- case _ => abort("Uncomparbale type kinds: UNIT with " + other)
+ case _ => abort("Uncomparabale type kinds: UNIT with " + other)
}
}
@@ -138,7 +138,7 @@ trait TypeKinds { self: ICodes =>
override def maxType(other: TypeKind): TypeKind = other match {
case BOOL => BOOL
case REFERENCE(a) if a == definitions.AllClass => BOOL
- case _ => abort("Uncomparbale type kinds: BOOL with " + other)
+ case _ => abort("Uncomparabale type kinds: BOOL with " + other)
}
}
@@ -148,7 +148,7 @@ trait TypeKinds { self: ICodes =>
other match {
case BYTE | SHORT | CHAR | INT | LONG | FLOAT | DOUBLE => other
case REFERENCE(a) if a == definitions.AllClass => BYTE
- case _ => abort("Uncomparbale type kinds: BYTE with " + other)
+ case _ => abort("Uncomparabale type kinds: BYTE with " + other)
}
}
@@ -159,7 +159,7 @@ trait TypeKinds { self: ICodes =>
case BYTE | SHORT | CHAR => SHORT
case REFERENCE(a) if a == definitions.AllClass => SHORT
case INT | LONG | FLOAT | DOUBLE => other
- case _ => abort("Uncomparbale type kinds: SHORT with " + other)
+ case _ => abort("Uncomparabale type kinds: SHORT with " + other)
}
}
@@ -170,7 +170,7 @@ trait TypeKinds { self: ICodes =>
case BYTE | SHORT | CHAR => CHAR
case REFERENCE(a) if a == definitions.AllClass => CHAR
case INT | LONG | FLOAT | DOUBLE => other
- case _ => abort("Uncomparbale type kinds: CHAR with " + other)
+ case _ => abort("Uncomparabale type kinds: CHAR with " + other)
}
}
@@ -182,7 +182,7 @@ trait TypeKinds { self: ICodes =>
case BYTE | SHORT | CHAR | INT => INT
case REFERENCE(a) if a == definitions.AllClass => INT
case LONG | FLOAT | DOUBLE => other
- case _ => abort("Uncomparbale type kinds: INT with " + other)
+ case _ => abort("Uncomparabale type kinds: INT with " + other)
}
}
@@ -193,7 +193,7 @@ trait TypeKinds { self: ICodes =>
case BYTE | SHORT | CHAR | INT | LONG => LONG
case REFERENCE(a) if a == definitions.AllClass => LONG
case FLOAT | DOUBLE => DOUBLE
- case _ => abort("Uncomparbale type kinds: LONG with " + other)
+ case _ => abort("Uncomparabale type kinds: LONG with " + other)
}
}
@@ -203,7 +203,7 @@ trait TypeKinds { self: ICodes =>
case BYTE | SHORT | CHAR | INT | LONG | FLOAT => FLOAT
case REFERENCE(a) if a == definitions.AllClass => FLOAT
case DOUBLE => DOUBLE
- case _ => abort("Uncomparbale type kinds: FLOAT with " + other)
+ case _ => abort("Uncomparabale type kinds: FLOAT with " + other)
}
}
@@ -213,7 +213,7 @@ trait TypeKinds { self: ICodes =>
if (other.isNumericType)
DOUBLE
else if (other == REFERENCE(definitions.AllClass)) DOUBLE
- else abort("Uncomparbale type kinds: DOUBLE with " + other)
+ else abort("Uncomparabale type kinds: DOUBLE with " + other)
}
/** A string reference */
@@ -428,8 +428,14 @@ trait TypeKinds { self: ICodes =>
case None =>
if (sym == definitions.ArrayClass)
ARRAY(toTypeKind(args.head))
- else
- REFERENCE(sym)
+ else {
+ if (sym.isClass)
+ REFERENCE(sym)
+ else {
+ assert(sym.isType, sym) // it must be compiling Array[a]
+ AnyRefReference
+ }
+ }
}
case ClassInfoType(_, _, sym) =>