summaryrefslogtreecommitdiff
path: root/test/files
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2010-11-18 01:11:37 +0000
committerPaul Phillips <paulp@improving.org>2010-11-18 01:11:37 +0000
commita86453a5eed21abf5dfa5fd1d0321c8eb0298302 (patch)
tree360448d50fe40940a3d9dfb255801a93b28da07f /test/files
parent48451f980e1a252a0470e72dfd944b1eee52891b (diff)
downloadscala-a86453a5eed21abf5dfa5fd1d0321c8eb0298302.tar.gz
scala-a86453a5eed21abf5dfa5fd1d0321c8eb0298302.tar.bz2
scala-a86453a5eed21abf5dfa5fd1d0321c8eb0298302.zip
Some refinement of the error messages when the ...
Some refinement of the error messages when the found and required types have the same simple names. No longer must we watch people scratch their heads at such messages as: found : scala.collection.Set[String] required: Set[String] Now so clear you could enjoy a movie through it: found : scala.collection.Set[String] required: scala.collection.immutable.Set[String] No review.
Diffstat (limited to 'test/files')
-rw-r--r--test/files/neg/bug2102.check2
-rw-r--r--test/files/neg/bug910.check2
-rw-r--r--test/files/neg/implicits.check2
-rw-r--r--test/files/neg/names-defaults-neg.check4
-rw-r--r--test/files/neg/t2180.check2
-rw-r--r--test/files/neg/type-diagnostics.check16
-rw-r--r--test/files/neg/type-diagnostics.scala18
7 files changed, 40 insertions, 6 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))
+}