Created
December 17, 2012 22:50
-
-
Save aryairani/4323148 to your computer and use it in GitHub Desktop.
This file contains 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
trait SuperC[A,B] { | |
def getB(a: A): B | |
// ... | |
} | |
trait Foo { | |
type A | |
type B | |
type C <: SuperC[A,B] | |
// ... | |
} | |
class Bar[F<:Foo](a: F#A, c: F#C) { | |
val b = c.getB(a) | |
} | |
/* | |
error: type mismatch; | |
found : Bar.this.a.type (with underlying type F#A) | |
required: _81.A where val _81: F | |
val b = c.getB(a) | |
^ | |
*/ | |
class MyFoo extends Foo { | |
type A = Int | |
type B = Int | |
type C = MyC | |
// ... | |
} | |
trait MyC extends SuperC[Int,Int] { | |
// ... | |
} | |
class MySubC extends MyC{ | |
def getB(a: Int): Int = ??? | |
// ... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment