diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/files/pos/t6274.scala | 13 | ||||
-rw-r--r-- | test/files/pos/t6294.scala | 14 | ||||
-rw-r--r-- | test/files/presentation/recursive-ask.check | 4 | ||||
-rw-r--r-- | test/files/presentation/recursive-ask/RecursiveAsk.scala | 20 | ||||
-rw-r--r-- | test/files/run/dynamic-anyval.check | 4 | ||||
-rw-r--r-- | test/files/run/dynamic-anyval.scala | 22 |
6 files changed, 77 insertions, 0 deletions
diff --git a/test/files/pos/t6274.scala b/test/files/pos/t6274.scala new file mode 100644 index 0000000000..cf769fc72d --- /dev/null +++ b/test/files/pos/t6274.scala @@ -0,0 +1,13 @@ +trait Crash { + + def foo(i: => Int) (j: Int): Int + + def t = { + // var count = 0 + foo { + var count = 0 + count + } _ + } + +} diff --git a/test/files/pos/t6294.scala b/test/files/pos/t6294.scala new file mode 100644 index 0000000000..c6d39a9cc8 --- /dev/null +++ b/test/files/pos/t6294.scala @@ -0,0 +1,14 @@ + + + +object A { + @annotation.static final val x = 123 +} + + +object B { + println(A.x) +} + + + diff --git a/test/files/presentation/recursive-ask.check b/test/files/presentation/recursive-ask.check new file mode 100644 index 0000000000..357d2cf879 --- /dev/null +++ b/test/files/presentation/recursive-ask.check @@ -0,0 +1,4 @@ +[ outer] askForResponse +[nested] askForResponse +passed +done diff --git a/test/files/presentation/recursive-ask/RecursiveAsk.scala b/test/files/presentation/recursive-ask/RecursiveAsk.scala new file mode 100644 index 0000000000..b0e29b3fd3 --- /dev/null +++ b/test/files/presentation/recursive-ask/RecursiveAsk.scala @@ -0,0 +1,20 @@ +import scala.tools.nsc.interactive.tests._ + +object Test extends InteractiveTest { + override def execute(): Unit = recursiveAskForResponse() + + def recursiveAskForResponse() { + val res0 = compiler.askForResponse( () => { + println("[ outer] askForResponse") + val res = compiler.askForResponse( () => { println("[nested] askForResponse") }) + println (res.get(5000) match { + case Some(_) => "passed" + case None => "timeout" + }) + }) + + res0.get + + println("done") + } +} diff --git a/test/files/run/dynamic-anyval.check b/test/files/run/dynamic-anyval.check new file mode 100644 index 0000000000..dee7bef8e8 --- /dev/null +++ b/test/files/run/dynamic-anyval.check @@ -0,0 +1,4 @@ +().dingo(bippy, 5) +List(1, 2, 3).dingo(bippy, 5) +().dingo(bippy, 5) +List(1, 2, 3).dingo(bippy, 5) diff --git a/test/files/run/dynamic-anyval.scala b/test/files/run/dynamic-anyval.scala new file mode 100644 index 0000000000..605503d377 --- /dev/null +++ b/test/files/run/dynamic-anyval.scala @@ -0,0 +1,22 @@ +import scala.language.dynamics + +object Test { + implicit class DynamicValue[T](val value: T) extends AnyVal with Dynamic { + def applyDynamic(name: String)(args: Any*) = println(s"""$this.$name(${args mkString ", "})""") + override def toString = "" + value + } + implicit class DynamicValue2[T](val value: T) extends Dynamic { + def applyDynamic(name: String)(args: Any*) = println(s"""$this.$name(${args mkString ", "})""") + override def toString = "" + value + } + + def f[T](x: DynamicValue[T]) = x.dingo("bippy", 5) + def g[T](x: DynamicValue2[T]) = x.dingo("bippy", 5) + + def main(args: Array[String]): Unit = { + f(()) + f(List(1, 2, 3)) + g(()) + g(List(1, 2, 3)) + } +} |