summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAntonio Cunei <antonio.cunei@epfl.ch>2010-01-15 17:18:18 +0000
committerAntonio Cunei <antonio.cunei@epfl.ch>2010-01-15 17:18:18 +0000
commit1ee78f5a8d1ac4beb3dff19f8aa147feea508e33 (patch)
tree977e78a276ba4939cc40d55dd77149ae3e0e10e9 /test
parent914d6ff44e34a1c15a920d6c055df062cc31b4f3 (diff)
downloadscala-1ee78f5a8d1ac4beb3dff19f8aa147feea508e33.tar.gz
scala-1ee78f5a8d1ac4beb3dff19f8aa147feea508e33.tar.bz2
scala-1ee78f5a8d1ac4beb3dff19f8aa147feea508e33.zip
Merged revisions 20429,20437-20438,20444-20447,...
Merged revisions 20429,20437-20438,20444-20447,20449-20451,20453,20456-20457,20459,20463- 20466,20468-20469,20476-20478,20480-20482,20484,20486-20491,20495-20496, 20500-20502,20504,20515,20519,20522-20525 via svnmerge from https://lampsvn.epfl.ch/svn-repos/scala/scala/trunk ........ r20429 | milessabin | 2010-01-10 13:08:40 +0100 (Sun, 10 Jan 2010) | 1 line Weaken the test for co-definition to equality of paths (equality of files fails where implementing types differ). Review by odersky. ........ r20437 | extempore | 2010-01-11 05:58:17 +0100 (Mon, 11 Jan 2010) | 3 lines Fix for an unfortunate bug introduced in r19020 which was causing a great many unnecessary and unreachable MatchErrors to appear in generated bytecode. ........ r20438 | rytz | 2010-01-11 09:55:42 +0100 (Mon, 11 Jan 2010) | 1 line speed up ClassPath.findClass. review by community ........ r20444 | prokopec | 2010-01-11 16:44:22 +0100 (Mon, 11 Jan 2010) | 2 lines Red black tree patch and test. no review ........ r20445 | odersky | 2010-01-11 16:48:20 +0100 (Mon, 11 Jan 2010) | 1 line Revised List#mapConserve so that it tests wrt eq not ==. ........ r20446 | odersky | 2010-01-11 16:48:58 +0100 (Mon, 11 Jan 2010) | 1 line Removed extraneous clause is isStrictlyMoreSpecific ........ r20447 | odersky | 2010-01-11 16:49:51 +0100 (Mon, 11 Jan 2010) | 1 line Avoided a crash scenario in the presentation compiler. ........ r20449 | prokopec | 2010-01-11 17:09:36 +0100 (Mon, 11 Jan 2010) | 2 lines Fixed #2810. no review ........ r20450 | extempore | 2010-01-11 17:26:44 +0100 (Mon, 11 Jan 2010) | 3 lines Fix for #2883, a regression introduced in r18789. It was only a regression because the pattern matcher has extractor bugs which don't manifest for case classes. Underlying bug remains. No review. ........ r20451 | extempore | 2010-01-11 17:31:44 +0100 (Mon, 11 Jan 2010) | 1 line Commented out some (debugging?) code which was breaking the build. ........ r20453 | extempore | 2010-01-11 18:16:56 +0100 (Mon, 11 Jan 2010) | 1 line Fix and test case for #2364, which regressed with the fix to #2721. ........ r20456 | milessabin | 2010-01-11 18:44:32 +0100 (Mon, 11 Jan 2010) | 1 line Reverting stray commit to Eclipse metadata. ........ r20457 | extempore | 2010-01-11 18:57:42 +0100 (Mon, 11 Jan 2010) | 2 lines Moved the test for #2364 to pending because it apparently uses some nonstandard classes. ........ r20459 | extempore | 2010-01-12 00:29:25 +0100 (Tue, 12 Jan 2010) | 8 lines A few repl features. Added the following commands: :history <N> shows N lines of history :h? <str> greps the history for str Altered tab-completion to be less verbose on the first tab, but notice when tab has been hit twice without any other input, and then be more verbose. And prettified the repl help text. ........ r20463 | plocinic | 2010-01-12 12:24:14 +0100 (Tue, 12 Jan 2010) | 1 line Compare typeParams correctly for symbols so that the build manager no longer reports false changes, cloneInfo instead instead of symbols. No review. ........ r20464 | extempore | 2010-01-12 14:44:43 +0100 (Tue, 12 Jan 2010) | 1 line Added toMap to TraversableLike. ........ r20465 | extempore | 2010-01-12 15:11:02 +0100 (Tue, 12 Jan 2010) | 2 lines A fix for at least one manifestation of #2865. Infinite collections and "size" don't mix! ........ r20466 | cunei | 2010-01-12 16:11:07 +0100 (Tue, 12 Jan 2010) | 3 lines Deprecated "=>?". Closes #2860 (see #2819). ........ r20468 | dragos | 2010-01-12 17:55:26 +0100 (Tue, 12 Jan 2010) | 5 lines Updated attempt at removing @inline warnings: - fixed a bug in closure elimination causing VerifyErrors - fixed a broken assert in GenICode that fired when -Ydebug was used - added final modifiers ........ r20469 | odersky | 2010-01-12 18:17:50 +0100 (Tue, 12 Jan 2010) | 1 line Closes #2867. review by extempore. ........ r20476 | plocinic | 2010-01-13 12:05:24 +0100 (Wed, 13 Jan 2010) | 1 line When comparing type aliases use info instead of tpe so that the changes are correctly detected. Fixes #2650. No review. ........ r20477 | extempore | 2010-01-13 14:08:53 +0100 (Wed, 13 Jan 2010) | 2 lines Overrode slice in the StringLike derivatives to use substring. Closes #2895. Review by community. ........ r20478 | odersky | 2010-01-13 14:37:30 +0100 (Wed, 13 Jan 2010) | 1 line more statistics hooks. no review necessary. ........ r20480 | extempore | 2010-01-13 15:38:37 +0100 (Wed, 13 Jan 2010) | 3 lines A variety of bugfixes discovered by findbugs. Most of them are examples of equality comparisons which are guaranteed to return false because someone is not comparing what they think they're comparing. ........ r20481 | moors | 2010-01-13 16:44:11 +0100 (Wed, 13 Jan 2010) | 2 lines closes #2421: more complete fix, now also check validity of inferred type arguments for expressions inferred for implicit values review by odersky ........ r20482 | extempore | 2010-01-13 17:02:41 +0100 (Wed, 13 Jan 2010) | 1 line Fix for #2817. Review by mharrah. ........ r20484 | odersky | 2010-01-13 17:27:40 +0100 (Wed, 13 Jan 2010) | 1 line Fixes #2755, but leaving open to analyze issue raised by Paul. review by extempore. ........ r20486 | odersky | 2010-01-13 17:36:06 +0100 (Wed, 13 Jan 2010) | 1 line Closes #2866, #2870. Attempt to fix #2733 by having only non-local members be visible for imports. However, this causes the interpreter to fail. review by extempore. ........ r20487 | odersky | 2010-01-13 17:36:29 +0100 (Wed, 13 Jan 2010) | 1 line new tests. no review. ........ r20488 | dubochet | 2010-01-13 18:00:14 +0100 (Wed, 13 Jan 2010) | 1 line [scaladoc] Use cases are printed. Reduced memory footprint of Scaladoc model. Review by community. ........ r20489 | moors | 2010-01-13 18:27:01 +0100 (Wed, 13 Jan 2010) | 1 line better fix for see #2421 after feedback from Martin ........ r20490 | extempore | 2010-01-13 23:50:40 +0100 (Wed, 13 Jan 2010) | 2 lines Reverts r20311 since I'm not seeing what's going on in #2876 and the optimization can wait. ........ r20491 | prokopec | 2010-01-14 00:42:33 +0100 (Thu, 14 Jan 2010) | 1 line Added ConcurrentMap and Properties conversion classes and test. ........ r20495 | extempore | 2010-01-14 02:22:05 +0100 (Thu, 14 Jan 2010) | 2 lines Finished up fixing #2773. Interpreter tries not to accidentally import synthetic locals from previous scopes. ........ r20496 | rytz | 2010-01-14 09:43:51 +0100 (Thu, 14 Jan 2010) | 1 line fix for .net compiler (flatten is skipped). no review (already done by dragos). ........ r20500 | dubochet | 2010-01-14 14:22:03 +0100 (Thu, 14 Jan 2010) | 1 line [scaladoc] Use cases are marked as such in the documentation (using some changes in r20488). Review by odersky. ........ r20501 | milessabin | 2010-01-14 17:10:18 +0100 (Thu, 14 Jan 2010) | 1 line Fixed #2889. No review necessary. ........ r20502 | plocinic | 2010-01-14 17:29:39 +0100 (Thu, 14 Jan 2010) | 1 line Closes #2649. No review. ........ r20504 | prokopec | 2010-01-14 18:02:45 +0100 (Thu, 14 Jan 2010) | 4 lines ConcurrentMap trait added to collection.mutable. JavaConversions now include conversions between Java ConcurrentMap objects and Scala ConcurrentMap objects. review by odersky ........ r20515 | phaller | 2010-01-15 00:55:41 +0100 (Fri, 15 Jan 2010) | 1 line Some optimizations to actor message queues and event handling. ........ r20519 | extempore | 2010-01-15 03:12:10 +0100 (Fri, 15 Jan 2010) | 1 line Fix and test for #2354. Review by community. ........ r20522 | milessabin | 2010-01-15 15:12:20 +0100 (Fri, 15 Jan 2010) | 1 line Fixes for various Scaladoc-related positions regressions with tests. Review by dubochet. ........ r20523 | dubochet | 2010-01-15 15:41:19 +0100 (Fri, 15 Jan 2010) | 1 line Fixed issue when searching for companion of class using "linkedSym" when value of same name is overloaded (for example companion of the Value class in an Enumeration). No review, already checked by odersky. ........ r20524 | dubochet | 2010-01-15 15:43:34 +0100 (Fri, 15 Jan 2010) | 1 line [scaladoc] Companion classes are printed. Original code contributed by Pedro Furlanetto. No review, checked by dubochet. ........ r20525 | cunei | 2010-01-15 17:58:28 +0100 (Fri, 15 Jan 2010) | 2 lines Reverted over-zealous replacement of 'PartialFunction' with '=>?'. ........
Diffstat (limited to 'test')
-rw-r--r--test/files/neg/t2421b.check4
-rw-r--r--test/files/neg/t2421b.scala17
-rw-r--r--test/files/neg/t2641.check2
-rw-r--r--test/files/neg/t2870.check7
-rwxr-xr-xtest/files/neg/t2870.scala9
-rw-r--r--test/files/pos/t2421b.scala19
-rw-r--r--test/files/pos/t2810.scala8
-rw-r--r--test/files/pos/t2867.scala1
-rw-r--r--test/files/positions/Scaladoc6.scala10
-rw-r--r--test/files/positions/Scaladoc7.scala6
-rw-r--r--test/files/positions/Scaladoc8.scala6
-rw-r--r--test/files/run/bug2354.scala17
-rw-r--r--test/files/run/bug2876.scala7
-rw-r--r--test/files/run/map_java_conversions.scala60
-rw-r--r--test/files/run/t2849.scala46
-rw-r--r--test/pending/run/bug2364.check1
-rw-r--r--test/pending/run/bug2364.scala60
17 files changed, 279 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)
+ }
+ }
+ }
+
+}
+
+
diff --git a/test/pending/run/bug2364.check b/test/pending/run/bug2364.check
new file mode 100644
index 0000000000..219305e43a
--- /dev/null
+++ b/test/pending/run/bug2364.check
@@ -0,0 +1 @@
+<test></test>
diff --git a/test/pending/run/bug2364.scala b/test/pending/run/bug2364.scala
new file mode 100644
index 0000000000..d5805a13b8
--- /dev/null
+++ b/test/pending/run/bug2364.scala
@@ -0,0 +1,60 @@
+import java.io.ByteArrayInputStream
+import java.io.ByteArrayOutputStream
+import com.sun.xml.internal.fastinfoset._
+import com.sun.xml.internal.fastinfoset.sax._
+import scala.xml.parsing.NoBindingFactoryAdapter
+import scala.xml._
+
+// Note - this is in pending because com.sun.xml.etc is not standard,
+// and I don't have time to extract a smaller test.
+
+object Test {
+ def main(args: Array[String]) {
+ val node = <test/>
+ val bytes = new ByteArrayOutputStream
+ val serializer = new SAXDocumentSerializer()
+
+ serializer.setOutputStream(bytes)
+ serializer.startDocument()
+ serialize(node, serializer)
+ serializer.endDocument()
+ println(parse(new ByteArrayInputStream(bytes.toByteArray)))
+ }
+ def serialize(node: Node, serializer: SAXDocumentSerializer) {
+ node match {
+ case _ : ProcInstr | _ : Comment | _ : EntityRef =>
+ case x : Atom[_] =>
+ val chars = x.text.toCharArray
+ serializer.characters(chars, 0, chars.length)
+ case _ : Elem =>
+ serializer.startElement("", node.label.toLowerCase, node.label.toLowerCase, attributes(node.attributes))
+ for (m <- node.child) serialize(m, serializer)
+ serializer.endElement("", node.label.toLowerCase, node.label.toLowerCase)
+ }
+ }
+ def parse(str: ByteArrayInputStream) = {
+ val parser = new SAXDocumentParser
+ val fac = new NoBindingFactoryAdapter
+
+ parser.setContentHandler(fac)
+ try {
+ parser.parse(str)
+ } catch {
+ case x: Exception =>
+ x.printStackTrace
+ }
+ fac.rootElem
+ }
+ def attributes(d: MetaData) = {
+ val attrs = new AttributesHolder
+
+ if (d != null) {
+ for (attr <- d) {
+ val sb = new StringBuilder()
+ Utility.sequenceToXML(attr.value, TopScope, sb, true)
+ attrs.addAttribute(new QualifiedName("", "", attr.key.toLowerCase), sb.toString)
+ }
+ }
+ attrs
+ }
+}