aboutsummaryrefslogtreecommitdiff
path: root/tests/neg/implicit-lower-bound.scala
diff options
context:
space:
mode:
authorGuillaume Martres <smarter@ubuntu.com>2015-07-11 01:35:54 +0200
committerGuillaume Martres <smarter@ubuntu.com>2015-07-11 01:52:36 +0200
commit0efa171e8ccca0d49fc6d800fd21e29f7b7336fd (patch)
tree0a135f3b4c7fbe0d3dd29b2f00edd5c62c88d16b /tests/neg/implicit-lower-bound.scala
parentb82313268b912c62f9ddc89fefd02be96f2de64c (diff)
downloaddotty-0efa171e8ccca0d49fc6d800fd21e29f7b7336fd.tar.gz
dotty-0efa171e8ccca0d49fc6d800fd21e29f7b7336fd.tar.bz2
dotty-0efa171e8ccca0d49fc6d800fd21e29f7b7336fd.zip
Don't add lower bounds of abstract types to the implicit scope
As the spec[1] says: "The parts of a type T are [...] if T is an abstract type, the parts of its upper bound;" [1]: http://www.scala-lang.org/files/archive/spec/2.11/07-implicits.html#implicit-parameters
Diffstat (limited to 'tests/neg/implicit-lower-bound.scala')
-rw-r--r--tests/neg/implicit-lower-bound.scala14
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/neg/implicit-lower-bound.scala b/tests/neg/implicit-lower-bound.scala
new file mode 100644
index 000000000..4d5e6389c
--- /dev/null
+++ b/tests/neg/implicit-lower-bound.scala
@@ -0,0 +1,14 @@
+class Foo
+
+class Bar extends Foo
+object Bar {
+ implicit val listbar: List[Bar] = ???
+}
+
+class Test {
+ def get1(implicit lf: List[_ <: Bar]) = {}
+ def get2(implicit lf: List[_ >: Bar]) = {}
+
+ get1 // works
+ get2 // error
+}