Skip to content

Commit 7f89686

Browse files
Remove extra .toTermNames
1 parent 6bcd80b commit 7f89686

File tree

7 files changed

+16
-16
lines changed

7 files changed

+16
-16
lines changed

compiler/src/dotty/tools/backend/jvm/DottyBackendInterface.scala

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,7 @@ class DottyBackendInterface(outputDirectory: AbstractFile, val superCallsMap: Ma
365365
def getAnnotPickle(jclassName: String, sym: Symbol): Option[Annotation] = None
366366

367367

368-
def getRequiredClass(fullname: String): Symbol = ctx.requiredClass(fullname.toTermName)
368+
def getRequiredClass(fullname: String): Symbol = ctx.requiredClass(fullname)
369369

370370
def getClassIfDefined(fullname: String): Symbol = NoSymbol // used only for android. todo: implement
371371

@@ -375,12 +375,12 @@ class DottyBackendInterface(outputDirectory: AbstractFile, val superCallsMap: Ma
375375
}
376376

377377
def requiredClass[T](implicit evidence: ClassTag[T]): Symbol =
378-
ctx.requiredClass(erasureString(evidence.runtimeClass).toTermName)
378+
ctx.requiredClass(erasureString(evidence.runtimeClass))
379379

380380
def requiredModule[T](implicit evidence: ClassTag[T]): Symbol = {
381381
val moduleName = erasureString(evidence.runtimeClass)
382382
val className = if (moduleName.endsWith("$")) moduleName.dropRight(1) else moduleName
383-
ctx.requiredModule(className.toTermName)
383+
ctx.requiredModule(className)
384384
}
385385

386386

@@ -1193,8 +1193,8 @@ class DottyBackendInterface(outputDirectory: AbstractFile, val superCallsMap: Ma
11931193
val arity = field.meth.tpe.widenDealias.paramTypes.size - _1.size
11941194
val returnsUnit = field.meth.tpe.widenDealias.resultType.classSymbol == UnitClass
11951195
if (returnsUnit)
1196-
ctx.requiredClass(("scala.compat.java8.JProcedure" + arity).toTermName)
1197-
else ctx.requiredClass(("scala.compat.java8.JFunction" + arity).toTermName)
1196+
ctx.requiredClass(("scala.compat.java8.JProcedure" + arity))
1197+
else ctx.requiredClass(("scala.compat.java8.JFunction" + arity))
11981198
}
11991199
}
12001200
}

compiler/src/dotty/tools/dotc/core/Definitions.scala

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ class Definitions {
200200
lazy val OpsPackageVal = ctx.newCompletePackageSymbol(RootClass, nme.OPS_PACKAGE).entered
201201
lazy val OpsPackageClass = OpsPackageVal.moduleClass.asClass
202202

203-
lazy val ScalaPackageVal = ctx.requiredPackage("scala")
203+
lazy val ScalaPackageVal = ctx.requiredPackage(nme.scala_)
204204
lazy val ScalaMathPackageVal = ctx.requiredPackage("scala.math")
205205
lazy val ScalaPackageClass = {
206206
val cls = ScalaPackageVal.moduleClass.asClass
@@ -211,8 +211,8 @@ class Definitions {
211211
cls
212212
}
213213
lazy val ScalaPackageObjectRef = ctx.requiredModuleRef("scala.package")
214-
lazy val JavaPackageVal = ctx.requiredPackage("java")
215-
lazy val JavaLangPackageVal = ctx.requiredPackage("java.lang")
214+
lazy val JavaPackageVal = ctx.requiredPackage(nme.java)
215+
lazy val JavaLangPackageVal = ctx.requiredPackage(jnme.JavaLang)
216216
// fundamental modules
217217
lazy val SysPackage = ctx.requiredModule("scala.sys.package")
218218
lazy val Sys_errorR = SysPackage.moduleClass.requiredMethodRef(nme.error)
@@ -342,11 +342,11 @@ class Definitions {
342342

343343
lazy val Predef_ConformsR = ScalaPredefModule.requiredClass("<:<").typeRef
344344
def Predef_Conforms(implicit ctx: Context) = Predef_ConformsR.symbol
345-
lazy val Predef_conformsR = ScalaPredefModule.requiredMethodRef("$conforms")
345+
lazy val Predef_conformsR = ScalaPredefModule.requiredMethodRef(nme.conforms_)
346346
def Predef_conforms(implicit ctx: Context) = Predef_conformsR.symbol
347-
lazy val Predef_classOfR = ScalaPredefModule.requiredMethodRef("classOf")
347+
lazy val Predef_classOfR = ScalaPredefModule.requiredMethodRef(nme.classOf)
348348
def Predef_classOf(implicit ctx: Context) = Predef_classOfR.symbol
349-
lazy val Predef_undefinedR = ScalaPredefModule.requiredMethodRef("???")
349+
lazy val Predef_undefinedR = ScalaPredefModule.requiredMethodRef(nme.???)
350350
def Predef_undefined(implicit ctx: Context) = Predef_undefinedR.symbol
351351

352352
lazy val ScalaRuntimeModuleRef = ctx.requiredModuleRef("scala.runtime.ScalaRunTime")

compiler/src/dotty/tools/dotc/core/StdNames.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,7 @@ object StdNames {
393393
val ClassManifestFactory: N = "ClassManifestFactory"
394394
val classOf: N = "classOf"
395395
val clone_ : N = "clone"
396-
// val conforms : N = "conforms" // Dotty deviation: no special treatment of conforms, so the occurrence of the name here would cause to unintended implicit shadowing. Should find a less common name for it in Predef.
396+
val conforms_ : N = "$conforms"
397397
val copy: N = "copy"
398398
val currentMirror: N = "currentMirror"
399399
val create: N = "create"

compiler/src/dotty/tools/dotc/core/tasty/TastyPrinter.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ class TastyPrinter(bytes: Array[Byte])(implicit ctx: Context) {
4949
def printNat() = print(Yellow(" " + readNat()).show)
5050
def printName() = {
5151
val idx = readNat()
52-
print(nameColor(" " + idx + " [" + nameRefToString(NameRef(idx)) + "]").show)
52+
print(nameColor(" " + idx + " [" + nameRefToString(NameRef(idx)) + "]"))
5353
}
5454
def printTree(): Unit = {
5555
newLine()

sbt-dotty/sbt-test/sbt-dotty/compiler-plugin/plugin/DivideZero.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class DivideZero extends PluginPhase with StandardPlugin {
2626

2727
private def isNumericDivide(sym: Symbol)(implicit ctx: Context): Boolean = {
2828
def test(tpe: String): Boolean =
29-
(sym.owner eq ctx.requiredClass(tpe.toTermName)) && sym.name.show == "/"
29+
(sym.owner eq ctx.requiredClass(tpe)) && sym.name.show == "/"
3030

3131
test("scala.Int") || test("scala.Long") || test("scala.Short") || test("scala.Float") || test("scala.Double")
3232
}

tests/plugins/neg/divideZero-research/plugin_1.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class DivideZero extends MiniPhase with ResearchPlugin {
2323

2424
private def isNumericDivide(sym: Symbol)(implicit ctx: Context): Boolean = {
2525
def test(tpe: String): Boolean =
26-
(sym.owner eq ctx.requiredClass(tpe.toTermName)) && sym.name == nme.DIV
26+
(sym.owner eq ctx.requiredClass(tpe)) && sym.name == nme.DIV
2727

2828
test("scala.Int") || test("scala.Long") || test("scala.Short") || test("scala.Float") || test("scala.Double")
2929
}

tests/plugins/neg/divideZero/plugin_1.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class DivideZero extends PluginPhase with StandardPlugin {
2424

2525
private def isNumericDivide(sym: Symbol)(implicit ctx: Context): Boolean = {
2626
def test(tpe: String): Boolean =
27-
(sym.owner eq ctx.requiredClass(tpe.toTermName)) && sym.name == nme.DIV
27+
(sym.owner eq ctx.requiredClass(tpe)) && sym.name == nme.DIV
2828

2929
test("scala.Int") || test("scala.Long") || test("scala.Short") || test("scala.Float") || test("scala.Double")
3030
}

0 commit comments

Comments
 (0)