summaryrefslogtreecommitdiff
path: root/test/scaladoc/resources/implicits-scopes-res.scala
blob: 4e55c3e388755d0a5a713976896a8a0c351e4413 (plain) (blame)
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
/**
 *  Testing scaladoc implicit scopes - looking for implicits in the right places
 */
package scala.test.scaladoc.implicits.scopes

// TEST1 - In package object
package object test1 {
  implicit def toB(a: A): B = null
}
package test1 {
  class A
  class B { def b = "" }
}

// TEST2 - In enclosing package - doesn't seem to work even in scalac
package object test2 {
  import classes._
  implicit def toB(a: A): B = null
}
package test2 {
  package classes {
    class A
    class B { def b = "" }
    object test { /* (new A).b won't compile */ }
  }
}

// TEST3 - In companion object
package test3 {
  class A
  object A { implicit def toB(a: A): B = null }
  class B { def b = "" }
}

// TEST4 - Nested type's companion object
package test4 {
  class U[V]
  class S
  object S { implicit def toB(a: A): B = null }
  class A extends U[S]
  class B { def b = "" }
}

// TEST5 - In scope
package test5 {
  object scope {
    class A
    class B { def b = "" }
    implicit def toB(a: A): B = null
  }
}