Created
October 14, 2015 21:36
-
-
Save iximeow/75249421519008559164 to your computer and use it in GitHub Desktop.
smells like a scalac bug?
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 X extends App { | |
| def uniq[T](x: T) = | |
| new { | |
| type Q = this.type | |
| def e(x: Q) = () | |
| def q2(x: Q): String = "hello!" | |
| } | |
| val x = uniq(1) | |
| val y = uniq(1) | |
| // x.e(y) // compilation error! cool! | |
| x.e(x) // NoSuchMethodException at runtime | |
| println(x.q2(x)) | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment