Skip to content

Instantly share code, notes, and snippets.

@smarter
Created March 18, 2016 21:39
Show Gist options
  • Save smarter/cbf02369c001974aab39 to your computer and use it in GitHub Desktop.
Save smarter/cbf02369c001974aab39 to your computer and use it in GitHub Desktop.
trait HasT { type T }
abstract class A {
val p: HasT
object X {
def foo(x: p.T): p.T = x
}
}
object B extends A {
// compile, change Int to String, compile succeeds but shouldn't
override val p: HasT { type T = Int } = new HasT { type T = Int }
}
object Test {
B.X.foo(1)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment