blob: f878eacf894b64eeff4411055f3b2170408adea3 (
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
|
trait Arr[T]
object Arr {
def apply[T](xs: T): Arr[T] = null
def apply(x: Long) : Arr[Long] = null
}
object I {
implicit def arrToTrav[T] (a: Arr[T]) : Traversable[T] = null
implicit def longArrToTrav(a: Arr[Long]): Traversable[Long] = null
}
object Test {
def foo(t: Traversable[Any]) = {}
object Okay {
Arr("1")
import I.{ arrToTrav, longArrToTrav }
val x = foo(Arr("2"))
}
object Fail {
// import I.arrToTrav
// foo(Arr("3")) // found String, expected Long
}
}
|