File: t8597.scala

package info (click to toggle)
scala 2.11.12-6
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 62,924 kB
  • sloc: javascript: 28,808; java: 13,415; xml: 3,135; sh: 1,620; python: 756; makefile: 38; awk: 36; ansic: 6
file content (27 lines) | stat: -rw-r--r-- 1,448 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
class Unchecked[C] {
  def nowarn[T] = (null: Any) match { case _: Some[T]      => } // warn (did not warn due to SI-8597)

  // These warned before.
  def warn1[T]  = (null: Any) match { case _: T            => } // warn
  def warn2     = (null: Any) match { case _: Some[String] => } // warn
                  (null: Any) match { case _: Some[C]      => } // warn

  // These must remain without warnings. These are excerpts from
  // related tests that are more exhauative.
  class C; class D extends C
  def okay      = (List(new D) : Seq[D]) match { case _: List[C] => case _ => } // nowarn
  class B2[A, B]
  class A2[X] extends B2[X, String]
  def okay2(x: A2[Int]) = x match { case _: B2[Int, _] => true } // nowarn
  def okay3(x: A2[Int]) = x match { case _: B2[Int, typeVar] => true } // nowarn

  def warnArray[T] = (null: Any) match { case _: Array[T] => } // warn (did not warn due to SI-8597)
  def nowarnArrayC   = (null: Any) match { case _: Array[C] => } // nowarn

  def nowarnArrayTypeVar[T] = (null: Any) match { case _: Array[t] => } // nowarn

  def noWarnArrayErasure1 = (null: Any) match {case Some(_: Array[String]) => } // nowarn
  def noWarnArrayErasure2 = (null: Any) match {case Some(_: Array[List[_]]) => } // nowarn
  def noWarnArrayErasure3 = (null: Any) match {case Some(_: Array[Array[List[_]]]) => } // nowarn
  def warnArrayErasure2   = (null: Any) match {case Some(_: Array[Array[List[String]]]) => } // warn
}