File tree 2 files changed +5
-5
lines changed
2 files changed +5
-5
lines changed Original file line number Diff line number Diff line change 1
1
Int
2
2
Int
3
- Int
4
- Int
5
- Int
3
+ Long
6
4
Int
7
5
Int
8
6
Int
Original file line number Diff line number Diff line change @@ -25,6 +25,7 @@ object Moop1 {
25
25
// Both f1 and f2 are applicable conversions for Int => String. Neither is better than the other.
26
26
// Scala2 contains a hack for backwards compatibility, which we are not forced to repeat.
27
27
// See discussion under SI-8280.
28
+
28
29
}
29
30
object ob2 {
30
31
implicit object f1 extends (Int => String ) { def apply (x : Int ): String = " Int" }
@@ -46,7 +47,7 @@ object Moop2 {
46
47
implicit def f1 (x : Int ): String = " Int"
47
48
implicit object f2 extends (Long => String ) { def apply (x : Long ): String = " Long" }
48
49
49
- println(5 : String )
50
+ println(5 : String ) // Dotty deviation: Dotty picks f2, because non-methods are more specific than methods
50
51
}
51
52
object ob2 {
52
53
implicit def f1 (x : Int ): String = " Int"
@@ -68,7 +69,8 @@ object Moop3 {
68
69
implicit val f1 : Int => String = _ => " Int"
69
70
implicit object f2 extends (Long => String ) { def apply (x : Long ): String = " Long" }
70
71
71
- // println(5: String) // Dotty deviation. This fails for Dotty with ambiguity error.
72
+ // println(5: String)
73
+ // Dotty deviation. This fails for Dotty with ambiguity error for similar reasons as ob1.
72
74
}
73
75
object ob2 {
74
76
implicit val f1 : Int => String = _ => " Int"
You can’t perform that action at this time.
0 commit comments