summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2010-10-03 03:19:21 +0000
committerPaul Phillips <paulp@improving.org>2010-10-03 03:19:21 +0000
commit2fefb37220f82300e2aa44442f1a42261d65e359 (patch)
tree24267661fa20065cf33c70d9860774b145673565
parent943fbb1363345fdaca55e5df95059e8ce8c1344b (diff)
downloadscala-2fefb37220f82300e2aa44442f1a42261d65e359.tar.gz
scala-2fefb37220f82300e2aa44442f1a42261d65e359.tar.bz2
scala-2fefb37220f82300e2aa44442f1a42261d65e359.zip
One last batch of test cleanups and I think I'l...
One last batch of test cleanups and I think I'll call it a day. If you're worried I didn't leave any for anyone else, let me put your fears to rest. PLENTY left to sift through. No review.
-rw-r--r--test/files/neg/t0513.check7
-rw-r--r--test/files/neg/t0513.scala (renamed from test/pending/neg/t0513.scala)4
-rw-r--r--test/files/neg/t2078.check4
-rw-r--r--test/files/neg/t2078.scala (renamed from test/pending/neg/t2078.scala)0
-rw-r--r--test/files/neg/t2180.check6
-rw-r--r--test/files/neg/t2180.scala9
-rw-r--r--test/files/pos/t0625.scala8
-rw-r--r--test/pending/neg/bug1210.check7
-rw-r--r--test/pending/neg/bug1210.scala10
-rw-r--r--test/pending/neg/bug1987.scala14
-rw-r--r--test/pending/neg/bug963.scala (renamed from test/pending/neg/t2079.scala)1
-rw-r--r--test/pending/neg/t0625.check7
-rw-r--r--test/pending/neg/t0625.scala4
-rw-r--r--test/pending/neg/t0653.check5
-rw-r--r--test/pending/neg/t0653.scala28
-rw-r--r--test/pending/neg/t1038.check4
-rw-r--r--test/pending/neg/t1038.scala7
-rw-r--r--test/pending/neg/t1845.scala12
-rw-r--r--test/pending/neg/t2180.scala31
-rw-r--r--test/pending/pos/bug1987/bug1987a.scala7
-rw-r--r--test/pending/pos/bug1987/bug1987b.scala10
21 files changed, 80 insertions, 105 deletions
diff --git a/test/files/neg/t0513.check b/test/files/neg/t0513.check
new file mode 100644
index 0000000000..edc0c9ab67
--- /dev/null
+++ b/test/files/neg/t0513.check
@@ -0,0 +1,7 @@
+t0513.scala:5: error: type arguments [Nothing,Int] do not conform to class Y's type parameter bounds [T1,T2 <: T1]
+ val test2 = Test[Y[Nothing, Int]] // No error
+ ^
+t0513.scala:5: error: type arguments [Nothing,Int] do not conform to class Y's type parameter bounds [T1,T2 <: T1]
+ val test2 = Test[Y[Nothing, Int]] // No error
+ ^
+two errors found
diff --git a/test/pending/neg/t0513.scala b/test/files/neg/t0513.scala
index 0082b0e563..0193483cab 100644
--- a/test/pending/neg/t0513.scala
+++ b/test/files/neg/t0513.scala
@@ -1,6 +1,6 @@
object Test {
- case class Y[T1, T2 <: T1]
+ case class Y[T1, T2 <: T1]()
//val test = Y[Nothing, Int] // Compiler error
- case class Test[T]
+ case class Test[T]()
val test2 = Test[Y[Nothing, Int]] // No error
}
diff --git a/test/files/neg/t2078.check b/test/files/neg/t2078.check
new file mode 100644
index 0000000000..1b79c19621
--- /dev/null
+++ b/test/files/neg/t2078.check
@@ -0,0 +1,4 @@
+t2078.scala:2: error: contravariant type S occurs in covariant position in type => java.lang.Object{val x: S} of value f
+ val f = new { val x = y }
+ ^
+one error found
diff --git a/test/pending/neg/t2078.scala b/test/files/neg/t2078.scala
index a697afc646..a697afc646 100644
--- a/test/pending/neg/t2078.scala
+++ b/test/files/neg/t2078.scala
diff --git a/test/files/neg/t2180.check b/test/files/neg/t2180.check
new file mode 100644
index 0000000000..58eb05b6b6
--- /dev/null
+++ b/test/files/neg/t2180.check
@@ -0,0 +1,6 @@
+t2180.scala:3: error: type mismatch;
+ found : List[Any]
+ required: scala.List[Mxml]
+ children.toList.flatMap ( e => {
+ ^
+one error found
diff --git a/test/files/neg/t2180.scala b/test/files/neg/t2180.scala
new file mode 100644
index 0000000000..54a9e49c1c
--- /dev/null
+++ b/test/files/neg/t2180.scala
@@ -0,0 +1,9 @@
+class Mxml {
+ private def processChildren( children:Seq[Any] ):List[Mxml] = {
+ children.toList.flatMap ( e => {
+ e match {
+ case s:scala.collection.Traversable[_] => s case a => List(a)
+ }
+ })
+ }
+}
diff --git a/test/files/pos/t0625.scala b/test/files/pos/t0625.scala
new file mode 100644
index 0000000000..5614542599
--- /dev/null
+++ b/test/files/pos/t0625.scala
@@ -0,0 +1,8 @@
+object Test {
+ def idMap[C[_],T](m: { def map[U](f: T => U): C[U] }): C[T] = m.map(t => t)
+
+ def main(args: Array[String]): Unit = {
+ idMap(Some(5))
+ idMap(Responder.constant(5))
+ }
+}
diff --git a/test/pending/neg/bug1210.check b/test/pending/neg/bug1210.check
deleted file mode 100644
index 4db920556f..0000000000
--- a/test/pending/neg/bug1210.check
+++ /dev/null
@@ -1,7 +0,0 @@
-bug1210.scala:13: error: illegal cyclic reference involving type Settings
- val v: List[selfType] = f[selfType]((x: selfType) => x.v)
- ^
-bug1210.scala:24: error: illegal cyclic reference involving type Settings
- f[selfType](_.g)
- ^
-two errors found
diff --git a/test/pending/neg/bug1210.scala b/test/pending/neg/bug1210.scala
deleted file mode 100644
index fc2c954ff2..0000000000
--- a/test/pending/neg/bug1210.scala
+++ /dev/null
@@ -1,10 +0,0 @@
-object Test {
- def id[T](f: T => T): T = error("bla")
-
- abstract class M { self =>
- type Settings
- type selfType = M {type Settings = self.Settings}
-
- val v: selfType = id[M.this.selfType](_.v)
- }
-}
diff --git a/test/pending/neg/bug1987.scala b/test/pending/neg/bug1987.scala
deleted file mode 100644
index d45f1b0f0d..0000000000
--- a/test/pending/neg/bug1987.scala
+++ /dev/null
@@ -1,14 +0,0 @@
-
-
-// Copyright Shunsuke Sogame 2008-2009.
-// Distributed under the terms of an MIT-style license.
-
-
-package object overloading {
- def bar(f: (Int) => Unit): Unit = ()
- def bar(f: (Int, Int) => Unit): Unit = ()
-}
-
-class PackageObjectOverloadingTest {
- overloading.bar( (i: Int) => () ) // doesn't compile.
-}
diff --git a/test/pending/neg/t2079.scala b/test/pending/neg/bug963.scala
index a86674c7e0..430ef090e4 100644
--- a/test/pending/neg/t2079.scala
+++ b/test/pending/neg/bug963.scala
@@ -1,3 +1,4 @@
+// Soundness bug, at #963 and dup at #2079.
trait A {
type T
var v : T
diff --git a/test/pending/neg/t0625.check b/test/pending/neg/t0625.check
deleted file mode 100644
index 45a35eb157..0000000000
--- a/test/pending/neg/t0625.check
+++ /dev/null
@@ -1,7 +0,0 @@
-<insert expected error message, current one is the following>
-
-t0625.scala:3: error: inferred the kinds of the type arguments (Option[B],Int) do not conform to the expected kinds of the type parameters (type C,type T).
-Option[B]'s type parameters do not match type C's expected parameters: class Option has one type parameter, but type C has one
- idMap(Some(0))
- ^
-one error found
diff --git a/test/pending/neg/t0625.scala b/test/pending/neg/t0625.scala
deleted file mode 100644
index a44a04fd97..0000000000
--- a/test/pending/neg/t0625.scala
+++ /dev/null
@@ -1,4 +0,0 @@
-object Test {
- def idMap[C[_],T](m: { def map[U](f: T => U): C[U] }): C[T] = m.map(t => t)
- idMap(Some(0))
-}
diff --git a/test/pending/neg/t0653.check b/test/pending/neg/t0653.check
deleted file mode 100644
index cb5ca65b8e..0000000000
--- a/test/pending/neg/t0653.check
+++ /dev/null
@@ -1,5 +0,0 @@
-t0653.scala:5: error: inferred the kinds of the type arguments (InL[Nothing,Nothing]) do not conform to the expected kinds of the type parameters (type Op) in class Fix.
-InL[Nothing,Nothing]'s type parameters do not match type Op's expected parameters: class InL has two type parameters, but type Op has one
- val zero = new Fix(new InL)
- ^
-one error found
diff --git a/test/pending/neg/t0653.scala b/test/pending/neg/t0653.scala
index 156aa2d701..48f39447ba 100644
--- a/test/pending/neg/t0653.scala
+++ b/test/pending/neg/t0653.scala
@@ -1,6 +1,30 @@
-class InL[A, B]
+// What is this test in place to test for?
+//
+class One[A]
+class Two[A, B]
class Fix[Op[A]](x : Op[Fix[Op]])
class FixTest {
- val zero = new Fix(new InL)
+ // works
+ // val zero = new Fix[One](new One)
+
+ // don't work:
+ val two = new Fix(new Two) // this was what I found here
+ val zero = new Fix(new One) // this seems like something which could plausibly work
+
+ // neg/t0653.scala:12: error: no type parameters for constructor Fix: (x: Op[Fix[Op[A]]])Fix[Op[A]] exist so that it can be applied to arguments (Two[Nothing,Nothing])
+ // --- because ---
+ // argument expression's type is not compatible with formal parameter type;
+ // found : Two[Nothing,Nothing]
+ // required: ?Op[ Fix[?Op[ A ]] ]
+ // val two = new Fix(new Two) // this was what I found here
+ // ^
+ // neg/t0653.scala:13: error: no type parameters for constructor Fix: (x: Op[Fix[Op[A]]])Fix[Op[A]] exist so that it can be applied to arguments (One[Nothing])
+ // --- because ---
+ // argument expression's type is not compatible with formal parameter type;
+ // found : One[Nothing]
+ // required: ?Op[ Fix[?Op[ A ]] ]
+ // val zero = new Fix(new One) // this seems like something which could plausibly work
+ // ^
+ // two errors found
}
diff --git a/test/pending/neg/t1038.check b/test/pending/neg/t1038.check
deleted file mode 100644
index 3bfd479f42..0000000000
--- a/test/pending/neg/t1038.check
+++ /dev/null
@@ -1,4 +0,0 @@
-t1038.scala:4: error: wrong number of arguments for constructor X: (Int)X
- val a = new X
- ^
-one error found
diff --git a/test/pending/neg/t1038.scala b/test/pending/neg/t1038.scala
deleted file mode 100644
index 7157aafa06..0000000000
--- a/test/pending/neg/t1038.scala
+++ /dev/null
@@ -1,7 +0,0 @@
-class X(x : Int)
-
-object Y {
- val a = new X
- import a._
- implicit val b : Int = 1
-}
diff --git a/test/pending/neg/t1845.scala b/test/pending/neg/t1845.scala
deleted file mode 100644
index cfb28aa03c..0000000000
--- a/test/pending/neg/t1845.scala
+++ /dev/null
@@ -1,12 +0,0 @@
-// Compiling the attached code makes scalac give a NPE.
-
-import scala.util.parsing.combinator.syntactical.TokenParsers
-import scala.util.parsing.combinator.lexical.StdLexical
-import scala.util.parsing.syntax.StdTokens
-
-class MyTokenParsers extends TokenParsers {
- import lexical._
- type Tokens = StdTokens
- type Elem = lexical.Token
- val lexical = new StdLexical
-}
diff --git a/test/pending/neg/t2180.scala b/test/pending/neg/t2180.scala
deleted file mode 100644
index a8055bf77d..0000000000
--- a/test/pending/neg/t2180.scala
+++ /dev/null
@@ -1,31 +0,0 @@
-
-
-Given the following code (which is broken):
-
-class Mxml {
-
- private def processChildren( children:Seq[Any] ):List[Mxml] = {
-
- children.toList.flatMap ( e => {
-
- e match {
-
- case s:scala.collection.Traversable[_] => s case a => List(a)
-
- }
-
- })
-
- }
-
-}
-
-I get the following error:
-
-Mxml.scala:5: error: could not find implicit value for parameter bf:scala.collection.generic.BuilderFactory[Any,List[Mxml],Sequence[Any]].
-
- children.flatMap ( e => {
-
-I spent 4 hours failing before I figured out the problem. The return type was wrong. It should have been List[Any].
-
-I have seen similar errors with map. My solution in the past has been to change it to a foldLeft because I have never been able to determine how to fix the problem until now.
diff --git a/test/pending/pos/bug1987/bug1987a.scala b/test/pending/pos/bug1987/bug1987a.scala
new file mode 100644
index 0000000000..7a62877ba0
--- /dev/null
+++ b/test/pending/pos/bug1987/bug1987a.scala
@@ -0,0 +1,7 @@
+package bug
+
+// goes with bug1987b.scala
+package object packageb {
+ def func(a: Int) = ()
+ def func(a: String) = ()
+}
diff --git a/test/pending/pos/bug1987/bug1987b.scala b/test/pending/pos/bug1987/bug1987b.scala
new file mode 100644
index 0000000000..875f5128f2
--- /dev/null
+++ b/test/pending/pos/bug1987/bug1987b.scala
@@ -0,0 +1,10 @@
+// compile with bug1987a.scala
+
+package bug.packageb
+// Note that the overloading works if instead of being in the package we import it:
+// replace the above line with import bug.packageb._
+
+class Client {
+ val x = func(1) // doesn't compile: type mismatch; found: Int(1) required: String
+ val y = func("1") // compiles
+}