Skip to content

Instantly share code, notes, and snippets.

@asflierl
Created May 11, 2016 09:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save asflierl/6cd9c2a12ed77b7d990676676db80c85 to your computer and use it in GitHub Desktop.
Save asflierl/6cd9c2a12ed77b7d990676676db80c85 to your computer and use it in GitHub Desktop.
class Meep[A, B](b: B) { def meep(a: A, f: B => B): Option[(B, B)] = Some(b, f(b)) }
class Moop extends Meep[Int, String]("meep") { def meep(a: Int)(f: String => String): Option[String] = super.meep(a, f).map(_._2) }
println(new Moop().meep(42, identity).map(_._2)) //witness ClassCastException
@asflierl
Copy link
Author

asflierl commented May 11, 2016

Should fail to compile (with something like error: name clash between defined and inherited member), but compiles fine with Scala 2.11.8.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment