diff options
author | Geoffrey Washburn <geoffrey.washburn@epfl.ch> | 2008-07-22 07:34:45 +0000 |
---|---|---|
committer | Geoffrey Washburn <geoffrey.washburn@epfl.ch> | 2008-07-22 07:34:45 +0000 |
commit | 872c9ba67d46345d0ff32ba5447587cda4600c9d (patch) | |
tree | 73e7198e254a00b74a572862f95a0780b1c4199b /src/compiler | |
parent | 1157b4042ddc3f928d82e7722b1619e628973a9c (diff) | |
download | scala-872c9ba67d46345d0ff32ba5447587cda4600c9d.tar.gz scala-872c9ba67d46345d0ff32ba5447587cda4600c9d.tar.bz2 scala-872c9ba67d46345d0ff32ba5447587cda4600c9d.zip |
AllClass => NothingClass
AllRefClass => NullClass
Diffstat (limited to 'src/compiler')
25 files changed, 95 insertions, 99 deletions
diff --git a/src/compiler/scala/tools/nsc/backend/icode/Checkers.scala b/src/compiler/scala/tools/nsc/backend/icode/Checkers.scala index c42c0536f4..46b5066e63 100644 --- a/src/compiler/scala/tools/nsc/backend/icode/Checkers.scala +++ b/src/compiler/scala/tools/nsc/backend/icode/Checkers.scala @@ -65,8 +65,8 @@ abstract class Checkers { val emptyStack = new TypeStack() val STRING = REFERENCE(definitions.StringClass) - val SCALA_ALL = REFERENCE(definitions.AllClass) - val SCALA_ALL_REF = REFERENCE(definitions.AllRefClass) + val SCALA_ALL = REFERENCE(definitions.NothingClass) + val SCALA_ALL_REF = REFERENCE(definitions.NullClass) // val CASE_CLASS = REFERENCE(definitions.getClass("scala.CaseClass")) def checkICodes: Unit = { diff --git a/src/compiler/scala/tools/nsc/backend/icode/GenICode.scala b/src/compiler/scala/tools/nsc/backend/icode/GenICode.scala index dcbbb6b659..83f509c13f 100644 --- a/src/compiler/scala/tools/nsc/backend/icode/GenICode.scala +++ b/src/compiler/scala/tools/nsc/backend/icode/GenICode.scala @@ -40,8 +40,8 @@ abstract class GenICode extends SubComponent { // this depends on the backend! should be changed. val ANY_REF_CLASS = REFERENCE(definitions.ObjectClass) - val SCALA_ALL = REFERENCE(definitions.AllClass) - val SCALA_ALLREF = REFERENCE(definitions.AllRefClass) + val SCALA_ALL = REFERENCE(definitions.NothingClass) + val SCALA_ALLREF = REFERENCE(definitions.NullClass) val THROWABLE = REFERENCE(definitions.ThrowableClass) val BoxesRunTime_equals = diff --git a/src/compiler/scala/tools/nsc/backend/icode/TypeKinds.scala b/src/compiler/scala/tools/nsc/backend/icode/TypeKinds.scala index 35675f5417..267e1495fc 100644 --- a/src/compiler/scala/tools/nsc/backend/icode/TypeKinds.scala +++ b/src/compiler/scala/tools/nsc/backend/icode/TypeKinds.scala @@ -112,8 +112,8 @@ trait TypeKinds { self: ICodes => (b.isReferenceType || b.isArrayType)) toTypeKind(lub0(a.toType, b.toType)) else if (a == b) a - else if (a == REFERENCE(definitions.AllClass)) b - else if (b == REFERENCE(definitions.AllClass)) a + else if (a == REFERENCE(definitions.NothingClass)) b + else if (b == REFERENCE(definitions.NothingClass)) a else (a, b) match { case (BOXED(a1), BOXED(b1)) => if (a1 == b1) a else REFERENCE(definitions.AnyRefClass) case (BOXED(_), REFERENCE(_)) | (REFERENCE(_), BOXED(_)) => REFERENCE(definitions.AnyRefClass) @@ -129,7 +129,7 @@ trait TypeKinds { self: ICodes => case object UNIT extends TypeKind { def maxType(other: TypeKind): TypeKind = other match { case UNIT => UNIT - case REFERENCE(a) if a == definitions.AllClass => UNIT + case REFERENCE(a) if a == definitions.NothingClass => UNIT case _ => abort("Uncomparable type kinds: UNIT with " + other) } } @@ -138,7 +138,7 @@ trait TypeKinds { self: ICodes => case object BOOL extends TypeKind { override def maxType(other: TypeKind): TypeKind = other match { case BOOL => BOOL - case REFERENCE(a) if a == definitions.AllClass => BOOL + case REFERENCE(a) if a == definitions.NothingClass => BOOL case _ => abort("Uncomparable type kinds: BOOL with " + other) } } @@ -148,7 +148,7 @@ trait TypeKinds { self: ICodes => override def maxType(other: TypeKind): TypeKind = other match { case BYTE | SHORT | CHAR | INT | LONG | FLOAT | DOUBLE => other - case REFERENCE(a) if a == definitions.AllClass => BYTE + case REFERENCE(a) if a == definitions.NothingClass => BYTE case _ => abort("Uncomparable type kinds: BYTE with " + other) } } @@ -158,7 +158,7 @@ trait TypeKinds { self: ICodes => override def maxType(other: TypeKind): TypeKind = other match { case BYTE | SHORT | CHAR => SHORT - case REFERENCE(a) if a == definitions.AllClass => SHORT + case REFERENCE(a) if a == definitions.NothingClass => SHORT case INT | LONG | FLOAT | DOUBLE => other case _ => abort("Uncomparable type kinds: SHORT with " + other) } @@ -169,7 +169,7 @@ trait TypeKinds { self: ICodes => override def maxType(other: TypeKind): TypeKind = other match { case BYTE | SHORT | CHAR => CHAR - case REFERENCE(a) if a == definitions.AllClass => CHAR + case REFERENCE(a) if a == definitions.NothingClass => CHAR case INT | LONG | FLOAT | DOUBLE => other case _ => abort("Uncomparable type kinds: CHAR with " + other) } @@ -181,7 +181,7 @@ trait TypeKinds { self: ICodes => override def maxType(other: TypeKind): TypeKind = other match { case BYTE | SHORT | CHAR | INT => INT - case REFERENCE(a) if a == definitions.AllClass => INT + case REFERENCE(a) if a == definitions.NothingClass => INT case LONG | FLOAT | DOUBLE => other case _ => abort("Uncomparable type kinds: INT with " + other) } @@ -192,7 +192,7 @@ trait TypeKinds { self: ICodes => override def maxType(other: TypeKind): TypeKind = other match { case BYTE | SHORT | CHAR | INT | LONG => LONG - case REFERENCE(a) if a == definitions.AllClass => LONG + case REFERENCE(a) if a == definitions.NothingClass => LONG case FLOAT | DOUBLE => DOUBLE case _ => abort("Uncomparable type kinds: LONG with " + other) } @@ -202,7 +202,7 @@ trait TypeKinds { self: ICodes => case object FLOAT extends TypeKind { override def maxType(other: TypeKind): TypeKind = other match { case BYTE | SHORT | CHAR | INT | LONG | FLOAT => FLOAT - case REFERENCE(a) if a == definitions.AllClass => FLOAT + case REFERENCE(a) if a == definitions.NothingClass => FLOAT case DOUBLE => DOUBLE case _ => abort("Uncomparable type kinds: FLOAT with " + other) } @@ -213,7 +213,7 @@ trait TypeKinds { self: ICodes => override def maxType(other: TypeKind): TypeKind = if (other.isNumericType) DOUBLE - else if (other == REFERENCE(definitions.AllClass)) DOUBLE + else if (other == REFERENCE(definitions.NothingClass)) DOUBLE else abort("Uncomparable type kinds: DOUBLE with " + other) } @@ -255,13 +255,13 @@ trait TypeKinds { self: ICodes => /** Checks subtyping relationship. */ override def <:<(other: TypeKind): Boolean = - if (cls == definitions.AllClass) + if (cls == definitions.NothingClass) true else other match { case REFERENCE(cls2) => cls.tpe <:< cls2.tpe case ARRAY(_) => - cls == definitions.AllRefClass + cls == definitions.NullClass case _ => false } diff --git a/src/compiler/scala/tools/nsc/backend/icode/analysis/TypeFlowAnalysis.scala b/src/compiler/scala/tools/nsc/backend/icode/analysis/TypeFlowAnalysis.scala index 942b335f1e..d897318f31 100644 --- a/src/compiler/scala/tools/nsc/backend/icode/analysis/TypeFlowAnalysis.scala +++ b/src/compiler/scala/tools/nsc/backend/icode/analysis/TypeFlowAnalysis.scala @@ -23,7 +23,7 @@ abstract class TypeFlowAnalysis { type Elem = icodes.TypeKind val Object = icodes.REFERENCE(global.definitions.ObjectClass) - val All = icodes.REFERENCE(global.definitions.AllClass) + val All = icodes.REFERENCE(global.definitions.NothingClass) def top = Object def bottom = All diff --git a/src/compiler/scala/tools/nsc/backend/jvm/GenJVM.scala b/src/compiler/scala/tools/nsc/backend/jvm/GenJVM.scala index 5cb78a5e12..d47ebd1182 100644 --- a/src/compiler/scala/tools/nsc/backend/jvm/GenJVM.scala +++ b/src/compiler/scala/tools/nsc/backend/jvm/GenJVM.scala @@ -1460,9 +1460,9 @@ abstract class GenJVM extends SubComponent { !sym.isImplClass && !sym.hasFlag(Flags.JAVA)) "$" else ""; - if (sym == definitions.AllClass) + if (sym == definitions.NothingClass) return "scala.runtime.Nothing$" - else if (sym == definitions.AllRefClass) + else if (sym == definitions.NullClass) return "scala.runtime.Null$" if (sym.isClass && !sym.rawowner.isPackageClass) diff --git a/src/compiler/scala/tools/nsc/backend/msil/GenMSIL.scala b/src/compiler/scala/tools/nsc/backend/msil/GenMSIL.scala index 9452ca0b74..e2380b7364 100644 --- a/src/compiler/scala/tools/nsc/backend/msil/GenMSIL.scala +++ b/src/compiler/scala/tools/nsc/backend/msil/GenMSIL.scala @@ -137,11 +137,11 @@ abstract class GenMSIL extends SubComponent { private def initMappings() { mapType(definitions.AnyClass, MOBJECT) mapType(definitions.AnyRefClass, MOBJECT) - //mapType(definitions.AllRefClass, clrTypes.getType("scala.AllRef$")) - //mapType(definitions.AllClass, clrTypes.getType("scala.All$")) + //mapType(definitions.NullClass, clrTypes.getType("scala.AllRef$")) + //mapType(definitions.NothingClass, clrTypes.getType("scala.All$")) // FIXME: for some reason the upper two lines map to null - mapType(definitions.AllRefClass, EXCEPTION) - mapType(definitions.AllClass, EXCEPTION) + mapType(definitions.NullClass, EXCEPTION) + mapType(definitions.NothingClass, EXCEPTION) val jEmpty = new Array[Type](0) val jString1 = Array(JSTRING.tpe) @@ -1831,9 +1831,9 @@ abstract class GenMSIL extends SubComponent { !sym.hasFlag(Flags.JAVA)) "$" else "" // Flags.JAVA: "symbol was not defined by a scala-class" (java, or .net-class) - if (sym == definitions.AllClass) + if (sym == definitions.NothingClass) return "scala.All$" - else if (sym == definitions.AllRefClass) + else if (sym == definitions.NullClass) return "scala.AllRef$" (if (sym.isClass || (sym.isModule && !sym.isMethod)) diff --git a/src/compiler/scala/tools/nsc/backend/opt/Inliners.scala b/src/compiler/scala/tools/nsc/backend/opt/Inliners.scala index e497829889..daf12112e2 100644 --- a/src/compiler/scala/tools/nsc/backend/opt/Inliners.scala +++ b/src/compiler/scala/tools/nsc/backend/opt/Inliners.scala @@ -439,8 +439,8 @@ abstract class Inliners extends SubComponent { private def lookupImpl(meth: Symbol, clazz: Symbol): Symbol = { //println("\t\tlooking up " + meth + " in " + clazz.fullNameString + " meth.owner = " + meth.owner) if (meth.owner == clazz - || clazz == definitions.AllRefClass - || clazz == definitions.AllClass) meth + || clazz == definitions.NullClass + || clazz == definitions.NothingClass) meth else { val implementingMethod = meth.overridingSymbol(clazz) if (implementingMethod != NoSymbol) diff --git a/src/compiler/scala/tools/nsc/doc/ModelAdditions.scala b/src/compiler/scala/tools/nsc/doc/ModelAdditions.scala index a742ba9f7b..a8fc073e99 100644 --- a/src/compiler/scala/tools/nsc/doc/ModelAdditions.scala +++ b/src/compiler/scala/tools/nsc/doc/ModelAdditions.scala @@ -15,12 +15,10 @@ class ModelAdditions(val global: Global) { import definitions._ def addition(sym: global.Symbol) {} - addition(AllClass); - comments(AllClass) = """ + addition(NothingClass); + comments(NothingClass) = """ <p> - Class <code>Nothing</code> (previously named <code>All</code> in - <a href="http://scala-lang.org" target="_top">Scala</a> 2.2.0 and - older versions) is - together with class <a href="Null.html"> + Class <code>Nothing</code> is - together with class <a href="Null.html"> <code>Null</code></a> - at the bottom of the <a href="http://scala-lang.org" target="_top">Scala</a> type hierarchy. @@ -40,12 +38,10 @@ class ModelAdditions(val global: Global) { any element type <code>T</code>. </p>""" - addition(AllRefClass); - comments(AllRefClass) = """ + addition(NullClass); + comments(NullClass) = """ <p> - Class <code>Null</code> (previously named <code>AllRef</code> in - <a href="http://scala-lang.org" target="_top">Scala</a> 2.2.0 and - older versions) is - together with class <a href="Nothing.html"> + Class <code>Null</code> is - together with class <a href="Nothing.html"> <code>Nothing</code> - at the bottom of the <a href="http://scala-lang.org" target="_top">Scala</a> type hierarchy. diff --git a/src/compiler/scala/tools/nsc/doc/ModelExtractor.scala b/src/compiler/scala/tools/nsc/doc/ModelExtractor.scala index 3a25b5163e..c3743d4b05 100644 --- a/src/compiler/scala/tools/nsc/doc/ModelExtractor.scala +++ b/src/compiler/scala/tools/nsc/doc/ModelExtractor.scala @@ -130,7 +130,7 @@ trait ModelExtractor { def resultType: Option[Type] = None def parents: Iterable[Type] = Nil def lo: Option[Type] = sym.info match { - case TypeBounds(lo, hi) if decode(lo.typeSymbol) != definitions.AllClass => Some(lo) + case TypeBounds(lo, hi) if decode(lo.typeSymbol) != definitions.NothingClass => Some(lo) case _ => None } def hi: Option[Type] = sym.info match { diff --git a/src/compiler/scala/tools/nsc/doc/ModelFrames.scala b/src/compiler/scala/tools/nsc/doc/ModelFrames.scala index ffb1cb0898..0242cbfb1b 100644 --- a/src/compiler/scala/tools/nsc/doc/ModelFrames.scala +++ b/src/compiler/scala/tools/nsc/doc/ModelFrames.scala @@ -26,7 +26,7 @@ trait ModelFrames extends ModelExtractor { import global.definitions._ global.definitions.init SyntheticClasses ++= List( - AllClass, AllRefClass, AnyClass, AnyRefClass, AnyValClass, + NothingClass, NullClass, AnyClass, AnyRefClass, AnyValClass, //value classes BooleanClass, ByteClass, CharClass, IntClass, LongClass, ShortClass, UnitClass) diff --git a/src/compiler/scala/tools/nsc/javac/JavaParsers.scala b/src/compiler/scala/tools/nsc/javac/JavaParsers.scala index f2cacb38cf..3e0f336b60 100755 --- a/src/compiler/scala/tools/nsc/javac/JavaParsers.scala +++ b/src/compiler/scala/tools/nsc/javac/JavaParsers.scala @@ -292,7 +292,7 @@ trait JavaParsers extends JavaScanners { if (in.token == QMARK) { val pos = in.currentPos in.nextToken - var lo: Tree = TypeTree(AllClass.tpe) + var lo: Tree = TypeTree(NothingClass.tpe) var hi: Tree = TypeTree(AnyClass.tpe) if (in.token == EXTENDS) { in.nextToken diff --git a/src/compiler/scala/tools/nsc/matching/ParallelMatching.scala b/src/compiler/scala/tools/nsc/matching/ParallelMatching.scala index 70e22cd70e..095ab0c561 100644 --- a/src/compiler/scala/tools/nsc/matching/ParallelMatching.scala +++ b/src/compiler/scala/tools/nsc/matching/ParallelMatching.scala @@ -954,7 +954,7 @@ trait ParallelMatching { } val body = targets(bx) // @bug: typer is not able to digest a body of type Nothing being assigned result type Unit - val tpe = if (body.tpe.typeSymbol eq definitions.AllClass) body.tpe else resultType + val tpe = if (body.tpe.typeSymbol eq definitions.NothingClass) body.tpe else resultType val label = theOwner.newLabel(body.pos, "body%"+bx).setInfo(new MethodType(argts.toList, tpe)) labels(bx) = label diff --git a/src/compiler/scala/tools/nsc/symtab/Constants.scala b/src/compiler/scala/tools/nsc/symtab/Constants.scala index ec6f5dbc8c..c273af6d35 100644 --- a/src/compiler/scala/tools/nsc/symtab/Constants.scala +++ b/src/compiler/scala/tools/nsc/symtab/Constants.scala @@ -65,7 +65,7 @@ trait Constants { case FloatTag => FloatClass.tpe case DoubleTag => DoubleClass.tpe case StringTag => StringClass.tpe - case NullTag => AllRefClass.tpe + case NullTag => NullClass.tpe case ClassTag => Predef_classOfType(value.asInstanceOf[Type]) case EnumTag => symbolValue.owner.linkedClassOfClass.tpe case AnnotationTag => AnnotationClass.tpe // what should it be? diff --git a/src/compiler/scala/tools/nsc/symtab/Definitions.scala b/src/compiler/scala/tools/nsc/symtab/Definitions.scala index b5ba39021b..35434de9ed 100644 --- a/src/compiler/scala/tools/nsc/symtab/Definitions.scala +++ b/src/compiler/scala/tools/nsc/symtab/Definitions.scala @@ -41,8 +41,8 @@ trait Definitions { lazy val anyrefparam = List(AnyRefClass.typeConstructor) - var AllRefClass: Symbol = _ - var AllClass: Symbol = _ + var NullClass: Symbol = _ + var NothingClass: Symbol = _ var SingletonClass: Symbol = _ lazy val ClassClass: Symbol = getClass(sn.Class) @@ -391,7 +391,7 @@ trait Definitions { private def newTypeParam(owner: Symbol, index: Int): Symbol = owner.newTypeParameter(NoPosition, "T" + index) - .setInfo(mkTypeBounds(AllClass.typeConstructor, AnyClass.typeConstructor)) + .setInfo(mkTypeBounds(NothingClass.typeConstructor, AnyClass.typeConstructor)) val boxedClass = new HashMap[Symbol, Symbol] val unboxMethod = new HashMap[Symbol, Symbol] // Type -> Method @@ -652,10 +652,10 @@ trait Definitions { AnyRefClass = newAlias(ScalaPackageClass, nme.AnyRef, ObjectClass.typeConstructor) - AllRefClass = newClass(ScalaPackageClass, nme.Null, anyrefparam) + NullClass = newClass(ScalaPackageClass, nme.Null, anyrefparam) .setFlag(ABSTRACT | TRAIT | FINAL) - AllClass = newClass(ScalaPackageClass, nme.Nothing, anyparam) + NothingClass = newClass(ScalaPackageClass, nme.Nothing, anyparam) .setFlag(ABSTRACT | TRAIT | FINAL) SingletonClass = newClass(ScalaPackageClass, nme.Singleton, anyparam) @@ -746,7 +746,7 @@ trait Definitions { String_+ = newMethod( StringClass, "+", anyparam, StringClass.typeConstructor) setFlag FINAL - PatternWildcard = NoSymbol.newValue(NoPosition, "_").setInfo(AllClass.typeConstructor) + PatternWildcard = NoSymbol.newValue(NoPosition, "_").setInfo(NothingClass.typeConstructor) if (forMSIL) { val intType = IntClass.typeConstructor diff --git a/src/compiler/scala/tools/nsc/symtab/Symbols.scala b/src/compiler/scala/tools/nsc/symtab/Symbols.scala index caaeda83f7..93b6342177 100644 --- a/src/compiler/scala/tools/nsc/symtab/Symbols.scala +++ b/src/compiler/scala/tools/nsc/symtab/Symbols.scala @@ -691,11 +691,11 @@ trait Symbols { */ def existentialBound: Type = if (this.isClass) - polyType(this.typeParams, mkTypeBounds(AllClass.tpe, this.classBound)) + polyType(this.typeParams, mkTypeBounds(NothingClass.tpe, this.classBound)) else if (this.isAbstractType) this.info else if (this.isTerm) - mkTypeBounds(AllClass.tpe, intersectionType(List(this.tpe, SingletonClass.tpe))) + mkTypeBounds(NothingClass.tpe, intersectionType(List(this.tpe, SingletonClass.tpe))) else throw new Error("unexpected alias type: "+this) @@ -741,10 +741,10 @@ trait Symbols { final def isSubClass(that: Symbol): Boolean = { isNonBottomSubClass(that) || - this == AllClass || - this == AllRefClass && + this == NothingClass || + this == NullClass && (that == AnyClass || - that != AllClass && (that isSubClass AnyRefClass)) + that != NothingClass && (that isSubClass AnyRefClass)) } // Overloaded Alternatives --------------------------------------------------------- @@ -1231,7 +1231,7 @@ trait Symbols { typeParamsString + { tp.resultType match { case TypeBounds(lo, hi) => - (if (lo.typeSymbol == AllClass) "" else " >: " + lo) + + (if (lo.typeSymbol == NothingClass) "" else " >: " + lo) + (if (hi.typeSymbol == AnyClass) "" else " <: " + hi) case rtp => "<: " + rtp diff --git a/src/compiler/scala/tools/nsc/symtab/Types.scala b/src/compiler/scala/tools/nsc/symtab/Types.scala index 2eeecbace6..6584741fa1 100644 --- a/src/compiler/scala/tools/nsc/symtab/Types.scala +++ b/src/compiler/scala/tools/nsc/symtab/Types.scala @@ -1013,7 +1013,7 @@ trait Types { case TypeBounds(_, _) => that <:< this case _ => lo <:< that && that <:< hi } - // override def isNullable: Boolean = AllRefClass.tpe <:< lo; + // override def isNullable: Boolean = NullClass.tpe <:< lo; override def safeToString = ">: " + lo + " <: " + hi override def kind = "TypeBoundsType" } @@ -1263,7 +1263,7 @@ trait Types { // override def isNullable: Boolean = // symbol == AnyClass || - // symbol != AllClass && (symbol isSubClass ObjectClass) && !(symbol isSubClass NonNullClass); + // symbol != NothingClass && (symbol isSubClass ObjectClass) && !(symbol isSubClass NonNullClass); // override def isNonNull: Boolean = symbol == NonNullClass || super.isNonNull; override def kind = "ClassInfoType" @@ -1320,7 +1320,7 @@ trait Types { pre.isTrivial && !sym.isTypeParameter && args.forall(_.isTrivial) override def isNotNull = - sym.isModuleClass || sym == AllClass || isValueClass(sym) || super.isNotNull + sym.isModuleClass || sym == NothingClass || isValueClass(sym) || super.isNotNull // @M: propagate actual type params (args) to `tp', by replacing formal type parameters with actual ones def transform(tp: Type): Type = { @@ -2094,7 +2094,7 @@ A type's typeSymbol should never be inspected directly. case TypeRef(pre, sym, args) if (variance != 0) && (occurCount isDefinedAt sym) => val repl = if (variance == 1) dropSingletonType(tp1.bounds.hi) else tp1.bounds.lo //println("eliminate "+sym+"/"+repl+"/"+occurCount(sym)+"/"+(tparams exists (repl.contains)))//DEBUG - if (repl.typeSymbol != AllClass && repl.typeSymbol != AllRefClass && + if (repl.typeSymbol != NothingClass && repl.typeSymbol != NullClass && occurCount(sym) == 1 && !(tparams exists (repl.contains))) repl else tp1 @@ -2553,7 +2553,7 @@ A type's typeSymbol should never be inspected directly. capturedPre get clazz match { case None => val qvar = makeFreshExistential(".type", clazz, - mkTypeBounds(AllClass.tpe, intersectionType(List(pre, SingletonClass.tpe)))) + mkTypeBounds(NothingClass.tpe, intersectionType(List(pre, SingletonClass.tpe)))) capturedPre += (clazz -> qvar) capturedParams = qvar :: capturedParams qvar @@ -2830,7 +2830,7 @@ A type's typeSymbol should never be inspected directly. private def boundFor(actualIdx: Int) = mkTypeBounds( - AllClass.tpe, + NothingClass.tpe, intersectionType(List(actuals(actualIdx), SingletonClass.tpe))) /* Return the type symbol for referencing a parameter index @@ -3561,10 +3561,10 @@ A type's typeSymbol should never be inspected directly. sym2.isClass && ({ val base = tp1 baseType sym2; !(base eq tp1) && (base <:< tp2) }) || - sym1 == AllClass + sym1 == NothingClass || // Console.println("last chance " + sym1 + " " + sym2 + " " + sym2.isClass + " " (sym2 isSubClass ObjectClass)) - sym1 == AllRefClass && + sym1 == NullClass && sym2.isClass && (sym2 isNonBottomSubClass ObjectClass) && (!(tp2.normalize.typeSymbol isNonBottomSubClass NotNullClass))) case (MethodType(pts1, res1), MethodType(pts2, res2)) => (pts1.length == pts2.length && @@ -3593,7 +3593,7 @@ A type's typeSymbol should never be inspected directly. if (constr1.inst != NoType) constr1.inst <:< tp2 else isRelatable(tv1, tp2) && { constr1.hibounds = tp2 :: constr1.hibounds; true } case (_, _) if (tp1.isHigherKinded || tp2.isHigherKinded) => - (tp1.typeSymbol == AllClass + (tp1.typeSymbol == NothingClass || tp2.typeSymbol == AnyClass // @M Any and Nothing are super-type resp. subtype of every well-kinded type || // @M! normalize reduces higher-kinded case to PolyType's @@ -3609,7 +3609,7 @@ A type's typeSymbol should never be inspected directly. case (_, RefinedType(parents2, ref2)) => (parents2 forall (tp2 => tp1 <:< tp2 || tp2.typeSymbol == NotNullClass && tp1.isNotNull)) && (ref2.toList forall tp1.specializes) && - (!parents2.exists(_.typeSymbol.isAbstractType) || tp1.typeSymbol != AllRefClass) + (!parents2.exists(_.typeSymbol.isAbstractType) || tp1.typeSymbol != NullClass) case (ExistentialType(_, _), _) => try { skolemizationLevel += 1 @@ -3638,9 +3638,9 @@ A type's typeSymbol should never be inspected directly. case (TypeRef(pre1, sym1, args1), _) => if (inIDE) trackTypeIDE(sym1) - (sym1 == AllClass && tp2 <:< AnyClass.tpe + (sym1 == NothingClass && tp2 <:< AnyClass.tpe || - sym1 == AllRefClass && tp2.isInstanceOf[SingletonType] && (tp1 <:< tp2.widen)) + sym1 == NullClass && tp2.isInstanceOf[SingletonType] && (tp1 <:< tp2.widen)) case _ => false }) || { @@ -3663,8 +3663,8 @@ A type's typeSymbol should never be inspected directly. * refinement type, otherwise we might return false negatives. */ def specializesSym(tp: Type, sym: Symbol): Boolean = - tp.typeSymbol == AllClass || - tp.typeSymbol == AllRefClass && (sym.owner isSubClass ObjectClass) || + tp.typeSymbol == NothingClass || + tp.typeSymbol == NullClass && (sym.owner isSubClass ObjectClass) || (tp.nonPrivateMember(sym.name).alternatives exists (alt => sym == alt || specializesSym(tp.narrow, alt, sym.owner.thisType, sym))) @@ -3764,7 +3764,7 @@ A type's typeSymbol should never be inspected directly. tvar.constr.hibounds = tparam2.tpe.instantiateTypeParams(tparams, tvars) :: tvar.constr.hibounds } else { - if (bound.typeSymbol != AllClass && bound.typeSymbol != tparam) { + if (bound.typeSymbol != NothingClass && bound.typeSymbol != tparam) { tvar.constr.lobounds = bound.instantiateTypeParams(tparams, tvars) :: tvar.constr.lobounds } @@ -3899,7 +3899,7 @@ A type's typeSymbol should never be inspected directly. /** The least upper bound wrt <:< of a list of types */ def lub(ts: List[Type], depth: Int): Type = { def lub0(ts0: List[Type]): Type = elimSub(ts0) match { - case List() => AllClass.tpe + case List() => NothingClass.tpe case List(t) => t case ts @ PolyType(tparams, _) :: _ => PolyType( @@ -4042,7 +4042,7 @@ A type's typeSymbol should never be inspected directly. val symbounds = symtypes filter isTypeBound var result: Type = if (symbounds.isEmpty) - mkTypeBounds(AllClass.tpe, AnyClass.tpe) + mkTypeBounds(NothingClass.tpe, AnyClass.tpe) else glbBounds(symbounds) for (t <- symtypes if !isTypeBound(t)) if (result.bounds containsType t) result = t @@ -4062,8 +4062,8 @@ A type's typeSymbol should never be inspected directly. existentialAbstraction(tparams, glbType) } catch { case GlbFailure => - if (ts forall (t => AllRefClass.tpe <:< t)) AllRefClass.tpe - else AllClass.tpe + if (ts forall (t => NullClass.tpe <:< t)) NullClass.tpe + else NothingClass.tpe } } if (settings.debug.value) { @@ -4116,7 +4116,7 @@ A type's typeSymbol should never be inspected directly. (tparam, as) => if (depth == 0) if (tparam.variance == variance) AnyClass.tpe - else if (tparam.variance == -variance) AllClass.tpe + else if (tparam.variance == -variance) NothingClass.tpe else NoType else if (tparam.variance == variance) lub(as, depth-1) diff --git a/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala b/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala index 6fdaec7caf..ce98eac3ff 100644 --- a/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala +++ b/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala @@ -496,11 +496,11 @@ abstract class ClassfileParser { case variance @ ('+' | '-' | '*') => index += 1 val bounds = variance match { - case '+' => mkTypeBounds(definitions.AllClass.tpe, + case '+' => mkTypeBounds(definitions.NothingClass.tpe, sig2type(tparams)) case '-' => mkTypeBounds(sig2type(tparams), definitions.AnyClass.tpe) - case '*' => mkTypeBounds(definitions.AllClass.tpe, + case '*' => mkTypeBounds(definitions.NothingClass.tpe, definitions.AnyClass.tpe) } val newtparam = makeExistential("?"+i, sym, bounds) @@ -574,7 +574,7 @@ abstract class ClassfileParser { if (sig(index) != ':') // guard against empty class bound ts += objToAny(sig2type(tparams)) } - s.setInfo(mkTypeBounds(definitions.AllClass.tpe, + s.setInfo(mkTypeBounds(definitions.NothingClass.tpe, intersectionType(ts.toList, sym))) newTParams += s } diff --git a/src/compiler/scala/tools/nsc/symtab/classfile/ICodeReader.scala b/src/compiler/scala/tools/nsc/symtab/classfile/ICodeReader.scala index f945809e72..feb29d5de4 100644 --- a/src/compiler/scala/tools/nsc/symtab/classfile/ICodeReader.scala +++ b/src/compiler/scala/tools/nsc/symtab/classfile/ICodeReader.scala @@ -187,9 +187,9 @@ abstract class ICodeReader extends ClassfileParser { override def classNameToSymbol(name: Name) = { val sym = if (name == nothingName) - definitions.AllClass + definitions.NothingClass else if (name == nullName) - definitions.AllRefClass + definitions.NullClass else if (name.endsWith("$class")) { val iface = definitions.getClass(name.subName(0, name.length - "$class".length)) log("forcing " + iface) diff --git a/src/compiler/scala/tools/nsc/symtab/classfile/MetaParser.scala b/src/compiler/scala/tools/nsc/symtab/classfile/MetaParser.scala index 21251e3ed8..0b0d77310a 100644 --- a/src/compiler/scala/tools/nsc/symtab/classfile/MetaParser.scala +++ b/src/compiler/scala/tools/nsc/symtab/classfile/MetaParser.scala @@ -72,7 +72,7 @@ abstract class MetaParser{ nextToken() val lo = if (token == ">") { nextToken(); parseType() } - else definitions.AllClass.tpe + else definitions.NothingClass.tpe val hi = if (token == "<") { nextToken(); parseType() } else definitions.AnyClass.tpe diff --git a/src/compiler/scala/tools/nsc/transform/CleanUp.scala b/src/compiler/scala/tools/nsc/transform/CleanUp.scala index c4a7240144..5a3ecabbca 100644 --- a/src/compiler/scala/tools/nsc/transform/CleanUp.scala +++ b/src/compiler/scala/tools/nsc/transform/CleanUp.scala @@ -544,7 +544,7 @@ abstract class CleanUp extends Transform { * store their result in a local variable. The catch blocks are adjusted as well. * The try tree is subsituted by a block whose result expression is read of that variable. */ case theTry @ Try(block, catches, finalizer) - if theTry.tpe.typeSymbol != definitions.UnitClass && theTry.tpe.typeSymbol != definitions.AllClass => + if theTry.tpe.typeSymbol != definitions.UnitClass && theTry.tpe.typeSymbol != definitions.NothingClass => val tpe = theTry.tpe.widen val tempVar = currentOwner.newValue(theTry.pos, unit.fresh.newName(theTry.pos, "exceptionResult")) .setInfo(tpe).setFlag(Flags.MUTABLE) diff --git a/src/compiler/scala/tools/nsc/typechecker/DeVirtualize.scala b/src/compiler/scala/tools/nsc/typechecker/DeVirtualize.scala index 0233ba66ca..964b0c5eee 100644 --- a/src/compiler/scala/tools/nsc/typechecker/DeVirtualize.scala +++ b/src/compiler/scala/tools/nsc/typechecker/DeVirtualize.scala @@ -252,7 +252,7 @@ abstract class DeVirtualize extends InfoTransform with TypingTransformers { val parents2 = addOverriddenVirtuals(clazz) map { c => typeRef(clazz.owner.thisType, c, typeParams map (_.tpe)) } - mkTypeBounds(AllClass.tpe, intersectionType(parents1 ::: parents2)) + mkTypeBounds(NothingClass.tpe, intersectionType(parents1 ::: parents2)) } } } diff --git a/src/compiler/scala/tools/nsc/typechecker/Infer.scala b/src/compiler/scala/tools/nsc/typechecker/Infer.scala index 00cc09c046..eccb8f8f4d 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Infer.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Infer.scala @@ -508,7 +508,7 @@ trait Infer { /** Return inferred type arguments, given type parameters, formal parameters, * argument types, result type and expected result type. * If this is not possible, throw a <code>NoInstance</code> exception. - * Undetermined type arguments are represented by `definitions.AllClass.tpe'. + * Undetermined type arguments are represented by `definitions.NothingClass.tpe'. * No check that inferred parameters conform to their bounds is made here. * * @param tparams the type parameters of the method @@ -559,7 +559,7 @@ trait Infer { val targs = solvedTypes(tvars, tparams, tparams map varianceInTypes(formals), false) // val res = List.map2(tparams, targs) {(tparam, targ) => - if (targ.typeSymbol == AllClass && (varianceInType(restpe)(tparam) & COVARIANT) == 0) { + if (targ.typeSymbol == NothingClass && (varianceInType(restpe)(tparam) & COVARIANT) == 0) { uninstantiated += tparam tparam.tpe //@M TODO: might be affected by change to tpe in Symbol } else if (targ.typeSymbol == RepeatedParamClass) { @@ -804,7 +804,7 @@ trait Infer { val hkparams = param.typeParams if(hkargs.length != hkparams.length) { - if(arg == AnyClass || arg == AllClass) (Nil, Nil, Nil) // Any and Nothing are kind-overloaded + if(arg == AnyClass || arg == NothingClass) (Nil, Nil, Nil) // Any and Nothing are kind-overloaded else (List((arg, param)), Nil, Nil) } else { val _arityMismatches = new ListBuffer[(Symbol, Symbol)] @@ -1113,7 +1113,7 @@ trait Infer { patternWarning(tp, "abstract type ") else if (sym.isAliasType) check(tp.normalize, bound) - else if (sym == AllClass || sym == AllRefClass) + else if (sym == NothingClass || sym == NullClass) error(pos, "this type cannot be used in a type pattern") else for (arg <- args) { @@ -1259,7 +1259,7 @@ trait Infer { } def checkDead(tree: Tree): Tree = { - if (settings.Xwarndeadcode.value && tree.tpe.typeSymbol == AllClass) + if (settings.Xwarndeadcode.value && tree.tpe.typeSymbol == NothingClass) context.warning (tree.pos, "dead code following this construct") tree } diff --git a/src/compiler/scala/tools/nsc/typechecker/Namers.scala b/src/compiler/scala/tools/nsc/typechecker/Namers.scala index 2223aa671a..db79d072c7 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Namers.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Namers.scala @@ -799,7 +799,7 @@ trait Namers { self: Analyzer => val tparamSyms = typer.reenterTypeParams(tparams) //@M make tparams available in scope (just for this abstypedef) val tp = typer.typedType(rhs).tpe match { case TypeBounds(lt, rt) if (lt.isError || rt.isError) => - TypeBounds(AllClass.tpe, AnyClass.tpe) + TypeBounds(NothingClass.tpe, AnyClass.tpe) case tp @ TypeBounds(lt, rt) if (tpsym hasFlag JAVA) => TypeBounds(lt, objToAny(rt)) case tp => diff --git a/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala b/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala index 0e7f8384c2..60abdcdb4b 100644 --- a/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala +++ b/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala @@ -567,7 +567,7 @@ abstract class RefChecks extends InfoTransform { !(receiver isSubClass actual)) nonSensible("", false) else if ((receiver hasFlag FINAL) && hasObjectEquals && !isValueClass(receiver) && - !(receiver isSubClass actual) && receiver != AllRefClass && actual != AllRefClass && + !(receiver isSubClass actual) && receiver != NullClass && actual != NullClass && (name == nme.EQ || name == nme.LE)) nonSensible("non-null ", false) else if ((isNew(qual) || isNew(args.head)) && hasObjectEquals && diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala index 03c6bcebf4..257461a9cb 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala @@ -695,7 +695,7 @@ trait Typers { self: Analyzer => // (e.g., m[Int] --> tree.tpe.symbol.typeParams.length == 1, tree.tpe.typeParams.length == 0!) tree.tpe.typeParams.length != pt.typeParams.length && !(tree.tpe.typeSymbol==AnyClass || - tree.tpe.typeSymbol==AllClass || + tree.tpe.typeSymbol==NothingClass || pt == WildcardType )) { // Check that the actual kind arity (tree.symbol.typeParams.length) conforms to the expected // kind-arity (pt.typeParams.length). Full checks are done in checkKindBounds in Infer. @@ -848,7 +848,7 @@ trait Typers { self: Analyzer => if (qual.isTerm && ((qual.symbol eq null) || !qual.symbol.isTerm || qual.symbol.isValue) && phase.id <= currentRun.typerPhase.id && !qtpe.isError && !tp.isError && - qtpe.typeSymbol != AllRefClass && qtpe.typeSymbol != AllClass && qtpe != WildcardType) { + qtpe.typeSymbol != NullClass && qtpe.typeSymbol != NothingClass && qtpe != WildcardType) { val coercion = inferView(qual.pos, qtpe, name, tp, true) if (coercion != EmptyTree) typedQualifier(atPos(qual.pos)(Apply(coercion, List(qual)))) @@ -1328,7 +1328,7 @@ trait Typers { self: Analyzer => if (meth.isPrimaryConstructor && meth.isClassConstructor && phase.id <= currentRun.typerPhase.id && !reporter.hasErrors) computeParamAliases(meth.owner, vparamss1, rhs1) - if (tpt1.tpe.typeSymbol != AllClass && !context.returnsSeen) rhs1 = checkDead(rhs1) + if (tpt1.tpe.typeSymbol != NothingClass && !context.returnsSeen) rhs1 = checkDead(rhs1) if (meth.owner.isRefinementClass && meth.allOverriddenSymbols.isEmpty) for (vparams <- ddef.vparamss; vparam <- vparams) @@ -1625,7 +1625,7 @@ trait Typers { self: Analyzer => !hasArrayElement(adaptedFormals(nonVarCount)) && !settings.XnoVarargsConversion.value) { val lastarg = typedArg(args(nonVarCount), mode, REGPATmode, WildcardType) - if ((lastarg.tpe.typeSymbol == ArrayClass || lastarg.tpe.typeSymbol == AllRefClass) && + if ((lastarg.tpe.typeSymbol == ArrayClass || lastarg.tpe.typeSymbol == NullClass) && !treeInfo.isWildcardStarArg(lastarg)) { if (lastarg.tpe.typeSymbol == ArrayClass) unit.warning( @@ -1652,7 +1652,7 @@ trait Typers { self: Analyzer => def needsInstantiation(tparams: List[Symbol], formals: List[Type], args: List[Tree]) = { def isLowerBounded(tparam: Symbol) = { val losym = tparam.info.bounds.lo.typeSymbol - losym != AllClass && losym != AllRefClass + losym != NothingClass && losym != NullClass } List.exists2(formals, args) { case (formal, Function(vparams, _)) => @@ -1687,7 +1687,7 @@ trait Typers { self: Analyzer => case Function(vparams, body) => functionType(vparams map (vparam => AnyClass.tpe), shapeType(body)) case _ => - AllClass.tpe + NothingClass.tpe } val argtypes = args map shapeType val pre = fun.symbol.tpe.prefix @@ -2293,7 +2293,7 @@ trait Typers { self: Analyzer => context.owner.newAliasType(tree.pos, name) setInfo pt else context.owner.newAbstractType(tree.pos, name) setInfo - mkTypeBounds(AllClass.tpe, AnyClass.tpe) + mkTypeBounds(NothingClass.tpe, AnyClass.tpe) val rawInfo = vble.rawInfo vble = if (vble.name == nme.WILDCARD.toTypeName) context.scope.enter(vble) else namer.enterInScope(vble) @@ -2393,7 +2393,7 @@ trait Typers { self: Analyzer => } else { context.enclMethod.returnsSeen = true val expr1: Tree = typed(expr, restpt0.tpe) - copy.Return(tree, checkDead(expr1)) setSymbol enclMethod.owner setType AllClass.tpe + copy.Return(tree, checkDead(expr1)) setSymbol enclMethod.owner setType NothingClass.tpe } } } @@ -3117,7 +3117,7 @@ trait Typers { self: Analyzer => case Throw(expr) => val expr1 = typed(expr, ThrowableClass.tpe) - copy.Throw(tree, expr1) setType AllClass.tpe + copy.Throw(tree, expr1) setType NothingClass.tpe case New(tpt: Tree) => typedNew(tpt) |