We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
class A[K] { def receive: PartialFunction[Any, Unit] = { case ds: List[Double] => // unchecked warning println("* List[Double]") case kx: Vector[K] => // no unchecked warning println("* Vector[K]") case ak: A[K] => // no unchecked warning println("* A[K]") } }
The text was updated successfully, but these errors were encountered:
Imported From: https://issues.scala-lang.org/browse/SI-9188?orig=1 Reporter: Chifeng Chou (cfchou) Affected Versions: 2.11.6
Sorry, something went wrong.
@retronym said: scala/scala#4366
@retronym said: Turns out the fix is a little harder than I thought. I'll have to circle back to this ticket later.
@som-snytt said: Maybe related lack of warning from SO.
"Any" seems to mean: OK, I don't need to help you anymore.
http://stackoverflow.com/questions/28859882/is-it-a-type-checker-bug
Similar to the SO example:
scala> import concurrent._,ExecutionContext.Implicits.global import concurrent._ import ExecutionContext.Implicits.global scala> trait Verify[A] { def apply(a: A): Boolean } defined trait Verify scala> case class FV[A](f: Future[A], v: Verify[A]) defined class FV scala> val vint = new Verify[Int] { def apply(i: Int) = i == 42 } vint: Verify[Int] = $anon$1@15ff3e9e scala> val x = FV(Future(3), vint) x: FV[Int] = FV(scala.concurrent.impl.Promise$DefaultPromise@291caca8,$anon$1@15ff3e9e) scala> (x: FV[_]) match { case FV(f: Future[String], v) => v(f.value.get.get) } <console>:17: warning: non-variable type argument String in type pattern scala.concurrent.Future[String] is unchecked since it is eliminated by erasure (x: FV[_]) match { case FV(f: Future[String], v) => v(f.value.get.get) } ^ res1: Boolean = false scala> (x: FV[_]) match { case FV(f: Future[Any], v) => v(f.value.get.get) } res2: Boolean = false scala> (x: FV[_]) match { case FV(f: Future[Any], v) => v("nope") } java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Integer at scala.runtime.BoxesRunTime.unboxToInt(BoxesRunTime.java:105) at $anon$1.apply(<console>:12) ... 33 elided
@SethTisue said (edited on Oct 22, 2015 1:14:43 AM UTC): golfed
class C[T] { (0: Any) match { case _: C[T] => } } // wtf y u no warn
retronym
No branches or pull requests
The text was updated successfully, but these errors were encountered: