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
dealias types when looking for uncheckable outer checks #6813
Comments
Imported From: https://issues.scala-lang.org/browse/SI-6813?orig=1 |
@paulp said: type FlagSet = Long It would sure be news to me if the pattern matcher had any chance of distinguishing "FlagSet" from "Long". |
@adriaanm said: |
@paulp said: |
@paulp said: |
@adriaanm said (edited on Dec 14, 2012 9:42:44 PM UTC): yes, the outer check should operate on the dealiased type and thus not warn |
@xeno-by said (edited on Dec 14, 2012 9:52:47 PM UTC): |
@paulp said: |
Ivan Macek (imacek) said: Is this the same issue as the one reported here? Thanks for help! |
Age Mooij (agemooij) said (edited on Jun 18, 2015 4:53:48 PM UTC): In short: I'm getting the dreaded warning when using a subtype of an object that I have aliased in a pattern match, which in my case involves an case Path.Segment(prefix, tail) ⇒ ... where type Path = spray.http.Uri.Path
val Path = spray.http.Uri.Path Any progress on this issue? Scala version: 2.11.6 |
No longer reproduces: Welcome to Scala 2.13.4 (OpenJDK 64-Bit Server VM, Java 11.0.9).
Type in expressions for evaluation. Or try :help.
import scala.reflect.runtime.universe._
scala> import scala.reflect.runtime.universe._
import scala.reflect.runtime.universe._
scala> Flag.IMPLICIT match { case f: FlagSet => "flag"; case l: Long => "long" }
val res0: String = flag |
Note how it now just returns "flag" not "long", so I assume whatever fixed that also fixed the warning. |
OTOH, a FlagSet isn't a Long and a Long isn't a FlagSet:
If the scrutinee is a Long, it's an error to have a FlagSet case:
If the scrutinee is a FlagSet, it matches a Long case with no warning, and the presumably unreachable FlagSet case is also allowed.
|
Hmm, good points, Paul, thank you. I closed this in passing by, so let me take your notes and review it better. |
Following pattern match:
Should return "flag". Class tag (FlagSetTag) is imported and in scope so it looks like pattern matching bug.
The text was updated successfully, but these errors were encountered: