Skip to content

Commit ae8ae8f

Browse files
committed
drop: remove access to Predef.any2stringadd
1 parent b2850be commit ae8ae8f

File tree

4 files changed

+6
-7
lines changed

4 files changed

+6
-7
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1763,7 +1763,7 @@ class Definitions {
17631763
RootRef(() => ScalaPackageVal.termRef)
17641764

17651765
private val PredefImportFns: RootRef =
1766-
RootRef(() => ScalaPredefModule.termRef, isPredef=true)
1766+
RootRef(() => ScalaPredefModule.termRef)
17671767

17681768
@tu private lazy val YimportsImportFns: List[RootRef] = ctx.settings.Yimports.value.map { name =>
17691769
val denot =

compiler/src/dotty/tools/dotc/typer/ImportInfo.scala

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,14 @@ import scala.compiletime.uninitialized
1616

1717
object ImportInfo {
1818

19-
case class RootRef(refFn: () => TermRef, isPredef: Boolean = false)
19+
case class RootRef(refFn: () => TermRef)
2020

2121
/** The import info for a root import */
2222
def rootImport(ref: RootRef)(using Context): ImportInfo =
2323
var selectors =
2424
untpd.ImportSelector(untpd.Ident(nme.WILDCARD)) // import all normal members...
2525
:: untpd.ImportSelector(untpd.Ident(nme.EMPTY)) // ... and also all given members
2626
:: Nil
27-
if ref.isPredef then // do not import any2stringadd
28-
selectors = untpd.ImportSelector(untpd.Ident(nme.any2stringadd), untpd.Ident(nme.WILDCARD))
29-
:: selectors
3027

3128
def sym(using Context) =
3229
val expr = tpd.Ident(ref.refFn()) // refFn must be called in the context of ImportInfo.sym

library/src/scala/Predef.scala

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -419,9 +419,11 @@ object Predef extends LowPriorityImplicits {
419419
@(deprecated @companionMethod)("Implicit injection of + is deprecated. Convert to String to call +", "2.13.0")
420420
@(deprecated @companionClass)("Implicit injection of + is deprecated. Convert to String to call +", "2.13.0") // for Scaladoc
421421
// scala/bug#8229 retaining the pre 2.11 name for source compatibility in shadowing this implicit
422-
implicit final class any2stringadd[A](private val self: A) extends AnyVal {
422+
private[scala] final class any2stringadd[A](private val self: A) extends AnyVal {
423423
def +(other: String): String = String.valueOf(self) + other
424424
}
425+
@deprecated
426+
private[scala] def any2stringadd[A](self: A): any2stringadd[A] = new any2stringadd[A](self)
425427

426428
/** @group char-sequence-wrappers */
427429
final class SeqCharSequence(sequenceOfChars: scala.collection.IndexedSeq[Char]) extends CharSequence {

tests/neg/i7137.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@ object App {
33
val any: Any = 3
44
val str: String = any + "a" // error
55
val str2: String = any2stringadd(any) + "a" // error
6-
val str3: String = Predef.any2stringadd(any) + "a"
6+
val str3: String = Predef.any2stringadd(any) + "a" // error
77
}

0 commit comments

Comments
 (0)