aboutsummaryrefslogtreecommitdiff
path: root/tests/pos/implicits1.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2013-08-27 14:12:31 +0200
committerMartin Odersky <odersky@gmail.com>2013-08-27 14:12:41 +0200
commite2a05a5ac38647f9727d1e0ec8c3c14ac82b5de7 (patch)
tree78b7e72faf3fd4478c82048c4f65f2528684525e /tests/pos/implicits1.scala
parenteab2123cd727fad2e0139e63edacfff7307d49f0 (diff)
downloaddotty-e2a05a5ac38647f9727d1e0ec8c3c14ac82b5de7.tar.gz
dotty-e2a05a5ac38647f9727d1e0ec8c3c14ac82b5de7.tar.bz2
dotty-e2a05a5ac38647f9727d1e0ec8c3c14ac82b5de7.zip
Fixed bugs related to typechecking closures.
Diffstat (limited to 'tests/pos/implicits1.scala')
-rw-r--r--tests/pos/implicits1.scala16
1 files changed, 15 insertions, 1 deletions
diff --git a/tests/pos/implicits1.scala b/tests/pos/implicits1.scala
index 4eae69325..2f0399b74 100644
--- a/tests/pos/implicits1.scala
+++ b/tests/pos/implicits1.scala
@@ -1,4 +1,6 @@
-class X(elem: Int) extends Object
+class X(val elem: Int) {
+ def foo(y: String): Int = y.length + elem
+}
object Implicits {
@@ -6,6 +8,12 @@ object Implicits {
implicit def conv(x: Int): X = new X(x)
+ class Xdecorator(x: X) extends Object {
+ def foo(cond: Boolean): Int = if (cond) x.foo("abc") else 0
+ }
+
+ implicit def XDecorator(x: X) = new Xdecorator(x)
+
val a: Object = "abc"
val b: Any = "abc"
@@ -18,4 +26,10 @@ object Implicits {
val z: X = 3
+ val c: Int = y.elem
+
+ val d: Int = z.foo("abc")
+
+ // val e: Int = z.foo(true) not yet
+
}