blob: aeb65915076b8fb3a81ac40b44756d0fd70d6f6a (
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
|
// #1579
object Test1579 {
class Column
class Query[E](val value: E)
class Invoker(q: Any) { val foo = null }
implicit def unwrap[C](q: Query[C]) = q.value
implicit def invoker(q: Query[Column]) = new Invoker(q)
val q = new Query(new Column)
q.foo
}
// #1625
object Test1625 {
class Wrapped(x:Any) {
def unwrap() = x
}
implicit def byName[A](x: =>A) = new Wrapped(x)
implicit def byVal[A](x: A) = x
def main(args: Array[String]) = {
// val res:Wrapped = 7 // works
val res = 7.unwrap() // doesn't work
println("=> result: " + res)
}
}
object Test2188 {
implicit def toJavaList[A: ClassManifest](t:collection.Seq[A]):java.util.List[A] = java.util.Arrays.asList(t.toArray:_*)
val x: java.util.List[String] = List("foo")
}
|