diff options
-rw-r--r-- | src/compiler/scala/tools/nsc/Global.scala | 1 | ||||
-rw-r--r-- | src/compiler/scala/tools/nsc/backend/icode/ICodes.scala | 5 | ||||
-rw-r--r-- | src/compiler/scala/tools/nsc/backend/icode/TypeKinds.scala | 28 |
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) => |