summaryrefslogtreecommitdiff
path: root/test/files
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2012-10-18 15:11:06 -0700
committerPaul Phillips <paulp@improving.org>2012-10-19 09:04:19 -0700
commit3fea5453b6a6c9451ecd6d0a93b92432b575e6cb (patch)
tree6e010951cdd253747afe18912547ca6d3fce2e6e /test/files
parent32d470d61195cbf092614711b27db396d0d54a40 (diff)
parent87c5895d4bae62f1b5bacbd145f2e0fddcccf423 (diff)
downloadscala-3fea5453b6a6c9451ecd6d0a93b92432b575e6cb.tar.gz
scala-3fea5453b6a6c9451ecd6d0a93b92432b575e6cb.tar.bz2
scala-3fea5453b6a6c9451ecd6d0a93b92432b575e6cb.zip
Merge remote-tracking branch 'origin/2.10.x' into merge-210
* origin/2.10.x: (52 commits) JavaUniverse Moved @contentDiagram in Symbols Adds lots of new documentation for TypeTags, Mirrors, Universes and more runtime.JavaUniverse - put ungrouped members at the top Forgotten annotation in Annotations Diagram tweaking Grouping for reflection and macros fixes a typo scala.reflect.api.Symbols documentation Symbols docs cleanup, mostly moved to guide scala.reflect.api.Position documentation scala.reflect.api.StandardNames documentation scala.reflect.api.Constants documentation removed docs for internal TypeCreator and TreeCreator simplified reflection docs for trees Rearranged some reflection docs, moving things to the guide reflection docs improvements and moves to doc page docs for reflection and macros SI-6509 Correct @template owners SI-6155 Scaladoc @template diagrms ... Conflicts: src/compiler/scala/tools/nsc/doc/model/ModelFactory.scala src/compiler/scala/tools/nsc/typechecker/Typers.scala src/reflect/scala/reflect/api/Trees.scala test/scaladoc/run/links.scala
Diffstat (limited to 'test/files')
-rw-r--r--test/files/neg/t6483.check9
-rw-r--r--test/files/neg/t6483.scala24
-rw-r--r--test/files/pos/t6215.scala1
-rw-r--r--test/files/pos/t6485a/Macros_1.scala5
-rw-r--r--test/files/pos/t6485a/Test_2.scala5
-rw-r--r--test/files/pos/t6485b/Test.scala10
-rw-r--r--test/files/pos/t6499.scala3
-rw-r--r--test/files/presentation/forgotten-ask.scala33
-rw-r--r--test/files/run/macro-reflective-mamd-normal-mi/Macros_Test_2.scala2
-rw-r--r--test/files/run/macro-typecheck-implicitsdisabled.check2
-rw-r--r--test/files/run/reflection-magicsymbols-invoke.scala8
-rw-r--r--test/files/run/reflection-valueclasses-magic.scala8
-rw-r--r--test/files/run/t6344.check16
-rw-r--r--test/files/run/t6440.check1
-rw-r--r--test/files/run/t6440.scala7
15 files changed, 122 insertions, 12 deletions
diff --git a/test/files/neg/t6483.check b/test/files/neg/t6483.check
new file mode 100644
index 0000000000..66e3507107
--- /dev/null
+++ b/test/files/neg/t6483.check
@@ -0,0 +1,9 @@
+t6483.scala:7: error: implementation restriction: qualified super reference is not allowed in value class
+This restriction is planned to be removed in subsequent releases.
+ override def foo = super[T].foo // error
+ ^
+t6483.scala:20: error: implementation restriction: nested class is not allowed in value class
+This restriction is planned to be removed in subsequent releases.
+ class Inner extends T {
+ ^
+two errors found
diff --git a/test/files/neg/t6483.scala b/test/files/neg/t6483.scala
new file mode 100644
index 0000000000..bd99f68fa4
--- /dev/null
+++ b/test/files/neg/t6483.scala
@@ -0,0 +1,24 @@
+trait T extends Any {
+ def foo = 1
+ type X
+}
+
+class C1(val a: Any) extends AnyVal with T {
+ override def foo = super[T].foo // error
+}
+
+class C2(val a: Int) extends AnyVal with T {
+ override def foo = super.foo + a // okay
+}
+
+class C3(val a: Int) extends AnyVal with T {
+ override def foo = C3.super.foo + a // okay
+}
+
+class C4(val a: Int) extends AnyVal with T {
+ def foo {
+ class Inner extends T {
+ override def foo = super[T].foo + a // no (direct) error, other than that a nested class is currently illegal.
+ }
+ }
+}
diff --git a/test/files/pos/t6215.scala b/test/files/pos/t6215.scala
new file mode 100644
index 0000000000..2f66892b69
--- /dev/null
+++ b/test/files/pos/t6215.scala
@@ -0,0 +1 @@
+class Foo(val v: String) extends AnyVal { private def len = v.length ; def f = len }
diff --git a/test/files/pos/t6485a/Macros_1.scala b/test/files/pos/t6485a/Macros_1.scala
new file mode 100644
index 0000000000..85c2d5dbdb
--- /dev/null
+++ b/test/files/pos/t6485a/Macros_1.scala
@@ -0,0 +1,5 @@
+import scala.reflect.macros.Context
+
+object Macros {
+ def crash(c: Context): c.Expr[Unit] = c.universe.reify(())
+} \ No newline at end of file
diff --git a/test/files/pos/t6485a/Test_2.scala b/test/files/pos/t6485a/Test_2.scala
new file mode 100644
index 0000000000..54e260ac74
--- /dev/null
+++ b/test/files/pos/t6485a/Test_2.scala
@@ -0,0 +1,5 @@
+import scala.language.experimental.macros
+
+final class Ops[T](val x: T) extends AnyVal {
+ def f = macro Macros.crash
+}
diff --git a/test/files/pos/t6485b/Test.scala b/test/files/pos/t6485b/Test.scala
new file mode 100644
index 0000000000..382df1c453
--- /dev/null
+++ b/test/files/pos/t6485b/Test.scala
@@ -0,0 +1,10 @@
+import scala.language.experimental.macros
+import scala.reflect.macros.Context
+
+final class Ops[T](val x: T) extends AnyVal {
+ def f = macro Macros.crash
+}
+
+object Macros {
+ def crash(c: Context): c.Expr[Unit] = c.universe.reify(())
+} \ No newline at end of file
diff --git a/test/files/pos/t6499.scala b/test/files/pos/t6499.scala
new file mode 100644
index 0000000000..db376572ee
--- /dev/null
+++ b/test/files/pos/t6499.scala
@@ -0,0 +1,3 @@
+object Test {
+ Map(): Map[_, Int] with Map[_, Int]
+}
diff --git a/test/files/presentation/forgotten-ask.scala b/test/files/presentation/forgotten-ask.scala
new file mode 100644
index 0000000000..358dd75e98
--- /dev/null
+++ b/test/files/presentation/forgotten-ask.scala
@@ -0,0 +1,33 @@
+import scala.tools.nsc.interactive._
+import tests._
+
+/** Test that no ask calls are left unanswered after a compiler has shut down. */
+object Test extends InteractiveTest {
+ import compiler._
+
+ def askItem(): Response[Unit] = {
+ compiler.askForResponse { () =>
+ Thread.sleep(100)
+ }
+ }
+
+ final val Timeout = 5000 //ms
+
+ override def main(args: Array[String]) {
+ val item1 = askItem()
+
+ compiler.askShutdown()
+
+ Thread.sleep(1000) // wait a bit, the compiler is shutting down
+ val item2 = askItem()
+
+ item1.get(Timeout) match {
+ case None => println("TIMEOUT")
+ case _ =>
+ }
+ item2.get(Timeout) match {
+ case None => println("TIMEOUT")
+ case _ =>
+ }
+ }
+} \ No newline at end of file
diff --git a/test/files/run/macro-reflective-mamd-normal-mi/Macros_Test_2.scala b/test/files/run/macro-reflective-mamd-normal-mi/Macros_Test_2.scala
index 089f30f389..adecfcff17 100644
--- a/test/files/run/macro-reflective-mamd-normal-mi/Macros_Test_2.scala
+++ b/test/files/run/macro-reflective-mamd-normal-mi/Macros_Test_2.scala
@@ -11,7 +11,7 @@ object Test extends App {
val macrobody = Select(Ident(newTermName("Impls")), newTermName("foo"))
val macroparam = ValDef(NoMods, newTermName("x"), TypeTree(definitions.IntClass.toType), EmptyTree)
val macrodef = DefDef(Modifiers(MACRO), newTermName("foo"), Nil, List(List(macroparam)), TypeTree(), macrobody)
- val modulector = DefDef(NoMods, nme.CONSTRUCTOR, Nil, List(List()), TypeTree(), Block(Apply(Select(Super(This(EmptyTypeName), EmptyTypeName), nme.CONSTRUCTOR), List())))
+ val modulector = DefDef(NoMods, nme.CONSTRUCTOR, Nil, List(List()), TypeTree(), Block(Apply(Select(Super(This(tpnme.EMPTY), tpnme.EMPTY), nme.CONSTRUCTOR), List())))
val module = ModuleDef(NoMods, newTermName("Macros"), Template(Nil, emptyValDef, List(modulector, macrodef)))
val macroapp = Apply(Select(Ident("Macros"), newTermName("foo")), List(Literal(Constant(42))))
val tree = Block(macrodef, module, macroapp)
diff --git a/test/files/run/macro-typecheck-implicitsdisabled.check b/test/files/run/macro-typecheck-implicitsdisabled.check
index 6cf25076a7..c4fa2c5c28 100644
--- a/test/files/run/macro-typecheck-implicitsdisabled.check
+++ b/test/files/run/macro-typecheck-implicitsdisabled.check
@@ -1,2 +1,2 @@
scala.this.Predef.any2ArrowAssoc[Int](1).->[Int](2)
-scala.reflect.internal.Types$TypeError: value -> is not a member of Int
+scala.reflect.macros.TypecheckException: value -> is not a member of Int
diff --git a/test/files/run/reflection-magicsymbols-invoke.scala b/test/files/run/reflection-magicsymbols-invoke.scala
index b38d1be7b2..5f39370708 100644
--- a/test/files/run/reflection-magicsymbols-invoke.scala
+++ b/test/files/run/reflection-magicsymbols-invoke.scala
@@ -2,6 +2,12 @@ import scala.reflect.runtime.universe._
import scala.reflect.runtime.universe.definitions._
import scala.reflect.runtime.{currentMirror => cm}
+package scala {
+ object ExceptionUtils {
+ def unwrapThrowable(ex: Throwable): Throwable = scala.reflect.runtime.ReflectionUtils.unwrapThrowable(ex)
+ }
+}
+
object Test extends App {
def key(sym: Symbol) = sym + ": " + sym.typeSignature
def test(tpe: Type, receiver: Any, method: String, args: Any*) {
@@ -13,7 +19,7 @@ object Test extends App {
println(result)
} catch {
case ex: Throwable =>
- val realex = scala.reflect.runtime.ReflectionUtils.unwrapThrowable(ex)
+ val realex = scala.ExceptionUtils.unwrapThrowable(ex)
println(realex.getClass + ": " + realex.getMessage)
}
print(s"testing ${tpe.typeSymbol.name}.$method: ")
diff --git a/test/files/run/reflection-valueclasses-magic.scala b/test/files/run/reflection-valueclasses-magic.scala
index a40b570774..c4a26e460a 100644
--- a/test/files/run/reflection-valueclasses-magic.scala
+++ b/test/files/run/reflection-valueclasses-magic.scala
@@ -3,6 +3,12 @@ import scala.reflect.runtime.universe.definitions._
import scala.reflect.runtime.{currentMirror => cm}
import scala.reflect.ClassTag
+package scala {
+ object ExceptionUtils {
+ def unwrapThrowable(ex: Throwable): Throwable = scala.reflect.runtime.ReflectionUtils.unwrapThrowable(ex)
+ }
+}
+
object Test extends App {
def key(sym: Symbol) = {
sym match {
@@ -35,7 +41,7 @@ object Test extends App {
println(s"[${result.getClass}] =======> $result")
} catch {
case ex: Throwable =>
- val realex = scala.reflect.runtime.ReflectionUtils.unwrapThrowable(ex)
+ val realex = scala.ExceptionUtils.unwrapThrowable(ex)
println(realex.getClass + ": " + realex.getMessage)
}
val meth = tpe.declaration(newTermName(method).encodedName.toTermName)
diff --git a/test/files/run/t6344.check b/test/files/run/t6344.check
index 5ac04d0320..8d9adac849 100644
--- a/test/files/run/t6344.check
+++ b/test/files/run/t6344.check
@@ -101,14 +101,14 @@ public int ValueInt.x()
public int ValueInt.x()
public java.lang.Object ValueInt.x()
public java.lang.Object ValueInt.x()
-public static Gen ValueInt.extension$plus(int,Gen,Gen)
-public static Gen<java.lang.Object> ValueInt.extension$plus(int,Gen<java.lang.Object>,Gen<java.lang.Object>)
-public static boolean ValueInt.extension$equals(int,java.lang.Object)
-public static boolean ValueInt.extension$equals(int,java.lang.Object)
-public static int ValueInt.extension$hashCode(int)
-public static int ValueInt.extension$hashCode(int)
-public static int ValueInt.extension$iplus(int,int,int)
-public static int ValueInt.extension$iplus(int,int,int)
+public static Gen ValueInt.plus$extension(int,Gen,Gen)
+public static Gen<java.lang.Object> ValueInt.plus$extension(int,Gen<java.lang.Object>,Gen<java.lang.Object>)
+public static boolean ValueInt.equals$extension(int,java.lang.Object)
+public static boolean ValueInt.equals$extension(int,java.lang.Object)
+public static int ValueInt.hashCode$extension(int)
+public static int ValueInt.hashCode$extension(int)
+public static int ValueInt.iplus$extension(int,int,int)
+public static int ValueInt.iplus$extension(int,int,int)
RefInt
public Gen RefInt.plus(Gen,Gen)
diff --git a/test/files/run/t6440.check b/test/files/run/t6440.check
new file mode 100644
index 0000000000..b5684daee4
--- /dev/null
+++ b/test/files/run/t6440.check
@@ -0,0 +1 @@
+Stream((), ?)
diff --git a/test/files/run/t6440.scala b/test/files/run/t6440.scala
new file mode 100644
index 0000000000..2b690f31e1
--- /dev/null
+++ b/test/files/run/t6440.scala
@@ -0,0 +1,7 @@
+object Test {
+
+ def main(args: Array[String]): Unit = {
+ println(Stream.continually(()).filterNot(_ => false).take(2))
+ }
+
+}