Skip to content

Remove internal.quoted.showName #10176

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 5, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 0 additions & 24 deletions library/src/scala/internal/quoted/showName.scala

This file was deleted.

41 changes: 16 additions & 25 deletions library/src/scala/tasty/reflect/SourceCodePrinter.scala
Original file line number Diff line number Diff line change
Expand Up @@ -1237,15 +1237,12 @@ class SourceCodePrinter[R <: Reflection & Singleton](val reflect: R)(syntaxHighl

def printAnnotation(annot: Term)(using elideThis: Option[Symbol]): Buffer = {
val Annotation(ref, args) = annot
if (annot.symbol.maybeOwner == Symbol.requiredClass("scala.internal.quoted.showName")) this
else {
this += "@"
printTypeTree(ref)
if (args.isEmpty)
this
else
inParens(printTrees(args, ", "))
}
this += "@"
printTypeTree(ref)
if (args.isEmpty)
this
else
inParens(printTrees(args, ", "))
}

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

private def splicedName(sym: Symbol): Option[String] = {
sym.annots.find(_.symbol.owner == Symbol.requiredClass("scala.internal.quoted.showName")).flatMap {
case Apply(_, Literal(Constant.String(c)) :: Nil) => Some(c)
case Apply(_, Inlined(_, _, Literal(Constant.String(c))) :: Nil) => Some(c)
case annot => None
}.orElse {
if sym.owner.isClassDef then None
else names.get(sym).orElse {
val name0 = sym.name
val index = namesIndex.getOrElse(name0, 1)
namesIndex(name0) = index + 1
val name =
if index == 1 then name0
else s"`$name0${index.toString.toCharArray.map {x => (x - '0' + '₀').toChar}.mkString}`"
names(sym) = name
Some(name)
}
if sym.owner.isClassDef then None
else names.get(sym).orElse {
val name0 = sym.name
val index = namesIndex.getOrElse(name0, 1)
namesIndex(name0) = index + 1
val name =
if index == 1 then name0
else s"`$name0${index.toString.toCharArray.map {x => (x - '0' + '₀').toChar}.mkString}`"
names(sym) = name
Some(name)
}
}

Expand Down
13 changes: 0 additions & 13 deletions tests/run-staging/quoted-show-name.check

This file was deleted.

21 changes: 0 additions & 21 deletions tests/run-staging/quoted-show-name.scala

This file was deleted.