diff options
Diffstat (limited to 'src/compiler/scala/tools/nsc/typechecker')
4 files changed, 12 insertions, 16 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Contexts.scala b/src/compiler/scala/tools/nsc/typechecker/Contexts.scala index a1ba8a2982..9b1f395ad0 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Contexts.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Contexts.scala @@ -664,7 +664,7 @@ trait Contexts { self: Analyzer => case List(ImportSelector(nme.WILDCARD, _, _, _)) => List(sym) case ImportSelector(from, _, to, _) :: _ if from == sym.name => if (to == nme.WILDCARD) List() - else { val sym1 = sym.cloneSymbol; sym1.name = to; List(sym1) } + else List(sym.cloneSymbol(sym.owner, sym.rawflags, to)) case _ :: rest => transformImport(rest, sym) } diff --git a/src/compiler/scala/tools/nsc/typechecker/MethodSynthesis.scala b/src/compiler/scala/tools/nsc/typechecker/MethodSynthesis.scala index 04341fea25..82ffc3fd9e 100644 --- a/src/compiler/scala/tools/nsc/typechecker/MethodSynthesis.scala +++ b/src/compiler/scala/tools/nsc/typechecker/MethodSynthesis.scala @@ -96,8 +96,7 @@ trait MethodSynthesis { finishMethod(m setInfoAndEnter infoFn(m), f) } private def cloneInternal(original: Symbol, f: Symbol => Tree, name: Name): Tree = { - val m = original.cloneSymbol(clazz, newMethodFlags(original)) setPos clazz.pos.focus - m.name = name + val m = original.cloneSymbol(clazz, newMethodFlags(original), name) setPos clazz.pos.focus finishMethod(clazz.info.decls enter m, f) } diff --git a/src/compiler/scala/tools/nsc/typechecker/Namers.scala b/src/compiler/scala/tools/nsc/typechecker/Namers.scala index ed17d6efa7..2539091966 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Namers.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Namers.scala @@ -831,19 +831,17 @@ trait Namers extends MethodSynthesis { if (!hasType) tpt defineType NoType - if (hasType || hasName) { - owner.typeOfThis = - if (hasType) selfTypeCompleter(tpt) - else owner.tpe - } val sym = ( - if (hasType) owner.thisSym setPos self.pos - else if (hasName) owner.thisSym - else owner.newThisSym(self.pos) setInfo owner.tpe + if (hasType || hasName) { + owner.typeOfThis = if (hasType) selfTypeCompleter(tpt) else owner.tpe + val selfSym = owner.thisSym setPos self.pos + if (hasName) selfSym setName name else selfSym + } + else { + val symName = if (name != nme.WILDCARD) name else nme.this_ + owner.newThisSym(symName, owner.pos) setInfo owner.tpe + } ) - if (hasName) - sym.name = name - self.symbol = context.scope enter sym } diff --git a/src/compiler/scala/tools/nsc/typechecker/TypeDiagnostics.scala b/src/compiler/scala/tools/nsc/typechecker/TypeDiagnostics.scala index 6efa595d99..3233b7b07c 100644 --- a/src/compiler/scala/tools/nsc/typechecker/TypeDiagnostics.scala +++ b/src/compiler/scala/tools/nsc/typechecker/TypeDiagnostics.scala @@ -270,8 +270,7 @@ trait TypeDiagnostics { private val savedName = sym.name def restoreName() = sym.name = savedName def isAltered = sym.name != savedName - def modifyName(f: String => String) = - sym.name = newTypeName(f(sym.name.toString)) + def modifyName(f: String => String) = sym setName newTypeName(f(sym.name.toString)) /** Prepend java.lang, scala., or Predef. if this type originated * in one of those. |