Skip to content

Commit b121901

Browse files
authored
Merge pull request #10407 from dotty-staging/remove-eql-proxy
Remove the `Eql` instance for `Proxy`.
2 parents f125fe9 + 0db6cde commit b121901

File tree

3 files changed

+4
-15
lines changed

3 files changed

+4
-15
lines changed

library/src/scala/Eql.scala

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package scala
22

33
import annotation.implicitNotFound
4-
import scala.collection.{GenSeq, Set}
4+
import scala.collection.{Seq, Set}
55

66
/** A marker trait indicating that values of type `L` can be compared to values of type `R`. */
77
@implicitNotFound("Values of types ${L} and ${R} cannot be compared with == or !=")
@@ -27,11 +27,8 @@ object Eql {
2727
given eqlString as Eql[String, String] = derived
2828

2929
// The next three definitions can go into the companion objects of classes
30-
// Seq, Set, and Proxy. For now they are here in order not to have to touch the
30+
// Seq and Set. For now they are here in order not to have to touch the
3131
// source code of these classes
32-
given eqlSeq[T, U](using eq: Eql[T, U]) as Eql[GenSeq[T], GenSeq[U]] = derived
32+
given eqlSeq[T, U](using eq: Eql[T, U]) as Eql[Seq[T], Seq[U]] = derived
3333
given eqlSet[T, U](using eq: Eql[T, U]) as Eql[Set[T], Set[U]] = derived
34-
35-
// true asymmetry, modeling the (somewhat problematic) nature of equals on Proxies
36-
given eqlProxy as Eql[Proxy, AnyRef] = derived
3734
}

tests/neg/equality.scala

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,6 @@ object equality {
1414
implicit def eqNum: Eql[Num, Num] = Eql.derived
1515
implicit def eqOption[T, U](implicit e: Eql[T, U]): Eql[Option[T], Option[U]] = Eql.derived
1616

17-
case class PString(a: String) extends Proxy {
18-
def self = a
19-
}
20-
2117
/*
2218
implicit def eqString: Eql[String, String] = Eql.derived
2319
implicit def eqInt: Eql[Int, Int] = Eql.derived
@@ -84,9 +80,6 @@ object equality {
8480
i == bi
8581
bi == i
8682

87-
val ps = PString("hello")
88-
ps == "world"
89-
9083
n match {
9184
case None => // error
9285
}
@@ -110,7 +103,6 @@ object equality {
110103
1 == "abc" // error
111104
"abc" == bi // error
112105
bi == "abc" // error
113-
"world" == ps // error
114106

115107
val s1 = Set(1, 2, 3)
116108
val s2 = Set()

tests/run/proxy.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,5 @@ object Test extends App {
1313

1414
val label = Bippy("bippy!")
1515
println(label == label)
16-
println(label == "bippy!")
16+
println((label: Any) == ("bippy!": Any))
1717
}

0 commit comments

Comments
 (0)