diff options
author | Martin Odersky <odersky@gmail.com> | 2006-10-20 13:37:17 +0000 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2006-10-20 13:37:17 +0000 |
commit | f9e5afd36a8a241abc86c80197d8fbe10488280e (patch) | |
tree | 0210b277aeabea10dc8eca0dc96171dcd5934976 /test/files | |
parent | f3f8f974bf0ebbe4746fbe83103566e71e8b1e7c (diff) | |
download | scala-f9e5afd36a8a241abc86c80197d8fbe10488280e.tar.gz scala-f9e5afd36a8a241abc86c80197d8fbe10488280e.tar.bz2 scala-f9e5afd36a8a241abc86c80197d8fbe10488280e.zip |
fixed problems in type patterns
made some type error messages more precise
Diffstat (limited to 'test/files')
-rw-r--r-- | test/files/neg/bug126.check | 4 | ||||
-rw-r--r-- | test/files/neg/bug126.scala | 8 | ||||
-rw-r--r-- | test/files/neg/escapes.check | 5 | ||||
-rwxr-xr-x | test/files/neg/escapes.scala | 6 | ||||
-rw-r--r-- | test/files/neg/gadts1.check | 7 | ||||
-rw-r--r-- | test/files/neg/viewtest.check | 7 | ||||
-rwxr-xr-x | test/files/pos/escapes2.scala | 5 | ||||
-rw-r--r-- | test/files/pos/viewtest2.scala | 2 | ||||
-rw-r--r-- | test/files/run/lisp.scala | 2 |
9 files changed, 25 insertions, 21 deletions
diff --git a/test/files/neg/bug126.check b/test/files/neg/bug126.check deleted file mode 100644 index 84a50aa821..0000000000 --- a/test/files/neg/bug126.check +++ /dev/null @@ -1,4 +0,0 @@ -bug126.scala:5 error: forward reference extends over definition of value foo2 - val Tuple1(foo2:(Any => Any)) = Tuple1((x:Any) => foo2(x)); - ^ -one error found diff --git a/test/files/neg/bug126.scala b/test/files/neg/bug126.scala deleted file mode 100644 index 75c10e608a..0000000000 --- a/test/files/neg/bug126.scala +++ /dev/null @@ -1,8 +0,0 @@ -class O { - val Bar:Any => Any = ((x:Any) => Bar(x)); - val Tuple2(foo:(Any => Any), bar) = Tuple2((x:Any) => foo(x), 1); - { - val Tuple1(foo2:(Any => Any)) = Tuple1((x:Any) => foo2(x)); - Console.println(foo2) - } -} diff --git a/test/files/neg/escapes.check b/test/files/neg/escapes.check new file mode 100644 index 0000000000..95299a4c75 --- /dev/null +++ b/test/files/neg/escapes.check @@ -0,0 +1,5 @@ +escapes.scala:2 error: type t escapes its defining scope as part of type t + def f(x: Any) = x match { case y: Cell[t] => y.elem }
+ ^ +subst type t to T +one error found diff --git a/test/files/neg/escapes.scala b/test/files/neg/escapes.scala new file mode 100755 index 0000000000..3a280e8d0a --- /dev/null +++ b/test/files/neg/escapes.scala @@ -0,0 +1,6 @@ +object Test { + def f(x: Any) = x match { case y: Cell[t] => y.elem } + class C3[T](val elem: T) + class D3[T](val elemD: T) extends C3[T](elemD) + def f[T](x: C3[T]) = x match { case d: D3[t] => d.elemD } +} diff --git a/test/files/neg/gadts1.check b/test/files/neg/gadts1.check index 8b3d6605ed..a761b79cb8 100644 --- a/test/files/neg/gadts1.check +++ b/test/files/neg/gadts1.check @@ -1,11 +1,6 @@ gadts1.scala:15 error: type mismatch; - found : Test.this.NumTerm - required: Test.this.Term[a] - case NumTerm(n) => c.x = Double(1.0) - ^ -gadts1.scala:15 error: type mismatch; found : Test.this.Double required: a case NumTerm(n) => c.x = Double(1.0) ^ -two errors found +one error found diff --git a/test/files/neg/viewtest.check b/test/files/neg/viewtest.check index b98b56bce5..044c3b7d91 100644 --- a/test/files/neg/viewtest.check +++ b/test/files/neg/viewtest.check @@ -1,7 +1,12 @@ +viewtest.scala:43 error: type mismatch; + found : scala.List[<type a in method compareTo>] + required: scala.List[<type a in method view3>] + case y1: List[a] => compareLists(x, y1) + ^ viewtest.scala:104 error: ambiguous implicit value: both method view4 in object O of type [a](a)a and method identity in object Predef of type [a](a)a match expected type (test.Str) => test.Ordered[test.Str] t = t insert Str(s) ^ -one error found +two errors found diff --git a/test/files/pos/escapes2.scala b/test/files/pos/escapes2.scala new file mode 100755 index 0000000000..b94066936a --- /dev/null +++ b/test/files/pos/escapes2.scala @@ -0,0 +1,5 @@ +object Test { + class C3[T](val elem: T) + class D3[T](val elemD: T) extends C3[T](elemD) + def f[T](x: C3[T]) = x match { case d: D3[t] => d.elemD } +} diff --git a/test/files/pos/viewtest2.scala b/test/files/pos/viewtest2.scala index 66cd1aa1bd..6a6ed96df7 100644 --- a/test/files/pos/viewtest2.scala +++ b/test/files/pos/viewtest2.scala @@ -40,7 +40,7 @@ object O { implicit def view3[a <% Ordered[a]](x: List[a]): Ordered[List[a]] = new Ordered[List[a]] { def compareTo [b >: List[a] <% Ordered[b]](y: b): int = y match { - case y1: List[a] => compareLists(x, y1) + case y1: List[a1] => compareLists(x, y1.asInstanceOf[List[a]]) case _ => -(y compareTo x) } private def compareLists(xs: List[a], ys: List[a]): int = { diff --git a/test/files/run/lisp.scala b/test/files/run/lisp.scala index f12196ca50..bf895f2349 100644 --- a/test/files/run/lisp.scala +++ b/test/files/run/lisp.scala @@ -287,7 +287,7 @@ object LispAny extends Lisp { } def asList(x: Data): List[Data] = x match { - case y: List[Data] => y + case y: List[_] => y case _ => lispError("malformed list: " + x) } |