Skip to content

Instantly share code, notes, and snippets.

@bmaggi
Created October 16, 2018 15:17
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 bmaggi/8b5fac0bd48f46681eed9d61898ad7fc to your computer and use it in GitHub Desktop.
Save bmaggi/8b5fac0bd48f46681eed9d61898ad7fc to your computer and use it in GitHub Desktop.
In Scala: Pattern Matching not working with List[T]
case class A()
case class B()
val b1 = B()
val b2 = B()
val sB = Seq[B](b1,b2)
sB match {
case _:Seq[A] => println("niet")
case _:Seq[B] => println("da")
case _ => println("?")
}
// result niet ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment