diff options
Diffstat (limited to 'src/compiler/scala/tools/nsc/typechecker')
14 files changed, 76 insertions, 76 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/AnalyzerPlugins.scala b/src/compiler/scala/tools/nsc/typechecker/AnalyzerPlugins.scala index 4210d0b9fb..54e4fefc15 100644 --- a/src/compiler/scala/tools/nsc/typechecker/AnalyzerPlugins.scala +++ b/src/compiler/scala/tools/nsc/typechecker/AnalyzerPlugins.scala @@ -146,7 +146,7 @@ trait AnalyzerPlugins { self: Analyzer => /** * Modify the type of a return expression. By default, return expressions have type - * NothingClass.tpe. + * NothingTpe. * * @param tpe The type of the return expression * @param typer The typer that was used for typing the return tree diff --git a/src/compiler/scala/tools/nsc/typechecker/Checkable.scala b/src/compiler/scala/tools/nsc/typechecker/Checkable.scala index 0686b28079..31a31df764 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Checkable.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Checkable.scala @@ -247,7 +247,7 @@ trait Checkable { case TypeRef(_, NothingClass | NullClass | AnyValClass, _) => false case RefinedType(_, decls) if !decls.isEmpty => false case p => - new CheckabilityChecker(AnyClass.tpe, p) isCheckable + new CheckabilityChecker(AnyTpe, p) isCheckable }) ) diff --git a/src/compiler/scala/tools/nsc/typechecker/ContextErrors.scala b/src/compiler/scala/tools/nsc/typechecker/ContextErrors.scala index 9a18248929..135a79124d 100644 --- a/src/compiler/scala/tools/nsc/typechecker/ContextErrors.scala +++ b/src/compiler/scala/tools/nsc/typechecker/ContextErrors.scala @@ -71,7 +71,7 @@ trait ContextErrors { extends TreeTypeError { def errMsg: String = errMsgForPt(pt0) def withPt(pt: Type): AbsTypeError = this.copy(pt0 = pt) - private def errMsgForPt(pt: Type) = + private def errMsgForPt(pt: Type) = s"diverging implicit expansion for type ${pt}\nstarting with ${sym.fullLocationString}" } @@ -1145,7 +1145,7 @@ trait ContextErrors { // failures which have nothing to do with implicit conversions // per se, but which manifest as implicit conversion conflicts // involving Any, are further explained from foundReqMsg. - if (AnyRefClass.tpe <:< req) ( + if (AnyRefTpe <:< req) ( if (sym == AnyClass || sym == UnitClass) ( sm"""|Note: ${sym.name} is not implicitly converted to AnyRef. You can safely |pattern match `x: AnyRef` or cast `x.asInstanceOf[AnyRef]` to do so.""" diff --git a/src/compiler/scala/tools/nsc/typechecker/Duplicators.scala b/src/compiler/scala/tools/nsc/typechecker/Duplicators.scala index aa05c97c08..95b771a8a5 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Duplicators.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Duplicators.scala @@ -17,7 +17,7 @@ import scala.collection.{ mutable, immutable } */ abstract class Duplicators extends Analyzer { import global._ - import definitions.{ AnyRefClass, AnyValClass } + import definitions._ /** Retype the given tree in the given context. Use this method when retyping * a method in a different class. The typer will replace references to the this of @@ -346,8 +346,8 @@ abstract class Duplicators extends Analyzer { // Without this, AnyRef specializations crash on patterns like // case _: Boolean => ... // Not at all sure this is safe. - else if (scrutTpe <:< AnyRefClass.tpe) - cases filterNot (_.pat.tpe <:< AnyValClass.tpe) + else if (scrutTpe <:< AnyRefTpe) + cases filterNot (_.pat.tpe <:< AnyValTpe) else cases } @@ -361,7 +361,7 @@ abstract class Duplicators extends Analyzer { case _ => debuglog("Duplicators default case: " + tree.summaryString) debuglog(" ---> " + tree) - if (tree.hasSymbolField && tree.symbol != NoSymbol && (tree.symbol.owner == definitions.AnyClass)) { + if (tree.hasSymbolField && tree.symbol != NoSymbol && (tree.symbol.owner == AnyClass)) { tree.symbol = NoSymbol // maybe we can find a more specific member in a subclass of Any (see AnyVal members, like ==) } val ntree = castType(tree, pt) diff --git a/src/compiler/scala/tools/nsc/typechecker/Implicits.scala b/src/compiler/scala/tools/nsc/typechecker/Implicits.scala index 37257b4f4e..a6a3a4911f 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Implicits.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Implicits.scala @@ -131,7 +131,7 @@ trait Implicits { val tvars = tpars map (TypeVar untouchable _) val tpSubsted = tp.subst(tpars, tvars) - val search = new ImplicitSearch(EmptyTree, functionType(List(tpSubsted), AnyClass.tpe), true, context.makeImplicit(reportAmbiguousErrors = false)) + val search = new ImplicitSearch(EmptyTree, functionType(List(tpSubsted), AnyTpe), true, context.makeImplicit(reportAmbiguousErrors = false)) search.allImplicitsPoly(tvars) } @@ -1259,8 +1259,8 @@ trait Implicits { // looking for a manifest of a type parameter that hasn't been inferred by now, // can't do much, but let's not fail else if (undetParams contains sym) { - // #3859: need to include the mapping from sym -> NothingClass.tpe in the SearchResult - mot(NothingClass.tpe, sym :: from, NothingClass.tpe :: to) + // #3859: need to include the mapping from sym -> NothingTpe in the SearchResult + mot(NothingTpe, sym :: from, NothingTpe :: to) } else { // a manifest should have been found by normal searchImplicit EmptyTree diff --git a/src/compiler/scala/tools/nsc/typechecker/Infer.scala b/src/compiler/scala/tools/nsc/typechecker/Infer.scala index 3abbfbd00c..961ef484d8 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Infer.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Infer.scala @@ -531,7 +531,7 @@ trait Infer extends Checkable { def unapply(m: Result): Some[(List[Symbol], List[Type], List[Type], List[Symbol])] = Some(toLists{ val (ok, nok) = m.map{case (p, a) => (p, a.getOrElse(null))}.partition(_._2 ne null) val (okArgs, okTparams) = ok.unzip - (okArgs, okTparams, m.values.map(_.getOrElse(NothingClass.tpe)), nok.keys) + (okArgs, okTparams, m.values.map(_.getOrElse(NothingTpe)), nok.keys) }) } @@ -581,7 +581,7 @@ trait Infer extends Checkable { /** Return inferred type arguments, given type parameters, formal parameters, * argument types, result type and expected result type. * If this is not possible, throw a `NoInstance` exception. - * Undetermined type arguments are represented by `definitions.NothingClass.tpe`. + * Undetermined type arguments are represented by `definitions.NothingTpe`. * No check that inferred parameters conform to their bounds is made here. * * @param tparams the type parameters of the method @@ -725,7 +725,7 @@ trait Infer extends Checkable { if (pos == -1) { if (positionalAllowed) { // treat assignment as positional argument argPos(index) = index - res = UnitClass.tpe + res = UnitTpe } else // unknown parameter name namesOK = false } else if (argPos.contains(pos)) { // parameter specified twice @@ -773,10 +773,10 @@ trait Infer extends Checkable { * @pre: the argument list is eligible for tuple conversion. */ private def typeAfterTupleConversion(argtpes: List[Type]): Type = ( - if (argtpes.isEmpty) UnitClass.tpe // aka "Tuple0" + if (argtpes.isEmpty) UnitTpe // aka "Tuple0" else tupleType(argtpes map { - case NamedType(name, tp) => UnitClass.tpe // not a named arg - only assignments here - case RepeatedType(tp) => tp // but probably shouldn't be tupling a call containing :_* + case NamedType(name, tp) => UnitTpe // not a named arg - only assignments here + case RepeatedType(tp) => tp // but probably shouldn't be tupling a call containing :_* case tp => tp }) ) diff --git a/src/compiler/scala/tools/nsc/typechecker/MethodSynthesis.scala b/src/compiler/scala/tools/nsc/typechecker/MethodSynthesis.scala index 50383a1e78..cc3a43a66e 100644 --- a/src/compiler/scala/tools/nsc/typechecker/MethodSynthesis.scala +++ b/src/compiler/scala/tools/nsc/typechecker/MethodSynthesis.scala @@ -103,7 +103,7 @@ trait MethodSynthesis { createMethod(original)(m => gen.mkMethodCall(newMethod, transformArgs(m.paramss.head map Ident))) def createSwitchMethod(name: Name, range: Seq[Int], returnType: Type)(f: Int => Tree) = { - createMethod(name, List(IntClass.tpe), returnType) { m => + createMethod(name, List(IntTpe), returnType) { m => val arg0 = Ident(m.firstParam) val default = DEFAULT ==> THROW(IndexOutOfBoundsExceptionClass, arg0) val cases = range.map(num => CASE(LIT(num)) ==> f(num)).toList :+ default diff --git a/src/compiler/scala/tools/nsc/typechecker/Namers.scala b/src/compiler/scala/tools/nsc/typechecker/Namers.scala index 55f144da13..9efb54d6cd 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Namers.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Namers.scala @@ -765,7 +765,7 @@ trait Namers extends MethodSynthesis { def accessorTypeCompleter(tree: ValDef, isSetter: Boolean) = mkTypeCompleter(tree) { sym => logAndValidate(sym) { sym setInfo { - val tp = if (isSetter) MethodType(List(sym.newSyntheticValueParam(typeSig(tree))), UnitClass.tpe) + val tp = if (isSetter) MethodType(List(sym.newSyntheticValueParam(typeSig(tree))), UnitTpe) else NullaryMethodType(typeSig(tree)) pluginsTypeSigAccessor(tp, typer, tree, sym) } @@ -863,7 +863,7 @@ trait Namers extends MethodSynthesis { private def templateSig(templ: Template): Type = { val clazz = context.owner def checkParent(tpt: Tree): Type = { - if (tpt.tpe.isError) AnyRefClass.tpe + if (tpt.tpe.isError) AnyRefTpe else tpt.tpe } @@ -1493,8 +1493,8 @@ trait Namers extends MethodSynthesis { private object RestrictJavaArraysMap extends TypeMap { def apply(tp: Type): Type = tp match { case TypeRef(pre, ArrayClass, List(elemtp)) - if elemtp.typeSymbol.isAbstractType && !(elemtp <:< ObjectClass.tpe) => - TypeRef(pre, ArrayClass, List(intersectionType(List(elemtp, ObjectClass.tpe)))) + if elemtp.typeSymbol.isAbstractType && !(elemtp <:< ObjectTpe) => + TypeRef(pre, ArrayClass, List(intersectionType(List(elemtp, ObjectTpe)))) case _ => mapOver(tp) } diff --git a/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala b/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala index 50b92f13ab..407eb3ac18 100644 --- a/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala +++ b/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala @@ -748,7 +748,7 @@ abstract class RefChecks extends InfoTransform with scala.reflect.internal.trans // Have to use matchingSymbol, not a method involving overridden symbols, // because the scala type system understands that an abstract method here does not // override a concrete method in Object. The jvm, however, does not. - val overridden = decl.matchingSymbol(ObjectClass, ObjectClass.tpe) + val overridden = decl.matchingSymbol(ObjectClass, ObjectTpe) if (overridden.isFinal) unit.error(decl.pos, "trait cannot redefine final method from class AnyRef") } @@ -996,7 +996,7 @@ abstract class RefChecks extends InfoTransform with scala.reflect.internal.trans // equals method inherited from Object or a case class synthetic equals (for // which we know the logic.) def isWarnable = isReferenceOp || (isUsingDefaultScalaOp && isUsingWarnableEquals) - def isEitherNullable = (NullClass.tpe <:< receiver.info) || (NullClass.tpe <:< actual.info) + def isEitherNullable = (NullTpe <:< receiver.info) || (NullTpe <:< actual.info) def isEitherValueClass = actual.isDerivedValueClass || receiver.isDerivedValueClass def isBoolean(s: Symbol) = unboxedValueClass(s) == BooleanClass def isUnit(s: Symbol) = unboxedValueClass(s) == UnitClass @@ -1081,7 +1081,7 @@ abstract class RefChecks extends InfoTransform with scala.reflect.internal.trans // better to have lubbed and lost def warnIfLubless(): Unit = { val common = global.lub(List(actual.tpe, receiver.tpe)) - if (ObjectClass.tpe <:< common) + if (ObjectTpe <:< common) unrelatedTypes() } // warn if actual has a case parent that is not same as receiver's; @@ -1533,7 +1533,7 @@ abstract class RefChecks extends InfoTransform with scala.reflect.internal.trans private def transformIf(tree: If): Tree = { val If(cond, thenpart, elsepart) = tree def unitIfEmpty(t: Tree): Tree = - if (t == EmptyTree) Literal(Constant(())).setPos(tree.pos).setType(UnitClass.tpe) else t + if (t == EmptyTree) Literal(Constant(())).setPos(tree.pos).setType(UnitTpe) else t cond.tpe match { case ConstantType(value) => diff --git a/src/compiler/scala/tools/nsc/typechecker/SuperAccessors.scala b/src/compiler/scala/tools/nsc/typechecker/SuperAccessors.scala index 4e78cecd7d..6933b10a0a 100644 --- a/src/compiler/scala/tools/nsc/typechecker/SuperAccessors.scala +++ b/src/compiler/scala/tools/nsc/typechecker/SuperAccessors.scala @@ -30,7 +30,7 @@ import symtab.Flags._ */ abstract class SuperAccessors extends transform.Transform with transform.TypingTransformers { import global._ - import definitions.{ UnitClass, ObjectClass, isRepeatedParamType, isByNameParamType, Any_asInstanceOf } + import definitions._ import analyzer.{ restrictionError } /** the following two members override abstract members in Transform */ @@ -458,7 +458,7 @@ abstract class SuperAccessors extends transform.Transform with transform.TypingT val protAcc = clazz.newMethod(accName, field.pos, newFlags = ARTIFACT) val paramTypes = List(clazz.typeOfThis, field.tpe) val params = protAcc newSyntheticValueParams paramTypes - val accessorType = MethodType(params, UnitClass.tpe) + val accessorType = MethodType(params, UnitTpe) protAcc setInfoAndEnter accessorType val obj :: value :: Nil = params diff --git a/src/compiler/scala/tools/nsc/typechecker/SyntheticMethods.scala b/src/compiler/scala/tools/nsc/typechecker/SyntheticMethods.scala index 406bc445c9..4ff3c39df3 100644 --- a/src/compiler/scala/tools/nsc/typechecker/SyntheticMethods.scala +++ b/src/compiler/scala/tools/nsc/typechecker/SyntheticMethods.scala @@ -100,7 +100,7 @@ trait SyntheticMethods extends ast.TreeDSL { case tp => tp } } - else AnyClass.tpe + else AnyTpe ) def forwardToRuntime(method: Symbol): Tree = @@ -131,7 +131,7 @@ trait SyntheticMethods extends ast.TreeDSL { def perElementMethod(name: Name, returnType: Type)(caseFn: Symbol => Tree): Tree = createSwitchMethod(name, accessors.indices, returnType)(idx => caseFn(accessors(idx))) - // def productElementNameMethod = perElementMethod(nme.productElementName, StringClass.tpe)(x => LIT(x.name.toString)) + // def productElementNameMethod = perElementMethod(nme.productElementName, StringTpe)(x => LIT(x.name.toString)) var syntheticCanEqual = false @@ -140,7 +140,7 @@ trait SyntheticMethods extends ast.TreeDSL { */ def canEqualMethod: Tree = { syntheticCanEqual = true - createMethod(nme.canEqual_, List(AnyClass.tpe), BooleanClass.tpe)(m => + createMethod(nme.canEqual_, List(AnyTpe), BooleanTpe)(m => Ident(m.firstParam) IS_OBJ classExistentialType(clazz)) } @@ -200,7 +200,7 @@ trait SyntheticMethods extends ast.TreeDSL { * } * } */ - def equalsCaseClassMethod: Tree = createMethod(nme.equals_, List(AnyClass.tpe), BooleanClass.tpe) { m => + def equalsCaseClassMethod: Tree = createMethod(nme.equals_, List(AnyTpe), BooleanTpe) { m => if (accessors.isEmpty) if (clazz.isFinal) thatTest(m) else thatTest(m) AND ((thatCast(m) DOT nme.canEqual_)(mkThis)) @@ -214,14 +214,14 @@ trait SyntheticMethods extends ast.TreeDSL { * val x$1 = that.asInstanceOf[this.C] * (this.underlying == that.underlying */ - def equalsDerivedValueClassMethod: Tree = createMethod(nme.equals_, List(AnyClass.tpe), BooleanClass.tpe) { m => + def equalsDerivedValueClassMethod: Tree = createMethod(nme.equals_, List(AnyTpe), BooleanTpe) { m => equalsCore(m, List(clazz.derivedValueClassUnbox)) } /* The hashcode method for value classes * def hashCode(): Int = this.underlying.hashCode */ - def hashCodeDerivedValueClassMethod: Tree = createMethod(nme.hashCode_, Nil, IntClass.tpe) { m => + def hashCodeDerivedValueClassMethod: Tree = createMethod(nme.hashCode_, Nil, IntTpe) { m => Select(mkThisSelect(clazz.derivedValueClassUnbox), nme.hashCode_) } @@ -265,8 +265,8 @@ trait SyntheticMethods extends ast.TreeDSL { } def specializedHashcode = { - createMethod(nme.hashCode_, Nil, IntClass.tpe) { m => - val accumulator = m.newVariable(newTermName("acc"), m.pos, SYNTHETIC) setInfo IntClass.tpe + createMethod(nme.hashCode_, Nil, IntTpe) { m => + val accumulator = m.newVariable(newTermName("acc"), m.pos, SYNTHETIC) setInfo IntTpe val valdef = ValDef(accumulator, Literal(Constant(0xcafebabe))) val mixes = accessors map (acc => Assign( @@ -356,7 +356,7 @@ trait SyntheticMethods extends ast.TreeDSL { // This method should be generated as private, but apparently if it is, then // it is name mangled afterward. (Wonder why that is.) So it's only protected. // For sure special methods like "readResolve" should not be mangled. - List(createMethod(nme.readResolve, Nil, ObjectClass.tpe)(m => { m setFlag PRIVATE ; REF(clazz.sourceModule) })) + List(createMethod(nme.readResolve, Nil, ObjectTpe)(m => { m setFlag PRIVATE ; REF(clazz.sourceModule) })) } else Nil ) diff --git a/src/compiler/scala/tools/nsc/typechecker/Tags.scala b/src/compiler/scala/tools/nsc/typechecker/Tags.scala index d2d7f57aef..32a66aa4dd 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Tags.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Tags.scala @@ -30,7 +30,7 @@ trait Tags { * However we found out that we don't really need this concept, so it got removed. * * @param pos Position for error reporting. Please, provide meaningful value. - * @param tp Type we're looking a ClassTag for, e.g. resolveClassTag(pos, IntClass.tpe) will look for ClassTag[Int]. + * @param tp Type we're looking a ClassTag for, e.g. resolveClassTag(pos, IntTpe) will look for ClassTag[Int]. * @param allowMaterialization If true (default) then the resolver is allowed to launch materialization macros when there's no class tag in scope. * If false then materialization macros are prohibited from running. * @@ -49,7 +49,7 @@ trait Tags { * @param pre Prefix that represents a universe this type tag will be bound to. * If `pre` is set to `NoType`, then any type tag in scope will do, regardless of its affiliation. * If `pre` is set to `NoType`, and tag resolution involves materialization, then `mkRuntimeUniverseRef` will be used. - * @param tp Type we're looking a TypeTag for, e.g. resolveTypeTag(pos, mkRuntimeUniverseRef, IntClass.tpe, false) will look for scala.reflect.runtime.universe.TypeTag[Int]. + * @param tp Type we're looking a TypeTag for, e.g. resolveTypeTag(pos, mkRuntimeUniverseRef, IntTpe, false) will look for scala.reflect.runtime.universe.TypeTag[Int]. * @param concrete If true then the result must not contain unresolved (i.e. not spliced) type parameters and abstract type members. * If false then the function will always succeed (abstract types will be reified as free types). * @param allowMaterialization If true (default) then the resolver is allowed to launch materialization macros when there's no type tag in scope. @@ -69,4 +69,4 @@ trait Tags { resolveTag(pos, taggedTp, allowMaterialization) } } -}
\ No newline at end of file +} diff --git a/src/compiler/scala/tools/nsc/typechecker/TypeDiagnostics.scala b/src/compiler/scala/tools/nsc/typechecker/TypeDiagnostics.scala index b2a6e7340d..5d790ba835 100644 --- a/src/compiler/scala/tools/nsc/typechecker/TypeDiagnostics.scala +++ b/src/compiler/scala/tools/nsc/typechecker/TypeDiagnostics.scala @@ -253,7 +253,7 @@ trait TypeDiagnostics { // For found/required errors where AnyRef would have sufficed: // explain in greater detail. def explainAnyVsAnyRef(found: Type, req: Type): String = { - if (AnyRefClass.tpe <:< req) notAnyRefMessage(found) else "" + if (AnyRefTpe <:< req) notAnyRefMessage(found) else "" } // TODO - figure out how to avoid doing any work at all diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala index b7e0d44e96..0b541c24c1 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala @@ -1147,7 +1147,7 @@ trait Typers extends Adaptations with Tags { if (mode.typingExprNotFun) { // The <: Any requirement inhibits attempts to adapt continuation types // to non-continuation types. - if (tree.tpe <:< AnyClass.tpe) pt.dealias match { + if (tree.tpe <:< AnyTpe) pt.dealias match { case TypeRef(_, UnitClass, _) => // (12) if (settings.warnValueDiscard) context.unit.warning(tree.pos, "discarded non-Unit value") @@ -1284,10 +1284,10 @@ trait Typers extends Adaptations with Tags { */ def instantiateExpectingUnit(tree: Tree, mode: Mode): Tree = { val savedUndetparams = context.undetparams - silent(_.instantiate(tree, mode, UnitClass.tpe)) orElse { _ => + silent(_.instantiate(tree, mode, UnitTpe)) orElse { _ => context.undetparams = savedUndetparams val valueDiscard = atPos(tree.pos)(Block(List(instantiate(tree, mode, WildcardType)), Literal(Constant(())))) - typed(valueDiscard, mode, UnitClass.tpe) + typed(valueDiscard, mode, UnitTpe) } } @@ -1708,7 +1708,7 @@ trait Typers extends Adaptations with Tags { } def typedParentTypes(templ: Template): List[Tree] = templ.parents match { - case Nil => List(atPos(templ.pos)(TypeTree(AnyRefClass.tpe))) + case Nil => List(atPos(templ.pos)(TypeTree(AnyRefTpe))) case first :: rest => try { val supertpts = fixDuplicateSyntheticParents(normalizeFirstParent( @@ -1734,7 +1734,7 @@ trait Typers extends Adaptations with Tags { log("Type error calculating parents in template " + templ) log("Error: " + ex) ParentTypesError(templ, ex) - List(TypeTree(AnyRefClass.tpe)) + List(TypeTree(AnyRefTpe)) } } @@ -1820,7 +1820,7 @@ trait Typers extends Adaptations with Tags { for (tparam <- clazz.typeParams) { if (classinfo.expansiveRefs(tparam) contains tparam) { val newinfo = ClassInfoType( - classinfo.parents map (_.instantiateTypeParams(List(tparam), List(AnyRefClass.tpe))), + classinfo.parents map (_.instantiateTypeParams(List(tparam), List(AnyRefTpe))), classinfo.decls, clazz) clazz.setInfo { @@ -1886,7 +1886,7 @@ trait Typers extends Adaptations with Tags { if (noSerializable) Nil else { clazz.makeSerializable() - List(TypeTree(SerializableClass.tpe) setPos clazz.pos.focus) + List(TypeTree(SerializableTpe) setPos clazz.pos.focus) } ) }) @@ -2377,7 +2377,7 @@ trait Typers extends Adaptations with Tags { case ldef @ LabelDef(_, _, _) => if (ldef.symbol == NoSymbol) ldef.symbol = namer.enterInScope( - context.owner.newLabel(ldef.name, ldef.pos) setInfo MethodType(List(), UnitClass.tpe)) + context.owner.newLabel(ldef.name, ldef.pos) setInfo MethodType(List(), UnitTpe)) case _ => } } @@ -2500,7 +2500,7 @@ trait Typers extends Adaptations with Tags { namer.enterIfNotThere(bind.symbol) val guard1: Tree = if (cdef.guard == EmptyTree) EmptyTree - else typed(cdef.guard, BooleanClass.tpe) + else typed(cdef.guard, BooleanTpe) var body1: Tree = typed(cdef.body, pt) if (context.enclosingCaseDef.savedTypeBounds.nonEmpty) { @@ -2597,7 +2597,7 @@ trait Typers extends Adaptations with Tags { val argTp :: resTp :: Nil = targs // targs must conform to Any for us to synthesize an applyOrElse (fallback to apply otherwise -- typically for @cps annotated targs) - val targsValidParams = targs forall (_ <:< AnyClass.tpe) + val targsValidParams = targs forall (_ <:< AnyTpe) val anonClass = (context.owner newAnonymousFunctionClass tree.pos @@ -2725,12 +2725,12 @@ trait Typers extends Adaptations with Tags { val methodBodyTyper = newTyper(context.makeNewScope(context.tree, methodSym)) // should use the DefDef for the context's tree, but it doesn't exist yet (we need the typer we're creating to create it) methodBodyTyper.context.scope enter paramSym - methodSym setInfo MethodType(List(paramSym), BooleanClass.tpe) + methodSym setInfo MethodType(List(paramSym), BooleanTpe) val defaultCase = mkDefaultCase(FALSE) - val match_ = methodBodyTyper.typedMatch(selector, casesTrue :+ defaultCase, mode, BooleanClass.tpe) + val match_ = methodBodyTyper.typedMatch(selector, casesTrue :+ defaultCase, mode, BooleanTpe) - DefDef(methodSym, methodBodyTyper.virtualizedMatch(match_, mode, BooleanClass.tpe)) + DefDef(methodSym, methodBodyTyper.virtualizedMatch(match_, mode, BooleanTpe)) } // only used for @cps annotated partial functions @@ -2739,7 +2739,7 @@ trait Typers extends Adaptations with Tags { val methodSym = anonClass.newMethod(nme.apply, tree.pos, FINAL | OVERRIDE) val paramSym = mkParam(methodSym) - methodSym setInfo MethodType(List(paramSym), AnyClass.tpe) + methodSym setInfo MethodType(List(paramSym), AnyTpe) val methodBodyTyper = newTyper(context.makeNewScope(context.tree, methodSym)) // should use the DefDef for the context's tree, but it doesn't exist yet (we need the typer we're creating to create it) @@ -3106,11 +3106,11 @@ trait Typers extends Adaptations with Tags { // less expensive than including them in inferMethodAlternative (see below). def shapeType(arg: Tree): Type = arg match { case Function(vparams, body) => - functionType(vparams map (_ => AnyClass.tpe), shapeType(body)) + functionType(vparams map (_ => AnyTpe), shapeType(body)) case AssignOrNamedArg(Ident(name), rhs) => NamedType(name, shapeType(rhs)) case _ => - NothingClass.tpe + NothingTpe } val argtypes = args map shapeType val pre = fun.symbol.tpe.prefix @@ -3872,7 +3872,7 @@ trait Typers extends Adaptations with Tags { // as we don't know which alternative to choose... here we do map2Conserve(args, tparams) { //@M! the polytype denotes the expected kind - (arg, tparam) => typedHigherKindedType(arg, mode, GenPolyType(tparam.typeParams, AnyClass.tpe)) + (arg, tparam) => typedHigherKindedType(arg, mode, GenPolyType(tparam.typeParams, AnyTpe)) } } else // @M: there's probably something wrong when args.length != tparams.length... (triggered by bug #320) // Martin, I'm using fake trees, because, if you use args or arg.map(typedType), @@ -3893,7 +3893,7 @@ trait Typers extends Adaptations with Tags { if (!isPastTyper && fun.symbol == Any_isInstanceOf && targs.nonEmpty) { val scrutineeType = fun match { case Select(qual, _) => qual.tpe - case _ => AnyClass.tpe + case _ => AnyTpe } checkCheckable(tree, targs.head, scrutineeType, inPattern = false) } @@ -4218,7 +4218,7 @@ trait Typers extends Adaptations with Tags { // (phase.erasedTypes && varsym.isValue && !varsym.isMethod)) { if (varsym.isVariable || varsym.isValue && phase.erasedTypes) { val rhs1 = typedByValueExpr(rhs, lhs1.tpe) - treeCopy.Assign(tree, lhs1, checkDead(rhs1)) setType UnitClass.tpe + treeCopy.Assign(tree, lhs1, checkDead(rhs1)) setType UnitTpe } else if(dyna.isDynamicallyUpdatable(lhs1)) { val rhs1 = typedByValueExpr(rhs) @@ -4229,10 +4229,10 @@ trait Typers extends Adaptations with Tags { } def typedIf(tree: If): If = { - val cond1 = checkDead(typedByValueExpr(tree.cond, BooleanClass.tpe)) + val cond1 = checkDead(typedByValueExpr(tree.cond, BooleanTpe)) // One-legged ifs don't need a lot of analysis if (tree.elsep.isEmpty) - return treeCopy.If(tree, cond1, typed(tree.thenp, UnitClass.tpe), tree.elsep) setType UnitClass.tpe + return treeCopy.If(tree, cond1, typed(tree.thenp, UnitTpe), tree.elsep) setType UnitTpe val thenp1 = typed(tree.thenp, pt) val elsep1 = typed(tree.elsep, pt) @@ -4313,7 +4313,7 @@ trait Typers extends Adaptations with Tags { unit.warning(tree.pos, "enclosing method " + name + " has result type Unit: return value discarded") } val res = treeCopy.Return(tree, checkDead(expr1)).setSymbol(enclMethod.owner) - val tp = pluginsTypedReturn(NothingClass.tpe, this, res, restpt.tpe) + val tp = pluginsTypedReturn(NothingTpe, this, res, restpt.tpe) res.setType(tp) } } @@ -4916,7 +4916,7 @@ trait Typers extends Adaptations with Tags { // if symbol hasn't been fully loaded, can't check kind-arity else map2Conserve(args, tparams) { (arg, tparam) => //@M! the polytype denotes the expected kind - typedHigherKindedType(arg, mode, GenPolyType(tparam.typeParams, AnyClass.tpe)) + typedHigherKindedType(arg, mode, GenPolyType(tparam.typeParams, AnyTpe)) } val argtypes = args1 map (_.tpe) @@ -5038,8 +5038,8 @@ trait Typers extends Adaptations with Tags { def typedTry(tree: Try) = { val Try(block, catches, fin) = tree val block1 = typed(block, pt) - val catches1 = typedCases(catches, ThrowableClass.tpe, pt) - val fin1 = if (fin.isEmpty) fin else typed(fin, UnitClass.tpe) + val catches1 = typedCases(catches, ThrowableTpe, pt) + val fin1 = if (fin.isEmpty) fin else typed(fin, UnitTpe) def finish(ownType: Type) = treeCopy.Try(tree, block1, catches1, fin1) setType ownType @@ -5058,8 +5058,8 @@ trait Typers extends Adaptations with Tags { } def typedThrow(tree: Throw) = { - val expr1 = typedByValueExpr(tree.expr, ThrowableClass.tpe) - treeCopy.Throw(tree, expr1) setType NothingClass.tpe + val expr1 = typedByValueExpr(tree.expr, ThrowableTpe) + treeCopy.Throw(tree, expr1) setType NothingTpe } def typedTyped(tree: Typed) = { @@ -5145,7 +5145,7 @@ trait Typers extends Adaptations with Tags { // @M maybe the well-kindedness check should be done when checking the type arguments conform to the type parameters' bounds? val args1 = if (sameLength(args, tparams)) map2Conserve(args, tparams) { //@M! the polytype denotes the expected kind - (arg, tparam) => typedHigherKindedType(arg, mode, GenPolyType(tparam.typeParams, AnyClass.tpe)) + (arg, tparam) => typedHigherKindedType(arg, mode, GenPolyType(tparam.typeParams, AnyTpe)) } else { //@M this branch is correctly hit for an overloaded polymorphic type. It also has to handle erroneous cases. @@ -5163,9 +5163,9 @@ trait Typers extends Adaptations with Tags { def typedApplyDynamic(tree: ApplyDynamic) = { assert(phase.erasedTypes) - val qual1 = typed(tree.qual, AnyRefClass.tpe) - val args1 = tree.args mapConserve (arg => typed(arg, AnyRefClass.tpe)) - treeCopy.ApplyDynamic(tree, qual1, args1) setType AnyRefClass.tpe + val qual1 = typed(tree.qual, AnyRefTpe) + val args1 = tree.args mapConserve (arg => typed(arg, AnyRefTpe)) + treeCopy.ApplyDynamic(tree, qual1, args1) setType AnyRefTpe } def typedReferenceToBoxed(tree: ReferenceToBoxed) = { @@ -5207,14 +5207,14 @@ trait Typers extends Adaptations with Tags { warnMissingInterpolator(tree) tree setType ( - if (tree.value.tag == UnitTag) UnitClass.tpe + if (tree.value.tag == UnitTag) UnitTpe else ConstantType(tree.value)) } def typedSingletonTypeTree(tree: SingletonTypeTree) = { val refTyped = context.withImplicitsDisabled { - typed(tree.ref, MonoQualifierModes | mode.onlyTypePat, AnyRefClass.tpe) + typed(tree.ref, MonoQualifierModes | mode.onlyTypePat, AnyRefTpe) } if (!refTyped.isErrorTyped) @@ -5257,7 +5257,7 @@ trait Typers extends Adaptations with Tags { // we should get here only when something before failed // and we try again (@see tryTypedApply). In that case we can assign // whatever type to tree; we just have to survive until a real error message is issued. - tree setType AnyClass.tpe + tree setType AnyTpe } def typedFunction(fun: Function) = { if (fun.symbol == NoSymbol) @@ -5534,7 +5534,7 @@ trait Typers extends Adaptations with Tags { val isMacroBodyOkay = !tree.symbol.isErroneous && !(tree1 exists (_.isErroneous)) && tree1 != EmptyTree val shouldInheritMacroImplReturnType = ddef.tpt.isEmpty - if (isMacroBodyOkay && shouldInheritMacroImplReturnType) computeMacroDefTypeFromMacroImpl(ddef, tree1.symbol) else AnyClass.tpe + if (isMacroBodyOkay && shouldInheritMacroImplReturnType) computeMacroDefTypeFromMacroImpl(ddef, tree1.symbol) else AnyTpe } def transformedOr(tree: Tree, op: => Tree): Tree = transformed remove tree match { |