diff options
Diffstat (limited to 'test/files')
-rw-r--r-- | test/files/neg/array-not-seq.check | 16 | ||||
-rw-r--r-- | test/files/neg/array-not-seq.flags | 1 | ||||
-rw-r--r-- | test/files/neg/array-not-seq.scala | 26 |
3 files changed, 43 insertions, 0 deletions
diff --git a/test/files/neg/array-not-seq.check b/test/files/neg/array-not-seq.check new file mode 100644 index 0000000000..bd72bb4e13 --- /dev/null +++ b/test/files/neg/array-not-seq.check @@ -0,0 +1,16 @@ +array-not-seq.scala:2: error: An Array will no longer match as Seq[_]. + def f1(x: Any) = x.isInstanceOf[Seq[_]] + ^ +array-not-seq.scala:4: error: An Array will no longer match as Seq[_]. + case _: Seq[_] => true + ^ +error: An Array will no longer match as Seq[_]. +array-not-seq.scala:16: error: An Array will no longer match as Seq[_]. + case (Some(_: Seq[_]), Nil, _) => 1 + ^ +error: An Array will no longer match as Seq[_]. +array-not-seq.scala:15: error: An Array will no longer match as Seq[_]. + def f5(x1: Any, x2: Any, x3: AnyRef) = (x1, x2, x3) match { + ^ +error: An Array will no longer match as Seq[_]. +7 errors found diff --git a/test/files/neg/array-not-seq.flags b/test/files/neg/array-not-seq.flags new file mode 100644 index 0000000000..4e9f7e4a56 --- /dev/null +++ b/test/files/neg/array-not-seq.flags @@ -0,0 +1 @@ +-Xmigration -Xfatal-warnings
\ No newline at end of file diff --git a/test/files/neg/array-not-seq.scala b/test/files/neg/array-not-seq.scala new file mode 100644 index 0000000000..07a2898d88 --- /dev/null +++ b/test/files/neg/array-not-seq.scala @@ -0,0 +1,26 @@ +object Test { + def f1(x: Any) = x.isInstanceOf[Seq[_]] + def f2(x: Any) = x match { + case _: Seq[_] => true + case _ => false + } + + def f3(x: Any) = x match { + case _: Array[_] => true + case _ => false + } + + def f4(x: Any) = x.isInstanceOf[Traversable[_]] + + def f5(x1: Any, x2: Any, x3: AnyRef) = (x1, x2, x3) match { + case (Some(_: Seq[_]), Nil, _) => 1 + case (None, List(_: List[_], _), _) => 2 + case _ => 3 + } + + def main(args: Array[String]): Unit = { + // println(f1(Array(1))) + // println(f2(Array(1))) + // println(f3(Array(1)) + } +} |