Skip to content

Commit f8a9c74

Browse files
committed
Remove internal.quoted.showName
1 parent 5e8c13f commit f8a9c74

File tree

4 files changed

+16
-83
lines changed

4 files changed

+16
-83
lines changed

Diff for: library/src/scala/internal/quoted/showName.scala

-24
This file was deleted.

Diff for: library/src/scala/tasty/reflect/SourceCodePrinter.scala

+16-25
Original file line numberDiff line numberDiff line change
@@ -1237,15 +1237,12 @@ class SourceCodePrinter[R <: Reflection & Singleton](val reflect: R)(syntaxHighl
12371237

12381238
def printAnnotation(annot: Term)(using elideThis: Option[Symbol]): Buffer = {
12391239
val Annotation(ref, args) = annot
1240-
if (annot.symbol.maybeOwner == Symbol.requiredClass("scala.internal.quoted.showName")) this
1241-
else {
1242-
this += "@"
1243-
printTypeTree(ref)
1244-
if (args.isEmpty)
1245-
this
1246-
else
1247-
inParens(printTrees(args, ", "))
1248-
}
1240+
this += "@"
1241+
printTypeTree(ref)
1242+
if (args.isEmpty)
1243+
this
1244+
else
1245+
inParens(printTrees(args, ", "))
12491246
}
12501247

12511248
def printDefAnnotations(definition: Definition)(using elideThis: Option[Symbol]): Buffer = {
@@ -1413,22 +1410,16 @@ class SourceCodePrinter[R <: Reflection & Singleton](val reflect: R)(syntaxHighl
14131410
private[this] val namesIndex = collection.mutable.Map.empty[String, Int]
14141411

14151412
private def splicedName(sym: Symbol): Option[String] = {
1416-
sym.annots.find(_.symbol.owner == Symbol.requiredClass("scala.internal.quoted.showName")).flatMap {
1417-
case Apply(_, Literal(Constant.String(c)) :: Nil) => Some(c)
1418-
case Apply(_, Inlined(_, _, Literal(Constant.String(c))) :: Nil) => Some(c)
1419-
case annot => None
1420-
}.orElse {
1421-
if sym.owner.isClassDef then None
1422-
else names.get(sym).orElse {
1423-
val name0 = sym.name
1424-
val index = namesIndex.getOrElse(name0, 1)
1425-
namesIndex(name0) = index + 1
1426-
val name =
1427-
if index == 1 then name0
1428-
else s"`$name0${index.toString.toCharArray.map {x => (x - '0' + '₀').toChar}.mkString}`"
1429-
names(sym) = name
1430-
Some(name)
1431-
}
1413+
if sym.owner.isClassDef then None
1414+
else names.get(sym).orElse {
1415+
val name0 = sym.name
1416+
val index = namesIndex.getOrElse(name0, 1)
1417+
namesIndex(name0) = index + 1
1418+
val name =
1419+
if index == 1 then name0
1420+
else s"`$name0${index.toString.toCharArray.map {x => (x - '0' + '₀').toChar}.mkString}`"
1421+
names(sym) = name
1422+
Some(name)
14321423
}
14331424
}
14341425

Diff for: tests/run-staging/quoted-show-name.check

-13
This file was deleted.

Diff for: tests/run-staging/quoted-show-name.scala

-21
This file was deleted.

0 commit comments

Comments
 (0)