Skip to content

Commit 86b88cc

Browse files
committed
More implicit and overloading tests
1 parent a7dd2c7 commit 86b88cc

File tree

3 files changed

+15
-1
lines changed

3 files changed

+15
-1
lines changed

tests/run/toplevel-implicits/Test_2.scala

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,7 @@ object Test extends App {
88
val d = new D
99
val d2 = d.pair(d)
1010
println(d2)
11+
12+
val ci: C = "abc"
13+
implicitly[TC[List[Int]]]
1114
}

tests/run/toplevel-implicits/defs_1.scala

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,11 @@ class D {
1212

1313
implicit class Ddeco(x: D) {
1414
def pair(y: D) = (x, y)
15-
}
15+
}
16+
17+
trait TC[X]
18+
19+
implicit def toC(x: String): C = new C()
20+
implicit def listTC[X: TC]: TC[List[X]] = null
21+
implicit val intTC: TC[Int] = null
22+

tests/run/toplevel-overloads/defs_1.scala

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,11 @@ package top
22

33
def hello(name: String) = s"hello, $name"
44
def hello(x: Int) = x.toString
5+
def hello(x: Boolean) = if (x) "yes" else "no"
56

67
object O {
78
def hi = hello("Bob")
9+
def gb = hello(true)
810
}
11+
12+
val test = hello(false)

0 commit comments

Comments
 (0)