diff options
Diffstat (limited to 'test/files/neg')
-rw-r--r-- | test/files/neg/patmat-type-check.check | 14 | ||||
-rw-r--r-- | test/files/neg/patmat-type-check.scala | 7 | ||||
-rw-r--r-- | test/files/neg/t3692.check | 12 | ||||
-rw-r--r-- | test/files/neg/t3692.scala | 2 |
4 files changed, 15 insertions, 20 deletions
diff --git a/test/files/neg/patmat-type-check.check b/test/files/neg/patmat-type-check.check index ab638b616d..8f81cede8f 100644 --- a/test/files/neg/patmat-type-check.check +++ b/test/files/neg/patmat-type-check.check @@ -1,21 +1,21 @@ -patmat-type-check.scala:18: error: scrutinee is incompatible with pattern type; +patmat-type-check.scala:22: error: scrutinee is incompatible with pattern type; found : Seq[A] required: java.lang.String def f1 = "bob".reverse match { case Seq('b', 'o', 'b') => true } // fail ^ -patmat-type-check.scala:19: error: scrutinee is incompatible with pattern type; +patmat-type-check.scala:23: error: scrutinee is incompatible with pattern type; found : Seq[A] required: Array[Char] def f2 = "bob".toArray match { case Seq('b', 'o', 'b') => true } // fail ^ -patmat-type-check.scala:23: error: scrutinee is incompatible with pattern type; +patmat-type-check.scala:27: error: scrutinee is incompatible with pattern type; found : Seq[A] required: Test.Bop2 def f3(x: Bop2) = x match { case Seq('b', 'o', 'b') => true } // fail ^ -patmat-type-check.scala:27: error: scrutinee is incompatible with pattern type; +patmat-type-check.scala:30: error: scrutinee is incompatible with pattern type; found : Seq[A] - required: Test.Bop3[T] - def f4[T](x: Bop3[T]) = x match { case Seq('b', 'o', 'b') => true } // fail - ^ + required: Test.Bop3[Char] + def f4[T](x: Bop3[Char]) = x match { case Seq('b', 'o', 'b') => true } // fail + ^ four errors found diff --git a/test/files/neg/patmat-type-check.scala b/test/files/neg/patmat-type-check.scala index c6c689b256..26d0409fa0 100644 --- a/test/files/neg/patmat-type-check.scala +++ b/test/files/neg/patmat-type-check.scala @@ -14,6 +14,10 @@ object Test final class Bop5[T, U, -V] def s4[T1, T2](x: Bop5[_, T1, T2]) = x match { case Seq('b', 'o', 'b') => true } + // free type parameter, allowed + final class Bop3[T] + def f4[T](x: Bop3[T]) = x match { case Seq('b', 'o', 'b') => true } + // String and Array are final/invariant, disallowed def f1 = "bob".reverse match { case Seq('b', 'o', 'b') => true } // fail def f2 = "bob".toArray match { case Seq('b', 'o', 'b') => true } // fail @@ -23,6 +27,5 @@ object Test def f3(x: Bop2) = x match { case Seq('b', 'o', 'b') => true } // fail // final, invariant type parameter, should be disallowed - final class Bop3[T] - def f4[T](x: Bop3[T]) = x match { case Seq('b', 'o', 'b') => true } // fail + def f4[T](x: Bop3[Char]) = x match { case Seq('b', 'o', 'b') => true } // fail } diff --git a/test/files/neg/t3692.check b/test/files/neg/t3692.check index ce89a6563d..96ddd2a461 100644 --- a/test/files/neg/t3692.check +++ b/test/files/neg/t3692.check @@ -1,14 +1,4 @@ -t3692.scala:11: warning: type Integer in package scala is deprecated: use <code>java.lang.Integer</code> instead - case m0: Map[Int, Int] => new java.util.HashMap[Integer, Integer] - ^ -t3692.scala:12: warning: type Integer in package scala is deprecated: use <code>java.lang.Integer</code> instead - case m1: Map[Int, V] => new java.util.HashMap[Integer, V] - ^ -t3692.scala:13: warning: type Integer in package scala is deprecated: use <code>java.lang.Integer</code> instead - case m2: Map[T, Int] => new java.util.HashMap[T, Integer] - ^ -t3692.scala:13: error: unreachable code +t3692.scala:15: error: unreachable code case m2: Map[T, Int] => new java.util.HashMap[T, Integer] ^ -three warnings found one error found diff --git a/test/files/neg/t3692.scala b/test/files/neg/t3692.scala index 78b0e4b843..151535ae94 100644 --- a/test/files/neg/t3692.scala +++ b/test/files/neg/t3692.scala @@ -1,3 +1,5 @@ +import java.lang.Integer + object ManifestTester { def main(args: Array[String]) = { val map = Map("John" -> 1, "Josh" -> 2) |