summaryrefslogtreecommitdiff
path: root/test/files
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2009-09-28 11:09:14 +0000
committerMartin Odersky <odersky@gmail.com>2009-09-28 11:09:14 +0000
commit53d98e7d421d55054fb0bcb606539fc36364bebf (patch)
treebe6b68360458b97ab92a0dc3e963f365ae5acd95 /test/files
parent32cac0e3fde4a512d7322cd60146bdac7d1898d4 (diff)
downloadscala-53d98e7d421d55054fb0bcb606539fc36364bebf.tar.gz
scala-53d98e7d421d55054fb0bcb606539fc36364bebf.tar.bz2
scala-53d98e7d421d55054fb0bcb606539fc36364bebf.zip
refined implicit resolution.
Diffstat (limited to 'test/files')
-rw-r--r--test/files/neg/implicits.scala19
-rw-r--r--test/files/pos/implicits.scala6
-rw-r--r--test/files/run/arrays.scala8
-rw-r--r--test/files/run/colltest1.scala2
-rw-r--r--test/files/run/multi-array.scala1
5 files changed, 36 insertions, 0 deletions
diff --git a/test/files/neg/implicits.scala b/test/files/neg/implicits.scala
index 056e0be6ca..be85029660 100644
--- a/test/files/neg/implicits.scala
+++ b/test/files/neg/implicits.scala
@@ -37,3 +37,22 @@ object test2 {
def foo(x: Int) = 3
foo(set)
}
+
+// #2180
+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/implicits.scala b/test/files/pos/implicits.scala
index 88632850fa..a8d362d0a7 100644
--- a/test/files/pos/implicits.scala
+++ b/test/files/pos/implicits.scala
@@ -30,3 +30,9 @@ object Test1625 {
println("=> result: " + res)
}
}
+
+object Test2188 {
+ implicit def toJavaList[A: ClassManifest](t:collection.Sequence[A]):java.util.List[A] = java.util.Arrays.asList(t.toArray:_*)
+
+ val x: java.util.List[String] = List("foo")
+}
diff --git a/test/files/run/arrays.scala b/test/files/run/arrays.scala
index 8a2d96a2a7..e8a984dc1b 100644
--- a/test/files/run/arrays.scala
+++ b/test/files/run/arrays.scala
@@ -158,6 +158,12 @@ object Test {
c(xs)
}
+ def checkT2368() {
+ val arr = Array(1, 2, 3)
+ arr(0) += 1
+ assert(arr(0) == 1)
+ }
+
//##########################################################################
// Values
@@ -919,6 +925,7 @@ object Test {
checkZip
checkConcat
+ checkT2368()
//######################################################################
@@ -929,3 +936,4 @@ object Test {
//##########################################################################
}
+
diff --git a/test/files/run/colltest1.scala b/test/files/run/colltest1.scala
index 2fc8af2390..7069c052a5 100644
--- a/test/files/run/colltest1.scala
+++ b/test/files/run/colltest1.scala
@@ -127,6 +127,8 @@ object Test extends Application {
assert(ten.patch(0, List(1, 2, 3), 9) == List(1, 2, 3, 10))
assert(empty.padTo(10, 7) == Array.fill(10)(7).toSequence)
assert((ten zip ten.indices) == ten.zipWithIndex)
+ assert(ten sortWith (_ < _) == ten)
+ assert(ten sortWith (_ > _) == ten.reverse)
}
def setTest(empty: => Set[String]) {
diff --git a/test/files/run/multi-array.scala b/test/files/run/multi-array.scala
index 04538402f8..42f64751fd 100644
--- a/test/files/run/multi-array.scala
+++ b/test/files/run/multi-array.scala
@@ -10,4 +10,5 @@ object Test extends Application {
for (i <- 0 until 3; j <- 0 until 3)
aaiComplete(i)(j) = i + j
println(aaiComplete.deepToString)
+ assert(aaiComplete.last.last == 4)
}