Skip to content

Commit 9830806

Browse files
Remove extra .toTermNames
1 parent f6e724b commit 9830806

File tree

8 files changed

+17
-17
lines changed

8 files changed

+17
-17
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
@@ -201,7 +201,7 @@ class Definitions {
201201
lazy val OpsPackageVal = ctx.newCompletePackageSymbol(RootClass, nme.OPS_PACKAGE).entered
202202
lazy val OpsPackageClass = OpsPackageVal.moduleClass.asClass
203203

204-
lazy val ScalaPackageVal = ctx.requiredPackage("scala")
204+
lazy val ScalaPackageVal = ctx.requiredPackage(nme.scala_)
205205
lazy val ScalaMathPackageVal = ctx.requiredPackage("scala.math")
206206
lazy val ScalaPackageClass = {
207207
val cls = ScalaPackageVal.moduleClass.asClass
@@ -212,8 +212,8 @@ class Definitions {
212212
cls
213213
}
214214
lazy val ScalaPackageObjectRef = ctx.requiredModuleRef("scala.package")
215-
lazy val JavaPackageVal = ctx.requiredPackage("java")
216-
lazy val JavaLangPackageVal = ctx.requiredPackage("java.lang")
215+
lazy val JavaPackageVal = ctx.requiredPackage(nme.java)
216+
lazy val JavaLangPackageVal = ctx.requiredPackage(jnme.JavaLang)
217217
// fundamental modules
218218
lazy val SysPackage = ctx.requiredModule("scala.sys.package")
219219
lazy val Sys_errorR = SysPackage.moduleClass.requiredMethodRef(nme.error)
@@ -348,11 +348,11 @@ class Definitions {
348348

349349
lazy val Predef_ConformsR = ScalaPredefModule.requiredClass("<:<").typeRef
350350
def Predef_Conforms(implicit ctx: Context) = Predef_ConformsR.symbol
351-
lazy val Predef_conformsR = ScalaPredefModule.requiredMethodRef("$conforms")
351+
lazy val Predef_conformsR = ScalaPredefModule.requiredMethodRef(nme.conforms_)
352352
def Predef_conforms(implicit ctx: Context) = Predef_conformsR.symbol
353-
lazy val Predef_classOfR = ScalaPredefModule.requiredMethodRef("classOf")
353+
lazy val Predef_classOfR = ScalaPredefModule.requiredMethodRef(nme.classOf)
354354
def Predef_classOf(implicit ctx: Context) = Predef_classOfR.symbol
355-
lazy val Predef_undefinedR = ScalaPredefModule.requiredMethodRef("???")
355+
lazy val Predef_undefinedR = ScalaPredefModule.requiredMethodRef(nme.???)
356356
def Predef_undefined(implicit ctx: Context) = Predef_undefinedR.symbol
357357
// The set of all wrap{X, Ref}Array methods, where X is a value type
358358
val Predef_wrapArray = new PerRun[collection.Set[Symbol]]({ implicit ctx =>

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -394,7 +394,7 @@ object StdNames {
394394
val ClassManifestFactory: N = "ClassManifestFactory"
395395
val classOf: N = "classOf"
396396
val clone_ : N = "clone"
397-
// 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.
397+
val conforms_ : N = "$conforms"
398398
val copy: N = "copy"
399399
val currentMirror: N = "currentMirror"
400400
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
@@ -48,7 +48,7 @@ class TastyPrinter(bytes: Array[Byte])(implicit ctx: Context) {
4848
def printNat() = print(Yellow(" " + readNat()).show)
4949
def printName() = {
5050
val idx = readNat()
51-
print(nameColor(" " + idx + " [" + nameRefToString(NameRef(idx)) + "]").show)
51+
print(nameColor(" " + idx + " [" + nameRefToString(NameRef(idx)) + "]"))
5252
}
5353
def printTree(): Unit = {
5454
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
@@ -25,7 +25,7 @@ class DivideZero extends PluginPhase with StandardPlugin {
2525

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

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

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
}

tests/plugins/pos/divideZero/plugin_1.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class DivideZero extends MiniPhase with Plugin {
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 == nme.DIV
29+
(sym.owner eq ctx.requiredClass(tpe)) && sym.name == nme.DIV
3030

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

0 commit comments

Comments
 (0)