diff options
author | Paul Phillips <paulp@improving.org> | 2010-12-31 07:08:27 +0000 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2010-12-31 07:08:27 +0000 |
commit | 6c04413edb892907b7d9765a9ccbd5d2e2632029 (patch) | |
tree | a81225740e698de309934f85a0e9f1e3d04ac310 /src | |
parent | 2b61c308c301008fbc20ea85eb1a9075861b48c3 (diff) | |
download | scala-6c04413edb892907b7d9765a9ccbd5d2e2632029.tar.gz scala-6c04413edb892907b7d9765a9ccbd5d2e2632029.tar.bz2 scala-6c04413edb892907b7d9765a9ccbd5d2e2632029.zip |
There's still some temporary scaffolding proppi...
There's still some temporary scaffolding propping up the Names
situation. This removes one strut: no more is there an implicit
conversion from String to TypeName. Implicits which remain to be deal
with: String => TermName, Name => TermName, Name => TypeName. Once
they're gone we're ready for KindNames! Just kidding, no review.
Diffstat (limited to 'src')
7 files changed, 13 insertions, 24 deletions
diff --git a/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala b/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala index da156684c0..96bbd7fcbc 100644 --- a/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala +++ b/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala @@ -323,7 +323,7 @@ self => Nil, List(Nil), TypeTree(), - Block(List(Apply(Select(Super("", ""), nme.CONSTRUCTOR), Nil)), Literal(Constant(()))) + Block(List(Apply(Select(Super(tpnme.EMPTY, tpnme.EMPTY), nme.CONSTRUCTOR), Nil)), Literal(Constant(()))) ) // def main diff --git a/src/compiler/scala/tools/nsc/symtab/StdNames.scala b/src/compiler/scala/tools/nsc/symtab/StdNames.scala index dabc55b462..30c1db9de1 100644 --- a/src/compiler/scala/tools/nsc/symtab/StdNames.scala +++ b/src/compiler/scala/tools/nsc/symtab/StdNames.scala @@ -385,6 +385,8 @@ trait StdNames extends reflect.generic.StdNames with NameManglers { } abstract class SymbolNames { + protected implicit def stringToTypeName(s: String): TypeName = newTypeName(s) + val BeanProperty : TypeName val BooleanBeanProperty : TypeName val BoxedBoolean : TypeName diff --git a/src/compiler/scala/tools/nsc/symtab/Symbols.scala b/src/compiler/scala/tools/nsc/symtab/Symbols.scala index 934622bea0..feccb4e462 100644 --- a/src/compiler/scala/tools/nsc/symtab/Symbols.scala +++ b/src/compiler/scala/tools/nsc/symtab/Symbols.scala @@ -32,9 +32,9 @@ trait Symbols extends reflect.generic.Symbols { self: SymbolTable => private var recursionTable = immutable.Map.empty[Symbol, Int] private var nextexid = 0 - private def freshExistentialName() = { + private def freshExistentialName(suffix: String) = { nextexid += 1 - "_"+nextexid + newTypeName("_" + nextexid + suffix) } /** The original owner of a class. Used by the backend to generate @@ -210,18 +210,11 @@ trait Symbols extends reflect.generic.Symbols { self: SymbolTable => argtypess map (_.map(param)) } - /** Make an existential variable. - * @param name suffix to be appended to the freshly generated name - * It's ususally "", except for type variables abstracting - * over values, where it is ".type". - * @param owner The owner of the variable - * @param bounds The variable's bounds - */ final def newExistential(pos: Position, name: TypeName): Symbol = newAbstractType(pos, name).setFlag(EXISTENTIAL) final def freshExistential(suffix: String): Symbol = - newExistential(pos, freshExistentialName()+suffix) + newExistential(pos, freshExistentialName(suffix)) /** Synthetic value parameters when parameter symbols are not available. * Calling this method multiple times will re-use the same parameter names. diff --git a/src/compiler/scala/tools/nsc/symtab/Types.scala b/src/compiler/scala/tools/nsc/symtab/Types.scala index 42cbcdd4eb..28e666755e 100644 --- a/src/compiler/scala/tools/nsc/symtab/Types.scala +++ b/src/compiler/scala/tools/nsc/symtab/Types.scala @@ -3213,7 +3213,7 @@ A type's typeSymbol should never be inspected directly. def typeParamsToExistentials(clazz: Symbol, tparams: List[Symbol]): List[Symbol] = { val eparams = for ((tparam, i) <- tparams.zipWithIndex) yield { - clazz.newExistential(clazz.pos, "?"+i).setInfo(tparam.info.bounds) + clazz.newExistential(clazz.pos, newTypeName("?"+i)).setInfo(tparam.info.bounds) } for (tparam <- eparams) tparam setInfo tparam.info.substSym(tparams, eparams) eparams @@ -3600,7 +3600,7 @@ A type's typeSymbol should never be inspected directly. val symowner = oldSym.owner val bound = singletonBounds(actualsIndexed(actualIdx)) - val sym = symowner.newExistential(oldSym.pos, oldSym.name+".type") + val sym = symowner.newExistential(oldSym.pos, newTypeName(oldSym.name + ".type")) sym.setInfo(bound) sym.setFlag(oldSym.flags) diff --git a/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala b/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala index f595abef55..5f63c4bdc7 100644 --- a/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala +++ b/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala @@ -462,7 +462,7 @@ abstract class ClassfileParser { ss = s substring start sym = owner.info.decls lookup ss if (sym == NoSymbol) { - sym = owner.newClass(NoPosition, ss) setInfo completer + sym = owner.newClass(NoPosition, newTypeName(ss)) setInfo completer owner.info.decls enter sym if (settings.debug.value && settings.verbose.value) println("loaded "+sym+" from file "+file) @@ -748,7 +748,7 @@ abstract class ClassfileParser { case '*' => TypeBounds(definitions.NothingClass.tpe, definitions.AnyClass.tpe) } - val newtparam = sym.newExistential(sym.pos, "?"+i) setInfo bounds + val newtparam = sym.newExistential(sym.pos, newTypeName("?"+i)) setInfo bounds existentials += newtparam xs += newtparam.tpe //@M should probably be .tpeHK i += 1 diff --git a/src/compiler/scala/tools/nsc/symtab/clr/TypeParser.scala b/src/compiler/scala/tools/nsc/symtab/clr/TypeParser.scala index cf2b7f6b8e..ce519b4ca4 100644 --- a/src/compiler/scala/tools/nsc/symtab/clr/TypeParser.scala +++ b/src/compiler/scala/tools/nsc/symtab/clr/TypeParser.scala @@ -150,8 +150,8 @@ abstract class TypeParser { val canBeTakenAddressOf = (typ.IsValueType || typ.IsEnum) && (typ.FullName != "System.Enum") if(canBeTakenAddressOf) { - clazzBoxed = clazz.owner.newClass(clazz.name + "Boxed") - clazzMgdPtr = clazz.owner.newClass(clazz.name + "MgdPtr") + clazzBoxed = clazz.owner.newClass(clazz.name append "Boxed") + clazzMgdPtr = clazz.owner.newClass(clazz.name append "MgdPtr") clrTypes.mdgptrcls4clssym(clazz) = clazzMgdPtr /* adding typMgdPtr to clrTypes.sym2type should happen early (before metadata for supertypes is parsed, before metadata for members are parsed) so that clazzMgdPtr can be found by getClRType. */ diff --git a/src/library/scala/reflect/generic/StdNames.scala b/src/library/scala/reflect/generic/StdNames.scala index 70e24e4dc5..3d4cdc46ce 100755 --- a/src/library/scala/reflect/generic/StdNames.scala +++ b/src/library/scala/reflect/generic/StdNames.scala @@ -3,13 +3,7 @@ package generic import scala.reflect.NameTransformer -trait LowPriorityStdNames { - self: Universe => - - implicit def stringToTypeName(s: String): TypeName = newTypeName(s) -} - -trait StdNames extends LowPriorityStdNames { +trait StdNames { self: Universe => val nme: LibraryTermNames |