-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use TypeTags when pattern-matching otherwise erased types #6517
Comments
Imported From: https://issues.scala-lang.org/browse/SI-6517?orig=1 |
@paulp said: |
@rkuhn said: def f[T: TypeTag](xs: List[T]) = xs match {
case (s: Set[String]) :: tail => ...
case xs: List[Map[Int, Int]] => ...
} |
@adriaanm said: |
Naftoli Gugenheim (naftoligug) said: |
@SethTisue said: |
@milessabin said: |
@SethTisue said: |
When the scrutinee of a match has a parametric type, and appropriate TypeTags are in scope, it should be possible to formulate a match like the following:
It would be nice if that would also work with type parameters used in non-top-level positions:
In principle the compiler should have all necessary knowledge available, but I cannot judge how difficult it would be to make this work.
Talking with Adriaan did not result in immediate dismissal, and he asked me to reference #5143 as related.
The text was updated successfully, but these errors were encountered: