Skip to content

Instantly share code, notes, and snippets.

@iximeow
Created October 14, 2015 21:36
Show Gist options
  • Select an option

  • Save iximeow/75249421519008559164 to your computer and use it in GitHub Desktop.

Select an option

Save iximeow/75249421519008559164 to your computer and use it in GitHub Desktop.
smells like a scalac bug?
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