summaryrefslogtreecommitdiff
path: root/test/files/run
diff options
context:
space:
mode:
Diffstat (limited to 'test/files/run')
-rw-r--r--test/files/run/macro-abort-fresh.check6
-rw-r--r--test/files/run/private-override.scala17
-rw-r--r--test/files/run/t6261.scala7
-rw-r--r--test/files/run/t7445.scala6
-rw-r--r--test/files/run/t7700.check2
-rw-r--r--test/files/run/t7700.scala17
-rw-r--r--test/files/run/t8199.scala105
-rw-r--r--test/files/run/var-arity-class-symbol.scala19
8 files changed, 152 insertions, 27 deletions
diff --git a/test/files/run/macro-abort-fresh.check b/test/files/run/macro-abort-fresh.check
index 9fddee57d4..5064b96eef 100644
--- a/test/files/run/macro-abort-fresh.check
+++ b/test/files/run/macro-abort-fresh.check
@@ -1,6 +1,6 @@
-fresh$1
-qwe1
-qwe2
+fresh$macro$1
+qwe$macro$2
+qwe$macro$3
reflective compilation has failed:
blargh
diff --git a/test/files/run/private-override.scala b/test/files/run/private-override.scala
deleted file mode 100644
index 0a3f57f97c..0000000000
--- a/test/files/run/private-override.scala
+++ /dev/null
@@ -1,17 +0,0 @@
-package test.p1.p2 {
- abstract class A {
- private[p2] def f2(): Int = 1
- }
- abstract class Other extends A {
- // It's a private method - not a private[p2] method. Not a failed
- // "weaker access privileges" override, a different namespace.
- private def f2(): Int = super.f2() + 2
- def go() = f2()
- }
-}
-
-object Test extends test.p1.p2.Other {
- def main(args: Array[String]): Unit = {
- println(go())
- }
-}
diff --git a/test/files/run/t6261.scala b/test/files/run/t6261.scala
index b4463256c9..bf6d640de3 100644
--- a/test/files/run/t6261.scala
+++ b/test/files/run/t6261.scala
@@ -2,12 +2,6 @@ import scala.collection.immutable._
object Test extends App {
- def test0() {
- val m=ListMap(1->2,3->4)
- if(m.tail ne m.tail)
- println("ListMap.tail uses a builder, so it is not O(1)")
- }
-
def test1() {
// test that a HashTrieMap with one leaf element is not created!
val x = HashMap.empty + (1->1) + (2->2)
@@ -92,7 +86,6 @@ object Test extends App {
// StructureTests.printStructure(z)
require(z.size == 2 && z.contains(a._1) && z.contains(c._1))
}
- test0()
test1()
test2()
test3()
diff --git a/test/files/run/t7445.scala b/test/files/run/t7445.scala
new file mode 100644
index 0000000000..e4ffeb8e1a
--- /dev/null
+++ b/test/files/run/t7445.scala
@@ -0,0 +1,6 @@
+import scala.collection.immutable.ListMap
+
+object Test extends App {
+ val a = ListMap(1 -> 1, 2 -> 2, 3 -> 3, 4 -> 4, 5 -> 5);
+ require(a.tail == ListMap(2 -> 2, 3 -> 3, 4 -> 4, 5 -> 5));
+}
diff --git a/test/files/run/t7700.check b/test/files/run/t7700.check
new file mode 100644
index 0000000000..ca8e686984
--- /dev/null
+++ b/test/files/run/t7700.check
@@ -0,0 +1,2 @@
+public abstract java.lang.Object C.bar(java.lang.Object)
+public abstract java.lang.Object C.foo(java.lang.Object)
diff --git a/test/files/run/t7700.scala b/test/files/run/t7700.scala
new file mode 100644
index 0000000000..76d16b808c
--- /dev/null
+++ b/test/files/run/t7700.scala
@@ -0,0 +1,17 @@
+import scala.annotation._
+
+trait C[@specialized U] {
+ @unspecialized
+ def foo(u: U): U
+ @unspecialized
+ def bar[A](u: U) = u
+}
+
+object Test extends App {
+ val declared = classOf[C[_]].getDeclaredMethods.sortBy(_.getName)
+ println(declared.mkString("\n"))
+ object CInt extends C[Int] { def foo(i: Int) = i }
+ object CAny extends C[Any] { def foo(a: Any) = a }
+ assert(CInt.foo(1) == 1)
+ assert(CAny.foo("") == "")
+}
diff --git a/test/files/run/t8199.scala b/test/files/run/t8199.scala
new file mode 100644
index 0000000000..50994159ed
--- /dev/null
+++ b/test/files/run/t8199.scala
@@ -0,0 +1,105 @@
+class reallylongnamereallylongnamereallylongnamereallylongnamereallylongnamereallylongnamereallylongnamereallylongnamereallylongnamereallylongnamereallylongnamereallylongnamereallylongnamereallylongnamereallylongnamereallylongnamereallylongname {
+object obj0
+object obj01
+object obj012
+object obj0123
+object obj01234
+object obj012345
+object obj0123456
+object obj01234567
+object obj012345678
+object obj0123456789
+object obj01234567890
+class cls0
+class cls01
+class cls012
+class cls0123
+class cls01234
+class cls012345
+class cls0123456
+class cls01234567
+class cls012345678
+class cls0123456789
+class cls01234567890
+trait trt0 { def x = Test.checkCallerImplClassName() }
+trait trt01 { def x = Test.checkCallerImplClassName() }
+trait trt012 { def x = Test.checkCallerImplClassName() }
+trait trt0123 { def x = Test.checkCallerImplClassName() }
+trait trt01234 { def x = Test.checkCallerImplClassName() }
+trait trt012345 { def x = Test.checkCallerImplClassName() }
+trait trt0123456 { def x = Test.checkCallerImplClassName() }
+trait trt01234567 { def x = Test.checkCallerImplClassName() }
+trait trt012345678 { def x = Test.checkCallerImplClassName() }
+trait trt0123456789 { def x = Test.checkCallerImplClassName() }
+trait trt01234567890 { def x = Test.checkCallerImplClassName() }
+}
+
+object Test extends App {
+ def check(c: Class[_]) {
+ checkClassName(c.getName)
+ }
+ def checkClassName(name: String) {
+ val defaultMaxClassFileLength = 255
+ assert((name + ".class").length <= defaultMaxClassFileLength, name)
+ }
+ def checkCallerImplClassName() {
+ val name = Thread.currentThread.getStackTrace.apply(2).getClassName
+ assert(name.contains("$class"))
+ Test.checkClassName(name)
+ }
+
+ val c = new reallylongnamereallylongnamereallylongnamereallylongnamereallylongnamereallylongnamereallylongnamereallylongnamereallylongnamereallylongnamereallylongnamereallylongnamereallylongnamereallylongnamereallylongnamereallylongnamereallylongname
+ import c._
+
+ check(obj0.getClass)
+ check(obj01.getClass)
+ check(obj012.getClass)
+ check(obj0123.getClass)
+ check(obj01234.getClass)
+ check(obj012345.getClass)
+ check(obj0123456.getClass)
+ check(obj01234567.getClass)
+ check(obj012345678.getClass)
+ check(obj0123456789.getClass)
+ check(obj01234567890.getClass)
+
+ check(classOf[cls0])
+ check(classOf[cls01])
+ check(classOf[cls012])
+ check(classOf[cls0123])
+ check(classOf[cls01234])
+ check(classOf[cls012345])
+ check(classOf[cls0123456])
+ check(classOf[cls01234567])
+ check(classOf[cls012345678])
+ check(classOf[cls0123456789])
+ check(classOf[cls01234567890])
+
+ // interface facets
+ check(classOf[trt0])
+ check(classOf[trt01])
+ check(classOf[trt012])
+ check(classOf[trt0123])
+ check(classOf[trt01234])
+ check(classOf[trt012345])
+ check(classOf[trt0123456])
+ check(classOf[trt01234567])
+ check(classOf[trt012345678])
+ check(classOf[trt0123456789])
+ check(classOf[trt01234567890])
+
+ // impl classes are harder to find the names of to test!
+ (new trt0 {}).x
+ (new trt01 {}).x
+ (new trt012 {}).x
+ (new trt0123 {}).x
+ (new trt01234 {}).x
+ (new trt012345 {}).x
+ (new trt0123456 {}).x
+ (new trt01234567 {}).x
+ (new trt012345678 {}).x
+ (new trt0123456789 {}).x
+ (new trt01234567890 {}).x
+}
+
+// filename too long: reallylongnamereallylongnamereallylongnamereallylongnamereallylongnamereallylongnamereallylongnamereallylongnamereallylongnamereallylongnamereallylongnamereallylongnamereallylongnamereallylongnamereallylongnamereallylongnamereallylongname$obj012345$.class
diff --git a/test/files/run/var-arity-class-symbol.scala b/test/files/run/var-arity-class-symbol.scala
new file mode 100644
index 0000000000..29fe960eb3
--- /dev/null
+++ b/test/files/run/var-arity-class-symbol.scala
@@ -0,0 +1,19 @@
+import scala.reflect.runtime.universe._, definitions._
+object Test extends App {
+ // Tuples
+ assert(TupleClass.seq.size == 22)
+ assert(TupleClass(0) == NoSymbol)
+ assert(TupleClass(23) == NoSymbol)
+ assert((1 to 22).forall { i => TupleClass(i).name.toString == s"Tuple$i" })
+ // Functions
+ assert(FunctionClass.seq.size == 23)
+ assert(FunctionClass(-1) == NoSymbol)
+ assert(FunctionClass(23) == NoSymbol)
+ assert((0 to 22).forall { i => FunctionClass(i).name.toString == s"Function$i" })
+ // Products
+ assert(ProductClass.seq.size == 23)
+ assert(ProductClass(-1) == NoSymbol)
+ assert(ProductClass(0) == UnitClass)
+ assert(ProductClass(23) == NoSymbol)
+ assert((1 to 22).forall { i => ProductClass(i).name.toString == s"Product$i" })
+}