diff options
author | Guillaume Martres <smarter@ubuntu.com> | 2015-07-11 01:35:54 +0200 |
---|---|---|
committer | Guillaume Martres <smarter@ubuntu.com> | 2015-07-11 01:52:36 +0200 |
commit | 0efa171e8ccca0d49fc6d800fd21e29f7b7336fd (patch) | |
tree | 0a135f3b4c7fbe0d3dd29b2f00edd5c62c88d16b /tests/neg | |
parent | b82313268b912c62f9ddc89fefd02be96f2de64c (diff) | |
download | dotty-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')
-rw-r--r-- | tests/neg/implicit-lower-bound.scala | 14 |
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 +} |