From 0021ffb0f1a0a857b7cdc8cdf769ae727dcb4b2c Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Mon, 27 Mar 2017 21:55:26 +0200 Subject: Add ShadowedName and AvoidClashName --- compiler/src/dotty/tools/dotc/transform/Erasure.scala | 3 ++- compiler/src/dotty/tools/dotc/transform/FirstTransform.scala | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) (limited to 'compiler/src/dotty/tools/dotc/transform') diff --git a/compiler/src/dotty/tools/dotc/transform/Erasure.scala b/compiler/src/dotty/tools/dotc/transform/Erasure.scala index d64120085..e9fe42e78 100644 --- a/compiler/src/dotty/tools/dotc/transform/Erasure.scala +++ b/compiler/src/dotty/tools/dotc/transform/Erasure.scala @@ -11,6 +11,7 @@ import core.Types._ import core.Names._ import core.StdNames._ import core.NameOps._ +import core.NameExtractors.ShadowedName import core.Decorators._ import core.Constants._ import core.Definitions._ @@ -363,7 +364,7 @@ object Erasure extends TypeTestsCasts{ def select(qual: Tree, sym: Symbol): Tree = { val name = tree.typeOpt match { - case tp: NamedType if tp.name.isShadowedName => sym.name.shadowedName + case tp: NamedType if tp.name.is(ShadowedName) => sym.name.derived(ShadowedName) case _ => sym.name } untpd.cpy.Select(tree)(qual, sym.name) diff --git a/compiler/src/dotty/tools/dotc/transform/FirstTransform.scala b/compiler/src/dotty/tools/dotc/transform/FirstTransform.scala index 8328e43de..803504944 100644 --- a/compiler/src/dotty/tools/dotc/transform/FirstTransform.scala +++ b/compiler/src/dotty/tools/dotc/transform/FirstTransform.scala @@ -19,8 +19,8 @@ import dotty.tools.dotc.core.Denotations.SingleDenotation import scala.collection.mutable import DenotTransformers._ import typer.Checking -import Names.Name import NameOps._ +import NameExtractors.AvoidClashName import StdNames._ @@ -129,7 +129,7 @@ class FirstTransform extends MiniPhaseTransform with InfoTransformer with Annota case _ => false } - val uniqueName = if (nameClash) objName.avoidClashName else objName + val uniqueName = if (nameClash) AvoidClashName(objName) else objName Thicket(stat :: ModuleDef(registerCompanion(uniqueName, stat.symbol), Nil).trees) case stat => stat } -- cgit v1.2.3