aboutsummaryrefslogtreecommitdiff
path: root/tests/pending/run/ordered.scala
diff options
context:
space:
mode:
Diffstat (limited to 'tests/pending/run/ordered.scala')
-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))
+
+}