Skip to content

Instantly share code, notes, and snippets.

@sandeepkota
Created October 19, 2016 17:01
Show Gist options
  • Save sandeepkota/adcbea9ce3fdac6ac33cd78351fe4424 to your computer and use it in GitHub Desktop.
Save sandeepkota/adcbea9ce3fdac6ac33cd78351fe4424 to your computer and use it in GitHub Desktop.
case class Zoo(str: String)
trait FZ
case class Foo(z: Zoo) extends FZ
case class Bar(z: Zoo) extends FZ
def some(f: FZ) = {
f match {
case Foo(z) | Bar(z) =>
println(z.str)
// Since 'z' is of Same type, can I get it here?
}
}
Foo(Zoo("Some"))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment