diff options
author | Adriaan Moors <adriaan.moors@typesafe.com> | 2014-02-18 11:12:50 -0800 |
---|---|---|
committer | Adriaan Moors <adriaan.moors@typesafe.com> | 2014-02-18 16:41:00 -0800 |
commit | 4223bc2ddc497457c7dccd1b9b65e98244a9b4d1 (patch) | |
tree | 913115fd5918fb372a5fae8228820b59c7fe2350 /src/library | |
parent | bba01661ea629ff636a538226ad267a67d9dbfa7 (diff) | |
download | scala-4223bc2ddc497457c7dccd1b9b65e98244a9b4d1.tar.gz scala-4223bc2ddc497457c7dccd1b9b65e98244a9b4d1.tar.bz2 scala-4223bc2ddc497457c7dccd1b9b65e98244a9b4d1.zip |
SI-7788 Avoid accidental shadowing of Predef.conforms
Rename `conforms` to `$conforms` and put in a minimal backstop: pos/t7788.scala
TODO: predicate the backwards compatibility shim for `Predef_conforms`
on `-Xsource:2.10`
Diffstat (limited to 'src/library')
-rw-r--r-- | src/library/scala/Predef.scala | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/library/scala/Predef.scala b/src/library/scala/Predef.scala index 2bde6795e0..faeb1dcbe2 100644 --- a/src/library/scala/Predef.scala +++ b/src/library/scala/Predef.scala @@ -382,9 +382,13 @@ object Predef extends LowPriorityImplicits with DeprecatedPredef { @implicitNotFound(msg = "Cannot prove that ${From} <:< ${To}.") sealed abstract class <:<[-From, +To] extends (From => To) with Serializable private[this] final val singleton_<:< = new <:<[Any,Any] { def apply(x: Any): Any = x } - // not in the <:< companion object because it is also - // intended to subsume identity (which is no longer implicit) - implicit def conforms[A]: A <:< A = singleton_<:<.asInstanceOf[A <:< A] + // The dollar prefix is to dodge accidental shadowing of this method + // by a user-defined method of the same name (SI-7788). + // The collections rely on this method. + implicit def $conforms[A]: A <:< A = singleton_<:<.asInstanceOf[A <:< A] + + @deprecated("Use `implicitly[T <:< U]` or `identity` instead.", "2.11.0") + def conforms[A]: A <:< A = $conforms[A] /** An instance of `A =:= B` witnesses that the types `A` and `B` are equal. * |