Created
March 18, 2016 21:39
-
-
Save smarter/cbf02369c001974aab39 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
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 } | |
} |
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
object Test { | |
B.X.foo(1) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment