diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/files/neg/bug2102.check | 2 | ||||
-rw-r--r-- | test/files/neg/bug910.check | 2 | ||||
-rw-r--r-- | test/files/neg/implicits.check | 2 | ||||
-rw-r--r-- | test/files/neg/names-defaults-neg.check | 4 | ||||
-rw-r--r-- | test/files/neg/t2180.check | 2 | ||||
-rw-r--r-- | test/files/neg/type-diagnostics.check | 16 | ||||
-rw-r--r-- | test/files/neg/type-diagnostics.scala | 18 | ||||
-rw-r--r-- | test/pending/run/instanceOfAndTypeMatching.scala | 11 |
8 files changed, 45 insertions, 12 deletions
diff --git a/test/files/neg/bug2102.check b/test/files/neg/bug2102.check index 075aa85e48..7478fcfcea 100644 --- a/test/files/neg/bug2102.check +++ b/test/files/neg/bug2102.check @@ -1,6 +1,6 @@ bug2102.scala:2: error: type mismatch; found : java.util.Iterator[Int] - required: scala.Iterator[_] + required: scala.collection.Iterator[_] val x: Iterator[_] = new java.util.ArrayList[Int]().iterator ^ one error found diff --git a/test/files/neg/bug910.check b/test/files/neg/bug910.check index 2bc2d986fa..1a845db9b9 100644 --- a/test/files/neg/bug910.check +++ b/test/files/neg/bug910.check @@ -1,6 +1,6 @@ bug910.scala:4: error: type mismatch; found : Seq[Char] - required: scala.Seq[Int] + required: Seq[Int] val y: Seq[Int] = rest ^ one error found diff --git a/test/files/neg/implicits.check b/test/files/neg/implicits.check index d975ccfa84..f7923131e1 100644 --- a/test/files/neg/implicits.check +++ b/test/files/neg/implicits.check @@ -5,7 +5,7 @@ implicits.scala:38: error: type mismatch; ^ implicits.scala:46: error: type mismatch; found : List[Any] - required: scala.List[Mxml] + required: List[Mxml] children.toList.flatMap ( e => { ^ two errors found diff --git a/test/files/neg/names-defaults-neg.check b/test/files/neg/names-defaults-neg.check index 743496e0e1..4882c01e4c 100644 --- a/test/files/neg/names-defaults-neg.check +++ b/test/files/neg/names-defaults-neg.check @@ -89,13 +89,13 @@ names-defaults-neg.scala:76: error: no type parameters for method test4: (x: T[T --- because --- argument expression's type is not compatible with formal parameter type; found : List[Int] - required: ?T[ ?T[ scala.List[?T[ X forSome { type X } ]] ] ] + required: ?T[ ?T[ List[?T[ X forSome { type X } ]] ] ] Error occurred in an application involving default arguments. test4() ^ names-defaults-neg.scala:79: error: type mismatch; found : List[Int] - required: scala.List[scala.List[?]] + required: List[List[?]] def test6[T](x: List[List[T]] = List(1,2)) = x ^ names-defaults-neg.scala:82: error: type mismatch; diff --git a/test/files/neg/t2180.check b/test/files/neg/t2180.check index 58eb05b6b6..addc4cfbb8 100644 --- a/test/files/neg/t2180.check +++ b/test/files/neg/t2180.check @@ -1,6 +1,6 @@ t2180.scala:3: error: type mismatch; found : List[Any] - required: scala.List[Mxml] + required: List[Mxml] children.toList.flatMap ( e => { ^ one error found diff --git a/test/files/neg/type-diagnostics.check b/test/files/neg/type-diagnostics.check new file mode 100644 index 0000000000..33e07f3816 --- /dev/null +++ b/test/files/neg/type-diagnostics.check @@ -0,0 +1,16 @@ +type-diagnostics.scala:4: error: type mismatch; + found : scala.collection.Set[String] + required: scala.collection.immutable.Set[String] + def f = Calculator("Hello",binding.keySet) + ^ +type-diagnostics.scala:13: error: type mismatch; + found : List[a(in method f2)] + required: List[a(in method f1)] + y match { case y1: List[a] => f3(x, y1) } + ^ +type-diagnostics.scala:17: error: type mismatch; + found : String(in method f2) + required: java.lang.String + def f2[String](s: String) = strings(List(s)) + ^ +three errors found diff --git a/test/files/neg/type-diagnostics.scala b/test/files/neg/type-diagnostics.scala new file mode 100644 index 0000000000..fdc0978138 --- /dev/null +++ b/test/files/neg/type-diagnostics.scala @@ -0,0 +1,18 @@ +object SetVsSet { + case class Calculator[+T](name: String, parameters: Set[String]) + val binding = Map.empty[String, String] + def f = Calculator("Hello",binding.keySet) +} + +object TParamConfusion { + def strings(xs: List[String]) = xs + + def f1[a <% Ordered[a]](x: List[a]) = { + def f2[b >: List[a] <% Ordered[b]](x: List[a], y: b): Int = { + def f3(xs: List[a], ys: List[a]) = -1 + y match { case y1: List[a] => f3(x, y1) } + } + } + + def f2[String](s: String) = strings(List(s)) +} diff --git a/test/pending/run/instanceOfAndTypeMatching.scala b/test/pending/run/instanceOfAndTypeMatching.scala index 9ab2d6c3c4..60b11ef0c1 100644 --- a/test/pending/run/instanceOfAndTypeMatching.scala +++ b/test/pending/run/instanceOfAndTypeMatching.scala @@ -87,8 +87,7 @@ class Outer { } } -object Test -{ +object Test { val outer1 = new Outer val outer2 = new Outer val inner1 = new outer1.Inner @@ -118,8 +117,8 @@ object Test List("These should be true under any scenario: ", inner1.isInstanceOf[outer1.Inner] , inner1.isInstanceOf[Outer#Inner] , - inner1 match { case _: Outer#Inner => true ; case _ => false } , - inner1 match { case _: outer1.Inner => true ; case _ => false } , + (inner1: Any) match { case _: Outer#Inner => true ; case _ => false } , + (inner1: Any) match { case _: outer1.Inner => true ; case _ => false } , inner1.compareSharpWithTypeMatch(inner2) , inner1.compareSharpWithInstanceOf(inner2) ) foreach println @@ -139,7 +138,7 @@ object Test ) foreach println List("These are doing the wrong thing under current proposal", - inner1 match { case _: outer2.Inner => true ; case _ => false } // should be false + (inner1: Any) match { case _: outer2.Inner => true ; case _ => false } // should be false ) foreach println } @@ -159,7 +158,7 @@ object Test // required: MethodInner where type MethodInner <: java.lang.Object with ScalaObject{def passOuter(other: Outer): Unit; def passThisType(other: Test.outer1.type): Unit; def passInner(other: Test.outer1.Inner): Unit; def passInner2(other: Test.outer1.Inner): Unit; def passInnerSharp(other: Outer#Inner): Unit; def passMethodInner(other: MethodInner): Unit} // method1.passMethodInner(method1) // ^ - // method1.passMethodInner(method1) + method1.passMethodInner(method1) // these should all fail to compile, and do // |