Last active
December 18, 2015 02:48
-
-
Save teamon/5713455 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class A | |
class B extends A | |
class C extends B | |
class Foo[X] { | |
def x[T >: X] = 1 | |
def y[T <: X] = 2 | |
} | |
val foo = new Foo[B] | |
foo.x[A] // => OK | |
foo.x[B] // => OK | |
foo.x[C] | |
// <console>:13: error: type arguments [C] do not conform to method x's type parameter bounds [T >: B] | |
// foo.x[C] | |
// ^ | |
foo.y[A] | |
// <console>:12: error: type arguments [A] do not conform to method y's type parameter bounds [T <: B] | |
// foo.y[A] | |
// ^ | |
foo.y[B] // => OK | |
foo.y[C] // => OK | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment