@@ -2,23 +2,23 @@ import scala.language.strictEquality
2
2
3
3
/**
4
4
* Multiversal Equality: https://dotty.epfl.ch/docs/reference/contextual/multiversal-equality.html
5
- * scala.Eq definition: https://github.com/lampepfl/dotty/blob/master/library/src/scala/Eql .scala
5
+ * scala.Eq definition: https://github.com/lampepfl/dotty/blob/master/library/src/scala/CanEqual .scala
6
6
*/
7
7
object MultiversalEquality {
8
8
9
9
def test : Unit = {
10
10
11
11
// Values of types Int and String cannot be compared with == or !=,
12
12
// unless we add the derived delegate instance like:
13
- given Eql [Int , String ] = Eql .derived
13
+ given CanEqual [Int , String ] = CanEqual .derived
14
14
println(3 == " 3" )
15
15
16
16
// By default, all numbers are comparable, because of;
17
- // implicit def eqlNumber: Eql [Number, Number] = derived
17
+ // given canEqualNumber as CanEqual [Number, Number] = derived
18
18
println(3 == 5.1 )
19
19
20
20
// By default, all Sequences are comparable, because of;
21
- // implicit def eqlSeq [T, U](implicit eq: Eql [T, U]): Eql[GenSeq [T], GenSeq [U]] = derived
21
+ // given canEqualSeq [T, U](using eq: CanEqual [T, U]) as CanEqual[Seq [T], Seq [U]] = derived
22
22
println(List (1 , 2 ) == Vector (1 , 2 ))
23
23
24
24
class A (a : Int )
@@ -29,8 +29,8 @@ object MultiversalEquality {
29
29
30
30
// scala.language.strictEquality is enabled, therefore we need some extra delegate instances
31
31
// to compare instances of A and B.
32
- given Eql [A , B ] = Eql .derived
33
- given Eql [B , A ] = Eql .derived
32
+ given CanEqual [A , B ] = CanEqual .derived
33
+ given CanEqual [B , A ] = CanEqual .derived
34
34
35
35
println(a != b)
36
36
println(b == a)
0 commit comments