Skip to content

Instantly share code, notes, and snippets.

@aryairani
Created December 17, 2012 22:50
Show Gist options
  • Save aryairani/4323148 to your computer and use it in GitHub Desktop.
Save aryairani/4323148 to your computer and use it in GitHub Desktop.
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