diff options
Diffstat (limited to 'test/files')
-rw-r--r-- | test/files/neg/t2421b.check | 4 | ||||
-rw-r--r-- | test/files/neg/t2421b.scala | 17 | ||||
-rw-r--r-- | test/files/neg/t2641.check | 2 | ||||
-rw-r--r-- | test/files/neg/t2870.check | 7 | ||||
-rwxr-xr-x | test/files/neg/t2870.scala | 9 | ||||
-rw-r--r-- | test/files/pos/t2421b.scala | 19 | ||||
-rw-r--r-- | test/files/pos/t2810.scala | 8 | ||||
-rw-r--r-- | test/files/pos/t2867.scala | 1 | ||||
-rw-r--r-- | test/files/positions/Scaladoc6.scala | 10 | ||||
-rw-r--r-- | test/files/positions/Scaladoc7.scala | 6 | ||||
-rw-r--r-- | test/files/positions/Scaladoc8.scala | 6 | ||||
-rw-r--r-- | test/files/run/bug2354.scala | 17 | ||||
-rw-r--r-- | test/files/run/bug2876.scala | 7 | ||||
-rw-r--r-- | test/files/run/map_java_conversions.scala | 60 | ||||
-rw-r--r-- | test/files/run/t2849.scala | 46 |
15 files changed, 218 insertions, 1 deletions
diff --git a/test/files/neg/t2421b.check b/test/files/neg/t2421b.check new file mode 100644 index 0000000000..f666a7d9d7 --- /dev/null +++ b/test/files/neg/t2421b.check @@ -0,0 +1,4 @@ +t2421b.scala:12: error: could not find implicit value for parameter aa: Test.F[Test.A] + f + ^ +one error found
\ No newline at end of file diff --git a/test/files/neg/t2421b.scala b/test/files/neg/t2421b.scala new file mode 100644 index 0000000000..d8159a8c37 --- /dev/null +++ b/test/files/neg/t2421b.scala @@ -0,0 +1,17 @@ +object Test { + class A + class B + class C + class F[X] + + def f(implicit aa: F[A]) = println(aa) + + // implicit def a : F[A] = new F[A]() + implicit def b[X <: B] = new F[X]() + + f +} + +/* bug: +error: type arguments [Test2.A] do not conform to method b's type parameter bounds [X <: Test2.B] +*/
\ No newline at end of file diff --git a/test/files/neg/t2641.check b/test/files/neg/t2641.check index 07900d0796..771624e8d9 100644 --- a/test/files/neg/t2641.check +++ b/test/files/neg/t2641.check @@ -25,7 +25,7 @@ t2641.scala:27: error: illegal inheritance; superclass Any trait Sliced extends Transformed[A] with super.Sliced { ^ t2641.scala:27: error: illegal inheritance; superclass Any - is not a subclass of the superclass TraversableLike + is not a subclass of the superclass Object of the mixin trait Sliced trait Sliced extends Transformed[A] with super.Sliced { ^ diff --git a/test/files/neg/t2870.check b/test/files/neg/t2870.check new file mode 100644 index 0000000000..6577577d3f --- /dev/null +++ b/test/files/neg/t2870.check @@ -0,0 +1,7 @@ +t2870.scala:1: error: not found: type Jar +class Jars(jar: Jar) + ^ +t2870.scala:6: error: illegal cyclic reference involving value <import> + val scala = fromClasspathString(javaClassPath) + ^ +two errors found diff --git a/test/files/neg/t2870.scala b/test/files/neg/t2870.scala new file mode 100755 index 0000000000..4de19242e3 --- /dev/null +++ b/test/files/neg/t2870.scala @@ -0,0 +1,9 @@ +class Jars(jar: Jar) + +object Jars { + import scala.util.Properties.javaClassPath + + val scala = fromClasspathString(javaClassPath) + + def fromClasspathString(s: String): Jars = null +} diff --git a/test/files/pos/t2421b.scala b/test/files/pos/t2421b.scala new file mode 100644 index 0000000000..0df3461662 --- /dev/null +++ b/test/files/pos/t2421b.scala @@ -0,0 +1,19 @@ +object Test { + class A + class B + class C + class F[X] + + def f(implicit aa: F[A]) = println(aa) + + implicit def a : F[A] = new F[A]() + implicit def b[X <: B] = new F[X]() + + f +} +/* bug: +error: ambiguous implicit values: + both method b in object Test1 of type [X <: Test1.B]Test1.F[X] + and method a in object Test1 of type => Test1.F[Test1.A] + match expected type Test1.F[Test1.A] +*/ diff --git a/test/files/pos/t2810.scala b/test/files/pos/t2810.scala new file mode 100644 index 0000000000..c85eca164a --- /dev/null +++ b/test/files/pos/t2810.scala @@ -0,0 +1,8 @@ + + + + +object Test { + val closeable1: { def close(): Unit } = new scala.io.Source { val iter: Iterator[Char] = "".iterator } + val closeable2: { def close(): Unit } = new java.io.Closeable { def close() = {} } +} diff --git a/test/files/pos/t2867.scala b/test/files/pos/t2867.scala new file mode 100644 index 0000000000..0434a380b9 --- /dev/null +++ b/test/files/pos/t2867.scala @@ -0,0 +1 @@ +case class A(l: List[_]*) diff --git a/test/files/positions/Scaladoc6.scala b/test/files/positions/Scaladoc6.scala new file mode 100644 index 0000000000..8beda625ae --- /dev/null +++ b/test/files/positions/Scaladoc6.scala @@ -0,0 +1,10 @@ +object Scaladoc6 { + { + /** + * Foo + */ + val i = 23 + } + + def f {} +} diff --git a/test/files/positions/Scaladoc7.scala b/test/files/positions/Scaladoc7.scala new file mode 100644 index 0000000000..6175222e3f --- /dev/null +++ b/test/files/positions/Scaladoc7.scala @@ -0,0 +1,6 @@ +object Scaladoc7 { + /** + * Foo + */ + val Pair(i, j) = (1, 2) +} diff --git a/test/files/positions/Scaladoc8.scala b/test/files/positions/Scaladoc8.scala new file mode 100644 index 0000000000..519d6ca06c --- /dev/null +++ b/test/files/positions/Scaladoc8.scala @@ -0,0 +1,6 @@ +/** + * Foo + */ +object Scaladoc8 { + +} diff --git a/test/files/run/bug2354.scala b/test/files/run/bug2354.scala new file mode 100644 index 0000000000..f46db13a95 --- /dev/null +++ b/test/files/run/bug2354.scala @@ -0,0 +1,17 @@ +import scala.xml.parsing._ +import scala.io.Source + +object Test +{ + val xml_good = "<title><![CDATA[Hello [tag]]]></title>" + val xml_bad = "<title><![CDATA[Hello [tag] ]]></title>" + + val parser1 = ConstructingParser.fromSource(Source.fromString(xml_good),false) + val parser2 = ConstructingParser.fromSource(Source.fromString(xml_bad),false) + + def main(args: Array[String]): Unit = { + parser1.document + parser2.document + } +} + diff --git a/test/files/run/bug2876.scala b/test/files/run/bug2876.scala new file mode 100644 index 0000000000..f71879ebff --- /dev/null +++ b/test/files/run/bug2876.scala @@ -0,0 +1,7 @@ +object Test +{ + def main(args: Array[String]): Unit = { + "x".view.filter(_ => true).take(1) + } +} + diff --git a/test/files/run/map_java_conversions.scala b/test/files/run/map_java_conversions.scala new file mode 100644 index 0000000000..4f9f8a915a --- /dev/null +++ b/test/files/run/map_java_conversions.scala @@ -0,0 +1,60 @@ + + + + + +object Test { + + def main(args: Array[String]) { + import collection.JavaConversions._ + + test(new java.util.HashMap[String, String]) + test(new java.util.Properties) + testConcMap + } + + def testConcMap { + import collection.JavaConversions._ + + val concMap = new java.util.concurrent.ConcurrentHashMap[String, String] + + test(concMap) + val cmap = asConcurrentMap(concMap) + cmap.putIfAbsent("absentKey", "absentValue") + cmap.put("somekey", "somevalue") + assert(cmap.remove("somekey", "somevalue") == true) + assert(cmap.replace("absentKey", "newAbsentValue") == Some("absentValue")) + assert(cmap.replace("absentKey", "newAbsentValue", ".......") == true) + } + + def test(m: collection.mutable.Map[String, String]) { + m.clear + assert(m.size == 0) + + m.put("key", "value") + assert(m.size == 1) + + assert(m.put("key", "anotherValue") == Some("value")) + assert(m.put("key2", "value2") == None) + assert(m.size == 2) + + m += (("key3", "value3")) + assert(m.size == 3) + + m -= "key2" + assert(m.size == 2) + assert(m.nonEmpty) + assert(m.remove("key") == Some("anotherValue")) + + m.clear + for (i <- 0 until 10) m += (("key" + i, "value" + i)) + for ((k, v) <- m) assert(k.startsWith("key")) + } + +} + + + + + + diff --git a/test/files/run/t2849.scala b/test/files/run/t2849.scala new file mode 100644 index 0000000000..68094de736 --- /dev/null +++ b/test/files/run/t2849.scala @@ -0,0 +1,46 @@ + + + +import scala.collection.immutable.SortedSet +import scala.collection.immutable.TreeSet + + + +object Test { + + def main(args: Array[String]) { + ticketExample + similarExample + } + + def ticketExample { + var big = 100000 + + var aSortedSet: SortedSet[Int] = TreeSet(big) + + for (i <- 1 until 10000) { + aSortedSet = (aSortedSet - big) ++ (TreeSet(i, big - 1)) + big = big - 1 + if (i % 1000 == 0) { + aSortedSet.until(i) + } + } + } + + def similarExample { + var big = 100 + + var aSortedSet: SortedSet[Int] = TreeSet(big) + + for (i <- 1 until 10000) { + aSortedSet = (aSortedSet - big) ++ (TreeSet(i, big - 1)) + big + big = big - 1 + if (i % 1000 == 0) { + aSortedSet.until(i) + } + } + } + +} + + |