1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
// test shadowing of implicits by synonymous non-implicit symbols
// whether they be inherited, imported (explicitly or using a wildcard) or defined directly
class A
class B
trait S {
implicit def aToB(a: A): B = new B
}
class T1 extends S {
def x: B = {
val aToB = 3
// ok: doesn't compile, because aToB method requires 'T.this.' prefix
//aToB(new A)
// bug: compiles, using T.this.aToB,
// despite it not being accessible without a prefix
new A
}
}
object O {
implicit def aToB(a: A): B = new B
}
class T2a {
import O._
def x: B = {
val aToB = 3
// ok: doesn't compile, because aToB method requires 'T.this.' prefix
//aToB(new A)
// bug: compiles, using T.this.aToB,
// despite it not being accessible without a prefix
new A
}
}
class T2b {
import O.aToB
def x: B = {
val aToB = 3
// ok: doesn't compile, because aToB method requires 'T.this.' prefix
//aToB(new A)
// bug: compiles, using T.this.aToB,
// despite it not being accessible without a prefix
new A
}
}
class T3 {
implicit def aToB(a: A): B = new B
def x: B = {
val aToB = 3
// ok: doesn't compile, because aToB method requires 'T.this.' prefix
//aToB(new A)
// bug: compiles, using T.this.aToB,
// despite it not being accessible without a prefix
new A
}
}
|