aboutsummaryrefslogtreecommitdiff
path: root/tests/pending/run
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2015-10-21 18:30:53 +0200
committerMartin Odersky <odersky@gmail.com>2015-10-21 18:50:11 +0200
commit1b81e31e4b8d6a3d3ce47d1386e65754ec5099b4 (patch)
tree1583306f299f7852e4036498540868c1bb303210 /tests/pending/run
parentc4882896c041774b7a8beab1dcb5b4eeee4701f1 (diff)
downloaddotty-1b81e31e4b8d6a3d3ce47d1386e65754ec5099b4.tar.gz
dotty-1b81e31e4b8d6a3d3ce47d1386e65754ec5099b4.tar.bz2
dotty-1b81e31e4b8d6a3d3ce47d1386e65754ec5099b4.zip
More tests
Diffstat (limited to 'tests/pending/run')
-rw-r--r--tests/pending/run/ordered.scala22
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/pending/run/ordered.scala b/tests/pending/run/ordered.scala
new file mode 100644
index 000000000..ffcdc624b
--- /dev/null
+++ b/tests/pending/run/ordered.scala
@@ -0,0 +1,22 @@
+// infers wrong instance --> an implementatioin is missing
+trait Ord[-T] {
+ def less(x: T, y: T): Boolean
+}
+
+object Test {
+
+ implicit val anyIsOrd: Ord[Any] = new Ord[Any] {
+ def less(x: Any, y: Any): Boolean = ???
+ }
+
+ implicit val intIsOrd: Ord[Int] = new Ord[Int] {
+ def less(x: Int, y: Int): Boolean = x < y
+ }
+
+ def less[T: Ord](x: T, y: T): Boolean =
+ implicitly[Ord[T]].less(x, y)
+
+ def main(args: Array[String]) =
+ assert(less(1, 2))
+
+}