diff options
Diffstat (limited to 'test')
198 files changed, 3762 insertions, 590 deletions
diff --git a/test/files/buildmanager/t2556_3/t2556_3.check b/test/files/buildmanager/t2556_3/t2556_3.check index 37808d2b31..34f90f7f9b 100644 --- a/test/files/buildmanager/t2556_3/t2556_3.check +++ b/test/files/buildmanager/t2556_3/t2556_3.check @@ -9,10 +9,10 @@ invalidate B.scala because it references invalid (no longer inherited) definitio compiling Set(B.scala, C.scala) B.scala:3: error: type mismatch; found : C - required: ?{val x: ?} + required: ?{def x: ?} Note that implicit conversions are not applicable because they are ambiguous: both method any2Ensuring in object Predef of type [A](x: A)Ensuring[A] and method any2ArrowAssoc in object Predef of type [A](x: A)ArrowAssoc[A] - are possible conversion functions from C to ?{val x: ?} + are possible conversion functions from C to ?{def x: ?} println( (new C).x ) ^ diff --git a/test/files/continuations-neg/t3718.check b/test/files/continuations-neg/t3718.check new file mode 100644 index 0000000000..659104c1c6 --- /dev/null +++ b/test/files/continuations-neg/t3718.check @@ -0,0 +1,4 @@ +t3718.scala:2: error: cannot cps-transform malformed (possibly in shift/reset placement) expression + scala.util.continuations.reset((_: Any).##) + ^ +one error found diff --git a/test/files/continuations-neg/t3718.scala b/test/files/continuations-neg/t3718.scala new file mode 100644 index 0000000000..a0fcb9d869 --- /dev/null +++ b/test/files/continuations-neg/t3718.scala @@ -0,0 +1,3 @@ +object Test { + scala.util.continuations.reset((_: Any).##) +} diff --git a/test/files/continuations-run/t5472.check b/test/files/continuations-run/t5472.check new file mode 100644 index 0000000000..d42e80c18e --- /dev/null +++ b/test/files/continuations-run/t5472.check @@ -0,0 +1 @@ +List(23, 23) diff --git a/test/files/continuations-run/t5472.scala b/test/files/continuations-run/t5472.scala new file mode 100644 index 0000000000..3e3c76b32a --- /dev/null +++ b/test/files/continuations-run/t5472.scala @@ -0,0 +1,90 @@ +import scala.annotation._ +import scala.util.continuations._ +import java.util.concurrent.atomic._ + +object Test { + def main(args: Array[String]) { + val map = Map("foo" -> 1, "bar" -> 2) + reset { + val mapped = + for { + (location, accessors) <- new ContinuationizedParallelIterable(map) + } yield { + shiftUnit0[Int, Unit](23) + } + println(mapped.toList) + } + } +} + +final class ContinuationizedParallelIterable[+A](protected val underline: Iterable[A]) { + def toList = underline.toList.sortBy(_.toString) + + final def filter(p: A => Boolean @suspendable): ContinuationizedParallelIterable[A] @suspendable = + shift( + new AtomicInteger(1) with ((ContinuationizedParallelIterable[A] => Unit) => Unit) { + private val results = new AtomicReference[List[A]](Nil) + + @tailrec + private def add(element: A) { + val old = results.get + if (!results.compareAndSet(old, element :: old)) { + add(element) + } + } + + override final def apply(continue: ContinuationizedParallelIterable[A] => Unit) { + for (element <- underline) { + super.incrementAndGet() + reset { + val pass = p(element) + if (pass) { + add(element) + } + if (super.decrementAndGet() == 0) { + continue(new ContinuationizedParallelIterable(results.get)) + } + } + } + if (super.decrementAndGet() == 0) { + continue(new ContinuationizedParallelIterable(results.get)) + } + } + }) + + final def foreach[U](f: A => U @suspendable): Unit @suspendable = + shift( + new AtomicInteger(1) with ((Unit => Unit) => Unit) { + override final def apply(continue: Unit => Unit) { + for (element <- underline) { + super.incrementAndGet() + reset { + f(element) + if (super.decrementAndGet() == 0) { + continue() + } + } + } + if (super.decrementAndGet() == 0) { + continue() + } + } + }) + + final def map[B: Manifest](f: A => B @suspendable): ContinuationizedParallelIterable[B] @suspendable = + shift( + new AtomicInteger(underline.size) with ((ContinuationizedParallelIterable[B] => Unit) => Unit) { + override final def apply(continue: ContinuationizedParallelIterable[B] => Unit) { + val results = new Array[B](super.get) + for ((element, i) <- underline.view zipWithIndex) { + reset { + val result = f(element) + results(i) = result + if (super.decrementAndGet() == 0) { + continue(new ContinuationizedParallelIterable(results)) + } + } + } + } + }) +} diff --git a/test/files/jvm/annotations.scala b/test/files/jvm/annotations.scala index b1c3c8ba40..66ebde592b 100644 --- a/test/files/jvm/annotations.scala +++ b/test/files/jvm/annotations.scala @@ -193,7 +193,9 @@ object Test6 { val c = new C("bob") c.setText("dylan") println(c.getText()) - if (new D(true).isProp()) { + val d = new D(true) + d.setProp(false) + if (!d.isProp()) { println(new D(false).getM()) } } diff --git a/test/files/jvm/future-spec/FutureTests.scala b/test/files/jvm/future-spec/FutureTests.scala new file mode 100644 index 0000000000..9a9cf951bb --- /dev/null +++ b/test/files/jvm/future-spec/FutureTests.scala @@ -0,0 +1,511 @@ + + + +import scala.concurrent._ +import scala.concurrent.util.duration._ +import scala.concurrent.util.Duration.Inf +import scala.collection._ +import scala.runtime.NonLocalReturnControl + + + +object FutureTests extends MinimalScalaTest { + + /* some utils */ + + def testAsync(s: String): Future[String] = s match { + case "Hello" => future { "World" } + case "Failure" => Promise.failed(new RuntimeException("Expected exception; to test fault-tolerance")).future + case "NoReply" => Promise[String]().future + } + + val defaultTimeout = Inf + + /* future specification */ + + "A future" should { + + "compose with for-comprehensions" in { + def async(x: Int) = future { (x * 2).toString } + val future0 = future[Any] { + "five!".length + } + + val future1 = for { + a <- future0.mapTo[Int] // returns 5 + b <- async(a) // returns "10" + c <- async(7) // returns "14" + } yield b + "-" + c + + val future2 = for { + a <- future0.mapTo[Int] + b <- (future { (a * 2).toString }).mapTo[Int] + c <- future { (7 * 2).toString } + } yield b + "-" + c + + Await.result(future1, defaultTimeout) mustBe ("10-14") + assert(checkType(future1, manifest[String])) + intercept[ClassCastException] { Await.result(future2, defaultTimeout) } + } + + "support pattern matching within a for-comprehension" in { + case class Req[T](req: T) + case class Res[T](res: T) + def async[T](req: Req[T]) = req match { + case Req(s: String) => future { Res(s.length) } + case Req(i: Int) => future { Res((i * 2).toString) } + } + + val future1 = for { + Res(a: Int) <- async(Req("Hello")) + Res(b: String) <- async(Req(a)) + Res(c: String) <- async(Req(7)) + } yield b + "-" + c + + val future2 = for { + Res(a: Int) <- async(Req("Hello")) + Res(b: Int) <- async(Req(a)) + Res(c: Int) <- async(Req(7)) + } yield b + "-" + c + + Await.result(future1, defaultTimeout) mustBe ("10-14") + intercept[NoSuchElementException] { Await.result(future2, defaultTimeout) } + } + + "recover from exceptions" in { + val future1 = Future(5) + val future2 = future1 map (_ / 0) + val future3 = future2 map (_.toString) + + val future4 = future1 recover { + case e: ArithmeticException => 0 + } map (_.toString) + + val future5 = future2 recover { + case e: ArithmeticException => 0 + } map (_.toString) + + val future6 = future2 recover { + case e: MatchError => 0 + } map (_.toString) + + val future7 = future3 recover { + case e: ArithmeticException => "You got ERROR" + } + + val future8 = testAsync("Failure") + val future9 = testAsync("Failure") recover { + case e: RuntimeException => "FAIL!" + } + val future10 = testAsync("Hello") recover { + case e: RuntimeException => "FAIL!" + } + val future11 = testAsync("Failure") recover { + case _ => "Oops!" + } + + Await.result(future1, defaultTimeout) mustBe (5) + intercept[ArithmeticException] { Await.result(future2, defaultTimeout) } + intercept[ArithmeticException] { Await.result(future3, defaultTimeout) } + Await.result(future4, defaultTimeout) mustBe ("5") + Await.result(future5, defaultTimeout) mustBe ("0") + intercept[ArithmeticException] { Await.result(future6, defaultTimeout) } + Await.result(future7, defaultTimeout) mustBe ("You got ERROR") + intercept[RuntimeException] { Await.result(future8, defaultTimeout) } + Await.result(future9, defaultTimeout) mustBe ("FAIL!") + Await.result(future10, defaultTimeout) mustBe ("World") + Await.result(future11, defaultTimeout) mustBe ("Oops!") + } + + "recoverWith from exceptions" in { + val o = new IllegalStateException("original") + val r = new IllegalStateException("recovered") + + intercept[IllegalStateException] { + val failed = Promise.failed[String](o).future recoverWith { + case _ if false == true => Promise.successful("yay!").future + } + Await.result(failed, defaultTimeout) + } mustBe (o) + + val recovered = Promise.failed[String](o).future recoverWith { + case _ => Promise.successful("yay!").future + } + Await.result(recovered, defaultTimeout) mustBe ("yay!") + + intercept[IllegalStateException] { + val refailed = Promise.failed[String](o).future recoverWith { + case _ => Promise.failed[String](r).future + } + Await.result(refailed, defaultTimeout) + } mustBe (r) + } + + "andThen like a boss" in { + val q = new java.util.concurrent.LinkedBlockingQueue[Int] + for (i <- 1 to 1000) { + val chained = future { + q.add(1); 3 + } andThen { + case _ => q.add(2) + } andThen { + case Right(0) => q.add(Int.MaxValue) + } andThen { + case _ => q.add(3); + } + Await.result(chained, defaultTimeout) mustBe (3) + q.poll() mustBe (1) + q.poll() mustBe (2) + q.poll() mustBe (3) + q.clear() + } + } + + "firstCompletedOf" in { + def futures = Vector.fill[Future[Int]](10) { + Promise[Int]().future + } :+ Promise.successful[Int](5).future + + Await.result(Future.firstCompletedOf(futures), defaultTimeout) mustBe (5) + Await.result(Future.firstCompletedOf(futures.iterator), defaultTimeout) mustBe (5) + } + + "find" in { + val futures = for (i <- 1 to 10) yield future { + i + } + + val result = Future.find[Int](futures)(_ == 3) + Await.result(result, defaultTimeout) mustBe (Some(3)) + + val notFound = Future.find[Int](futures.iterator)(_ == 11) + Await.result(notFound, defaultTimeout) mustBe (None) + } + + "zip" in { + val timeout = 10000 millis + val f = new IllegalStateException("test") + intercept[IllegalStateException] { + val failed = Promise.failed[String](f).future zip Promise.successful("foo").future + Await.result(failed, timeout) + } mustBe (f) + + intercept[IllegalStateException] { + val failed = Promise.successful("foo").future zip Promise.failed[String](f).future + Await.result(failed, timeout) + } mustBe (f) + + intercept[IllegalStateException] { + val failed = Promise.failed[String](f).future zip Promise.failed[String](f).future + Await.result(failed, timeout) + } mustBe (f) + + val successful = Promise.successful("foo").future zip Promise.successful("foo").future + Await.result(successful, timeout) mustBe (("foo", "foo")) + } + + "fold" in { + val timeout = 10000 millis + def async(add: Int, wait: Int) = future { + Thread.sleep(wait) + add + } + + val futures = (0 to 9) map { + idx => async(idx, idx * 200) + } + val folded = Future.fold(futures)(0)(_ + _) + Await.result(folded, timeout) mustBe (45) + + val futuresit = (0 to 9) map { + idx => async(idx, idx * 200) + } + val foldedit = Future.fold(futures)(0)(_ + _) + Await.result(foldedit, timeout) mustBe (45) + } + + "fold by composing" in { + val timeout = 10000 millis + def async(add: Int, wait: Int) = future { + Thread.sleep(wait) + add + } + def futures = (0 to 9) map { + idx => async(idx, idx * 200) + } + val folded = futures.foldLeft(Future(0)) { + case (fr, fa) => for (r <- fr; a <- fa) yield (r + a) + } + Await.result(folded, timeout) mustBe (45) + } + + "fold with an exception" in { + val timeout = 10000 millis + def async(add: Int, wait: Int) = future { + Thread.sleep(wait) + if (add == 6) throw new IllegalArgumentException("shouldFoldResultsWithException: expected") + add + } + def futures = (0 to 9) map { + idx => async(idx, idx * 100) + } + val folded = Future.fold(futures)(0)(_ + _) + intercept[IllegalArgumentException] { + Await.result(folded, timeout) + }.getMessage mustBe ("shouldFoldResultsWithException: expected") + } + + "fold mutable zeroes safely" in { + import scala.collection.mutable.ArrayBuffer + def test(testNumber: Int) { + val fs = (0 to 1000) map (i => Future(i)) + val f = Future.fold(fs)(ArrayBuffer.empty[AnyRef]) { + case (l, i) if i % 2 == 0 => l += i.asInstanceOf[AnyRef] + case (l, _) => l + } + val result = Await.result(f.mapTo[ArrayBuffer[Int]], 10000 millis).sum + + assert(result == 250500) + } + + (1 to 100) foreach test //Make sure it tries to provoke the problem + } + + "return zero value if folding empty list" in { + val zero = Future.fold(List[Future[Int]]())(0)(_ + _) + Await.result(zero, defaultTimeout) mustBe (0) + } + + "shouldReduceResults" in { + def async(idx: Int) = future { + Thread.sleep(idx * 200) + idx + } + val timeout = 10000 millis + + val futures = (0 to 9) map { async } + val reduced = Future.reduce(futures)(_ + _) + Await.result(reduced, timeout) mustBe (45) + + val futuresit = (0 to 9) map { async } + val reducedit = Future.reduce(futuresit)(_ + _) + Await.result(reducedit, timeout) mustBe (45) + } + + "shouldReduceResultsWithException" in { + def async(add: Int, wait: Int) = future { + Thread.sleep(wait) + if (add == 6) throw new IllegalArgumentException("shouldFoldResultsWithException: expected") + else add + } + val timeout = 10000 millis + def futures = (1 to 10) map { + idx => async(idx, idx * 100) + } + val failed = Future.reduce(futures)(_ + _) + intercept[IllegalArgumentException] { + Await.result(failed, timeout) + }.getMessage mustBe ("shouldFoldResultsWithException: expected") + } + + "shouldReduceThrowNSEEOnEmptyInput" in { + intercept[java.util.NoSuchElementException] { + val emptyreduced = Future.reduce(List[Future[Int]]())(_ + _) + Await.result(emptyreduced, defaultTimeout) + } + } + + "shouldTraverseFutures" in { + object counter { + var count = -1 + def incAndGet() = counter.synchronized { + count += 2 + count + } + } + + val oddFutures = List.fill(100)(future { counter.incAndGet() }).iterator + val traversed = Future.sequence(oddFutures) + Await.result(traversed, defaultTimeout).sum mustBe (10000) + + val list = (1 to 100).toList + val traversedList = Future.traverse(list)(x => Future(x * 2 - 1)) + Await.result(traversedList, defaultTimeout).sum mustBe (10000) + + val iterator = (1 to 100).toList.iterator + val traversedIterator = Future.traverse(iterator)(x => Future(x * 2 - 1)) + Await.result(traversedIterator, defaultTimeout).sum mustBe (10000) + } + + "shouldHandleThrowables" in { + val ms = new mutable.HashSet[Throwable] with mutable.SynchronizedSet[Throwable] + implicit val ec = scala.concurrent.ExecutionContext.fromExecutor(new scala.concurrent.forkjoin.ForkJoinPool(), { + t => + ms += t + }) + + class ThrowableTest(m: String) extends Throwable(m) + + val f1 = future[Any] { + throw new ThrowableTest("test") + } + + intercept[ThrowableTest] { + Await.result(f1, defaultTimeout) + } + + val latch = new TestLatch + val f2 = future { + Await.ready(latch, 5 seconds) + "success" + } + val f3 = f2 map { s => s.toUpperCase } + + f2 foreach { _ => throw new ThrowableTest("dispatcher foreach") } + f2 onSuccess { case _ => throw new ThrowableTest("dispatcher receive") } + + latch.open() + + Await.result(f2, defaultTimeout) mustBe ("success") + + f2 foreach { _ => throw new ThrowableTest("current thread foreach") } + f2 onSuccess { case _ => throw new ThrowableTest("current thread receive") } + + Await.result(f3, defaultTimeout) mustBe ("SUCCESS") + + val waiting = future { + Thread.sleep(1000) + } + Await.ready(waiting, 2000 millis) + + ms.size mustBe (4) + } + + "shouldBlockUntilResult" in { + val latch = new TestLatch + + val f = future { + Await.ready(latch, 5 seconds) + 5 + } + val f2 = future { + val res = Await.result(f, Inf) + res + 9 + } + + intercept[TimeoutException] { + Await.ready(f2, 100 millis) + } + + latch.open() + + Await.result(f2, defaultTimeout) mustBe (14) + + val f3 = future { + Thread.sleep(100) + 5 + } + + intercept[TimeoutException] { + Await.ready(f3, 0 millis) + } + } + + "run callbacks async" in { + val latch = Vector.fill(10)(new TestLatch) + + val f1 = future { + latch(0).open() + Await.ready(latch(1), TestLatch.DefaultTimeout) + "Hello" + } + val f2 = f1 map { + s => + latch(2).open() + Await.ready(latch(3), TestLatch.DefaultTimeout) + s.length + } + for (_ <- f2) latch(4).open() + + Await.ready(latch(0), TestLatch.DefaultTimeout) + + f1.isCompleted mustBe (false) + f2.isCompleted mustBe (false) + + latch(1).open() + Await.ready(latch(2), TestLatch.DefaultTimeout) + + f1.isCompleted mustBe (true) + f2.isCompleted mustBe (false) + + val f3 = f1 map { + s => + latch(5).open() + Await.ready(latch(6), TestLatch.DefaultTimeout) + s.length * 2 + } + for (_ <- f3) latch(3).open() + + Await.ready(latch(5), TestLatch.DefaultTimeout) + + f3.isCompleted mustBe (false) + + latch(6).open() + Await.ready(latch(4), TestLatch.DefaultTimeout) + + f2.isCompleted mustBe (true) + f3.isCompleted mustBe (true) + + val p1 = Promise[String]() + val f4 = p1.future map { + s => + latch(7).open() + Await.ready(latch(8), TestLatch.DefaultTimeout) + s.length + } + for (_ <- f4) latch(9).open() + + p1.future.isCompleted mustBe (false) + f4.isCompleted mustBe (false) + + p1 complete Right("Hello") + + Await.ready(latch(7), TestLatch.DefaultTimeout) + + p1.future.isCompleted mustBe (true) + f4.isCompleted mustBe (false) + + latch(8).open() + Await.ready(latch(9), TestLatch.DefaultTimeout) + + Await.ready(f4, defaultTimeout).isCompleted mustBe (true) + } + + "should not deadlock with nested await (ticket 1313)" in { + val simple = Future() map { + _ => + val unit = Future(()) + val umap = unit map { _ => () } + Await.result(umap, Inf) + } + Await.ready(simple, Inf).isCompleted mustBe (true) + + val l1, l2 = new TestLatch + val complex = Future() map { + _ => + blocking { + val nested = Future(()) + for (_ <- nested) l1.open() + Await.ready(l1, TestLatch.DefaultTimeout) // make sure nested is completed + for (_ <- nested) l2.open() + Await.ready(l2, TestLatch.DefaultTimeout) + } + } + Await.ready(complex, defaultTimeout).isCompleted mustBe (true) + } + + } + +} + + diff --git a/test/files/jvm/future-spec/PromiseTests.scala b/test/files/jvm/future-spec/PromiseTests.scala new file mode 100644 index 0000000000..6016746a23 --- /dev/null +++ b/test/files/jvm/future-spec/PromiseTests.scala @@ -0,0 +1,244 @@ + + + +import scala.concurrent._ +import scala.concurrent.util.duration._ +import scala.concurrent.util.Duration.Inf +import scala.collection._ +import scala.runtime.NonLocalReturnControl + + + +object PromiseTests extends MinimalScalaTest { + + val defaultTimeout = Inf + + /* promise specification */ + + "An empty Promise" should { + + "not be completed" in { + val p = Promise() + p.future.isCompleted mustBe (false) + } + + "have no value" in { + val p = Promise() + p.future.value mustBe (None) + } + + "return supplied value on timeout" in { + val failure = Promise.failed[String](new RuntimeException("br0ken")).future + val otherFailure = Promise.failed[String](new RuntimeException("last")).future + val empty = Promise[String]().future + val timedOut = Promise.successful[String]("Timedout").future + + Await.result(failure fallbackTo timedOut, defaultTimeout) mustBe ("Timedout") + Await.result(timedOut fallbackTo empty, defaultTimeout) mustBe ("Timedout") + Await.result(failure fallbackTo failure fallbackTo timedOut, defaultTimeout) mustBe ("Timedout") + intercept[RuntimeException] { + Await.result(failure fallbackTo otherFailure, defaultTimeout) + }.getMessage mustBe ("last") + } + + } + + "A successful Promise" should { + val result = "test value" + val future = Promise[String]().complete(Right(result)).future + futureWithResult(_(future, result)) + } + + "A failed Promise" should { + val message = "Expected Exception" + val future = Promise[String]().complete(Left(new RuntimeException(message))).future + futureWithException[RuntimeException](_(future, message)) + } + + "An interrupted Promise" should { + val message = "Boxed InterruptedException" + val future = Promise[String]().complete(Left(new InterruptedException(message))).future + futureWithException[ExecutionException](_(future, message)) + } + + "A NonLocalReturnControl failed Promise" should { + val result = "test value" + val future = Promise[String]().complete(Left(new NonLocalReturnControl[String]("test", result))).future + futureWithResult(_(future, result)) + } + + def futureWithResult(f: ((Future[Any], Any) => Unit) => Unit) { + + "be completed" in { f((future, _) => future.isCompleted mustBe (true)) } + + "contain a value" in { f((future, result) => future.value mustBe (Some(Right(result)))) } + + "return result with 'blocking'" in { f((future, result) => blocking(future, defaultTimeout) mustBe (result)) } + + "return result with 'Await.result'" in { f((future, result) => Await.result(future, defaultTimeout) mustBe (result)) } + + "not timeout" in { f((future, _) => Await.ready(future, 0 millis)) } + + "filter result" in { + f { + (future, result) => + Await.result((future filter (_ => true)), defaultTimeout) mustBe (result) + intercept[NoSuchElementException] { + Await.result((future filter (_ => false)), defaultTimeout) + } + } + } + + "transform result with map" in { f((future, result) => Await.result((future map (_.toString.length)), defaultTimeout) mustBe (result.toString.length)) } + + "compose result with flatMap" in { + f { (future, result) => + val r = for (r <- future; p <- Promise.successful("foo").future) yield r.toString + p + Await.result(r, defaultTimeout) mustBe (result.toString + "foo") + } + } + + "perform action with foreach" in { + f { + (future, result) => + val p = Promise[Any]() + future foreach p.success + Await.result(p.future, defaultTimeout) mustBe (result) + } + } + + "zip properly" in { + f { + (future, result) => + Await.result(future zip Promise.successful("foo").future, defaultTimeout) mustBe ((result, "foo")) + intercept[RuntimeException] { + Await.result(future zip Promise.failed(new RuntimeException("ohnoes")).future, defaultTimeout) + }.getMessage mustBe ("ohnoes") + } + } + + "not recover from exception" in { f((future, result) => Await.result(future.recover({ case _ => "pigdog" }), defaultTimeout) mustBe (result)) } + + "perform action on result" in { + f { + (future, result) => + val p = Promise[Any]() + future.onSuccess { case x => p.success(x) } + Await.result(p.future, defaultTimeout) mustBe (result) + } + } + + "not project a failure" in { + f { + (future, result) => + intercept[NoSuchElementException] { + Await.result(future.failed, defaultTimeout) + }.getMessage mustBe ("Future.failed not completed with a throwable. Instead completed with: " + result) + } + } + + "cast using mapTo" in { + f { + (future, result) => + Await.result(future.mapTo[Boolean].recover({ case _: ClassCastException ⇒ false }), defaultTimeout) mustBe (false) + } + } + + } + + def futureWithException[E <: Throwable: Manifest](f: ((Future[Any], String) => Unit) => Unit) { + + "be completed" in { + f((future, _) => future.isCompleted mustBe (true)) + } + + "contain a value" in { + f((future, message) => { + future.value.get.left.get.getMessage mustBe (message) + }) + } + + "throw exception with 'blocking'" in { + f { + (future, message) => + intercept[E] { + blocking(future, defaultTimeout) + }.getMessage mustBe (message) + } + } + + "throw exception with 'Await.result'" in { + f { + (future, message) => + intercept[E] { + Await.result(future, defaultTimeout) + }.getMessage mustBe (message) + } + } + + "retain exception with filter" in { + f { + (future, message) => + intercept[E] { Await.result(future filter (_ => true), defaultTimeout) }.getMessage mustBe (message) + intercept[E] { Await.result(future filter (_ => false), defaultTimeout) }.getMessage mustBe (message) + } + } + + "retain exception with map" in { + f { + (future, message) => + intercept[E] { Await.result(future map (_.toString.length), defaultTimeout) }.getMessage mustBe (message) + } + } + + "retain exception with flatMap" in { + f { + (future, message) => + intercept[E] { Await.result(future flatMap (_ => Promise.successful("foo").future), defaultTimeout) }.getMessage mustBe (message) + } + } + + "zip properly" in { + f { + (future, message) => + intercept[E] { + Await.result(future zip Promise.successful("foo").future, defaultTimeout) + }.getMessage mustBe (message) + } + } + + "recover from exception" in { + f { + (future, message) => + Await.result(future.recover({ case e if e.getMessage == message ⇒ "pigdog" }), defaultTimeout) mustBe ("pigdog") + } + } + + "project a failure" in { + f((future, message) => Await.result(future.failed, defaultTimeout).getMessage mustBe (message)) + } + + "perform action on exception" in { + f { + (future, message) => + val p = Promise[Any]() + future.onFailure { case _ => p.success(message) } + Await.result(p.future, defaultTimeout) mustBe (message) + } + } + + "always cast successfully using mapTo" in { + f { + (future, message) => + intercept[E] { Await.result(future.mapTo[java.lang.Thread], defaultTimeout) }.getMessage mustBe (message) + } + } + } +} + + + + + + + diff --git a/test/files/jvm/future-spec/main.scala b/test/files/jvm/future-spec/main.scala new file mode 100644 index 0000000000..45b59d5d20 --- /dev/null +++ b/test/files/jvm/future-spec/main.scala @@ -0,0 +1,108 @@ + + + +import scala.collection._ +import scala.concurrent._ +import scala.concurrent.util.Duration +import java.util.concurrent.{ TimeoutException, CountDownLatch, TimeUnit } + + +object Test { + + def main(args: Array[String]) { + FutureTests.check() + PromiseTests.check() + } + +} + + +trait Output { + val buffer = new StringBuilder + + def bufferPrintln(a: Any) = buffer.synchronized { + buffer.append(a.toString + "\n") + } +} + + +trait MinimalScalaTest extends Output { + + val throwables = mutable.ArrayBuffer[Throwable]() + + def check() { + if (throwables.nonEmpty) println(buffer.toString) + } + + implicit def stringops(s: String) = new { + + def should[U](snippets: =>U) = { + bufferPrintln(s + " should:") + snippets + } + + def in[U](snippet: =>U) = { + try { + bufferPrintln("- " + s) + snippet + bufferPrintln("[OK] Test passed.") + } catch { + case e => + bufferPrintln("[FAILED] " + e) + bufferPrintln(e.getStackTrace().mkString("\n")) + throwables += e + } + } + + } + + implicit def objectops(obj: Any) = new { + + def mustBe(other: Any) = assert(obj == other, obj + " is not " + other) + + } + + def intercept[T <: Throwable: Manifest](body: =>Any): T = { + try { + body + throw new Exception("Exception of type %s was not thrown".format(manifest[T])) + } catch { + case t: Throwable => + if (manifest[T].erasure != t.getClass) throw t + else t.asInstanceOf[T] + } + } + + def checkType[T: Manifest, S](in: Future[T], refmanifest: Manifest[S]): Boolean = manifest[T] == refmanifest +} + + +object TestLatch { + val DefaultTimeout = Duration(5, TimeUnit.SECONDS) + + def apply(count: Int = 1) = new TestLatch(count) +} + + +class TestLatch(count: Int = 1) extends Awaitable[Unit] { + private var latch = new CountDownLatch(count) + + def countDown() = latch.countDown() + def isOpen: Boolean = latch.getCount == 0 + def open() = while (!isOpen) countDown() + def reset() = latch = new CountDownLatch(count) + + @throws(classOf[TimeoutException]) + def ready(atMost: Duration)(implicit permit: CanAwait) = { + val opened = latch.await(atMost.toNanos, TimeUnit.NANOSECONDS) + if (!opened) throw new TimeoutException("Timeout of %s." format (atMost.toString)) + this + } + + @throws(classOf[Exception]) + def result(atMost: Duration)(implicit permit: CanAwait): Unit = { + ready(atMost) + } + +} + diff --git a/test/files/jvm/signum.scala b/test/files/jvm/signum.scala index feb28d3e43..76602a6641 100644 --- a/test/files/jvm/signum.scala +++ b/test/files/jvm/signum.scala @@ -11,5 +11,11 @@ object Test { assert(math.signum(0) == 0) assert(math.signum(-1) == -1) assert(math.signum(Int.MinValue) == -1) + + assert(java.lang.Float.floatToIntBits(math.signum(0f)) == 0x0) + assert(java.lang.Float.floatToIntBits(math.signum(-0f)) == 0x80000000) + + assert(java.lang.Double.doubleToLongBits(math.signum(0d)) == 0x0L) + assert(java.lang.Double.doubleToLongBits(math.signum(-0d)) == 0x8000000000000000L) } } diff --git a/test/pending/neg/dbldef.check b/test/files/neg/dbldef.check index 3ee63475e4..3ee63475e4 100644 --- a/test/pending/neg/dbldef.check +++ b/test/files/neg/dbldef.check diff --git a/test/pending/neg/dbldef.scala b/test/files/neg/dbldef.scala index c70fb97b2c..c70fb97b2c 100644 --- a/test/pending/neg/dbldef.scala +++ b/test/files/neg/dbldef.scala diff --git a/test/files/neg/gadts1.check b/test/files/neg/gadts1.check index 0441f604c9..44d2b114d6 100644 --- a/test/files/neg/gadts1.check +++ b/test/files/neg/gadts1.check @@ -11,7 +11,4 @@ gadts1.scala:20: error: type mismatch; required: a case Cell[a](x: Int) => c.x = 5 ^ -gadts1.scala:20: error: Could not typecheck extractor call: case class <none> with arguments List((x @ (_: Int))) - case Cell[a](x: Int) => c.x = 5 - ^ -four errors found +three errors found diff --git a/test/files/neg/logImplicits.check b/test/files/neg/logImplicits.check index d98422dacb..54afc6f86d 100644 --- a/test/files/neg/logImplicits.check +++ b/test/files/neg/logImplicits.check @@ -1,16 +1,16 @@ -logImplicits.scala:2: applied implicit conversion from xs.type to ?{val size: ?} = implicit def byteArrayOps(xs: Array[Byte]): scala.collection.mutable.ArrayOps[Byte] +logImplicits.scala:2: applied implicit conversion from xs.type to ?{def size: ?} = implicit def byteArrayOps(xs: Array[Byte]): scala.collection.mutable.ArrayOps[Byte] def f(xs: Array[Byte]) = xs.size ^ -logImplicits.scala:7: applied implicit conversion from String("abc") to ?{val map: ?} = implicit def augmentString(x: String): scala.collection.immutable.StringOps +logImplicits.scala:7: applied implicit conversion from String("abc") to ?{def map: ?} = implicit def augmentString(x: String): scala.collection.immutable.StringOps def f = "abc" map (_ + 1) ^ logImplicits.scala:15: inferred view from String("abc") to Int = C.this.convert:(p: String("abc"))Int math.max(122, x: Int) ^ -logImplicits.scala:19: applied implicit conversion from Int(1) to ?{val ->: ?} = implicit def any2ArrowAssoc[A](x: A): ArrowAssoc[A] +logImplicits.scala:19: applied implicit conversion from Int(1) to ?{def ->: ?} = implicit def any2ArrowAssoc[A](x: A): ArrowAssoc[A] def f = (1 -> 2) + "c" ^ -logImplicits.scala:19: applied implicit conversion from (Int, Int) to ?{val +: ?} = implicit def any2stringadd(x: Any): scala.runtime.StringAdd +logImplicits.scala:19: applied implicit conversion from (Int, Int) to ?{def +: ?} = implicit def any2stringadd(x: Any): scala.runtime.StringAdd def f = (1 -> 2) + "c" ^ logImplicits.scala:22: error: class Un needs to be abstract, since method unimplemented is not defined diff --git a/test/files/neg/macro-invalidsig-context-bounds.check b/test/files/neg/macro-invalidsig-context-bounds.check index dd68e5db1b..0401993335 100644 --- a/test/files/neg/macro-invalidsig-context-bounds.check +++ b/test/files/neg/macro-invalidsig-context-bounds.check @@ -1,4 +1,4 @@ -Impls_1.scala:4: error: macro implementations cannot have implicit parameters other than TypeTag evidences
- def foo[U: c.TypeTag: Numeric](c: Ctx) = {
- ^
-one error found
+Impls_1.scala:4: error: macro implementations cannot have implicit parameters other than TypeTag evidences + def foo[U: c.TypeTag: Numeric](c: Ctx) = { + ^ +one error found diff --git a/test/files/neg/macro-invalidsig-context-bounds/Macros_Test_2.scala b/test/files/neg/macro-invalidsig-context-bounds/Macros_Test_1.scala index 5b4602f328..5b4602f328 100644 --- a/test/files/neg/macro-invalidsig-context-bounds/Macros_Test_2.scala +++ b/test/files/neg/macro-invalidsig-context-bounds/Macros_Test_1.scala diff --git a/test/files/neg/overloaded-unapply.check b/test/files/neg/overloaded-unapply.check index 1da93f6939..68a826bac2 100644 --- a/test/files/neg/overloaded-unapply.check +++ b/test/files/neg/overloaded-unapply.check @@ -7,7 +7,8 @@ match argument types (List[a]) overloaded-unapply.scala:22: error: cannot resolve overloaded unapply case List(x, xs) => 7 ^ -overloaded-unapply.scala:12: error: method unapply is defined twice in overloaded-unapply.scala +overloaded-unapply.scala:12: error: method unapply is defined twice + conflicting symbols both originated in file 'overloaded-unapply.scala' def unapply[a](xs: List[a]): Option[Null] = xs match { ^ three errors found diff --git a/test/files/neg/override.check b/test/files/neg/override.check index 0336fb2b11..fc152cb3b1 100644 --- a/test/files/neg/override.check +++ b/test/files/neg/override.check @@ -1,5 +1,5 @@ override.scala:9: error: overriding type T in trait A with bounds >: Int <: Int; type T in trait B with bounds >: String <: String has incompatible type lazy val x : A with B = x - ^ + ^ one error found diff --git a/test/files/neg/package-ob-case.flags b/test/files/neg/package-ob-case.flags index e8fb65d50c..6c1dd108ae 100644 --- a/test/files/neg/package-ob-case.flags +++ b/test/files/neg/package-ob-case.flags @@ -1 +1 @@ --Xfatal-warnings
\ No newline at end of file +-Xfatal-warnings -Xlint
\ No newline at end of file diff --git a/test/files/neg/patmat-type-check.check b/test/files/neg/patmat-type-check.check index ab4451f089..e045841ce1 100644 --- a/test/files/neg/patmat-type-check.check +++ b/test/files/neg/patmat-type-check.check @@ -3,31 +3,19 @@ patmat-type-check.scala:22: error: scrutinee is incompatible with pattern type; required: String def f1 = "bob".reverse match { case Seq('b', 'o', 'b') => true } // fail ^ -patmat-type-check.scala:22: error: value _1 is not a member of object Seq - def f1 = "bob".reverse match { case Seq('b', 'o', 'b') => true } // fail - ^ patmat-type-check.scala:23: error: scrutinee is incompatible with pattern type; found : Seq[A] required: Array[Char] def f2 = "bob".toArray match { case Seq('b', 'o', 'b') => true } // fail ^ -patmat-type-check.scala:23: error: value _1 is not a member of object Seq - def f2 = "bob".toArray match { case Seq('b', 'o', 'b') => true } // fail - ^ patmat-type-check.scala:27: error: scrutinee is incompatible with pattern type; found : Seq[A] required: Test.Bop2 def f3(x: Bop2) = x match { case Seq('b', 'o', 'b') => true } // fail ^ -patmat-type-check.scala:27: error: value _1 is not a member of object Seq - def f3(x: Bop2) = x match { case Seq('b', 'o', 'b') => true } // fail - ^ patmat-type-check.scala:30: error: scrutinee is incompatible with pattern type; found : Seq[A] required: Test.Bop3[Char] def f4[T](x: Bop3[Char]) = x match { case Seq('b', 'o', 'b') => true } // fail ^ -patmat-type-check.scala:30: error: value _1 is not a member of object Seq - def f4[T](x: Bop3[Char]) = x match { case Seq('b', 'o', 'b') => true } // fail - ^ -8 errors found +four errors found diff --git a/test/files/neg/primitive-sigs-1.check b/test/files/neg/primitive-sigs-1.check index 8713d95cc3..77dc457a49 100644 --- a/test/files/neg/primitive-sigs-1.check +++ b/test/files/neg/primitive-sigs-1.check @@ -1,6 +1,6 @@ -A_3.scala:3: error: type mismatch; +B.scala:3: error: type mismatch; found : Bippy required: AC[Integer] - J_2.f(new Bippy()) - ^ + J.f(new Bippy()) + ^ one error found diff --git a/test/files/neg/primitive-sigs-1/A_1.scala b/test/files/neg/primitive-sigs-1/A.scala index 0dd83b5d6a..0dd83b5d6a 100644 --- a/test/files/neg/primitive-sigs-1/A_1.scala +++ b/test/files/neg/primitive-sigs-1/A.scala diff --git a/test/files/neg/primitive-sigs-1/A_3.scala b/test/files/neg/primitive-sigs-1/B.scala index dec617a111..0958bcda57 100644 --- a/test/files/neg/primitive-sigs-1/A_3.scala +++ b/test/files/neg/primitive-sigs-1/B.scala @@ -1,5 +1,5 @@ object Test { def main(args: Array[String]): Unit = { - J_2.f(new Bippy()) + J.f(new Bippy()) } } diff --git a/test/files/neg/primitive-sigs-1/J_2.java b/test/files/neg/primitive-sigs-1/J.java index b416befb4d..2e43b8330c 100644 --- a/test/files/neg/primitive-sigs-1/J_2.java +++ b/test/files/neg/primitive-sigs-1/J.java @@ -1,6 +1,6 @@ // java: often the java or scala compiler will save us from // the untruth in the signature, but not always. -public class J_2 { +public class J { public static Integer f(AC<Integer> x) { return x.f(); } public static void main(String[] args) { f(new Bippy()); diff --git a/test/files/neg/t0418.check b/test/files/neg/t0418.check index 50931a1bca..4e9ad2f9ae 100644 --- a/test/files/neg/t0418.check +++ b/test/files/neg/t0418.check @@ -4,7 +4,4 @@ t0418.scala:2: error: not found: value Foo12340771 t0418.scala:2: error: not found: value x null match { case Foo12340771.Bar(x) => x } ^ -t0418.scala:2: error: Could not typecheck extractor call: case class <none> with arguments List((x @ _)) - null match { case Foo12340771.Bar(x) => x } - ^ -three errors found +two errors found diff --git a/test/files/neg/t112706A.check b/test/files/neg/t112706A.check index fb18b31be1..30d0c3ec91 100644 --- a/test/files/neg/t112706A.check +++ b/test/files/neg/t112706A.check @@ -3,7 +3,4 @@ t112706A.scala:5: error: constructor cannot be instantiated to expected type; required: String case Tuple2(node,_) => ^ -t112706A.scala:5: error: Could not typecheck extractor call: case class Tuple2 with arguments List((node @ _), _) - case Tuple2(node,_) => - ^ -two errors found +one error found diff --git a/test/files/neg/t200.check b/test/files/neg/t200.check index 3ef6665fe5..b6b1a32267 100644 --- a/test/files/neg/t200.check +++ b/test/files/neg/t200.check @@ -1,4 +1,5 @@ -t200.scala:7: error: method foo is defined twice in t200.scala +t200.scala:7: error: method foo is defined twice + conflicting symbols both originated in file 't200.scala' def foo: Int; ^ one error found diff --git a/test/files/neg/t2775.check b/test/files/neg/t2775.check index f357221cd9..a1e950cf73 100644 --- a/test/files/neg/t2775.check +++ b/test/files/neg/t2775.check @@ -1,4 +1,4 @@ -t2775.scala:1: error: cannot find class tag for element type B.this.T
-trait B[S] { type T = S; val c = new Array[T](1) }
- ^
-one error found
+t2775.scala:1: error: cannot find array tag for element type B.this.T +trait B[S] { type T = S; val c = new Array[T](1) } + ^ +one error found diff --git a/test/files/neg/t2779.check b/test/files/neg/t2779.check index d642541e3e..0ab4c50d0f 100644 --- a/test/files/neg/t2779.check +++ b/test/files/neg/t2779.check @@ -1,4 +1,5 @@ -t2779.scala:16: error: method f is defined twice in t2779.scala +t2779.scala:16: error: method f is defined twice + conflicting symbols both originated in file 't2779.scala' override def f = List(M1) ^ one error found diff --git a/test/files/neg/t278.check b/test/files/neg/t278.check index 0c2dfeb67a..405f7d225c 100644 --- a/test/files/neg/t278.check +++ b/test/files/neg/t278.check @@ -4,7 +4,8 @@ t278.scala:5: error: overloaded method value a with alternatives: does not take type parameters println(a[A]) ^ -t278.scala:4: error: method a is defined twice in t278.scala +t278.scala:4: error: method a is defined twice + conflicting symbols both originated in file 't278.scala' def a = (p:A) => () ^ two errors found diff --git a/test/files/neg/t3392.check b/test/files/neg/t3392.check index 3a39098c4e..842d63eec9 100644 --- a/test/files/neg/t3392.check +++ b/test/files/neg/t3392.check @@ -1,7 +1,4 @@ t3392.scala:9: error: not found: value x case x@A(x/*<-- refers to the pattern that includes this comment*/.Ex(42)) => ^ -t3392.scala:9: error: Could not typecheck extractor call: case class <none> with arguments List(42) - case x@A(x/*<-- refers to the pattern that includes this comment*/.Ex(42)) => - ^ -two errors found +one error found diff --git a/test/files/neg/t418.check b/test/files/neg/t418.check index c06088ba9d..1489547823 100644 --- a/test/files/neg/t418.check +++ b/test/files/neg/t418.check @@ -4,7 +4,4 @@ t418.scala:2: error: not found: value Foo12340771 t418.scala:2: error: not found: value x null match { case Foo12340771.Bar(x) => x } ^ -t418.scala:2: error: Could not typecheck extractor call: case class <none> with arguments List((x @ _)) - null match { case Foo12340771.Bar(x) => x } - ^ -three errors found +two errors found diff --git a/test/files/neg/t4515.check b/test/files/neg/t4515.check index 856d252a0f..a60d16295f 100644 --- a/test/files/neg/t4515.check +++ b/test/files/neg/t4515.check @@ -1,6 +1,6 @@ t4515.scala:37: error: type mismatch; - found : _0(in method apply) where type _0(in method apply) - required: (some other)_0(in method apply) + found : _0(in value $anonfun) where type _0(in value $anonfun) + required: (some other)_0(in value $anonfun) handler.onEvent(target, ctx.getEvent, node, ctx) ^ one error found diff --git a/test/files/neg/t4568.check b/test/files/neg/t4568.check new file mode 100644 index 0000000000..f94d699486 --- /dev/null +++ b/test/files/neg/t4568.check @@ -0,0 +1,4 @@ +t4568.scala:8: error: recursive method isSubListOf needs result type + case h :: t => y.contains(h) && (t.isSubListOf(y.drop(y.indexOf(h) + 1))) + ^ +one error found diff --git a/test/files/neg/t4568.scala b/test/files/neg/t4568.scala new file mode 100644 index 0000000000..8067759262 --- /dev/null +++ b/test/files/neg/t4568.scala @@ -0,0 +1,13 @@ +object SubList { + implicit def sublistable[A](x: List[A]) = new SubListable(x) + + class SubListable[A](x: List[A]) { + def isSubListOf(y: List[A]) = { + x match { + case Nil => true + case h :: t => y.contains(h) && (t.isSubListOf(y.drop(y.indexOf(h) + 1))) + } + } + } + +}
\ No newline at end of file diff --git a/test/files/neg/t5106.check b/test/files/neg/t5106.check new file mode 100644 index 0000000000..ac16041cf7 --- /dev/null +++ b/test/files/neg/t5106.check @@ -0,0 +1,11 @@ +t5106.scala:3: error: type mismatch; + found : Int(4) + required: String + val (n, l): (String, Int) = (4, "") + ^ +t5106.scala:3: error: type mismatch; + found : String("") + required: Int + val (n, l): (String, Int) = (4, "") + ^ +two errors found diff --git a/test/files/neg/t5106.scala b/test/files/neg/t5106.scala new file mode 100644 index 0000000000..419b430ff1 --- /dev/null +++ b/test/files/neg/t5106.scala @@ -0,0 +1,5 @@ +class A { + def f { + val (n, l): (String, Int) = (4, "") + } +} diff --git a/test/files/neg/t5504.check b/test/files/neg/t5504.check new file mode 100644 index 0000000000..2827c02d10 --- /dev/null +++ b/test/files/neg/t5504.check @@ -0,0 +1,4 @@ +error: type _$1 is defined twice + conflicting symbols both originated in file 't5504/s_1.scala' + Note: this may be due to a bug in the compiler involving wildcards in package objects +one error found diff --git a/test/files/neg/t5504/s_1.scala b/test/files/neg/t5504/s_1.scala new file mode 100644 index 0000000000..35cb2c8bae --- /dev/null +++ b/test/files/neg/t5504/s_1.scala @@ -0,0 +1,4 @@ +// a.scala +package object foo { + val m: List[_] = Nil +} diff --git a/test/files/neg/t5504/s_2.scala b/test/files/neg/t5504/s_2.scala new file mode 100644 index 0000000000..03eecf6e19 --- /dev/null +++ b/test/files/neg/t5504/s_2.scala @@ -0,0 +1,8 @@ +// b.scala +package foo + +object Test { + def main(args: Array[String]): Unit = { + println(foo.m) + } +} diff --git a/test/files/neg/t5578.check b/test/files/neg/t5578.check new file mode 100644 index 0000000000..d803adb223 --- /dev/null +++ b/test/files/neg/t5578.check @@ -0,0 +1,4 @@ +t5578.scala:33: error: No Manifest available for T. + def plus[T: Numeric](x: Rep[T], y: Rep[T]): Rep[T] = Plus[T](x,y) + ^ +one error found diff --git a/test/files/neg/t5578.scala b/test/files/neg/t5578.scala new file mode 100644 index 0000000000..ce72f32d53 --- /dev/null +++ b/test/files/neg/t5578.scala @@ -0,0 +1,39 @@ +trait Base { + type Rep[T] +} + +trait Expressions { + // constants/symbols (atomic) + abstract class Exp[T] + // ... + case class Sym[T](n: Int) extends Exp[T] + + // operations (composite, defined in subtraits) + abstract class Def[T] + + // additional members for managing encountered definitions + def findOrCreateDefinition[T](rhs: Def[T]): Sym[T] + implicit def toExp[T:Manifest](d: Def[T]): Exp[T] = findOrCreateDefinition(d) +} + +trait BaseExp extends Base with Expressions { + type Rep[T] = Exp[T] + + def findOrCreateDefinition[T](rhs: Def[T]): Sym[T] = null // stub +} + +trait NumericOps extends Base { + def plus[T](x: Rep[T], y: Rep[T]): Rep[T] +} + +trait NumericOpsExp extends BaseExp { + case class Plus[T:Numeric](x: Rep[T], y: Rep[T]) + extends Def[T] + + def plus[T: Numeric](x: Rep[T], y: Rep[T]): Rep[T] = Plus[T](x,y) + + // Possible solutions: +// def plus[T: Numeric: Manifest](x: Rep[T], y: Rep[T]): Rep[T] = Plus[T](x, y) +// def plus[T](x: Rep[T], y: Rep[T])(implicit num: Numeric[T], man: Manifest[T]): Rep[T] = Plus(x,y) + +} diff --git a/test/files/neg/t5589neg.check b/test/files/neg/t5589neg.check index fb6858a397..b3ff16d7e4 100644 --- a/test/files/neg/t5589neg.check +++ b/test/files/neg/t5589neg.check @@ -22,9 +22,6 @@ t5589neg.scala:4: error: constructor cannot be instantiated to expected type; t5589neg.scala:4: error: not found: value y2 def f7(x: Either[Int, (String, Int)]) = for (y1 @ Tuple1(y2) <- x.right) yield ((y1, y2)) ^ -t5589neg.scala:4: error: Could not typecheck extractor call: case class Tuple1 with arguments List((y2 @ _)) - def f7(x: Either[Int, (String, Int)]) = for (y1 @ Tuple1(y2) <- x.right) yield ((y1, y2)) - ^ t5589neg.scala:5: error: constructor cannot be instantiated to expected type; found : (T1, T2, T3) required: (String, Int) @@ -37,4 +34,4 @@ t5589neg.scala:5: error: not found: value y2 def f8(x: Either[Int, (String, Int)]) = for ((y1, y2, y3) <- x.right) yield ((y1, y2)) ^ two warnings found -8 errors found +7 errors found diff --git a/test/files/neg/t5666.check b/test/files/neg/t5666.check index 2b8b9077bb..4289b00ade 100644 --- a/test/files/neg/t5666.check +++ b/test/files/neg/t5666.check @@ -4,7 +4,34 @@ t5666.scala:2: error: class Any is abstract; cannot be instantiated t5666.scala:3: error: class AnyVal is abstract; cannot be instantiated new AnyVal ^ +t5666.scala:4: error: Double does not have a constructor + new Double + ^ +t5666.scala:5: error: Float does not have a constructor + new Float + ^ +t5666.scala:6: error: Long does not have a constructor + new Long + ^ +t5666.scala:7: error: Int does not have a constructor + new Int + ^ +t5666.scala:8: error: Char does not have a constructor + new Char + ^ +t5666.scala:9: error: Short does not have a constructor + new Short + ^ +t5666.scala:10: error: Byte does not have a constructor + new Byte + ^ +t5666.scala:11: error: Boolean does not have a constructor + new Boolean + ^ +t5666.scala:12: error: Unit does not have a constructor + new Unit + ^ t5666.scala:13: error: class Nothing is abstract; cannot be instantiated new Nothing ^ -three errors found +12 errors found diff --git a/test/files/neg/t5728.check b/test/files/neg/t5728.check new file mode 100644 index 0000000000..14f9c42ae0 --- /dev/null +++ b/test/files/neg/t5728.check @@ -0,0 +1,4 @@ +t5728.scala:3: error: implicit classes must accept exactly one primary constructor parameter + implicit class Foo + ^ +one error found diff --git a/test/files/neg/t5728.scala b/test/files/neg/t5728.scala new file mode 100644 index 0000000000..99337d06d4 --- /dev/null +++ b/test/files/neg/t5728.scala @@ -0,0 +1,7 @@ +object Test { + + implicit class Foo + + implicit def Foo = new Foo + +} diff --git a/test/files/neg/t591.check b/test/files/neg/t591.check index 5cdeebf079..d33f6d7a2f 100644 --- a/test/files/neg/t591.check +++ b/test/files/neg/t591.check @@ -1,4 +1,5 @@ -t591.scala:38: error: method input_= is defined twice in t591.scala +t591.scala:38: error: method input_= is defined twice + conflicting symbols both originated in file 't591.scala' def input_=(in : Input) = {} ^ one error found diff --git a/test/files/neg/t750.check b/test/files/neg/t750.check new file mode 100644 index 0000000000..c17ca334e6 --- /dev/null +++ b/test/files/neg/t750.check @@ -0,0 +1,15 @@ +Test_2.scala:4: error: type mismatch; + found : Array[Int] + required: Array[? with Object] +Note: Int >: ? with Object, but class Array is invariant in type T. +You may wish to investigate a wildcard type such as `_ >: ? with Object`. (SLS 3.2.10) + AO_1.f(a) + ^ +Test_2.scala:5: error: type mismatch; + found : Array[Int] + required: Array[Int] +Note: Int >: Int, but class Array is invariant in type T. +You may wish to investigate a wildcard type such as `_ >: Int`. (SLS 3.2.10) + AO_1.f[Int](a) + ^ +two errors found diff --git a/test/files/neg/t750/AO_1.java b/test/files/neg/t750/AO_1.java new file mode 100644 index 0000000000..4c7360ec6f --- /dev/null +++ b/test/files/neg/t750/AO_1.java @@ -0,0 +1,5 @@ +public class AO_1 { + public static <T> void f(T[] ar0) { + System.out.println(ar0); + } +}
\ No newline at end of file diff --git a/test/files/neg/t750/Test_2.scala b/test/files/neg/t750/Test_2.scala new file mode 100644 index 0000000000..80977431c5 --- /dev/null +++ b/test/files/neg/t750/Test_2.scala @@ -0,0 +1,6 @@ +// t750 +object Test extends App { + val a = Array(1, 2, 3) + AO_1.f(a) + AO_1.f[Int](a) +} diff --git a/test/files/neg/t750b.check b/test/files/neg/t750b.check new file mode 100644 index 0000000000..72a249191e --- /dev/null +++ b/test/files/neg/t750b.check @@ -0,0 +1,15 @@ +Test.scala:4: error: type mismatch; + found : Array[Int] + required: Array[? with Object] +Note: Int >: ? with Object, but class Array is invariant in type T. +You may wish to investigate a wildcard type such as `_ >: ? with Object`. (SLS 3.2.10) + AO.f(a) + ^ +Test.scala:5: error: type mismatch; + found : Array[Int] + required: Array[Int] +Note: Int >: Int, but class Array is invariant in type T. +You may wish to investigate a wildcard type such as `_ >: Int`. (SLS 3.2.10) + AO.f[Int](a) + ^ +two errors found diff --git a/test/files/neg/t750b/AO.java b/test/files/neg/t750b/AO.java new file mode 100644 index 0000000000..060baf9a3c --- /dev/null +++ b/test/files/neg/t750b/AO.java @@ -0,0 +1,5 @@ +public class AO { + public static <T> void f(T[] ar0) { + System.out.println(ar0); + } +}
\ No newline at end of file diff --git a/test/files/neg/t750b/Test.scala b/test/files/neg/t750b/Test.scala new file mode 100644 index 0000000000..5f792a7be8 --- /dev/null +++ b/test/files/neg/t750b/Test.scala @@ -0,0 +1,6 @@ +// t750 +object Test extends App { + val a = Array(1, 2, 3) + AO.f(a) + AO.f[Int](a) +} diff --git a/test/files/neg/t800.check b/test/files/neg/t800.check index 44c316a95b..8ba95fddde 100644 --- a/test/files/neg/t800.check +++ b/test/files/neg/t800.check @@ -1,13 +1,16 @@ t800.scala:4: error: qualification is already defined as value qualification val qualification = false; ^ -t800.scala:8: error: method qualification is defined twice in t800.scala +t800.scala:8: error: method qualification is defined twice + conflicting symbols both originated in file 't800.scala' val qualification = false; ^ -t800.scala:12: error: value qualification is defined twice in t800.scala +t800.scala:12: error: value qualification is defined twice + conflicting symbols both originated in file 't800.scala' var qualification = false; ^ -t800.scala:16: error: method qualification is defined twice in t800.scala +t800.scala:16: error: method qualification is defined twice + conflicting symbols both originated in file 't800.scala' var qualification = false; ^ four errors found diff --git a/test/files/neg/t900.check b/test/files/neg/t900.check index 047094ad6e..4611ceba8c 100644 --- a/test/files/neg/t900.check +++ b/test/files/neg/t900.check @@ -2,8 +2,8 @@ t900.scala:4: error: type mismatch; found : Foo.this.x.type (with underlying type Foo.this.bar) required: AnyRef Note that implicit conversions are not applicable because they are ambiguous: - both method any2stringadd in object Predef of type (x: Any)scala.runtime.StringAdd - and method any2stringfmt in object Predef of type (x: Any)scala.runtime.StringFormat + both method any2stringfmt in object Predef of type (x: Any)scala.runtime.StringFormat + and method any2stringadd in object Predef of type (x: Any)scala.runtime.StringAdd are possible conversion functions from Foo.this.x.type to AnyRef def break(): x.type ^ diff --git a/test/files/neg/t963.check b/test/files/neg/t963.check new file mode 100644 index 0000000000..1f2d0687b3 --- /dev/null +++ b/test/files/neg/t963.check @@ -0,0 +1,12 @@ +t963.scala:14: error: stable identifier required, but Test.this.y3.x found. + val w3 : y3.x.type = y3.x + ^ +t963.scala:17: error: stable identifier required, but Test.this.y4.x found. + val w4 : y4.x.type = y4.x + ^ +t963.scala:10: error: type mismatch; + found : Object{def x: Integer} + required: AnyRef{val x: Integer} + val y2 : { val x : java.lang.Integer } = new { def x = new java.lang.Integer(r.nextInt) } + ^ +three errors found diff --git a/test/files/neg/t963.scala b/test/files/neg/t963.scala new file mode 100644 index 0000000000..0cc2034299 --- /dev/null +++ b/test/files/neg/t963.scala @@ -0,0 +1,18 @@ +import scala.util.Random + +// Only y1 (val/val) should actually compile. +object Test { + val r = new Random() + + val y1 : { val x : java.lang.Integer } = new { val x = new java.lang.Integer(r.nextInt) } + val w1 : y1.x.type = y1.x + + val y2 : { val x : java.lang.Integer } = new { def x = new java.lang.Integer(r.nextInt) } + val w2 : y2.x.type = y2.x + + val y3 : { def x : java.lang.Integer } = new { val x = new java.lang.Integer(r.nextInt) } + val w3 : y3.x.type = y3.x + + val y4 : { def x : java.lang.Integer } = new { def x = new java.lang.Integer(r.nextInt) } + val w4 : y4.x.type = y4.x +} diff --git a/test/files/pos/gen-traversable-methods.scala b/test/files/pos/gen-traversable-methods.scala new file mode 100644 index 0000000000..2604a09f11 --- /dev/null +++ b/test/files/pos/gen-traversable-methods.scala @@ -0,0 +1,20 @@ + + + +import collection._ + + + +object Test { + + def main(args: Array[String]) { + val gen: GenTraversable[Int] = List(1, 2, 3) + gen.head + gen.headOption + gen.tail + gen.last + gen.lastOption + gen.init + } + +} diff --git a/test/pending/pos/no-widen-locals.scala b/test/files/pos/no-widen-locals.scala index 013e63f0a2..013e63f0a2 100644 --- a/test/pending/pos/no-widen-locals.scala +++ b/test/files/pos/no-widen-locals.scala diff --git a/test/files/pos/t1279a.scala b/test/files/pos/t1279a.scala index 9212b583d4..18b1e53f46 100644 --- a/test/files/pos/t1279a.scala +++ b/test/files/pos/t1279a.scala @@ -1,40 +1,39 @@ -// see #13 -// providing the type parameter in the recursive call to all4Impl -// avoids the problem - - // covariant linked list -abstract class M -{ self => - - type T - final type selfType = M {type T <: self.T} - type actualSelfType >: self.type <: selfType - - def next: selfType +abstract class M { + self => + type T + final type selfType = M {type T <: self.T} + type actualSelfType >: self.type <: selfType - // I don't understand why this doesn't compile, but that's a separate matter - // error: method all2 cannot be accessed in M.this.selfType - // because its instance type => Stream[M{type T <: M.this.selfType#T}] - // contains a malformed type: M.this.selfType#T - // def all2: Stream[M {type T <: self.T}] = Stream.cons(self: actualSelfType, next.all2) + def next: selfType + // I don't understand why this doesn't compile, but that's a separate matter + // error: method all2 cannot be accessed in M.this.selfType + // because its instance type => Stream[M{type T <: M.this.selfType#T}] + // contains a malformed type: M.this.selfType#T + def all2: Stream[M {type T <: self.T}] = Stream.cons(self: actualSelfType, next.all2) - // compiles successfully - // def all3: Stream[M {type T <: self.T}] = all3Impl(self: actualSelfType) - // private def all3Impl(first: M {type T <: self.T}): Stream[M {type T <: self.T}] = Stream.cons(first, all3Impl(first.next)) + // compiles successfully + def all3: Stream[M {type T <: self.T}] = all3Impl(self: actualSelfType) + private def all3Impl(first: M {type T <: self.T}): Stream[M {type T <: self.T}] = Stream.cons(first, all3Impl(first.next)) - - - def all4: Stream[M {type T <: self.T}] = Unrelated.all4Impl[T](self: actualSelfType) + def all4: Stream[M {type T <: self.T}] = Unrelated.all4Impl[T](self: actualSelfType) } -object Unrelated -{ - // TODO!!! fix this bug for real, it compiles successfully, but weird types are inferred - // def all4Impl[U](first: M {type T <: U}): Stream[M {type T <: U}] = Stream.cons(first, all4Impl(first.next)) - -// compiles successfully - def all4Impl[U](first: M {type T <: U}): Stream[M {type T <: U}] = Stream.cons(first, all4Impl[U](first.next)) +// TODO!!! fix this bug for real, it compiles successfully, but weird types are inferred +object Unrelated { + // compiles successfully + def all4Impl[U](first: M {type T <: U}): Stream[M {type T <: U}] = Stream.cons(first, all4Impl[U](first.next)) + + // should compile successfully without the [U], but: + // def all4ImplFail[U](first: M {type T <: U}): Stream[M {type T <: U}] = Stream.cons(first, all4ImplFail(first.next)) + // + // test/files/pos/t1279a.scala:31: error: type mismatch; + // found : first.selfType + // (which expands to) M{type T <: first.T} + // required: M{type T <: Nothing} + // def all4ImplFail[U](first: M {type T <: U}): Stream[M {type T <: U}] = Stream.cons(first, all4ImplFail(first.next)) + // ^ + // one error found } diff --git a/test/pending/pos/t1357.scala b/test/files/pos/t1357.scala index 7bc6d45034..7bc6d45034 100644 --- a/test/pending/pos/t1357.scala +++ b/test/files/pos/t1357.scala diff --git a/test/files/pos/t1785.scala b/test/files/pos/t1785.scala new file mode 100644 index 0000000000..0b1fafb27c --- /dev/null +++ b/test/files/pos/t1785.scala @@ -0,0 +1,7 @@ +class t1785 { + def apply[T](x: Int) = 1 +} + +object test { + (new t1785)[Int](1) +} diff --git a/test/files/pos/t5198.scala b/test/files/pos/t5198.scala new file mode 100644 index 0000000000..f403f77f7d --- /dev/null +++ b/test/files/pos/t5198.scala @@ -0,0 +1,15 @@ +package gaga + + + + + +trait Sys[Self <: Sys[Self]] { + type Tx +} + + +sealed trait AssocEntry[S <: Sys[S], @specialized(Int) A] { + def value: A + def value(implicit tx: S#Tx): A +} diff --git a/test/files/pos/t5240.scala b/test/files/pos/t5240.scala new file mode 100644 index 0000000000..2db689c27d --- /dev/null +++ b/test/files/pos/t5240.scala @@ -0,0 +1,11 @@ + + + + + + +package object foo { + + var labels: Array[_ <: String] = null + +} diff --git a/test/files/pos/t5542.flags b/test/files/pos/t5542.flags new file mode 100644 index 0000000000..464cc20ea6 --- /dev/null +++ b/test/files/pos/t5542.flags @@ -0,0 +1 @@ +-Xfatal-warnings -unchecked
\ No newline at end of file diff --git a/test/files/pos/t5542.scala b/test/files/pos/t5542.scala new file mode 100644 index 0000000000..80b8cef030 --- /dev/null +++ b/test/files/pos/t5542.scala @@ -0,0 +1,3 @@ +class Test { + Option(3) match { case Some(n) => n; case None => 0 } +}
\ No newline at end of file diff --git a/test/files/pos/t5667.scala b/test/files/pos/t5667.scala new file mode 100644 index 0000000000..513de5b663 --- /dev/null +++ b/test/files/pos/t5667.scala @@ -0,0 +1,6 @@ +object Main { + implicit class C(val s: String) extends AnyVal + implicit class C2(val s: String) extends AnyRef + + implicit case class Foo(i: Int) +} diff --git a/test/files/pos/t5703/Base.java b/test/files/pos/t5703/Base.java new file mode 100644 index 0000000000..fa75cc3bdd --- /dev/null +++ b/test/files/pos/t5703/Base.java @@ -0,0 +1,3 @@ +public abstract class Base<Params> { + public abstract void func(Params[] params); +}
\ No newline at end of file diff --git a/test/files/pos/t5703/Impl.scala b/test/files/pos/t5703/Impl.scala new file mode 100644 index 0000000000..ee22d8fb4b --- /dev/null +++ b/test/files/pos/t5703/Impl.scala @@ -0,0 +1,3 @@ +class Implementation extends Base[Object] { + def func(params: Array[Object]): Unit = {} +}
\ No newline at end of file diff --git a/test/files/pos/t5720-ownerous.scala b/test/files/pos/t5720-ownerous.scala new file mode 100644 index 0000000000..3a12499612 --- /dev/null +++ b/test/files/pos/t5720-ownerous.scala @@ -0,0 +1,56 @@ + +/* + * The block under qual$1 must be owned by it. + * In the sample bug, the first default arg generates x$4, + * the second default arg generates qual$1, hence the maximal + * minimization. + * + <method> <triedcooking> def model: C.this.M = { + val qual$1: C.this.M = scala.Option.apply[C.this.M]({ + val x$1: lang.this.String("foo") = "foo"; + val x$2: String = C.this.M.apply$default$2("foo"); + C.this.M.apply("foo")(x$2) +}).getOrElse[C.this.M]({ + val x$3: lang.this.String("bar") = "bar"; + val x$4: String = C.this.M.apply$default$2("bar"); + C.this.M.apply("bar")(x$4) + }); + val x$5: lang.this.String("baz") = "baz"; + val x$6: String = qual$1.copy$default$2("baz"); + qual$1.copy("baz")(x$6) + } + */ +class C { + case class M(currentUser: String = "anon")(val message: String = "empty") + val m = M("foo")() + + // reported + //def model = Option(M("foo")()).getOrElse(M("bar")()).copy(currentUser = "")() + + // the bug + def model = Option(m).getOrElse(M("bar")()).copy("baz")() + + // style points for this version + def modish = ((null: Option[M]) getOrElse new M()()).copy()() + + // various simplifications are too simple + case class N(currentUser: String = "anon") + val n = N("fun") + def nudel = Option(n).getOrElse(N()).copy() +} + +object Test { + def main(args: Array[String]) { + val c = new C + println(c.model.currentUser) + println(c.model.message) + } +} +/* +symbol value x$4$1 does not exist in badcopy.C.model +at scala.reflect.internal.SymbolTable.abort(SymbolTable.scala:45) +at scala.tools.nsc.Global.abort(Global.scala:202) +at scala.tools.nsc.backend.icode.GenICode$ICodePhase.liftedTree2$1(GenICode.scala:998) +at scala.tools.nsc.backend.icode.GenICode$ICodePhase.scala$tools$nsc$backend$icode$GenICode$ICodePhase$$genLoad(GenICode.scala:992) +*/ + diff --git a/test/files/pos/t5727.scala b/test/files/pos/t5727.scala new file mode 100644 index 0000000000..e091d827b4 --- /dev/null +++ b/test/files/pos/t5727.scala @@ -0,0 +1,31 @@ + +/* + * We like operators, bar none. + */ +object Test { + + trait SomeInfo + case object NoInfo extends SomeInfo + + sealed abstract class Res[+T] + case object NotRes extends Res[Nothing] + + + abstract class Base[+T] { + def apply(f: String): Res[T] + // 'i' crashes the compiler, similarly if we use currying + //def |[U >: T](a: => Base[U], i: SomeInfo = NoInfo): Base[U] = null + def bar[U >: T](a: => Base[U], i: SomeInfo = NoInfo): Base[U] = null + } + + implicit def fromStringToBase(a: String): Base[String] = new Base[String] { def apply(in: String) = NotRes } + + // bug + //def Sample: Base[Any] = ( rep("foo" | "bar") | "sth") + def Sample: Base[Any] = ( rep("foo" bar "bar") bar "sth") + + def rep[T](p: => Base[T]): Base[T] = null // whatever + + def main(args: Array[String]) { + } +} diff --git a/test/files/pos/t5729.scala b/test/files/pos/t5729.scala new file mode 100644 index 0000000000..9fd9c9ffbb --- /dev/null +++ b/test/files/pos/t5729.scala @@ -0,0 +1,6 @@ +trait T[X] +object Test { + def join(in: Seq[T[_]]): Int = ??? + def join[S](in: Seq[T[S]]): String = ??? + join(null: Seq[T[_]]) +}
\ No newline at end of file diff --git a/test/files/pos/t5769.scala b/test/files/pos/t5769.scala new file mode 100644 index 0000000000..723d37bfee --- /dev/null +++ b/test/files/pos/t5769.scala @@ -0,0 +1,8 @@ +// a.scala + +class A { + type AI = Array[Int] + + def f1 = arrayTag[Array[Int]] + def f2 = arrayTag[AI] +}
\ No newline at end of file diff --git a/test/files/presentation/callcc-interpreter.check b/test/files/presentation/callcc-interpreter.check index c50e171b4e..68ac904b18 100644 --- a/test/files/presentation/callcc-interpreter.check +++ b/test/files/presentation/callcc-interpreter.check @@ -4,66 +4,66 @@ askTypeCompletion at CallccInterpreter.scala(51,38) ================================================================================ [response] aksTypeCompletion at (51,38) retrieved 64 members -`class AddcallccInterpreter.Add` -`class AppcallccInterpreter.App` -`class CcccallccInterpreter.Ccc` -`class ConcallccInterpreter.Con` -`class FuncallccInterpreter.Fun` -`class LamcallccInterpreter.Lam` -`class McallccInterpreter.M` -`class NumcallccInterpreter.Num` -`class VarcallccInterpreter.Var` -`method !=(x$1: Any)Boolean` -`method !=(x$1: AnyRef)Boolean` -`method ##()Int` -`method +(other: String)String` -`method ->[B](y: B)(callccInterpreter.type, B)` -`method ==(x$1: Any)Boolean` -`method ==(x$1: AnyRef)Boolean` -`method add(a: callccInterpreter.Value, b: callccInterpreter.Value)callccInterpreter.M[_ >: callccInterpreter.Num with callccInterpreter.Wrong.type <: Product with Serializable with callccInterpreter.Value]` -`method apply(a: callccInterpreter.Value, b: callccInterpreter.Value)callccInterpreter.M[callccInterpreter.Value]` -`method asInstanceOf[T0]=> T0` -`method callCC[A](h: (A => callccInterpreter.M[A]) => callccInterpreter.M[A])callccInterpreter.M[A]` -`method clone()Object` -`method ensuring(cond: Boolean)callccInterpreter.type` -`method ensuring(cond: Boolean, msg: => Any)callccInterpreter.type` -`method ensuring(cond: callccInterpreter.type => Boolean)callccInterpreter.type` -`method ensuring(cond: callccInterpreter.type => Boolean, msg: => Any)callccInterpreter.type` -`method eq(x$1: AnyRef)Boolean` -`method equals(x$1: Any)Boolean` -`method finalize()Unit` -`method formatted(fmtstr: String)String` -`method hashCode()Int` -`method id[A]=> A => A` -`method interp(t: callccInterpreter.Term, e: callccInterpreter.Environment)callccInterpreter.M[callccInterpreter.Value]` -`method isInstanceOf[T0]=> Boolean` -`method lookup(x: callccInterpreter.Name, e: callccInterpreter.Environment)callccInterpreter.M[callccInterpreter.Value]` -`method main(args: Array[String])Unit` -`method ne(x$1: AnyRef)Boolean` -`method notify()Unit` -`method notifyAll()Unit` -`method showM(m: callccInterpreter.M[callccInterpreter.Value])String` -`method synchronized[T0](x$1: T0)T0` -`method test(t: callccInterpreter.Term)String` -`method toString()String` -`method unitM[A](a: A)callccInterpreter.M[A]` -`method wait()Unit` -`method wait(x$1: Long)Unit` -`method wait(x$1: Long, x$2: Int)Unit` -`method x=> callccInterpreter.type` -`method →[B](y: B)(callccInterpreter.type, B)` -`object WrongcallccInterpreter.Wrong.type` -`trait TermcallccInterpreter.Term` -`trait ValuecallccInterpreter.Value` -`type AnswercallccInterpreter.Answer` -`type EnvironmentcallccInterpreter.Environment` -`type NamecallccInterpreter.Name` -`value __leftOfArrowcallccInterpreter.type` -`value __resultOfEnsuringcallccInterpreter.type` -`value selfAny` -`value term0callccInterpreter.App` -`value term1callccInterpreter.App` -`value term2callccInterpreter.Add` +[accessible: true] `class AddcallccInterpreter.Add` +[accessible: true] `class AppcallccInterpreter.App` +[accessible: true] `class CcccallccInterpreter.Ccc` +[accessible: true] `class ConcallccInterpreter.Con` +[accessible: true] `class FuncallccInterpreter.Fun` +[accessible: true] `class LamcallccInterpreter.Lam` +[accessible: true] `class McallccInterpreter.M` +[accessible: true] `class NumcallccInterpreter.Num` +[accessible: true] `class VarcallccInterpreter.Var` +[accessible: true] `method !=(x$1: Any)Boolean` +[accessible: true] `method !=(x$1: AnyRef)Boolean` +[accessible: true] `method ##()Int` +[accessible: true] `method +(other: String)String` +[accessible: true] `method ->[B](y: B)(callccInterpreter.type, B)` +[accessible: true] `method ==(x$1: Any)Boolean` +[accessible: true] `method ==(x$1: AnyRef)Boolean` +[accessible: true] `method add(a: callccInterpreter.Value, b: callccInterpreter.Value)callccInterpreter.M[_ >: callccInterpreter.Num with callccInterpreter.Wrong.type <: Product with Serializable with callccInterpreter.Value]` +[accessible: true] `method apply(a: callccInterpreter.Value, b: callccInterpreter.Value)callccInterpreter.M[callccInterpreter.Value]` +[accessible: true] `method asInstanceOf[T0]=> T0` +[accessible: true] `method callCC[A](h: (A => callccInterpreter.M[A]) => callccInterpreter.M[A])callccInterpreter.M[A]` +[accessible: true] `method clone()Object` +[accessible: true] `method ensuring(cond: Boolean)callccInterpreter.type` +[accessible: true] `method ensuring(cond: Boolean, msg: => Any)callccInterpreter.type` +[accessible: true] `method ensuring(cond: callccInterpreter.type => Boolean)callccInterpreter.type` +[accessible: true] `method ensuring(cond: callccInterpreter.type => Boolean, msg: => Any)callccInterpreter.type` +[accessible: true] `method eq(x$1: AnyRef)Boolean` +[accessible: true] `method equals(x$1: Any)Boolean` +[accessible: true] `method finalize()Unit` +[accessible: true] `method formatted(fmtstr: String)String` +[accessible: true] `method hashCode()Int` +[accessible: true] `method id[A]=> A => A` +[accessible: true] `method interp(t: callccInterpreter.Term, e: callccInterpreter.Environment)callccInterpreter.M[callccInterpreter.Value]` +[accessible: true] `method isInstanceOf[T0]=> Boolean` +[accessible: true] `method lookup(x: callccInterpreter.Name, e: callccInterpreter.Environment)callccInterpreter.M[callccInterpreter.Value]` +[accessible: true] `method main(args: Array[String])Unit` +[accessible: true] `method ne(x$1: AnyRef)Boolean` +[accessible: true] `method notify()Unit` +[accessible: true] `method notifyAll()Unit` +[accessible: true] `method showM(m: callccInterpreter.M[callccInterpreter.Value])String` +[accessible: true] `method synchronized[T0](x$1: T0)T0` +[accessible: true] `method test(t: callccInterpreter.Term)String` +[accessible: true] `method toString()String` +[accessible: true] `method unitM[A](a: A)callccInterpreter.M[A]` +[accessible: true] `method wait()Unit` +[accessible: true] `method wait(x$1: Long)Unit` +[accessible: true] `method wait(x$1: Long, x$2: Int)Unit` +[accessible: true] `method x=> callccInterpreter.type` +[accessible: true] `method →[B](y: B)(callccInterpreter.type, B)` +[accessible: true] `object WrongcallccInterpreter.Wrong.type` +[accessible: true] `trait TermcallccInterpreter.Term` +[accessible: true] `trait ValuecallccInterpreter.Value` +[accessible: true] `type AnswercallccInterpreter.Answer` +[accessible: true] `type EnvironmentcallccInterpreter.Environment` +[accessible: true] `type NamecallccInterpreter.Name` +[accessible: true] `value term0callccInterpreter.App` +[accessible: true] `value term1callccInterpreter.App` +[accessible: true] `value term2callccInterpreter.Add` +[accessible: false] `value __leftOfArrowcallccInterpreter.type` +[accessible: false] `value __resultOfEnsuringcallccInterpreter.type` +[accessible: false] `value selfAny` ================================================================================ askType at CallccInterpreter.scala(14,21) diff --git a/test/files/presentation/ide-bug-1000349.check b/test/files/presentation/ide-bug-1000349.check index 9c070ef24e..d643f82a25 100644 --- a/test/files/presentation/ide-bug-1000349.check +++ b/test/files/presentation/ide-bug-1000349.check @@ -4,37 +4,37 @@ askTypeCompletion at CompletionOnEmptyArgMethod.scala(2,17) ================================================================================ [response] aksTypeCompletion at (2,17) retrieved 37 members -`method !=(x$1: Any)Boolean` -`method !=(x$1: AnyRef)Boolean` -`method ##()Int` -`method +(other: String)String` -`method ->[B](y: B)(Foo, B)` -`method ==(x$1: Any)Boolean` -`method ==(x$1: AnyRef)Boolean` -`method asInstanceOf[T0]=> T0` -`method clone()Object` -`method ensuring(cond: Boolean)Foo` -`method ensuring(cond: Boolean, msg: => Any)Foo` -`method ensuring(cond: Foo => Boolean)Foo` -`method ensuring(cond: Foo => Boolean, msg: => Any)Foo` -`method eq(x$1: AnyRef)Boolean` -`method equals(x$1: Any)Boolean` -`method finalize()Unit` -`method foo=> Foo` -`method formatted(fmtstr: String)String` -`method hashCode()Int` -`method isInstanceOf[T0]=> Boolean` -`method ne(x$1: AnyRef)Boolean` -`method notify()Unit` -`method notifyAll()Unit` -`method synchronized[T0](x$1: T0)T0` -`method toString()String` -`method wait()Unit` -`method wait(x$1: Long)Unit` -`method wait(x$1: Long, x$2: Int)Unit` -`method x=> Foo` -`method →[B](y: B)(Foo, B)` -`value __leftOfArrowFoo` -`value __resultOfEnsuringFoo` -`value selfAny` -================================================================================
\ No newline at end of file +[accessible: true] `method !=(x$1: Any)Boolean` +[accessible: true] `method !=(x$1: AnyRef)Boolean` +[accessible: true] `method ##()Int` +[accessible: true] `method +(other: String)String` +[accessible: true] `method ->[B](y: B)(Foo, B)` +[accessible: true] `method ==(x$1: Any)Boolean` +[accessible: true] `method ==(x$1: AnyRef)Boolean` +[accessible: true] `method asInstanceOf[T0]=> T0` +[accessible: true] `method clone()Object` +[accessible: true] `method ensuring(cond: Boolean)Foo` +[accessible: true] `method ensuring(cond: Boolean, msg: => Any)Foo` +[accessible: true] `method ensuring(cond: Foo => Boolean)Foo` +[accessible: true] `method ensuring(cond: Foo => Boolean, msg: => Any)Foo` +[accessible: true] `method eq(x$1: AnyRef)Boolean` +[accessible: true] `method equals(x$1: Any)Boolean` +[accessible: true] `method finalize()Unit` +[accessible: true] `method foo=> Foo` +[accessible: true] `method formatted(fmtstr: String)String` +[accessible: true] `method hashCode()Int` +[accessible: true] `method isInstanceOf[T0]=> Boolean` +[accessible: true] `method ne(x$1: AnyRef)Boolean` +[accessible: true] `method notify()Unit` +[accessible: true] `method notifyAll()Unit` +[accessible: true] `method synchronized[T0](x$1: T0)T0` +[accessible: true] `method toString()String` +[accessible: true] `method wait()Unit` +[accessible: true] `method wait(x$1: Long)Unit` +[accessible: true] `method wait(x$1: Long, x$2: Int)Unit` +[accessible: true] `method x=> Foo` +[accessible: true] `method →[B](y: B)(Foo, B)` +[accessible: false] `value __leftOfArrowFoo` +[accessible: false] `value __resultOfEnsuringFoo` +[accessible: false] `value selfAny` +================================================================================ diff --git a/test/files/presentation/ide-bug-1000475.check b/test/files/presentation/ide-bug-1000475.check index 1718119385..2410ebf71d 100644 --- a/test/files/presentation/ide-bug-1000475.check +++ b/test/files/presentation/ide-bug-1000475.check @@ -4,112 +4,112 @@ askTypeCompletion at Foo.scala(3,7) ================================================================================ [response] aksTypeCompletion at (3,7) retrieved 36 members -`method !=(x$1: Any)Boolean` -`method !=(x$1: AnyRef)Boolean` -`method ##()Int` -`method +(other: String)String` -`method ->[B](y: B)(Object, B)` -`method ==(x$1: Any)Boolean` -`method ==(x$1: AnyRef)Boolean` -`method asInstanceOf[T0]=> T0` -`method clone()Object` -`method ensuring(cond: Boolean)Object` -`method ensuring(cond: Boolean, msg: => Any)Object` -`method ensuring(cond: Object => Boolean)Object` -`method ensuring(cond: Object => Boolean, msg: => Any)Object` -`method eq(x$1: AnyRef)Boolean` -`method equals(x$1: Any)Boolean` -`method finalize()Unit` -`method formatted(fmtstr: String)String` -`method hashCode()Int` -`method isInstanceOf[T0]=> Boolean` -`method ne(x$1: AnyRef)Boolean` -`method notify()Unit` -`method notifyAll()Unit` -`method synchronized[T0](x$1: T0)T0` -`method toString()String` -`method wait()Unit` -`method wait(x$1: Long)Unit` -`method wait(x$1: Long, x$2: Int)Unit` -`method x=> Object` -`method →[B](y: B)(Object, B)` -`value __leftOfArrowObject` -`value __resultOfEnsuringObject` -`value selfAny` +[accessible: true] `method !=(x$1: Any)Boolean` +[accessible: true] `method !=(x$1: AnyRef)Boolean` +[accessible: true] `method ##()Int` +[accessible: true] `method +(other: String)String` +[accessible: true] `method ->[B](y: B)(Object, B)` +[accessible: true] `method ==(x$1: Any)Boolean` +[accessible: true] `method ==(x$1: AnyRef)Boolean` +[accessible: true] `method asInstanceOf[T0]=> T0` +[accessible: true] `method ensuring(cond: Boolean)Object` +[accessible: true] `method ensuring(cond: Boolean, msg: => Any)Object` +[accessible: true] `method ensuring(cond: Object => Boolean)Object` +[accessible: true] `method ensuring(cond: Object => Boolean, msg: => Any)Object` +[accessible: true] `method eq(x$1: AnyRef)Boolean` +[accessible: true] `method equals(x$1: Any)Boolean` +[accessible: true] `method formatted(fmtstr: String)String` +[accessible: true] `method hashCode()Int` +[accessible: true] `method isInstanceOf[T0]=> Boolean` +[accessible: true] `method ne(x$1: AnyRef)Boolean` +[accessible: true] `method notify()Unit` +[accessible: true] `method notifyAll()Unit` +[accessible: true] `method synchronized[T0](x$1: T0)T0` +[accessible: true] `method toString()String` +[accessible: true] `method wait()Unit` +[accessible: true] `method wait(x$1: Long)Unit` +[accessible: true] `method wait(x$1: Long, x$2: Int)Unit` +[accessible: true] `method x=> Object` +[accessible: true] `method →[B](y: B)(Object, B)` +[accessible: false] `method clone()Object` +[accessible: false] `method finalize()Unit` +[accessible: false] `value __leftOfArrowObject` +[accessible: false] `value __resultOfEnsuringObject` +[accessible: false] `value selfAny` ================================================================================ askTypeCompletion at Foo.scala(6,10) ================================================================================ [response] aksTypeCompletion at (6,10) retrieved 36 members -`method !=(x$1: Any)Boolean` -`method !=(x$1: AnyRef)Boolean` -`method ##()Int` -`method +(other: String)String` -`method ->[B](y: B)(Object, B)` -`method ==(x$1: Any)Boolean` -`method ==(x$1: AnyRef)Boolean` -`method asInstanceOf[T0]=> T0` -`method clone()Object` -`method ensuring(cond: Boolean)Object` -`method ensuring(cond: Boolean, msg: => Any)Object` -`method ensuring(cond: Object => Boolean)Object` -`method ensuring(cond: Object => Boolean, msg: => Any)Object` -`method eq(x$1: AnyRef)Boolean` -`method equals(x$1: Any)Boolean` -`method finalize()Unit` -`method formatted(fmtstr: String)String` -`method hashCode()Int` -`method isInstanceOf[T0]=> Boolean` -`method ne(x$1: AnyRef)Boolean` -`method notify()Unit` -`method notifyAll()Unit` -`method synchronized[T0](x$1: T0)T0` -`method toString()String` -`method wait()Unit` -`method wait(x$1: Long)Unit` -`method wait(x$1: Long, x$2: Int)Unit` -`method x=> Object` -`method →[B](y: B)(Object, B)` -`value __leftOfArrowObject` -`value __resultOfEnsuringObject` -`value selfAny` +[accessible: true] `method !=(x$1: Any)Boolean` +[accessible: true] `method !=(x$1: AnyRef)Boolean` +[accessible: true] `method ##()Int` +[accessible: true] `method +(other: String)String` +[accessible: true] `method ->[B](y: B)(Object, B)` +[accessible: true] `method ==(x$1: Any)Boolean` +[accessible: true] `method ==(x$1: AnyRef)Boolean` +[accessible: true] `method asInstanceOf[T0]=> T0` +[accessible: true] `method ensuring(cond: Boolean)Object` +[accessible: true] `method ensuring(cond: Boolean, msg: => Any)Object` +[accessible: true] `method ensuring(cond: Object => Boolean)Object` +[accessible: true] `method ensuring(cond: Object => Boolean, msg: => Any)Object` +[accessible: true] `method eq(x$1: AnyRef)Boolean` +[accessible: true] `method equals(x$1: Any)Boolean` +[accessible: true] `method formatted(fmtstr: String)String` +[accessible: true] `method hashCode()Int` +[accessible: true] `method isInstanceOf[T0]=> Boolean` +[accessible: true] `method ne(x$1: AnyRef)Boolean` +[accessible: true] `method notify()Unit` +[accessible: true] `method notifyAll()Unit` +[accessible: true] `method synchronized[T0](x$1: T0)T0` +[accessible: true] `method toString()String` +[accessible: true] `method wait()Unit` +[accessible: true] `method wait(x$1: Long)Unit` +[accessible: true] `method wait(x$1: Long, x$2: Int)Unit` +[accessible: true] `method x=> Object` +[accessible: true] `method →[B](y: B)(Object, B)` +[accessible: false] `method clone()Object` +[accessible: false] `method finalize()Unit` +[accessible: false] `value __leftOfArrowObject` +[accessible: false] `value __resultOfEnsuringObject` +[accessible: false] `value selfAny` ================================================================================ askTypeCompletion at Foo.scala(7,7) ================================================================================ [response] aksTypeCompletion at (7,7) retrieved 36 members -`method !=(x$1: Any)Boolean` -`method !=(x$1: AnyRef)Boolean` -`method ##()Int` -`method +(other: String)String` -`method ->[B](y: B)(Object, B)` -`method ==(x$1: Any)Boolean` -`method ==(x$1: AnyRef)Boolean` -`method asInstanceOf[T0]=> T0` -`method clone()Object` -`method ensuring(cond: Boolean)Object` -`method ensuring(cond: Boolean, msg: => Any)Object` -`method ensuring(cond: Object => Boolean)Object` -`method ensuring(cond: Object => Boolean, msg: => Any)Object` -`method eq(x$1: AnyRef)Boolean` -`method equals(x$1: Any)Boolean` -`method finalize()Unit` -`method formatted(fmtstr: String)String` -`method hashCode()Int` -`method isInstanceOf[T0]=> Boolean` -`method ne(x$1: AnyRef)Boolean` -`method notify()Unit` -`method notifyAll()Unit` -`method synchronized[T0](x$1: T0)T0` -`method toString()String` -`method wait()Unit` -`method wait(x$1: Long)Unit` -`method wait(x$1: Long, x$2: Int)Unit` -`method x=> Object` -`method →[B](y: B)(Object, B)` -`value __leftOfArrowObject` -`value __resultOfEnsuringObject` -`value selfAny` +[accessible: true] `method !=(x$1: Any)Boolean` +[accessible: true] `method !=(x$1: AnyRef)Boolean` +[accessible: true] `method ##()Int` +[accessible: true] `method +(other: String)String` +[accessible: true] `method ->[B](y: B)(Object, B)` +[accessible: true] `method ==(x$1: Any)Boolean` +[accessible: true] `method ==(x$1: AnyRef)Boolean` +[accessible: true] `method asInstanceOf[T0]=> T0` +[accessible: true] `method ensuring(cond: Boolean)Object` +[accessible: true] `method ensuring(cond: Boolean, msg: => Any)Object` +[accessible: true] `method ensuring(cond: Object => Boolean)Object` +[accessible: true] `method ensuring(cond: Object => Boolean, msg: => Any)Object` +[accessible: true] `method eq(x$1: AnyRef)Boolean` +[accessible: true] `method equals(x$1: Any)Boolean` +[accessible: true] `method formatted(fmtstr: String)String` +[accessible: true] `method hashCode()Int` +[accessible: true] `method isInstanceOf[T0]=> Boolean` +[accessible: true] `method ne(x$1: AnyRef)Boolean` +[accessible: true] `method notify()Unit` +[accessible: true] `method notifyAll()Unit` +[accessible: true] `method synchronized[T0](x$1: T0)T0` +[accessible: true] `method toString()String` +[accessible: true] `method wait()Unit` +[accessible: true] `method wait(x$1: Long)Unit` +[accessible: true] `method wait(x$1: Long, x$2: Int)Unit` +[accessible: true] `method x=> Object` +[accessible: true] `method →[B](y: B)(Object, B)` +[accessible: false] `method clone()Object` +[accessible: false] `method finalize()Unit` +[accessible: false] `value __leftOfArrowObject` +[accessible: false] `value __resultOfEnsuringObject` +[accessible: false] `value selfAny` ================================================================================ diff --git a/test/files/presentation/ide-bug-1000531.check b/test/files/presentation/ide-bug-1000531.check index 2b48a80d38..2ae0158a13 100644 --- a/test/files/presentation/ide-bug-1000531.check +++ b/test/files/presentation/ide-bug-1000531.check @@ -3,124 +3,125 @@ reload: CrashOnLoad.scala askTypeCompletion at CrashOnLoad.scala(6,12) ================================================================================ [response] aksTypeCompletion at (6,12) -retrieved 123 members -`class GroupedIteratorIterator[B]#GroupedIterator` -`method !=(x$1: Any)Boolean` -`method !=(x$1: AnyRef)Boolean` -`method ##()Int` -`method +(other: String)String` -`method ++[B >: B](that: => scala.collection.GenTraversableOnce[B])Iterator[B]` -`method ->[B](y: B)(java.util.Iterator[B], B)` -`method /:[B](z: B)(op: (B, B) => B)B` -`method /:\[A1 >: B](z: A1)(op: (A1, A1) => A1)A1` -`method :\[B](z: B)(op: (B, B) => B)B` -`method ==(x$1: Any)Boolean` -`method ==(x$1: AnyRef)Boolean` -`method addString(b: StringBuilder)StringBuilder` -`method addString(b: StringBuilder, sep: String)StringBuilder` -`method addString(b: StringBuilder, start: String, sep: String, end: String)StringBuilder` -`method aggregate[B](z: B)(seqop: (B, B) => B, combop: (B, B) => B)B` -`method asInstanceOf[T0]=> T0` -`method buffered=> scala.collection.BufferedIterator[B]` -`method clone()Object` -`method collectFirst[B](pf: PartialFunction[B,B])Option[B]` -`method collect[B](pf: PartialFunction[B,B])Iterator[B]` -`method contains(elem: Any)Boolean` -`method copyToArray[B >: B](xs: Array[B])Unit` -`method copyToArray[B >: B](xs: Array[B], start: Int)Unit` -`method copyToArray[B >: B](xs: Array[B], start: Int, len: Int)Unit` -`method copyToBuffer[B >: B](dest: scala.collection.mutable.Buffer[B])Unit` -`method count(p: B => Boolean)Int` -`method drop(n: Int)Iterator[B]` -`method dropWhile(p: B => Boolean)Iterator[B]` -`method duplicate=> (Iterator[B], Iterator[B])` -`method ensuring(cond: Boolean)java.util.Iterator[B]` -`method ensuring(cond: Boolean, msg: => Any)java.util.Iterator[B]` -`method ensuring(cond: java.util.Iterator[B] => Boolean)java.util.Iterator[B]` -`method ensuring(cond: java.util.Iterator[B] => Boolean, msg: => Any)java.util.Iterator[B]` -`method eq(x$1: AnyRef)Boolean` -`method equals(x$1: Any)Boolean` -`method exists(p: B => Boolean)Boolean` -`method filter(p: B => Boolean)Iterator[B]` -`method filterNot(p: B => Boolean)Iterator[B]` -`method finalize()Unit` -`method find(p: B => Boolean)Option[B]` -`method flatMap[B](f: B => scala.collection.GenTraversableOnce[B])Iterator[B]` -`method foldLeft[B](z: B)(op: (B, B) => B)B` -`method foldRight[B](z: B)(op: (B, B) => B)B` -`method fold[A1 >: B](z: A1)(op: (A1, A1) => A1)A1` -`method forall(p: B => Boolean)Boolean` -`method foreach[U](f: B => U)Unit` -`method formatted(fmtstr: String)String` -`method grouped[B >: B](size: Int)Iterator[B]#GroupedIterator[B]` -`method hasDefiniteSize=> Boolean` -`method hasNext()Boolean` -`method hashCode()Int` -`method indexOf[B >: B](elem: B)Int` -`method indexWhere(p: B => Boolean)Int` -`method isEmpty=> Boolean` -`method isInstanceOf[T0]=> Boolean` -`method isTraversableAgain=> Boolean` -`method length=> Int` -`method map[B](f: B => B)Iterator[B]` -`method maxBy[B](f: B => B)(implicit cmp: Ordering[B])B` -`method max[B >: B](implicit cmp: Ordering[B])B` -`method minBy[B](f: B => B)(implicit cmp: Ordering[B])B` -`method min[B >: B](implicit cmp: Ordering[B])B` -`method mkString(sep: String)String` -`method mkString(start: String, sep: String, end: String)String` -`method mkString=> String` -`method ne(x$1: AnyRef)Boolean` -`method next()B` -`method nonEmpty=> Boolean` -`method notify()Unit` -`method notifyAll()Unit` -`method padTo[A1 >: B](len: Int, elem: A1)Iterator[A1]` -`method partition(p: B => Boolean)(Iterator[B], Iterator[B])` -`method patch[B >: B](from: Int, patchElems: Iterator[B], replaced: Int)Iterator[B]` -`method product[B >: B](implicit num: Numeric[B])B` -`method reduceLeftOption[B >: B](op: (B, B) => B)Option[B]` -`method reduceLeft[B >: B](op: (B, B) => B)B` -`method reduceOption[A1 >: B](op: (A1, A1) => A1)Option[A1]` -`method reduceRightOption[B >: B](op: (B, B) => B)Option[B]` -`method reduceRight[B >: B](op: (B, B) => B)B` -`method reduce[A1 >: B](op: (A1, A1) => A1)A1` -`method remove()Unit` -`method reversed=> List[B]` -`method sameElements(that: Iterator[_])Boolean` -`method scanLeft[B](z: B)(op: (B, B) => B)Iterator[B]` -`method scanRight[B](z: B)(op: (B, B) => B)Iterator[B]` -`method seq=> Iterator[B]` -`method size=> Int` -`method slice(from: Int, until: Int)Iterator[B]` -`method sliding[B >: B](size: Int, step: Int)Iterator[B]#GroupedIterator[B]` -`method span(p: B => Boolean)(Iterator[B], Iterator[B])` -`method sum[B >: B](implicit num: Numeric[B])B` -`method synchronized[T0](x$1: T0)T0` -`method take(n: Int)Iterator[B]` -`method takeWhile(p: B => Boolean)Iterator[B]` -`method toArray[B >: B](implicit evidence$1: ArrayTag[B])Array[B]` -`method toBuffer[B >: B]=> scala.collection.mutable.Buffer[B]` -`method toIndexedSeq=> scala.collection.immutable.IndexedSeq[B]` -`method toIterable=> Iterable[B]` -`method toIterator=> Iterator[B]` -`method toList=> List[B]` -`method toMap[T, U](implicit ev: <:<[B,(T, U)])scala.collection.immutable.Map[T,U]` -`method toSeq=> Seq[B]` -`method toSet[B >: B]=> scala.collection.immutable.Set[B]` -`method toStream=> scala.collection.immutable.Stream[B]` -`method toString()String` -`method toTraversable=> Traversable[B]` -`method wait()Unit` -`method wait(x$1: Long)Unit` -`method wait(x$1: Long, x$2: Int)Unit` -`method withFilter(p: B => Boolean)Iterator[B]` -`method x=> java.util.Iterator[B]` -`method zipAll[B, A1 >: B, B1 >: B](that: Iterator[B], thisElem: A1, thatElem: B1)Iterator[(A1, B1)]` -`method zipWithIndex=> Iterator[(B, Int)]` -`method zip[B](that: Iterator[B])Iterator[(B, B)]` -`method →[B](y: B)(java.util.Iterator[B], B)` -`value __leftOfArrowjava.util.Iterator[B]` -`value __resultOfEnsuringjava.util.Iterator[B]` -`value selfAny` +retrieved 124 members +[accessible: true] `class GroupedIteratorIterator[B]#GroupedIterator` +[accessible: true] `method !=(x$1: Any)Boolean` +[accessible: true] `method !=(x$1: AnyRef)Boolean` +[accessible: true] `method ##()Int` +[accessible: true] `method +(other: String)String` +[accessible: true] `method ++[B >: B](that: => scala.collection.GenTraversableOnce[B])Iterator[B]` +[accessible: true] `method ->[B](y: B)(java.util.Iterator[B], B)` +[accessible: true] `method /:[B](z: B)(op: (B, B) => B)B` +[accessible: true] `method /:\[A1 >: B](z: A1)(op: (A1, A1) => A1)A1` +[accessible: true] `method :\[B](z: B)(op: (B, B) => B)B` +[accessible: true] `method ==(x$1: Any)Boolean` +[accessible: true] `method ==(x$1: AnyRef)Boolean` +[accessible: true] `method addString(b: StringBuilder)StringBuilder` +[accessible: true] `method addString(b: StringBuilder, sep: String)StringBuilder` +[accessible: true] `method addString(b: StringBuilder, start: String, sep: String, end: String)StringBuilder` +[accessible: true] `method aggregate[B](z: B)(seqop: (B, B) => B, combop: (B, B) => B)B` +[accessible: true] `method asInstanceOf[T0]=> T0` +[accessible: true] `method buffered=> scala.collection.BufferedIterator[B]` +[accessible: true] `method collectFirst[B](pf: PartialFunction[B,B])Option[B]` +[accessible: true] `method collect[B](pf: PartialFunction[B,B])Iterator[B]` +[accessible: true] `method contains(elem: Any)Boolean` +[accessible: true] `method copyToArray[B >: B](xs: Array[B])Unit` +[accessible: true] `method copyToArray[B >: B](xs: Array[B], start: Int)Unit` +[accessible: true] `method copyToArray[B >: B](xs: Array[B], start: Int, len: Int)Unit` +[accessible: true] `method copyToBuffer[B >: B](dest: scala.collection.mutable.Buffer[B])Unit` +[accessible: true] `method corresponds[B](that: scala.collection.GenTraversableOnce[B])(p: (B, B) => Boolean)Boolean` +[accessible: true] `method count(p: B => Boolean)Int` +[accessible: true] `method drop(n: Int)Iterator[B]` +[accessible: true] `method dropWhile(p: B => Boolean)Iterator[B]` +[accessible: true] `method duplicate=> (Iterator[B], Iterator[B])` +[accessible: true] `method ensuring(cond: Boolean)java.util.Iterator[B]` +[accessible: true] `method ensuring(cond: Boolean, msg: => Any)java.util.Iterator[B]` +[accessible: true] `method ensuring(cond: java.util.Iterator[B] => Boolean)java.util.Iterator[B]` +[accessible: true] `method ensuring(cond: java.util.Iterator[B] => Boolean, msg: => Any)java.util.Iterator[B]` +[accessible: true] `method eq(x$1: AnyRef)Boolean` +[accessible: true] `method equals(x$1: Any)Boolean` +[accessible: true] `method exists(p: B => Boolean)Boolean` +[accessible: true] `method filter(p: B => Boolean)Iterator[B]` +[accessible: true] `method filterNot(p: B => Boolean)Iterator[B]` +[accessible: true] `method find(p: B => Boolean)Option[B]` +[accessible: true] `method flatMap[B](f: B => scala.collection.GenTraversableOnce[B])Iterator[B]` +[accessible: true] `method foldLeft[B](z: B)(op: (B, B) => B)B` +[accessible: true] `method foldRight[B](z: B)(op: (B, B) => B)B` +[accessible: true] `method fold[A1 >: B](z: A1)(op: (A1, A1) => A1)A1` +[accessible: true] `method forall(p: B => Boolean)Boolean` +[accessible: true] `method foreach[U](f: B => U)Unit` +[accessible: true] `method formatted(fmtstr: String)String` +[accessible: true] `method grouped[B >: B](size: Int)Iterator[B]#GroupedIterator[B]` +[accessible: true] `method hasDefiniteSize=> Boolean` +[accessible: true] `method hasNext()Boolean` +[accessible: true] `method hashCode()Int` +[accessible: true] `method indexOf[B >: B](elem: B)Int` +[accessible: true] `method indexWhere(p: B => Boolean)Int` +[accessible: true] `method isEmpty=> Boolean` +[accessible: true] `method isInstanceOf[T0]=> Boolean` +[accessible: true] `method isTraversableAgain=> Boolean` +[accessible: true] `method length=> Int` +[accessible: true] `method map[B](f: B => B)Iterator[B]` +[accessible: true] `method maxBy[B](f: B => B)(implicit cmp: Ordering[B])B` +[accessible: true] `method max[B >: B](implicit cmp: Ordering[B])B` +[accessible: true] `method minBy[B](f: B => B)(implicit cmp: Ordering[B])B` +[accessible: true] `method min[B >: B](implicit cmp: Ordering[B])B` +[accessible: true] `method mkString(sep: String)String` +[accessible: true] `method mkString(start: String, sep: String, end: String)String` +[accessible: true] `method mkString=> String` +[accessible: true] `method ne(x$1: AnyRef)Boolean` +[accessible: true] `method next()B` +[accessible: true] `method nonEmpty=> Boolean` +[accessible: true] `method notify()Unit` +[accessible: true] `method notifyAll()Unit` +[accessible: true] `method padTo[A1 >: B](len: Int, elem: A1)Iterator[A1]` +[accessible: true] `method partition(p: B => Boolean)(Iterator[B], Iterator[B])` +[accessible: true] `method patch[B >: B](from: Int, patchElems: Iterator[B], replaced: Int)Iterator[B]` +[accessible: true] `method product[B >: B](implicit num: Numeric[B])B` +[accessible: true] `method reduceLeftOption[B >: B](op: (B, B) => B)Option[B]` +[accessible: true] `method reduceLeft[B >: B](op: (B, B) => B)B` +[accessible: true] `method reduceOption[A1 >: B](op: (A1, A1) => A1)Option[A1]` +[accessible: true] `method reduceRightOption[B >: B](op: (B, B) => B)Option[B]` +[accessible: true] `method reduceRight[B >: B](op: (B, B) => B)B` +[accessible: true] `method reduce[A1 >: B](op: (A1, A1) => A1)A1` +[accessible: true] `method remove()Unit` +[accessible: true] `method sameElements(that: Iterator[_])Boolean` +[accessible: true] `method scanLeft[B](z: B)(op: (B, B) => B)Iterator[B]` +[accessible: true] `method scanRight[B](z: B)(op: (B, B) => B)Iterator[B]` +[accessible: true] `method seq=> Iterator[B]` +[accessible: true] `method size=> Int` +[accessible: true] `method slice(from: Int, until: Int)Iterator[B]` +[accessible: true] `method sliding[B >: B](size: Int, step: Int)Iterator[B]#GroupedIterator[B]` +[accessible: true] `method span(p: B => Boolean)(Iterator[B], Iterator[B])` +[accessible: true] `method sum[B >: B](implicit num: Numeric[B])B` +[accessible: true] `method synchronized[T0](x$1: T0)T0` +[accessible: true] `method take(n: Int)Iterator[B]` +[accessible: true] `method takeWhile(p: B => Boolean)Iterator[B]` +[accessible: true] `method toArray[B >: B](implicit evidence$1: ArrayTag[B])Array[B]` +[accessible: true] `method toBuffer[B >: B]=> scala.collection.mutable.Buffer[B]` +[accessible: true] `method toIndexedSeq=> scala.collection.immutable.IndexedSeq[B]` +[accessible: true] `method toIterable=> Iterable[B]` +[accessible: true] `method toIterator=> Iterator[B]` +[accessible: true] `method toList=> List[B]` +[accessible: true] `method toMap[T, U](implicit ev: <:<[B,(T, U)])scala.collection.immutable.Map[T,U]` +[accessible: true] `method toSeq=> Seq[B]` +[accessible: true] `method toSet[B >: B]=> scala.collection.immutable.Set[B]` +[accessible: true] `method toStream=> scala.collection.immutable.Stream[B]` +[accessible: true] `method toString()String` +[accessible: true] `method toTraversable=> Traversable[B]` +[accessible: true] `method wait()Unit` +[accessible: true] `method wait(x$1: Long)Unit` +[accessible: true] `method wait(x$1: Long, x$2: Int)Unit` +[accessible: true] `method withFilter(p: B => Boolean)Iterator[B]` +[accessible: true] `method x=> java.util.Iterator[B]` +[accessible: true] `method zipAll[B, A1 >: B, B1 >: B](that: Iterator[B], thisElem: A1, thatElem: B1)Iterator[(A1, B1)]` +[accessible: true] `method zipWithIndex=> Iterator[(B, Int)]` +[accessible: true] `method zip[B](that: Iterator[B])Iterator[(B, B)]` +[accessible: true] `method →[B](y: B)(java.util.Iterator[B], B)` +[accessible: false] `method clone()Object` +[accessible: false] `method finalize()Unit` +[accessible: false] `method reversed=> List[B]` +[accessible: false] `value __leftOfArrowjava.util.Iterator[B]` +[accessible: false] `value __resultOfEnsuringjava.util.Iterator[B]` +[accessible: false] `value selfAny` ================================================================================ diff --git a/test/files/presentation/implicit-member.check b/test/files/presentation/implicit-member.check index e8e656f12a..ce21293ae5 100644 --- a/test/files/presentation/implicit-member.check +++ b/test/files/presentation/implicit-member.check @@ -4,39 +4,39 @@ askTypeCompletion at ImplicitMember.scala(7,7) ================================================================================ [response] aksTypeCompletion at (7,7) retrieved 39 members -`class AppliedImplicitImplicit.AppliedImplicit` -`method !=(x$1: Any)Boolean` -`method !=(x$1: AnyRef)Boolean` -`method ##()Int` -`method +(other: String)String` -`method ->[B](y: B)(Implicit.type, B)` -`method ==(x$1: Any)Boolean` -`method ==(x$1: AnyRef)Boolean` -`method AppliedImplicit[A](x: A)Implicit.AppliedImplicit[A]` -`method asInstanceOf[T0]=> T0` -`method clone()Object` -`method ensuring(cond: Boolean)Implicit.type` -`method ensuring(cond: Boolean, msg: => Any)Implicit.type` -`method ensuring(cond: Implicit.type => Boolean)Implicit.type` -`method ensuring(cond: Implicit.type => Boolean, msg: => Any)Implicit.type` -`method eq(x$1: AnyRef)Boolean` -`method equals(x$1: Any)Boolean` -`method finalize()Unit` -`method formatted(fmtstr: String)String` -`method hashCode()Int` -`method isInstanceOf[T0]=> Boolean` -`method ne(x$1: AnyRef)Boolean` -`method notify()Unit` -`method notifyAll()Unit` -`method synchronized[T0](x$1: T0)T0` -`method toString()String` -`method wait()Unit` -`method wait(x$1: Long)Unit` -`method wait(x$1: Long, x$2: Int)Unit` -`method x=> Implicit.type` -`method →[B](y: B)(Implicit.type, B)` -`value __leftOfArrowImplicit.type` -`value __resultOfEnsuringImplicit.type` -`value selfAny` -`value xImplicit.type` +[accessible: true] `class AppliedImplicitImplicit.AppliedImplicit` +[accessible: true] `method !=(x$1: Any)Boolean` +[accessible: true] `method !=(x$1: AnyRef)Boolean` +[accessible: true] `method ##()Int` +[accessible: true] `method +(other: String)String` +[accessible: true] `method ->[B](y: B)(Implicit.type, B)` +[accessible: true] `method ==(x$1: Any)Boolean` +[accessible: true] `method ==(x$1: AnyRef)Boolean` +[accessible: true] `method AppliedImplicit[A](x: A)Implicit.AppliedImplicit[A]` +[accessible: true] `method asInstanceOf[T0]=> T0` +[accessible: true] `method clone()Object` +[accessible: true] `method ensuring(cond: Boolean)Implicit.type` +[accessible: true] `method ensuring(cond: Boolean, msg: => Any)Implicit.type` +[accessible: true] `method ensuring(cond: Implicit.type => Boolean)Implicit.type` +[accessible: true] `method ensuring(cond: Implicit.type => Boolean, msg: => Any)Implicit.type` +[accessible: true] `method eq(x$1: AnyRef)Boolean` +[accessible: true] `method equals(x$1: Any)Boolean` +[accessible: true] `method finalize()Unit` +[accessible: true] `method formatted(fmtstr: String)String` +[accessible: true] `method hashCode()Int` +[accessible: true] `method isInstanceOf[T0]=> Boolean` +[accessible: true] `method ne(x$1: AnyRef)Boolean` +[accessible: true] `method notify()Unit` +[accessible: true] `method notifyAll()Unit` +[accessible: true] `method synchronized[T0](x$1: T0)T0` +[accessible: true] `method toString()String` +[accessible: true] `method wait()Unit` +[accessible: true] `method wait(x$1: Long)Unit` +[accessible: true] `method wait(x$1: Long, x$2: Int)Unit` +[accessible: true] `method x=> Implicit.type` +[accessible: true] `method →[B](y: B)(Implicit.type, B)` +[accessible: false] `value __leftOfArrowImplicit.type` +[accessible: false] `value __resultOfEnsuringImplicit.type` +[accessible: false] `value selfAny` +[accessible: false] `value xImplicit.type` ================================================================================ diff --git a/test/files/presentation/patmat.flags b/test/files/presentation/patmat.flags index 468b48c9e3..dc13682c5e 100644 --- a/test/files/presentation/patmat.flags +++ b/test/files/presentation/patmat.flags @@ -1,3 +1,2 @@ # This test will fail in the new pattern matcher because # it generates trees whose positions are not transparent --Xoldpatmat diff --git a/test/files/presentation/ping-pong.check b/test/files/presentation/ping-pong.check index 38040bdacf..1f02274736 100644 --- a/test/files/presentation/ping-pong.check +++ b/test/files/presentation/ping-pong.check @@ -4,83 +4,83 @@ askTypeCompletion at PingPong.scala(10,23) ================================================================================ [response] aksTypeCompletion at (10,23) retrieved 40 members -`method !=(x$1: Any)Boolean` -`method !=(x$1: AnyRef)Boolean` -`method ##()Int` -`method +(other: String)String` -`method ->[B](y: B)(Pong, B)` -`method ==(x$1: Any)Boolean` -`method ==(x$1: AnyRef)Boolean` -`method asInstanceOf[T0]=> T0` -`method clone()Object` -`method ensuring(cond: Boolean)Pong` -`method ensuring(cond: Boolean, msg: => Any)Pong` -`method ensuring(cond: Pong => Boolean)Pong` -`method ensuring(cond: Pong => Boolean, msg: => Any)Pong` -`method eq(x$1: AnyRef)Boolean` -`method equals(x$1: Any)Boolean` -`method finalize()Unit` -`method formatted(fmtstr: String)String` -`method hashCode()Int` -`method isInstanceOf[T0]=> Boolean` -`method ne(x$1: AnyRef)Boolean` -`method notify()Unit` -`method notifyAll()Unit` -`method poke()Unit` -`method synchronized[T0](x$1: T0)T0` -`method toString()String` -`method wait()Unit` -`method wait(x$1: Long)Unit` -`method wait(x$1: Long, x$2: Int)Unit` -`method x=> Pong` -`method →[B](y: B)(Pong, B)` -`value __leftOfArrowPong` -`value __resultOfEnsuringPong` -`value nameString` -`value pingPing` -`value selfAny` +[accessible: true] `method !=(x$1: Any)Boolean` +[accessible: true] `method !=(x$1: AnyRef)Boolean` +[accessible: true] `method ##()Int` +[accessible: true] `method +(other: String)String` +[accessible: true] `method ->[B](y: B)(Pong, B)` +[accessible: true] `method ==(x$1: Any)Boolean` +[accessible: true] `method ==(x$1: AnyRef)Boolean` +[accessible: true] `method asInstanceOf[T0]=> T0` +[accessible: true] `method ensuring(cond: Boolean)Pong` +[accessible: true] `method ensuring(cond: Boolean, msg: => Any)Pong` +[accessible: true] `method ensuring(cond: Pong => Boolean)Pong` +[accessible: true] `method ensuring(cond: Pong => Boolean, msg: => Any)Pong` +[accessible: true] `method eq(x$1: AnyRef)Boolean` +[accessible: true] `method equals(x$1: Any)Boolean` +[accessible: true] `method formatted(fmtstr: String)String` +[accessible: true] `method hashCode()Int` +[accessible: true] `method isInstanceOf[T0]=> Boolean` +[accessible: true] `method ne(x$1: AnyRef)Boolean` +[accessible: true] `method notify()Unit` +[accessible: true] `method notifyAll()Unit` +[accessible: true] `method poke()Unit` +[accessible: true] `method synchronized[T0](x$1: T0)T0` +[accessible: true] `method toString()String` +[accessible: true] `method wait()Unit` +[accessible: true] `method wait(x$1: Long)Unit` +[accessible: true] `method wait(x$1: Long, x$2: Int)Unit` +[accessible: true] `method x=> Pong` +[accessible: true] `method →[B](y: B)(Pong, B)` +[accessible: false] `method clone()Object` +[accessible: false] `method finalize()Unit` +[accessible: false] `value __leftOfArrowPong` +[accessible: false] `value __resultOfEnsuringPong` +[accessible: false] `value nameString` +[accessible: false] `value pingPing` +[accessible: false] `value selfAny` ================================================================================ askTypeCompletion at PingPong.scala(19,20) ================================================================================ [response] aksTypeCompletion at (19,20) retrieved 40 members -`method !=(x$1: Any)Boolean` -`method !=(x$1: AnyRef)Boolean` -`method ##()Int` -`method +(other: String)String` -`method ->[B](y: B)(Ping, B)` -`method ==(x$1: Any)Boolean` -`method ==(x$1: AnyRef)Boolean` -`method asInstanceOf[T0]=> T0` -`method clone()Object` -`method ensuring(cond: Boolean)Ping` -`method ensuring(cond: Boolean, msg: => Any)Ping` -`method ensuring(cond: Ping => Boolean)Ping` -`method ensuring(cond: Ping => Boolean, msg: => Any)Ping` -`method eq(x$1: AnyRef)Boolean` -`method equals(x$1: Any)Boolean` -`method finalize()Unit` -`method formatted(fmtstr: String)String` -`method hashCode()Int` -`method isInstanceOf[T0]=> Boolean` -`method loop=> Unit` -`method name=> String` -`method ne(x$1: AnyRef)Boolean` -`method notify()Unit` -`method notifyAll()Unit` -`method poke=> Unit` -`method synchronized[T0](x$1: T0)T0` -`method toString()String` -`method wait()Unit` -`method wait(x$1: Long)Unit` -`method wait(x$1: Long, x$2: Int)Unit` -`method x=> Ping` -`method →[B](y: B)(Ping, B)` -`value __leftOfArrowPing` -`value __resultOfEnsuringPing` -`value pongPong` -`value selfAny` +[accessible: true] `method !=(x$1: Any)Boolean` +[accessible: true] `method !=(x$1: AnyRef)Boolean` +[accessible: true] `method ##()Int` +[accessible: true] `method +(other: String)String` +[accessible: true] `method ->[B](y: B)(Ping, B)` +[accessible: true] `method ==(x$1: Any)Boolean` +[accessible: true] `method ==(x$1: AnyRef)Boolean` +[accessible: true] `method asInstanceOf[T0]=> T0` +[accessible: true] `method ensuring(cond: Boolean)Ping` +[accessible: true] `method ensuring(cond: Boolean, msg: => Any)Ping` +[accessible: true] `method ensuring(cond: Ping => Boolean)Ping` +[accessible: true] `method ensuring(cond: Ping => Boolean, msg: => Any)Ping` +[accessible: true] `method eq(x$1: AnyRef)Boolean` +[accessible: true] `method equals(x$1: Any)Boolean` +[accessible: true] `method formatted(fmtstr: String)String` +[accessible: true] `method hashCode()Int` +[accessible: true] `method isInstanceOf[T0]=> Boolean` +[accessible: true] `method loop=> Unit` +[accessible: true] `method name=> String` +[accessible: true] `method ne(x$1: AnyRef)Boolean` +[accessible: true] `method notify()Unit` +[accessible: true] `method notifyAll()Unit` +[accessible: true] `method poke=> Unit` +[accessible: true] `method synchronized[T0](x$1: T0)T0` +[accessible: true] `method toString()String` +[accessible: true] `method wait()Unit` +[accessible: true] `method wait(x$1: Long)Unit` +[accessible: true] `method wait(x$1: Long, x$2: Int)Unit` +[accessible: true] `method x=> Ping` +[accessible: true] `method →[B](y: B)(Ping, B)` +[accessible: false] `method clone()Object` +[accessible: false] `method finalize()Unit` +[accessible: false] `value __leftOfArrowPing` +[accessible: false] `value __resultOfEnsuringPing` +[accessible: false] `value pongPong` +[accessible: false] `value selfAny` ================================================================================ askType at PingPong.scala(8,10) diff --git a/test/files/presentation/visibility.check b/test/files/presentation/visibility.check new file mode 100644 index 0000000000..290a5ac381 --- /dev/null +++ b/test/files/presentation/visibility.check @@ -0,0 +1,221 @@ +reload: Completions.scala + +askTypeCompletion at Completions.scala(14,12) +================================================================================ +[response] aksTypeCompletion at (14,12) +retrieved 42 members +[accessible: true] `method !=(x$1: Any)Boolean` +[accessible: true] `method !=(x$1: AnyRef)Boolean` +[accessible: true] `method ##()Int` +[accessible: true] `method +(other: String)String` +[accessible: true] `method ->[B](y: B)(accessibility.Foo, B)` +[accessible: true] `method ==(x$1: Any)Boolean` +[accessible: true] `method ==(x$1: AnyRef)Boolean` +[accessible: true] `method asInstanceOf[T0]=> T0` +[accessible: true] `method clone()Object` +[accessible: true] `method ensuring(cond: Boolean)accessibility.Foo` +[accessible: true] `method ensuring(cond: Boolean, msg: => Any)accessibility.Foo` +[accessible: true] `method ensuring(cond: accessibility.Foo => Boolean)accessibility.Foo` +[accessible: true] `method ensuring(cond: accessibility.Foo => Boolean, msg: => Any)accessibility.Foo` +[accessible: true] `method eq(x$1: AnyRef)Boolean` +[accessible: true] `method equals(x$1: Any)Boolean` +[accessible: true] `method finalize()Unit` +[accessible: true] `method formatted(fmtstr: String)String` +[accessible: true] `method hashCode()Int` +[accessible: true] `method isInstanceOf[T0]=> Boolean` +[accessible: true] `method ne(x$1: AnyRef)Boolean` +[accessible: true] `method notify()Unit` +[accessible: true] `method notifyAll()Unit` +[accessible: true] `method secretPrivate()Unit` +[accessible: true] `method secretProtected()Unit` +[accessible: true] `method secretProtectedInPackage()Unit` +[accessible: true] `method secretPublic()Unit` +[accessible: true] `method someTests(other: accessibility.Foo)Unit` +[accessible: true] `method synchronized[T0](x$1: T0)T0` +[accessible: true] `method toString()String` +[accessible: true] `method wait()Unit` +[accessible: true] `method wait(x$1: Long)Unit` +[accessible: true] `method wait(x$1: Long, x$2: Int)Unit` +[accessible: true] `method x=> accessibility.Foo` +[accessible: true] `method →[B](y: B)(accessibility.Foo, B)` +[accessible: false] `method secretPrivateThis()Unit` +[accessible: false] `value __leftOfArrowaccessibility.Foo` +[accessible: false] `value __resultOfEnsuringaccessibility.Foo` +[accessible: false] `value selfAny` +================================================================================ + +askTypeCompletion at Completions.scala(16,11) +================================================================================ +[response] aksTypeCompletion at (16,11) +retrieved 42 members +[accessible: true] `method !=(x$1: Any)Boolean` +[accessible: true] `method !=(x$1: AnyRef)Boolean` +[accessible: true] `method ##()Int` +[accessible: true] `method +(other: String)String` +[accessible: true] `method ->[B](y: B)(accessibility.Foo, B)` +[accessible: true] `method ==(x$1: Any)Boolean` +[accessible: true] `method ==(x$1: AnyRef)Boolean` +[accessible: true] `method asInstanceOf[T0]=> T0` +[accessible: true] `method clone()Object` +[accessible: true] `method ensuring(cond: Boolean)accessibility.Foo` +[accessible: true] `method ensuring(cond: Boolean, msg: => Any)accessibility.Foo` +[accessible: true] `method ensuring(cond: accessibility.Foo => Boolean)accessibility.Foo` +[accessible: true] `method ensuring(cond: accessibility.Foo => Boolean, msg: => Any)accessibility.Foo` +[accessible: true] `method eq(x$1: AnyRef)Boolean` +[accessible: true] `method equals(x$1: Any)Boolean` +[accessible: true] `method finalize()Unit` +[accessible: true] `method formatted(fmtstr: String)String` +[accessible: true] `method hashCode()Int` +[accessible: true] `method isInstanceOf[T0]=> Boolean` +[accessible: true] `method ne(x$1: AnyRef)Boolean` +[accessible: true] `method notify()Unit` +[accessible: true] `method notifyAll()Unit` +[accessible: true] `method secretPrivate()Unit` +[accessible: true] `method secretPrivateThis()Unit` +[accessible: true] `method secretProtected()Unit` +[accessible: true] `method secretProtectedInPackage()Unit` +[accessible: true] `method secretPublic()Unit` +[accessible: true] `method someTests(other: accessibility.Foo)Unit` +[accessible: true] `method synchronized[T0](x$1: T0)T0` +[accessible: true] `method toString()String` +[accessible: true] `method wait()Unit` +[accessible: true] `method wait(x$1: Long)Unit` +[accessible: true] `method wait(x$1: Long, x$2: Int)Unit` +[accessible: true] `method x=> accessibility.Foo` +[accessible: true] `method →[B](y: B)(accessibility.Foo, B)` +[accessible: false] `value __leftOfArrowaccessibility.Foo` +[accessible: false] `value __resultOfEnsuringaccessibility.Foo` +[accessible: false] `value selfAny` +================================================================================ + +askTypeCompletion at Completions.scala(22,11) +================================================================================ +[response] aksTypeCompletion at (22,11) +retrieved 42 members +[accessible: true] `method !=(x$1: Any)Boolean` +[accessible: true] `method !=(x$1: AnyRef)Boolean` +[accessible: true] `method ##()Int` +[accessible: true] `method +(other: String)String` +[accessible: true] `method ->[B](y: B)(accessibility.AccessibilityChecks, B)` +[accessible: true] `method ==(x$1: Any)Boolean` +[accessible: true] `method ==(x$1: AnyRef)Boolean` +[accessible: true] `method asInstanceOf[T0]=> T0` +[accessible: true] `method clone()Object` +[accessible: true] `method ensuring(cond: Boolean)accessibility.AccessibilityChecks` +[accessible: true] `method ensuring(cond: Boolean, msg: => Any)accessibility.AccessibilityChecks` +[accessible: true] `method ensuring(cond: accessibility.AccessibilityChecks => Boolean)accessibility.AccessibilityChecks` +[accessible: true] `method ensuring(cond: accessibility.AccessibilityChecks => Boolean, msg: => Any)accessibility.AccessibilityChecks` +[accessible: true] `method eq(x$1: AnyRef)Boolean` +[accessible: true] `method equals(x$1: Any)Boolean` +[accessible: true] `method finalize()Unit` +[accessible: true] `method formatted(fmtstr: String)String` +[accessible: true] `method hashCode()Int` +[accessible: true] `method isInstanceOf[T0]=> Boolean` +[accessible: true] `method ne(x$1: AnyRef)Boolean` +[accessible: true] `method notify()Unit` +[accessible: true] `method notifyAll()Unit` +[accessible: true] `method secretProtected()Unit` +[accessible: true] `method secretProtectedInPackage()Unit` +[accessible: true] `method secretPublic()Unit` +[accessible: true] `method someTests(other: accessibility.Foo)Unit` +[accessible: true] `method someTests=> Unit` +[accessible: true] `method synchronized[T0](x$1: T0)T0` +[accessible: true] `method toString()String` +[accessible: true] `method wait()Unit` +[accessible: true] `method wait(x$1: Long)Unit` +[accessible: true] `method wait(x$1: Long, x$2: Int)Unit` +[accessible: true] `method x=> accessibility.AccessibilityChecks` +[accessible: true] `method →[B](y: B)(accessibility.AccessibilityChecks, B)` +[accessible: false] `method secretPrivate()Unit` +[accessible: false] `value __leftOfArrowaccessibility.AccessibilityChecks` +[accessible: false] `value __resultOfEnsuringaccessibility.AccessibilityChecks` +[accessible: false] `value selfAny` +================================================================================ + +askTypeCompletion at Completions.scala(28,10) +================================================================================ +[response] aksTypeCompletion at (28,10) +retrieved 42 members +[accessible: true] `method !=(x$1: Any)Boolean` +[accessible: true] `method !=(x$1: AnyRef)Boolean` +[accessible: true] `method ##()Int` +[accessible: true] `method +(other: String)String` +[accessible: true] `method ->[B](y: B)(accessibility.Foo, B)` +[accessible: true] `method ==(x$1: Any)Boolean` +[accessible: true] `method ==(x$1: AnyRef)Boolean` +[accessible: true] `method asInstanceOf[T0]=> T0` +[accessible: true] `method ensuring(cond: Boolean)accessibility.Foo` +[accessible: true] `method ensuring(cond: Boolean, msg: => Any)accessibility.Foo` +[accessible: true] `method ensuring(cond: accessibility.Foo => Boolean)accessibility.Foo` +[accessible: true] `method ensuring(cond: accessibility.Foo => Boolean, msg: => Any)accessibility.Foo` +[accessible: true] `method eq(x$1: AnyRef)Boolean` +[accessible: true] `method equals(x$1: Any)Boolean` +[accessible: true] `method formatted(fmtstr: String)String` +[accessible: true] `method hashCode()Int` +[accessible: true] `method isInstanceOf[T0]=> Boolean` +[accessible: true] `method ne(x$1: AnyRef)Boolean` +[accessible: true] `method notify()Unit` +[accessible: true] `method notifyAll()Unit` +[accessible: true] `method secretProtectedInPackage()Unit` +[accessible: true] `method secretPublic()Unit` +[accessible: true] `method someTests(other: accessibility.Foo)Unit` +[accessible: true] `method synchronized[T0](x$1: T0)T0` +[accessible: true] `method toString()String` +[accessible: true] `method wait()Unit` +[accessible: true] `method wait(x$1: Long)Unit` +[accessible: true] `method wait(x$1: Long, x$2: Int)Unit` +[accessible: true] `method x=> accessibility.Foo` +[accessible: true] `method →[B](y: B)(accessibility.Foo, B)` +[accessible: false] `method clone()Object` +[accessible: false] `method finalize()Unit` +[accessible: false] `method secretPrivate()Unit` +[accessible: false] `method secretPrivateThis()Unit` +[accessible: false] `method secretProtected()Unit` +[accessible: false] `value __leftOfArrowaccessibility.Foo` +[accessible: false] `value __resultOfEnsuringaccessibility.Foo` +[accessible: false] `value selfAny` +================================================================================ + +askTypeCompletion at Completions.scala(37,8) +================================================================================ +[response] aksTypeCompletion at (37,8) +retrieved 42 members +[accessible: true] `method !=(x$1: Any)Boolean` +[accessible: true] `method !=(x$1: AnyRef)Boolean` +[accessible: true] `method ##()Int` +[accessible: true] `method +(other: String)String` +[accessible: true] `method ->[B](y: B)(accessibility.Foo, B)` +[accessible: true] `method ==(x$1: Any)Boolean` +[accessible: true] `method ==(x$1: AnyRef)Boolean` +[accessible: true] `method asInstanceOf[T0]=> T0` +[accessible: true] `method ensuring(cond: Boolean)accessibility.Foo` +[accessible: true] `method ensuring(cond: Boolean, msg: => Any)accessibility.Foo` +[accessible: true] `method ensuring(cond: accessibility.Foo => Boolean)accessibility.Foo` +[accessible: true] `method ensuring(cond: accessibility.Foo => Boolean, msg: => Any)accessibility.Foo` +[accessible: true] `method eq(x$1: AnyRef)Boolean` +[accessible: true] `method equals(x$1: Any)Boolean` +[accessible: true] `method formatted(fmtstr: String)String` +[accessible: true] `method hashCode()Int` +[accessible: true] `method isInstanceOf[T0]=> Boolean` +[accessible: true] `method ne(x$1: AnyRef)Boolean` +[accessible: true] `method notify()Unit` +[accessible: true] `method notifyAll()Unit` +[accessible: true] `method secretPublic()Unit` +[accessible: true] `method someTests(other: accessibility.Foo)Unit` +[accessible: true] `method synchronized[T0](x$1: T0)T0` +[accessible: true] `method toString()String` +[accessible: true] `method wait()Unit` +[accessible: true] `method wait(x$1: Long)Unit` +[accessible: true] `method wait(x$1: Long, x$2: Int)Unit` +[accessible: true] `method x=> accessibility.Foo` +[accessible: true] `method →[B](y: B)(accessibility.Foo, B)` +[accessible: false] `method clone()Object` +[accessible: false] `method finalize()Unit` +[accessible: false] `method secretPrivate()Unit` +[accessible: false] `method secretPrivateThis()Unit` +[accessible: false] `method secretProtected()Unit` +[accessible: false] `method secretProtectedInPackage()Unit` +[accessible: false] `value __leftOfArrowaccessibility.Foo` +[accessible: false] `value __resultOfEnsuringaccessibility.Foo` +[accessible: false] `value selfAny` +================================================================================ diff --git a/test/files/presentation/visibility/Test.scala b/test/files/presentation/visibility/Test.scala new file mode 100644 index 0000000000..96e758d974 --- /dev/null +++ b/test/files/presentation/visibility/Test.scala @@ -0,0 +1,5 @@ +import scala.tools.nsc.interactive.tests.InteractiveTest + +object Test extends InteractiveTest { + +}
\ No newline at end of file diff --git a/test/files/presentation/visibility/src/Completions.scala b/test/files/presentation/visibility/src/Completions.scala new file mode 100644 index 0000000000..098b98a0fd --- /dev/null +++ b/test/files/presentation/visibility/src/Completions.scala @@ -0,0 +1,40 @@ +package accessibility { + + class Foo { + private def secretPrivate(): Unit = () + private[this] def secretPrivateThis(): Unit = () + + protected def secretProtected(): Unit + + protected[accessibility] def secretProtectedInPackage(): Unit + + def secretPublic(): Unit + + def someTests(other: Foo) { + other./*!*/secretPrivate // should be all but scretThis + + this./*!*/secretProtected // should hit five completions + } + } + + class AccessibilityChecks extends Foo { + def someTests { + this./*!*/ // should not list secretPrivate* + } + } + + class UnrelatedClass { + def someTests(foo: Foo) { + foo./*!*/ // should list public and protected[accessiblity] + } + } + +} + +package other { + class SomeChecsk { + def foo(o: accessibility.Foo) { + o./*!*/ // should only match secretPublic + } + } +}
\ No newline at end of file diff --git a/test/files/run/array-charSeq.check b/test/files/run/array-charSeq.check new file mode 100644 index 0000000000..f1f374f63e --- /dev/null +++ b/test/files/run/array-charSeq.check @@ -0,0 +1,248 @@ + +[check 'abcdefghi'] len = 9 +sub(0, 9) == 'abcdefghi' +sub(0, 0) == '' +sub(1, 9) == 'bcdefghi' +sub(0, 1) == 'a' +sub(2, 9) == 'cdefghi' +sub(0, 2) == 'ab' +sub(3, 9) == 'defghi' +sub(0, 3) == 'abc' +sub(4, 9) == 'efghi' +sub(0, 4) == 'abcd' +sub(5, 9) == 'fghi' +sub(0, 5) == 'abcde' +sub(6, 9) == 'ghi' +sub(0, 6) == 'abcdef' +sub(7, 9) == 'hi' +sub(0, 7) == 'abcdefg' +sub(8, 9) == 'i' +sub(0, 8) == 'abcdefgh' + +[check 'bcdefgh'] len = 7 +sub(0, 7) == 'bcdefgh' +sub(0, 0) == '' +sub(1, 7) == 'cdefgh' +sub(0, 1) == 'b' +sub(2, 7) == 'defgh' +sub(0, 2) == 'bc' +sub(3, 7) == 'efgh' +sub(0, 3) == 'bcd' +sub(4, 7) == 'fgh' +sub(0, 4) == 'bcde' +sub(5, 7) == 'gh' +sub(0, 5) == 'bcdef' +sub(6, 7) == 'h' +sub(0, 6) == 'bcdefg' + +[check 'cdefg'] len = 5 +sub(0, 5) == 'cdefg' +sub(0, 0) == '' +sub(1, 5) == 'defg' +sub(0, 1) == 'c' +sub(2, 5) == 'efg' +sub(0, 2) == 'cd' +sub(3, 5) == 'fg' +sub(0, 3) == 'cde' +sub(4, 5) == 'g' +sub(0, 4) == 'cdef' + +[check 'def'] len = 3 +sub(0, 3) == 'def' +sub(0, 0) == '' +sub(1, 3) == 'ef' +sub(0, 1) == 'd' +sub(2, 3) == 'f' +sub(0, 2) == 'de' + +[check 'e'] len = 1 +sub(0, 1) == 'e' +sub(0, 0) == '' + +[check 'abcdefgh'] len = 8 +sub(0, 8) == 'abcdefgh' +sub(0, 0) == '' +sub(1, 8) == 'bcdefgh' +sub(0, 1) == 'a' +sub(2, 8) == 'cdefgh' +sub(0, 2) == 'ab' +sub(3, 8) == 'defgh' +sub(0, 3) == 'abc' +sub(4, 8) == 'efgh' +sub(0, 4) == 'abcd' +sub(5, 8) == 'fgh' +sub(0, 5) == 'abcde' +sub(6, 8) == 'gh' +sub(0, 6) == 'abcdef' +sub(7, 8) == 'h' +sub(0, 7) == 'abcdefg' + +[check 'bcdefg'] len = 6 +sub(0, 6) == 'bcdefg' +sub(0, 0) == '' +sub(1, 6) == 'cdefg' +sub(0, 1) == 'b' +sub(2, 6) == 'defg' +sub(0, 2) == 'bc' +sub(3, 6) == 'efg' +sub(0, 3) == 'bcd' +sub(4, 6) == 'fg' +sub(0, 4) == 'bcde' +sub(5, 6) == 'g' +sub(0, 5) == 'bcdef' + +[check 'cdef'] len = 4 +sub(0, 4) == 'cdef' +sub(0, 0) == '' +sub(1, 4) == 'def' +sub(0, 1) == 'c' +sub(2, 4) == 'ef' +sub(0, 2) == 'cd' +sub(3, 4) == 'f' +sub(0, 3) == 'cde' + +[check 'de'] len = 2 +sub(0, 2) == 'de' +sub(0, 0) == '' +sub(1, 2) == 'e' +sub(0, 1) == 'd' + +[check ''] len = 0 + +[check 'abcdefg'] len = 7 +sub(0, 7) == 'abcdefg' +sub(0, 0) == '' +sub(1, 7) == 'bcdefg' +sub(0, 1) == 'a' +sub(2, 7) == 'cdefg' +sub(0, 2) == 'ab' +sub(3, 7) == 'defg' +sub(0, 3) == 'abc' +sub(4, 7) == 'efg' +sub(0, 4) == 'abcd' +sub(5, 7) == 'fg' +sub(0, 5) == 'abcde' +sub(6, 7) == 'g' +sub(0, 6) == 'abcdef' + +[check 'bcdef'] len = 5 +sub(0, 5) == 'bcdef' +sub(0, 0) == '' +sub(1, 5) == 'cdef' +sub(0, 1) == 'b' +sub(2, 5) == 'def' +sub(0, 2) == 'bc' +sub(3, 5) == 'ef' +sub(0, 3) == 'bcd' +sub(4, 5) == 'f' +sub(0, 4) == 'bcde' + +[check 'cde'] len = 3 +sub(0, 3) == 'cde' +sub(0, 0) == '' +sub(1, 3) == 'de' +sub(0, 1) == 'c' +sub(2, 3) == 'e' +sub(0, 2) == 'cd' + +[check 'd'] len = 1 +sub(0, 1) == 'd' +sub(0, 0) == '' + +[check 'abcdef'] len = 6 +sub(0, 6) == 'abcdef' +sub(0, 0) == '' +sub(1, 6) == 'bcdef' +sub(0, 1) == 'a' +sub(2, 6) == 'cdef' +sub(0, 2) == 'ab' +sub(3, 6) == 'def' +sub(0, 3) == 'abc' +sub(4, 6) == 'ef' +sub(0, 4) == 'abcd' +sub(5, 6) == 'f' +sub(0, 5) == 'abcde' + +[check 'bcde'] len = 4 +sub(0, 4) == 'bcde' +sub(0, 0) == '' +sub(1, 4) == 'cde' +sub(0, 1) == 'b' +sub(2, 4) == 'de' +sub(0, 2) == 'bc' +sub(3, 4) == 'e' +sub(0, 3) == 'bcd' + +[check 'cd'] len = 2 +sub(0, 2) == 'cd' +sub(0, 0) == '' +sub(1, 2) == 'd' +sub(0, 1) == 'c' + +[check ''] len = 0 + +[check 'abcde'] len = 5 +sub(0, 5) == 'abcde' +sub(0, 0) == '' +sub(1, 5) == 'bcde' +sub(0, 1) == 'a' +sub(2, 5) == 'cde' +sub(0, 2) == 'ab' +sub(3, 5) == 'de' +sub(0, 3) == 'abc' +sub(4, 5) == 'e' +sub(0, 4) == 'abcd' + +[check 'bcd'] len = 3 +sub(0, 3) == 'bcd' +sub(0, 0) == '' +sub(1, 3) == 'cd' +sub(0, 1) == 'b' +sub(2, 3) == 'd' +sub(0, 2) == 'bc' + +[check 'c'] len = 1 +sub(0, 1) == 'c' +sub(0, 0) == '' + +[check 'abcd'] len = 4 +sub(0, 4) == 'abcd' +sub(0, 0) == '' +sub(1, 4) == 'bcd' +sub(0, 1) == 'a' +sub(2, 4) == 'cd' +sub(0, 2) == 'ab' +sub(3, 4) == 'd' +sub(0, 3) == 'abc' + +[check 'bc'] len = 2 +sub(0, 2) == 'bc' +sub(0, 0) == '' +sub(1, 2) == 'c' +sub(0, 1) == 'b' + +[check ''] len = 0 + +[check 'abc'] len = 3 +sub(0, 3) == 'abc' +sub(0, 0) == '' +sub(1, 3) == 'bc' +sub(0, 1) == 'a' +sub(2, 3) == 'c' +sub(0, 2) == 'ab' + +[check 'b'] len = 1 +sub(0, 1) == 'b' +sub(0, 0) == '' + +[check 'ab'] len = 2 +sub(0, 2) == 'ab' +sub(0, 0) == '' +sub(1, 2) == 'b' +sub(0, 1) == 'a' + +[check ''] len = 0 + +[check 'a'] len = 1 +sub(0, 1) == 'a' +sub(0, 0) == '' diff --git a/test/files/run/array-charSeq.scala b/test/files/run/array-charSeq.scala new file mode 100644 index 0000000000..f7d0586f03 --- /dev/null +++ b/test/files/run/array-charSeq.scala @@ -0,0 +1,27 @@ +object Test { + val arr = Array[Char]('a' to 'i': _*) + var xs: CharSequence = arr + val hash = xs.hashCode + + def check(chars: CharSequence) { + println("\n[check '" + chars + "'] len = " + chars.length) + chars match { + case x: runtime.ArrayCharSequence => assert(x.xs eq arr, ((x.xs, arr))) + case x => assert(false, x) + } + + 0 until chars.length foreach { i => + println("sub(%s, %s) == '%s'".format(i, chars.length, chars.subSequence(i, chars.length))) + println("sub(%s, %s) == '%s'".format(0, i, chars.subSequence(0, i))) + } + if (chars.length >= 2) + check(chars.subSequence(1, chars.length - 1)) + } + + def main(args: Array[String]): Unit = { + while (xs.length > 0) { + check(xs) + xs = xs.subSequence(0, xs.length - 1) + } + } +} diff --git a/test/files/run/existentials3-old.check b/test/files/run/existentials3-old.check index e166e53ba8..72abfac637 100644 --- a/test/files/run/existentials3-old.check +++ b/test/files/run/existentials3-old.check @@ -1,22 +1,22 @@ -_ <: scala.runtime.AbstractFunction0[_ <: Object with Test$ToS with scala.Product with scala.Serializable] with scala.Serializable with java.lang.Object
-_ <: Object with Test$ToS with scala.Product with scala.Serializable
-Object with Test$ToS
-Object with Test$ToS
-Object with Test$ToS
-scala.Function0[Object with Test$ToS]
-scala.Function0[Object with Test$ToS]
-_ <: Object with _ <: Object with Object with Test$ToS
-_ <: Object with _ <: Object with _ <: Object with Test$ToS
-scala.collection.immutable.List[Object with scala.collection.Seq[Int]]
-scala.collection.immutable.List[Object with scala.collection.Seq[_ <: Int]]
-_ <: scala.runtime.AbstractFunction0[_ <: Object with Test$ToS with scala.Product with scala.Serializable] with scala.Serializable with java.lang.Object
-_ <: Object with Test$ToS with scala.Product with scala.Serializable
-Object with Test$ToS
-Object with Test$ToS
-Object with Test$ToS
-scala.Function0[Object with Test$ToS]
-scala.Function0[Object with Test$ToS]
-_ <: Object with _ <: Object with Object with Test$ToS
-_ <: Object with _ <: Object with _ <: Object with Test$ToS
-scala.collection.immutable.List[Object with scala.collection.Seq[Int]]
-scala.collection.immutable.List[Object with scala.collection.Seq[_ <: Int]]
+_ <: scala.runtime.AbstractFunction0[_ <: Object with Test$ToS with scala.Product with scala.Serializable] with scala.Serializable with java.lang.Object +_ <: Object with Test$ToS with scala.Product with scala.Serializable +Object with Test$ToS +Object with Test$ToS +Object with Test$ToS +scala.Function0[Object with Test$ToS] +scala.Function0[Object with Test$ToS] +_ <: Object with _ <: Object with Test$ToS +_ <: Object with _ <: Object with _ <: Object with Test$ToS +scala.collection.immutable.List[Object with scala.collection.Seq[Int]] +scala.collection.immutable.List[Object with scala.collection.Seq[_ <: Int]] +_ <: scala.runtime.AbstractFunction0[_ <: Object with Test$ToS with scala.Product with scala.Serializable] with scala.Serializable with java.lang.Object +_ <: Object with Test$ToS with scala.Product with scala.Serializable +Object with Test$ToS +Object with Test$ToS +Object with Test$ToS +scala.Function0[Object with Test$ToS] +scala.Function0[Object with Test$ToS] +_ <: Object with _ <: Object with Test$ToS +_ <: Object with _ <: Object with _ <: Object with Test$ToS +scala.collection.immutable.List[Object with scala.collection.Seq[Int]] +scala.collection.immutable.List[Object with scala.collection.Seq[_ <: Int]] diff --git a/test/files/run/inner-parse.check b/test/files/run/inner-parse.check index 87ea9ddeb5..e4a30714bd 100644 --- a/test/files/run/inner-parse.check +++ b/test/files/run/inner-parse.check @@ -5,6 +5,7 @@ class Test$$anonfun$main$1 extends scala.runtime.AbstractFunction1$mcVL$sp descriptor <clinit> ()V descriptor apply (Lscala/Tuple2;)V descriptor apply (Ljava/lang/Object;)Ljava/lang/Object; + descriptor apply (Ljava/lang/Object;)V descriptor cwd$1 Ljava/lang/String; descriptor serialVersionUID J descriptor <init> (Ljava/lang/String;)V diff --git a/test/files/run/nonlocalreturn.check b/test/files/run/nonlocalreturn.check new file mode 100644 index 0000000000..aeb2d5e239 --- /dev/null +++ b/test/files/run/nonlocalreturn.check @@ -0,0 +1 @@ +Some(1) diff --git a/test/files/run/nonlocalreturn.scala b/test/files/run/nonlocalreturn.scala new file mode 100644 index 0000000000..3c1e7420ed --- /dev/null +++ b/test/files/run/nonlocalreturn.scala @@ -0,0 +1,15 @@ +object Test { + def wrap[K](body: => K): K = body + + def f(): Option[Int] = { + wrap({ return Some(1) ; None }) + } + + def main(args: Array[String]) { + println(f()) + } +} +// java.lang.ClassCastException: scala.Some cannot be cast to scala.None$ +// at Test$$anonfun$f$1.apply(nonlocalreturn.scala:5) +// at Test$$anonfun$f$1.apply(nonlocalreturn.scala:5) +// at Test$.wrap(nonlocalreturn.scala:2) diff --git a/test/files/run/packrat3.check b/test/files/run/packrat3.check index 4d84623ce6..8c10626751 100644 --- a/test/files/run/packrat3.check +++ b/test/files/run/packrat3.check @@ -4,4 +4,4 @@ (((List(a, a, a, a, b, b, b, b)~())~List(a, a, a, a))~List(b, b, b, b, c, c, c, c)) Expected failure ``b'' expected but `c' found -``c'' expected but EOF found +end of input diff --git a/test/files/run/programmatic-main.check b/test/files/run/programmatic-main.check index d16e2c5178..bdf76ddce1 100644 --- a/test/files/run/programmatic-main.check +++ b/test/files/run/programmatic-main.check @@ -4,27 +4,28 @@ namer 2 resolve names, attach symbols to named trees packageobjects 3 load package objects typer 4 the meat and potatoes: type the trees - superaccessors 5 add super accessors in traits and nested classes - extmethods 6 add extension methods for inline classes - pickler 7 serialize symbol tables - refchecks 8 reference/override checking, translate nested objects - uncurry 9 uncurry, translate function values to anonymous classes - tailcalls 10 replace tail calls by jumps - specialize 11 @specialized-driven class and method specialization - explicitouter 12 this refs to outer pointers, translate patterns - erasure 13 erase types, add interfaces for traits - posterasure 14 clean up erased inline classes - lazyvals 15 allocate bitmaps, translate lazy vals into lazified defs - lambdalift 16 move nested functions to top level - constructors 17 move field definitions into constructors - flatten 18 eliminate inner classes - mixin 19 mixin composition - cleanup 20 platform-specific cleanups, generate reflective calls - icode 21 generate portable intermediate code - inliner 22 optimization: do inlining -inlineExceptionHandlers 23 optimization: inline exception handlers - closelim 24 optimization: eliminate uncalled closures - dce 25 optimization: eliminate dead code - jvm 26 generate JVM bytecode - terminal 27 The last phase in the compiler chain + patmat 5 translate match expressions + superaccessors 6 add super accessors in traits and nested classes + extmethods 7 add extension methods for inline classes + pickler 8 serialize symbol tables + refchecks 9 reference/override checking, translate nested objects + uncurry 10 uncurry, translate function values to anonymous classes + tailcalls 11 replace tail calls by jumps + specialize 12 @specialized-driven class and method specialization + explicitouter 13 this refs to outer pointers, translate patterns + erasure 14 erase types, add interfaces for traits + posterasure 15 clean up erased inline classes + lazyvals 16 allocate bitmaps, translate lazy vals into lazified defs + lambdalift 17 move nested functions to top level + constructors 18 move field definitions into constructors + flatten 19 eliminate inner classes + mixin 20 mixin composition + cleanup 21 platform-specific cleanups, generate reflective calls + icode 22 generate portable intermediate code + inliner 23 optimization: do inlining +inlineExceptionHandlers 24 optimization: inline exception handlers + closelim 25 optimization: eliminate uncalled closures + dce 26 optimization: eliminate dead code + jvm 27 generate JVM bytecode + terminal 28 The last phase in the compiler chain diff --git a/test/files/run/reflection-simple.check b/test/files/run/reflection-simple.check new file mode 100644 index 0000000000..671d9d2716 --- /dev/null +++ b/test/files/run/reflection-simple.check @@ -0,0 +1,45 @@ +Running +constructor Foo$3 +constructor Object +method != +method != +method ## +method $asInstanceOf +method $init$ +method $isInstanceOf +method == +method == +method _1 +method _2 +method _3 +method a +method asInstanceOf +method b +method c +method canEqual +method clone +method copy +method copy$default$1 +method copy$default$2 +method copy$default$3 +method eq +method equals +method finalize +method getClass +method hashCode +method isInstanceOf +method ne +method notify +method notifyAll +method productArity +method productElement +method productIterator +method productPrefix +method synchronized +method toString +method wait +method wait +method wait +value a +value b +value c diff --git a/test/files/run/reflection-simple.scala b/test/files/run/reflection-simple.scala new file mode 100644 index 0000000000..fb3feec3cb --- /dev/null +++ b/test/files/run/reflection-simple.scala @@ -0,0 +1,11 @@ +// a.scala +// Wed May 2 01:01:22 PDT 2012 + +object Test { + def main(args: Array[String]) { + System.out.println("Running") + case class Foo(a: Int, b: Int, c: Int) + val props = reflect.mirror.classToType(classOf[Foo]).members.filter(_.isTerm).map(_.toString) + props.toList.sorted foreach System.out.println + } +} diff --git a/test/pending/run/reify_csv.check b/test/files/run/reify_csv.check index b56f4bb50b..b56f4bb50b 100644 --- a/test/pending/run/reify_csv.check +++ b/test/files/run/reify_csv.check diff --git a/test/pending/run/reify_csv.scala b/test/files/run/reify_csv.scala index 966521575c..966521575c 100644 --- a/test/pending/run/reify_csv.scala +++ b/test/files/run/reify_csv.scala diff --git a/test/files/run/reify_fors.flags b/test/files/run/reify_fors.flags index ba80cad69b..e69de29bb2 100644 --- a/test/files/run/reify_fors.flags +++ b/test/files/run/reify_fors.flags @@ -1 +0,0 @@ --Xoldpatmat diff --git a/test/pending/run/reify_lazyevaluation.check b/test/files/run/reify_lazyevaluation.check index 1c7f96cd96..1c7f96cd96 100644 --- a/test/pending/run/reify_lazyevaluation.check +++ b/test/files/run/reify_lazyevaluation.check diff --git a/test/pending/run/reify_lazyevaluation.scala b/test/files/run/reify_lazyevaluation.scala index 1a0c858914..1a0c858914 100644 --- a/test/pending/run/reify_lazyevaluation.scala +++ b/test/files/run/reify_lazyevaluation.scala diff --git a/test/files/run/reify_maps.flags b/test/files/run/reify_maps.flags index ba80cad69b..e69de29bb2 100644 --- a/test/files/run/reify_maps.flags +++ b/test/files/run/reify_maps.flags @@ -1 +0,0 @@ --Xoldpatmat diff --git a/test/pending/run/reify_properties.check b/test/files/run/reify_properties.check index d769bea4b0..d769bea4b0 100644 --- a/test/pending/run/reify_properties.check +++ b/test/files/run/reify_properties.check diff --git a/test/pending/run/reify_properties.scala b/test/files/run/reify_properties.scala index 5cacc262ac..5cacc262ac 100644 --- a/test/pending/run/reify_properties.scala +++ b/test/files/run/reify_properties.scala diff --git a/test/files/run/repl-suppressed-warnings.scala b/test/files/run/repl-suppressed-warnings.scala index 9afbbaf1a5..1a51afe34f 100644 --- a/test/files/run/repl-suppressed-warnings.scala +++ b/test/files/run/repl-suppressed-warnings.scala @@ -1,7 +1,7 @@ import scala.tools.partest.ReplTest object Test extends ReplTest { - override def extraSettings = "-Xoldpatmat" + override def extraSettings = "" def code = """ // "Is this thing on?" Not working on first couple diff --git a/test/files/run/si5045.check b/test/files/run/si5045.check new file mode 100644 index 0000000000..7e9c1961b7 --- /dev/null +++ b/test/files/run/si5045.check @@ -0,0 +1,6 @@ + extract an exact match 2011-07-15 2011-07-15 + extract from middle of string 2011-07-15 2011-07-15 + extract from middle of string (P2) 2011-07-15 2011-07-15 + extract from middle of string (P3) 2011-07-15 2011-07-15 + copyright example has date Copyright 2011 Copyright 2011 + copyright example missing date No copyright No copyright diff --git a/test/files/run/si5045.scala b/test/files/run/si5045.scala new file mode 100644 index 0000000000..e198b101f3 --- /dev/null +++ b/test/files/run/si5045.scala @@ -0,0 +1,46 @@ +object Test extends App { + + import scala.util.matching.{ Regex, UnanchoredRegex } + + val dateP1 = """(\d\d\d\d)-(\d\d)-(\d\d)""".r.unanchored + val dateP2 = """(\d\d\d\d)-(\d\d)-(\d\d)""" r ("year", "month", "day") unanchored + val dateP3 = new Regex("""(\d\d\d\d)-(\d\d)-(\d\d)""", "year", "month", "day") with UnanchoredRegex + + val yearStr = "2011" + val dateStr = List(yearStr,"07","15").mkString("-") + + def test(msg: String)(strs: Seq[String]): Unit = println("%40s %s".format(msg, strs mkString " ")) + + test("extract an exact match") { + val dateP1(y,m,d) = dateStr + Seq(List(y,m,d).mkString("-"), dateStr) + } + + test("extract from middle of string") { + val dateP1(y,m,d) = "Tested on "+dateStr+"." + Seq(List(y,m,d).mkString("-"), dateStr) + } + + test("extract from middle of string (P2)") { + val dateP2(y,m,d) = "Tested on "+dateStr+"." + Seq(List(y,m,d).mkString("-"), dateStr) + } + + test("extract from middle of string (P3)") { + val dateP2(y,m,d) = "Tested on "+dateStr+"." + Seq(List(y,m,d).mkString("-"), dateStr) + } + + def copyright(in: String): String = in match { + case dateP1(year, month, day) => "Copyright "+year + case _ => "No copyright" + } + + test("copyright example has date") { + Seq(copyright("Date of this document: "+dateStr), "Copyright "+yearStr) + } + + test("copyright example missing date") { + Seq(copyright("Date of this document: unknown"), "No copyright") + } +} diff --git a/test/pending/run/t1697.scala b/test/files/run/t1697.scala index 01590dd405..01590dd405 100644 --- a/test/pending/run/t1697.scala +++ b/test/files/run/t1697.scala diff --git a/test/files/run/t2337.check b/test/files/run/t2337.check new file mode 100644 index 0000000000..18f1f66fc3 --- /dev/null +++ b/test/files/run/t2337.check @@ -0,0 +1,4 @@ +(Both Int,-1,-1) +(Both Float,1,1) +(Float then Int,0,0) +(Int then Float,0,0) diff --git a/test/files/run/t2337.scala b/test/files/run/t2337.scala new file mode 100644 index 0000000000..86a372ce56 --- /dev/null +++ b/test/files/run/t2337.scala @@ -0,0 +1,21 @@ + +object Test { + + def compare(first: Any, second: Any): Any = { + (first, second) match { + case (k: Int, o: Int) => k compare o + //why the next case matches (Float, Int) but does not match (Int, Float) ??? + case (k: Number, o: Number) => k.doubleValue() compare o.doubleValue() + case _ => "BOGON" + // throw new Exception("Unsupported compare " + first + "; " + second) + } + } + + def main(args: Array[String]): Unit = { + println("Both Int", -1, compare(0, 1)) + println("Both Float", 1, compare(1.0, 0.0)) + println("Float then Int", 0, compare(10.0, 10)) + println("Int then Float", 0, compare(10, 10.0)) //this fails with an exception + } +} + diff --git a/test/files/run/t3569.check b/test/files/run/t3569.check index c73fce419a..a9fb5ff32e 100644 --- a/test/files/run/t3569.check +++ b/test/files/run/t3569.check @@ -9,8 +9,7 @@ private int Test$X.var1 private int Test$X.var2 private int Test$X.var3 private int Test$X.x -private volatile int Test$X.bitmap$priv$0 -public volatile int Test$X.bitmap$0 +private volatile byte Test$X.bitmap$0 private final int Test$Y.z1 private final int Test$Y.z2 private int Test$Y.x diff --git a/test/pending/run/t3705.scala b/test/files/run/t3705.scala index fcc020f28c..fcc020f28c 100644 --- a/test/pending/run/t3705.scala +++ b/test/files/run/t3705.scala diff --git a/test/files/run/t3798.check b/test/files/run/t3798.check new file mode 100644 index 0000000000..27ba77ddaf --- /dev/null +++ b/test/files/run/t3798.check @@ -0,0 +1 @@ +true diff --git a/test/files/run/t3798.scala b/test/files/run/t3798.scala new file mode 100644 index 0000000000..3ede57bee7 --- /dev/null +++ b/test/files/run/t3798.scala @@ -0,0 +1,10 @@ +object Test { + def main(args: Array[String]) { + val seq: MySeq[Undefined] = new MySeq[Floats](new Array[Float](10)) + println(10 == seq.array.length) + } +} + +sealed trait Undefined { type ArrayType <: Array[_] } +sealed trait Floats extends Undefined { type ArrayType = Array[Float] } +class MySeq[+T <: Undefined](val array: T#ArrayType) diff --git a/test/files/run/t4216.check b/test/files/run/t4216.check new file mode 100644 index 0000000000..ac19a98315 --- /dev/null +++ b/test/files/run/t4216.check @@ -0,0 +1,34 @@ +Type in expressions to have them evaluated. +Type :help for more information. + +scala> def f[A: ArrayTag](a: A) = java.util.Arrays.asList(Array(a): _*) +f: [A](a: A)(implicit evidence$1: ArrayTag[A])java.util.List[A] + +scala> f(".") +res0: java.util.List[String] = [.] + +scala> f(0) +res1: java.util.List[Int] = [0] + +scala> def i(a: Int) = java.util.Arrays.asList(Array(a): _*) +i: (a: Int)java.util.List[Int] + +scala> i(0) +res2: java.util.List[Int] = [0] + +scala> def o(a: Any) = java.util.Arrays.asList(Array(a): _*) +o: (a: Any)java.util.List[Any] + +scala> o(".") +res3: java.util.List[Any] = [.] + +scala> class V(val a: Int) extends AnyVal +defined class V + +scala> f(new V(0)) +res4: java.util.List[V] = [V@0] + +scala> o(new V(0)) +res5: java.util.List[Any] = [V@0] + +scala> diff --git a/test/files/run/t4216.scala b/test/files/run/t4216.scala new file mode 100644 index 0000000000..4ada8f48aa --- /dev/null +++ b/test/files/run/t4216.scala @@ -0,0 +1,18 @@ +import scala.tools.partest.ReplTest + +// t4216 +object Test extends ReplTest { + def code = + """ + |def f[A: ArrayTag](a: A) = java.util.Arrays.asList(Array(a): _*) + |f(".") + |f(0) + |def i(a: Int) = java.util.Arrays.asList(Array(a): _*) + |i(0) + |def o(a: Any) = java.util.Arrays.asList(Array(a): _*) + |o(".") + |class V(val a: Int) extends AnyVal + |f(new V(0)) + |o(new V(0)) + |""".stripMargin.trim +} diff --git a/test/pending/run/t4415.scala b/test/files/run/t4415.scala index f96031d650..f96031d650 100644 --- a/test/pending/run/t4415.scala +++ b/test/files/run/t4415.scala diff --git a/test/files/run/t4536.check b/test/files/run/t4536.check new file mode 100644 index 0000000000..0c5a72ada7 --- /dev/null +++ b/test/files/run/t4536.check @@ -0,0 +1,8 @@ +cls: bar +obj: foo +obj: bar +cls: bar +obj: bar +trait: pili +trait: mili +trait: foo
\ No newline at end of file diff --git a/test/files/run/t4536.scala b/test/files/run/t4536.scala new file mode 100644 index 0000000000..acd91deb7f --- /dev/null +++ b/test/files/run/t4536.scala @@ -0,0 +1,46 @@ + + + + + + +object dynamicObject extends Dynamic { + def applyDynamic(m: String)() = println("obj: " + m); + this.foo() +} + + +class dynamicClass extends Dynamic { + def applyDynamic(m: String)() = println("cls: " + m); + this.bar() + dynamicObject.bar() +} + + +abstract class dynamicAbstractClass extends Dynamic { + def applyDynamic(m: String)(args: Any*): Unit + this.pili(1, new dynamicClass, "hello"); +} + + +trait dynamicTrait extends Dynamic { + def applyDynamic(m: String)(args: Any*) = println("trait: " + m); + def two = 2 + this.mili(1,2,3) + two +} + + +object dynamicMixin extends dynamicAbstractClass with dynamicTrait { + this.foo(None) +} + + +object Test { + + def main(args: Array[String]) { + val cls = new dynamicClass + dynamicMixin + } + +} diff --git a/test/files/run/t4929.check b/test/files/run/t4929.check new file mode 100644 index 0000000000..0f0c913d55 --- /dev/null +++ b/test/files/run/t4929.check @@ -0,0 +1 @@ +success
\ No newline at end of file diff --git a/test/files/run/t4929.scala b/test/files/run/t4929.scala new file mode 100644 index 0000000000..3208cd1b09 --- /dev/null +++ b/test/files/run/t4929.scala @@ -0,0 +1,42 @@ +import scala.util.parsing.json._ +import java.util.concurrent._ +import collection.JavaConversions._ + +object Test extends App { + + val LIMIT = 2000 + val THREAD_COUNT = 20 + val count = new java.util.concurrent.atomic.AtomicInteger(0) + + val begin = new CountDownLatch(THREAD_COUNT) + val finish = new CountDownLatch(THREAD_COUNT) + + val errors = new ConcurrentLinkedQueue[Throwable] + + (1 to THREAD_COUNT) foreach { i => + val thread = new Thread { + override def run() { + begin.await(1, TimeUnit.SECONDS) + try { + while (count.getAndIncrement() < LIMIT && errors.isEmpty) { + JSON.parseFull("""{"foo": [1,2,3,4]}""") + } + } catch { + case t: Throwable => errors.add(t) + } + + finish.await(10, TimeUnit.SECONDS) + } + } + + thread.setDaemon(true) + thread.start() + + } + + + errors foreach { throw(_) } + + println("success") + +} diff --git a/test/files/run/t5018.scala b/test/files/run/t5018.scala new file mode 100644 index 0000000000..bb67a252e5 --- /dev/null +++ b/test/files/run/t5018.scala @@ -0,0 +1,37 @@ + + + +import java.io._ +import collection._ + + + +object Test { + + def serializeDeserialize[T <: AnyRef](obj: T) = { + val buffer = new ByteArrayOutputStream + val out = new ObjectOutputStream(buffer) + out.writeObject(obj) + val in = new ObjectInputStream(new ByteArrayInputStream(buffer.toByteArray)) + in.readObject.asInstanceOf[T] + } + + def main(args: Array[String]) { + val values = mutable.Map(1 -> 1).values + assert(serializeDeserialize(values).toList == values.toList) + + val keyset = mutable.Map(1 -> 1).keySet + assert(serializeDeserialize(keyset) == keyset) + + val imkeyset = immutable.Map(1 -> 1).keySet + assert(serializeDeserialize(imkeyset) == imkeyset) + + val defaultmap = immutable.Map(1 -> 1).withDefaultValue(1) + assert(serializeDeserialize(defaultmap) == defaultmap) + + val minusmap = mutable.Map(1 -> 1).withDefault(x => -x) + assert(serializeDeserialize(minusmap) == minusmap) + } + +} + diff --git a/test/files/run/t5040.check b/test/files/run/t5040.check new file mode 100644 index 0000000000..3f7b5908a9 --- /dev/null +++ b/test/files/run/t5040.check @@ -0,0 +1 @@ +applyDynamic diff --git a/test/files/run/t5040.scala b/test/files/run/t5040.scala new file mode 100644 index 0000000000..6cd2c22234 --- /dev/null +++ b/test/files/run/t5040.scala @@ -0,0 +1,11 @@ +abstract class Prova2 extends Dynamic { + def applyDynamic(m: String)(): Unit + private def privateMethod() = println("private method") +} + +object Test extends App { + val prova= new Prova2 { + def applyDynamic(m: String)() = println("applyDynamic") + } + prova.privateMethod() +} diff --git a/test/pending/run/t5258a.check b/test/files/run/t5258a.check index 4e0b2da04c..4e0b2da04c 100644 --- a/test/pending/run/t5258a.check +++ b/test/files/run/t5258a.check diff --git a/test/pending/run/t5258a.scala b/test/files/run/t5258a.scala index 127829c724..127829c724 100644 --- a/test/pending/run/t5258a.scala +++ b/test/files/run/t5258a.scala diff --git a/test/files/run/t5272_1.flags b/test/files/run/t5272_1.flags index cb8324a345..e69de29bb2 100644 --- a/test/files/run/t5272_1.flags +++ b/test/files/run/t5272_1.flags @@ -1 +0,0 @@ --Xoldpatmat
\ No newline at end of file diff --git a/test/files/run/t5272_2.flags b/test/files/run/t5272_2.flags index cb8324a345..e69de29bb2 100644 --- a/test/files/run/t5272_2.flags +++ b/test/files/run/t5272_2.flags @@ -1 +0,0 @@ --Xoldpatmat
\ No newline at end of file diff --git a/test/files/run/t5273_1.flags b/test/files/run/t5273_1.flags index ba80cad69b..e69de29bb2 100644 --- a/test/files/run/t5273_1.flags +++ b/test/files/run/t5273_1.flags @@ -1 +0,0 @@ --Xoldpatmat diff --git a/test/files/run/t5273_2a.flags b/test/files/run/t5273_2a.flags index ba80cad69b..e69de29bb2 100644 --- a/test/files/run/t5273_2a.flags +++ b/test/files/run/t5273_2a.flags @@ -1 +0,0 @@ --Xoldpatmat diff --git a/test/files/run/t5273_2b.flags b/test/files/run/t5273_2b.flags index ba80cad69b..e69de29bb2 100644 --- a/test/files/run/t5273_2b.flags +++ b/test/files/run/t5273_2b.flags @@ -1 +0,0 @@ --Xoldpatmat diff --git a/test/files/run/t5514.check b/test/files/run/t5514.check new file mode 100644 index 0000000000..c68f7c9029 --- /dev/null +++ b/test/files/run/t5514.check @@ -0,0 +1,19 @@ +constructed reader: 10 +constructed reader: 9 +constructed reader: 8 +constructed reader: 7 +constructed reader: 6 +constructed reader: 5 +constructed reader: 4 +constructed reader: 3 +constructed reader: 2 +constructed reader: 1 +constructed reader: 0 +[0.0] parsed: List(s10, s9, s8, s7, s6, s5, s4, s3, s2, s1) +constructed reader: 10 +constructed reader: 9 +constructed reader: 8 +constructed reader: 7 +constructed reader: 6 +constructed reader: 5 +[0.0] parsed: List(s10, s9, s8, s7, s6)
\ No newline at end of file diff --git a/test/files/run/t5514.scala b/test/files/run/t5514.scala new file mode 100644 index 0000000000..efd5ba6cb9 --- /dev/null +++ b/test/files/run/t5514.scala @@ -0,0 +1,35 @@ + + + +import scala.io.Source +import scala.util.parsing.combinator.Parsers +import scala.util.parsing.input.Reader +import scala.util.parsing.input.Position + + + +class DemoReader(n: Int) extends Reader[String] { + def atEnd = n == 0 + def first = if (n >= 0) "s" + n else throw new IllegalArgumentException("No more input.") + def rest = new DemoReader(n - 1) + def pos = new Position { + def line = 0 + def column = 0 + def lineContents = first + } + println("constructed reader: " + n) +} + + +object Test extends App with Parsers { + type Elem = String + def startsWith(prefix: String) = acceptIf(_ startsWith prefix)("Error: " + _) + + val resrep = startsWith("s").*(new DemoReader(10)) + Console println resrep + + val resrep5 = repN(5, startsWith("s"))(new DemoReader(10)) + Console println resrep5 +} + + diff --git a/test/files/run/t5543.check b/test/files/run/t5543.check new file mode 100644 index 0000000000..517038f4c7 --- /dev/null +++ b/test/files/run/t5543.check @@ -0,0 +1,3 @@ +Test, 7, 119 +m, 3, 19 +Test, 5, 85 diff --git a/test/files/run/t5543.scala b/test/files/run/t5543.scala new file mode 100644 index 0000000000..651bc7f2b2 --- /dev/null +++ b/test/files/run/t5543.scala @@ -0,0 +1,26 @@ + +object Test extends Function0[Int] { + // this and v resolve to Test.this, Test.v not A.this, A.v + class A(x: Function0[Int] = this)(val a: Int = v, val b: Int = v * x()) extends Function0[Int] { + val v = 3 + override def toString = x.toString +", "+ a +", "+ b + // ordinary instance scope + def m(i: Int = v, y: Function0[Int] = this) = "m, "+ i +", "+ y() + def apply() = 19 + } + object A { + val v = 5 + // should happily coexist with default getters, in a happier world + def init(x: Function0[Int] = Test.this)(a: Int = v, b: Int = v * x()) = x.toString +", "+ a +", "+ b + override def toString = "A" + } + val v = 7 + def apply() = 17 + override def toString = "Test" + def main(args: Array[String]) { + val sut = new A()() + println(sut.toString) + println(sut.m()) + println(A.init()()) + } +} diff --git a/test/files/run/t5577.check b/test/files/run/t5577.check new file mode 100644 index 0000000000..3eca387955 --- /dev/null +++ b/test/files/run/t5577.check @@ -0,0 +1,11 @@ +Received a size hint: 10 +0 +1 +2 +3 +4 +5 +6 +7 +8 +9
\ No newline at end of file diff --git a/test/files/run/t5577.scala b/test/files/run/t5577.scala new file mode 100644 index 0000000000..b5d6d8c5b6 --- /dev/null +++ b/test/files/run/t5577.scala @@ -0,0 +1,27 @@ + + + +import collection._ + + + +object Test { + + class AlarmingBuffer[T] extends mutable.ArrayBuffer[T] { + override def sizeHint(x: Int) { + println("Received a size hint: " + x) + super.sizeHint(x) + } + } + + def main(args: Array[String]) { + val iteratorBuilder = (new AlarmingBuffer[Int]) mapResult { + res => res.iterator + } + + iteratorBuilder.sizeHint(10) + iteratorBuilder ++= (0 until 10) + iteratorBuilder.result.foreach(println) + } + +} diff --git a/test/files/run/t5590.check b/test/files/run/t5590.check new file mode 100644 index 0000000000..ad4a2eee64 --- /dev/null +++ b/test/files/run/t5590.check @@ -0,0 +1,4 @@ +Map(a -> a, b -> b, c -> c) +Map(a -> a, b -> b, c -> c) +Set(a, b, c, d, e) +Set(a, b, c, d, e)
\ No newline at end of file diff --git a/test/files/run/t5590.scala b/test/files/run/t5590.scala new file mode 100644 index 0000000000..9c806e0b7d --- /dev/null +++ b/test/files/run/t5590.scala @@ -0,0 +1,31 @@ + + + +import java.io._ +import collection._ + + + +object Test { + + def check(obj: AnyRef) { + println(obj) + + val bos = new ByteArrayOutputStream() + val out = new ObjectOutputStream(bos) + out.writeObject(obj) + val arr = bos.toByteArray() + val in = new ObjectInputStream(new ByteArrayInputStream(arr)) + val deser = in.readObject() + + println(deser) + } + + def main(args: Array[String]) { + val lhm = mutable.LinkedHashMap("a" -> "a", "b" -> "b", "c" -> "c") + val lhs = mutable.LinkedHashSet("a", "b", "c", "d", "e") + check(lhm) + check(lhs) + } + +} diff --git a/test/files/run/t5608.check b/test/files/run/t5608.check new file mode 100644 index 0000000000..ba70d21701 --- /dev/null +++ b/test/files/run/t5608.check @@ -0,0 +1 @@ +A@6 diff --git a/test/files/run/t5608.scala b/test/files/run/t5608.scala new file mode 100644 index 0000000000..19b3681932 --- /dev/null +++ b/test/files/run/t5608.scala @@ -0,0 +1,12 @@ +object Test { + def main(args:Array[String]) { + val ns = Array(3L, 3L, 3L) + val a1: A = new A(ns(0)) + val a2: A = new A(ns(0)) + println(a1 + a2) + } +} + +class A(val u: Long) extends AnyVal { + def +(other: A) = new A(other.u + u) +} diff --git a/test/files/run/t5612.check b/test/files/run/t5612.check new file mode 100644 index 0000000000..9d19cca292 --- /dev/null +++ b/test/files/run/t5612.check @@ -0,0 +1,4 @@ +START for List(Two, Two, One, Three) +TWO +TWO +ONE diff --git a/test/files/run/t5612.scala b/test/files/run/t5612.scala new file mode 100644 index 0000000000..48b3093548 --- /dev/null +++ b/test/files/run/t5612.scala @@ -0,0 +1,28 @@ +object L extends Enumeration { + val One, Two, Three = Value +} + +class Foo { + def foo(xs: List[L.Value]) { + import scala.util.control.Breaks.{break, breakable} + println("START for " + xs) + breakable { + for (x <- xs) { + x match { + case L.One => println("ONE"); return + case L.Two => println("TWO") + case L.Three => println("THREE"); break + } + } + } + println("FINISH") + } +} + +object Test { + def main(args: Array[String]) { + val f = new Foo() + val l = List(L.Two, L.Two, L.One, L.Three) + f.foo(l) + } +} diff --git a/test/files/run/t5629.check b/test/files/run/t5629.check new file mode 100644 index 0000000000..6a2d630f4e --- /dev/null +++ b/test/files/run/t5629.check @@ -0,0 +1,2 @@ +int child got: 33 +any child got: 33 diff --git a/test/files/run/t5629.scala b/test/files/run/t5629.scala new file mode 100644 index 0000000000..69feddd3a5 --- /dev/null +++ b/test/files/run/t5629.scala @@ -0,0 +1,36 @@ + + + +import scala.{specialized => spec} + + + +trait GrandParent[@spec(Int) -A] { + def foo(a: A): Unit + def bar[B <: A](b: B): Unit = println("grandparent got: %s" format b) +} + + +trait Parent[@spec(Int) -A] extends GrandParent[A] { + def foo(a: A) = bar(a) +} + + +class IntChild extends Parent[Int] { + override def bar[B <: Int](b: B): Unit = println("int child got: %s" format b) +} + + +class AnyChild extends Parent[Any] { + override def bar[B <: Any](b: B): Unit = println("any child got: %s" format b) +} + + +object Test { + + def main(args: Array[String]) { + new IntChild().foo(33) + new AnyChild().foo(33) + } + +} diff --git a/test/files/run/t5629b.check b/test/files/run/t5629b.check new file mode 100644 index 0000000000..1bc0248c3d --- /dev/null +++ b/test/files/run/t5629b.check @@ -0,0 +1,10 @@ +=== pf(1): +MySmartPF.apply entered... +newPF.applyOrElse entered... +default +scala.MatchError: () (of class scala.runtime.BoxedUnit) +=== pf(42): +MySmartPF.apply entered... +newPF.applyOrElse entered... +ok +=== done diff --git a/test/files/run/t5629b.scala b/test/files/run/t5629b.scala new file mode 100644 index 0000000000..6c908081b9 --- /dev/null +++ b/test/files/run/t5629b.scala @@ -0,0 +1,41 @@ + + + + + +object Test extends App { + + trait MyPF[@specialized(Int) -A] extends (A => Unit) { + def isDefinedAt(x: A): Boolean + def applyOrElse[A1 <: A](x: A1, default: A1 => Unit): Unit = { + println("MyPF.applyOrElse entered...") + if (isDefinedAt(x)) apply(x) else default(x) + } + } + + trait MySmartPF[@specialized(Int) -A] extends MyPF[A] { + def apply(x: A): Unit = { + println("MySmartPF.apply entered...") + applyOrElse(x, { _: Any => throw new MatchError }) + } + } + + type T = Int + //type T = Any + + def newPF(test: T): MyPF[T] = new MySmartPF[T] { + def isDefinedAt(x: T): Boolean = x != test + override def applyOrElse[A1 <: T](x: A1, default: A1 => Unit): Unit = { + println("newPF.applyOrElse entered...") + if (x != test) { println("ok"); () } else { println("default"); default(x) } + } + } + + val pf = newPF(1) + println("=== pf(1):") + try { pf(1) } catch { case x => println(x) } + println("=== pf(42):") + pf(42) + println("=== done") + +} diff --git a/test/files/run/t5655.check b/test/files/run/t5655.check new file mode 100644 index 0000000000..43ebd50e7a --- /dev/null +++ b/test/files/run/t5655.check @@ -0,0 +1,30 @@ +Type in expressions to have them evaluated. +Type :help for more information. + +scala> + +scala> object x { def x={} } +defined module x + +scala> import x._ +import x._ + +scala> x +<console>:12: error: reference to x is ambiguous; +it is imported twice in the same scope by +import x._ +and import x + x + ^ + +scala> x +<console>:12: error: reference to x is ambiguous; +it is imported twice in the same scope by +import x._ +and import x + x + ^ + +scala> + +scala> diff --git a/test/files/run/t5655.scala b/test/files/run/t5655.scala new file mode 100644 index 0000000000..b15feb788e --- /dev/null +++ b/test/files/run/t5655.scala @@ -0,0 +1,10 @@ +import scala.tools.partest.ReplTest + +object Test extends ReplTest { + def code = """ +object x { def x={} } +import x._ +x +x + """ +} diff --git a/test/files/run/t5656.check b/test/files/run/t5656.check new file mode 100644 index 0000000000..9543ee799e --- /dev/null +++ b/test/files/run/t5656.check @@ -0,0 +1 @@ +List(1, 2, 3)_List(a, b, c)
\ No newline at end of file diff --git a/test/files/run/t5656.scala b/test/files/run/t5656.scala new file mode 100644 index 0000000000..f5ea147a4e --- /dev/null +++ b/test/files/run/t5656.scala @@ -0,0 +1,11 @@ + + + + +object Test { + + def main(args: Array[String]) { + println(Seq(List('1', '2', '3'), List('a', 'b', 'c')).view.addString(new StringBuilder, "_")) + } + +} diff --git a/test/files/run/t5688.check b/test/files/run/t5688.check new file mode 100644 index 0000000000..2c84f9e2ef --- /dev/null +++ b/test/files/run/t5688.check @@ -0,0 +1 @@ +Vector(ta, tb, tab) diff --git a/test/files/run/t5688.scala b/test/files/run/t5688.scala new file mode 100644 index 0000000000..f99bfb47d3 --- /dev/null +++ b/test/files/run/t5688.scala @@ -0,0 +1,23 @@ +object Test extends App { + trait T + + trait TA + trait TB + + class A extends T with TA + class B extends T with TB + class AB extends T with TA with TB + // Matching on _: TA with TB + + val li: Vector[T] = Vector(new A, new B, new AB) + + val matched = (for (l <- li) yield { + l match { + case _: TA with TB => "tab" + case _: TA => "ta" + case _: TB => "tb" + } + }) + + println(matched) +}
\ No newline at end of file diff --git a/test/files/run/tuple-zipped.scala b/test/files/run/tuple-zipped.scala index a9851346bc..b197183844 100644 --- a/test/files/run/tuple-zipped.scala +++ b/test/files/run/tuple-zipped.scala @@ -15,14 +15,14 @@ object Test { def main(args: Array[String]): Unit = { for (cc1 <- xss1 ; cc2 <- xss2) { - val sum1 = (cc1, cc2).zip map { case (x, y) => x + y } sum + val sum1 = (cc1, cc2).zipped map { case (x, y) => x + y } sum val sum2 = (cc1, cc2).zipped map (_ + _) sum assert(sum1 == sum2) } for (cc1 <- xss1 ; cc2 <- xss2 ; cc3 <- xss3) { - val sum1 = (cc1, cc2, cc3).zip map { case (x, y, z) => x + y + z } sum + val sum1 = (cc1, cc2, cc3).zipped map { case (x, y, z) => x + y + z } sum val sum2 = (cc1, cc2, cc3).zipped map (_ + _ + _) sum assert(sum1 == sum2) diff --git a/test/files/run/virtpatmat_staging.flags b/test/files/run/virtpatmat_staging.flags index 3f5a3100e4..48fd867160 100644 --- a/test/files/run/virtpatmat_staging.flags +++ b/test/files/run/virtpatmat_staging.flags @@ -1 +1 @@ - -Xexperimental +-Xexperimental diff --git a/test/pending/neg/t1557.scala b/test/pending/neg/t1557.scala new file mode 100644 index 0000000000..ba93b45fad --- /dev/null +++ b/test/pending/neg/t1557.scala @@ -0,0 +1,18 @@ +object Test extends App { + trait A + trait B extends A + + trait C { + trait D { type T >: B <: A } + val y: (D with this.type)#T = new B { } + } + + class D extends C { + trait E + type T = E + def frob(arg : E) : E = arg + frob(y) + } + + new D +}
\ No newline at end of file diff --git a/test/pending/neg/t2066.scala b/test/pending/neg/t2066.scala new file mode 100644 index 0000000000..46177b19f7 --- /dev/null +++ b/test/pending/neg/t2066.scala @@ -0,0 +1,16 @@ +object Test extends App { + trait A { + def f[T[_]](x : T[Int]) : T[Any] + } + + class B extends A { + def f[T[+_]](x : T[Int]) : T[Any] = x + } + + class P[Y](var y : Y) + + val p = new P(1) + val palias = (new B():A).f[P](p) + palias.y = "hello" + val z: Int = p.y +}
\ No newline at end of file diff --git a/test/pending/neg/t5618.check b/test/pending/neg/t5618.check new file mode 100644 index 0000000000..118e812ae4 --- /dev/null +++ b/test/pending/neg/t5618.check @@ -0,0 +1,7 @@ +t5618.scala:12: error: could not find implicit value for parameter class1: Class1 + val class2 = new Class2 + ^ +t5618.scala:18: error: could not find implicit value for parameter class1: Class1 + val class2 = new Class2 + ^ +two errors found
\ No newline at end of file diff --git a/test/pending/neg/t5618.scala b/test/pending/neg/t5618.scala new file mode 100644 index 0000000000..66e06787f1 --- /dev/null +++ b/test/pending/neg/t5618.scala @@ -0,0 +1,27 @@ + + + + +case class Class1 + + +case class Class2(implicit class1: Class1) + + +object Test1 { + val class2 = new Class2 + implicit val class1 = new Class1 +} + + +object Test2 { + val class2 = new Class2 + implicit val class1: Class1 = new Class1 +} + + +object Test3 { + implicit val class1 = new Class1 + val class2 = new Class2 +} + diff --git a/test/pending/pos/t4683.scala b/test/pending/pos/t4683.scala new file mode 100644 index 0000000000..7af7024159 --- /dev/null +++ b/test/pending/pos/t4683.scala @@ -0,0 +1,11 @@ + + + + +class DelayedInitTest { + def a = () + class B extends DelayedInit { + a + def delayedInit(body: => Unit) = () + } +} diff --git a/test/pending/pos/t5399.scala b/test/pending/pos/t5399.scala index d8c1d5e51c..89caba39c1 100644 --- a/test/pending/pos/t5399.scala +++ b/test/pending/pos/t5399.scala @@ -1,15 +1,8 @@ class Test { - type AnyCyclic = Execute[Task]#CyclicException[_] + class A[T] + class B[T](val a: A[T]) - trait Task[T] + case class CaseClass[T](x: T) - trait Execute[A[_] <: AnyRef] { - class CyclicException[T](val caller: A[T], val target: A[T]) - } - - def convertCyclic(c: AnyCyclic): String = - (c.caller, c.target) match { - case (caller: Task[_], target: Task[_]) => "bazinga!" - } + def break(existB: B[_]) = CaseClass(existB.a) match { case CaseClass(_) => } } - diff --git a/test/pending/pos/t5399a.scala b/test/pending/pos/t5399a.scala new file mode 100644 index 0000000000..4ebd85ad03 --- /dev/null +++ b/test/pending/pos/t5399a.scala @@ -0,0 +1,19 @@ +class Foo { + trait Init[T] + class ScopedKey[T] extends Init[T] + + trait Setting[T] { + val key: ScopedKey[T] + } + + case class ScopedKey1[T](val foo: Init[T]) extends ScopedKey[T] + + val scalaHome: Setting[Option[String]] = null + val scalaVersion: Setting[String] = null + + def testPatternMatch(s: Setting[_]) { + s.key match { + case ScopedKey1(scalaHome.key | scalaVersion.key) => () + } + } +} diff --git a/test/pending/pos/t5503.flags b/test/pending/pos/t5503.flags new file mode 100644 index 0000000000..e8fb65d50c --- /dev/null +++ b/test/pending/pos/t5503.flags @@ -0,0 +1 @@ +-Xfatal-warnings
\ No newline at end of file diff --git a/test/pending/pos/t5503.scala b/test/pending/pos/t5503.scala new file mode 100644 index 0000000000..8a1925df1f --- /dev/null +++ b/test/pending/pos/t5503.scala @@ -0,0 +1,18 @@ +trait A { + type Type + type MethodType <: Type + + val MethodType: MethodTypeExtractor = null + + abstract class MethodTypeExtractor { + def unapply(tpe: MethodType): Option[(Any, Any)] + } +} + +object Test { + val a: A = null + + def foo(tpe: a.Type) = tpe match { + case a.MethodType(_, _) => + } +}
\ No newline at end of file diff --git a/test/pending/pos/t5521.scala b/test/pending/pos/t5521.scala new file mode 100644 index 0000000000..dc025d0945 --- /dev/null +++ b/test/pending/pos/t5521.scala @@ -0,0 +1,3 @@ +class Foo { type Bar } + +class Quux(val foo: Foo)(val bar: foo.Bar)
\ No newline at end of file diff --git a/test/pending/pos/t5534.scala b/test/pending/pos/t5534.scala new file mode 100644 index 0000000000..834c4fd68d --- /dev/null +++ b/test/pending/pos/t5534.scala @@ -0,0 +1,11 @@ +object Phrase extends Enumeration { + type Phrase = Value + val PHRASE1 = Value("My phrase 1") + val PHRASE2 = Value("My phrase 2") +} + +class Entity(text:String) + +object Test { + val myMapWithPhrases = Phrase.values.map(p => (p -> new Entity(p.toString))).toMap +}
\ No newline at end of file diff --git a/test/pending/pos/t5559.scala b/test/pending/pos/t5559.scala new file mode 100644 index 0000000000..586e52cd4f --- /dev/null +++ b/test/pending/pos/t5559.scala @@ -0,0 +1,23 @@ + + + + +object Test { + + class Inv[T] + + def foo[S](interface: Inv[_ >: S], implementation: Inv[S]) {} + + def bar[R, T <: R](interface: Inv[R], impl: Inv[T]) { + //foo[T](interface, impl) + foo(interface, impl) // Compilation Error + // Inv[R] <: Inv[_ >: S] + // Inv[T] <: Inv[S] + // ---------------------- + // R >: S + // T == S + } + +} + + diff --git a/test/pending/pos/t5564.scala b/test/pending/pos/t5564.scala new file mode 100644 index 0000000000..1783a903ed --- /dev/null +++ b/test/pending/pos/t5564.scala @@ -0,0 +1,5 @@ +trait C + +class Foo[@specialized(Int) T, A] { + def bar[B >: A <: C]: T = ??? +} diff --git a/test/pending/pos/t5579.scala b/test/pending/pos/t5579.scala new file mode 100644 index 0000000000..a1ee077fe7 --- /dev/null +++ b/test/pending/pos/t5579.scala @@ -0,0 +1,29 @@ +import language.existentials + +class Result[+A] + +case class Success[A](x: A) extends Result[A] + +class Apply[A] + +object Apply { + def apply[A](f: Int => Result[A]): Apply[A] = new Apply[A] +} + +object TestUnit { + //Error is here: + def goo = Apply { i => + i match { + case 1 => Success(Some(1)) + case _ => Success(None) + } + } + + //If type is defined explicitly (which I wanted from compiler to infer), then all is ok + def foo = Apply[t forSome { type t >: Some[Int] with None.type <: Option[Int] }] { i => + i match { + case 1 => Success(Some(1)) + case _ => Success(None) + } + } +} diff --git a/test/pending/pos/t5585.scala b/test/pending/pos/t5585.scala new file mode 100644 index 0000000000..5d3eb86111 --- /dev/null +++ b/test/pending/pos/t5585.scala @@ -0,0 +1,18 @@ +class Result[+A] + +case class Success[A](x: A) extends Result[A] + +class Apply[A] + +object Apply { + def apply[A](f: Int => Result[A]): Apply[A] = new Apply[A] +} + +object TestUnit { + def goo : Apply[Option[Int]] = Apply { i => + val p = i match { + case 1 => Success(Some(1)) + case _ => Success(None) + } + } +}
\ No newline at end of file diff --git a/test/pending/pos/t5606.scala b/test/pending/pos/t5606.scala new file mode 100644 index 0000000000..2545271e32 --- /dev/null +++ b/test/pending/pos/t5606.scala @@ -0,0 +1,9 @@ + + + + + + + + +case class CaseTest[_](someData:String) diff --git a/test/pending/pos/t5639/Bar.scala b/test/pending/pos/t5639/Bar.scala new file mode 100644 index 0000000000..f577500acd --- /dev/null +++ b/test/pending/pos/t5639/Bar.scala @@ -0,0 +1,7 @@ +package pack.age + +import pack.age.Implicits._ + +object Quux { + def baz : Baz = 1 +} diff --git a/test/pending/pos/t5639/Foo.scala b/test/pending/pos/t5639/Foo.scala new file mode 100644 index 0000000000..6602150661 --- /dev/null +++ b/test/pending/pos/t5639/Foo.scala @@ -0,0 +1,7 @@ +package pack.age + +class Baz + +object Implicits { + implicit def Baz(n: Int): Baz = new Baz +} diff --git a/test/pending/pos/t5654.scala b/test/pending/pos/t5654.scala new file mode 100644 index 0000000000..eb711a5f37 --- /dev/null +++ b/test/pending/pos/t5654.scala @@ -0,0 +1,4 @@ +case class Bomb(a: Array[_]) +case class Bomb2(a: Array[T] forSome { type T }) +class Okay1(a: Array[_]) +case class Okay2(s: Seq[_])
\ No newline at end of file diff --git a/test/pending/pos/t5712.scala b/test/pending/pos/t5712.scala new file mode 100644 index 0000000000..31f365028a --- /dev/null +++ b/test/pending/pos/t5712.scala @@ -0,0 +1,14 @@ +import scala.tools.nsc._ + +object Test { + + // works + def mkReifier(global: Global)(typer: global.analyzer.Typer) = typer + +/* +<console>:10: error: not found: value global + class Reifier(global: Global)(typer: global.analyzer.Typer) { } +*/ + class Reifier(global: Global)(typer: global.analyzer.Typer) { } + +} diff --git a/test/pending/presentation/t5708.check b/test/pending/presentation/t5708.check new file mode 100644 index 0000000000..9d944d6cfc --- /dev/null +++ b/test/pending/presentation/t5708.check @@ -0,0 +1,81 @@ +reload: Completions.scala + +askTypeCompletion at Completions.scala(9,9) +================================================================================ +[response] aksTypeCompletion at (9,9) +retrieved 38 members +[accessible: true] `method !=(x$1: Any)Boolean` +[accessible: true] `method !=(x$1: AnyRef)Boolean` +[accessible: true] `method ##()Int` +[accessible: true] `method +(other: String)String` +[accessible: true] `method ->[B](y: B)(test.Compat.type, B)` +[accessible: true] `method ==(x$1: Any)Boolean` +[accessible: true] `method ==(x$1: AnyRef)Boolean` +[accessible: true] `method asInstanceOf[T0]=> T0` +[accessible: true] `method ensuring(cond: Boolean)test.Compat.type` +[accessible: true] `method ensuring(cond: Boolean, msg: => Any)test.Compat.type` +[accessible: true] `method ensuring(cond: test.Compat.type => Boolean)test.Compat.type` +[accessible: true] `method ensuring(cond: test.Compat.type => Boolean, msg: => Any)test.Compat.type` +[accessible: true] `method eq(x$1: AnyRef)Boolean` +[accessible: true] `method equals(x$1: Any)Boolean` +[accessible: true] `method formatted(fmtstr: String)String` +[accessible: true] `method hashCode()Int` +[accessible: true] `method isInstanceOf[T0]=> Boolean` +[accessible: true] `method ne(x$1: AnyRef)Boolean` +[accessible: true] `method notify()Unit` +[accessible: true] `method notifyAll()Unit` +[accessible: true] `method synchronized[T0](x$1: T0)T0` +[accessible: true] `method toString()String` +[accessible: true] `method wait()Unit` +[accessible: true] `method wait(x$1: Long)Unit` +[accessible: true] `method wait(x$1: Long, x$2: Int)Unit` +[accessible: true] `method x=> test.Compat.type` +[accessible: true] `method →[B](y: B)(test.Compat.type, B)` +[accessible: true] `lazy value fooInt` +[accessible: false] `method clone()Object` +[accessible: false] `method finalize()Unit` +[accessible: true] `value CONST_STRINGString("constant")` +[accessible: false] `value __leftOfArrowtest.Compat.type` +[accessible: false] `value __resultOfEnsuringtest.Compat.type` +[accessible: false] `value selfAny` +================================================================================ + +askTypeCompletion at Completions.scala(10,9) +================================================================================ +[response] aksTypeCompletion at (10,9) +retrieved 38 members +[accessible: true] `method !=(x$1: Any)Boolean` +[accessible: true] `method !=(x$1: AnyRef)Boolean` +[accessible: true] `method ##()Int` +[accessible: true] `method +(other: String)String` +[accessible: true] `method ->[B](y: B)(test.Compat.type, B)` +[accessible: true] `method ==(x$1: Any)Boolean` +[accessible: true] `method ==(x$1: AnyRef)Boolean` +[accessible: true] `method asInstanceOf[T0]=> T0` +[accessible: true] `method ensuring(cond: Boolean)test.Compat.type` +[accessible: true] `method ensuring(cond: Boolean, msg: => Any)test.Compat.type` +[accessible: true] `method ensuring(cond: test.Compat.type => Boolean)test.Compat.type` +[accessible: true] `method ensuring(cond: test.Compat.type => Boolean, msg: => Any)test.Compat.type` +[accessible: true] `method eq(x$1: AnyRef)Boolean` +[accessible: true] `method equals(x$1: Any)Boolean` +[accessible: true] `method formatted(fmtstr: String)String` +[accessible: true] `method hashCode()Int` +[accessible: true] `method isInstanceOf[T0]=> Boolean` +[accessible: true] `method ne(x$1: AnyRef)Boolean` +[accessible: true] `method notify()Unit` +[accessible: true] `method notifyAll()Unit` +[accessible: true] `method synchronized[T0](x$1: T0)T0` +[accessible: true] `method toString()String` +[accessible: true] `method wait()Unit` +[accessible: true] `method wait(x$1: Long)Unit` +[accessible: true] `method wait(x$1: Long, x$2: Int)Unit` +[accessible: true] `method x=> test.Compat.type` +[accessible: true] `method →[B](y: B)(test.Compat.type, B)` +[accessible: true] `lazy value fooInt` +[accessible: false] `method clone()Object` +[accessible: false] `method finalize()Unit` +[accessible: true] `value CONST_STRINGString("constant")` +[accessible: false] `value __leftOfArrowtest.Compat.type` +[accessible: false] `value __resultOfEnsuringtest.Compat.type` +[accessible: false] `value selfAny` +================================================================================ diff --git a/test/pending/presentation/t5708/Test.scala b/test/pending/presentation/t5708/Test.scala new file mode 100644 index 0000000000..96e758d974 --- /dev/null +++ b/test/pending/presentation/t5708/Test.scala @@ -0,0 +1,5 @@ +import scala.tools.nsc.interactive.tests.InteractiveTest + +object Test extends InteractiveTest { + +}
\ No newline at end of file diff --git a/test/pending/presentation/t5708/src/Completions.scala b/test/pending/presentation/t5708/src/Completions.scala new file mode 100644 index 0000000000..cc41492df7 --- /dev/null +++ b/test/pending/presentation/t5708/src/Completions.scala @@ -0,0 +1,11 @@ +package test + +object Compat { + final val CONST_STRING = "constant" + lazy val foo = 4 +} + +class Foo { + Compat./*!*/CONST_STRING // its 'accessible' flag is false + Compat./*!*/foo // its 'accessible' flag is false +} diff --git a/test/pending/run/t4560.scala b/test/pending/run/t4560.scala new file mode 100644 index 0000000000..fe62136319 --- /dev/null +++ b/test/pending/run/t4560.scala @@ -0,0 +1,9 @@ +trait B { + this: Test.type => + + def y = new { def f() = () } + def fail() = y.f() +} +object Test extends B { + def main(args: Array[String]): Unit = fail() +}
\ No newline at end of file diff --git a/test/pending/run/t4728.check b/test/pending/run/t4728.check new file mode 100644 index 0000000000..7a754f414c --- /dev/null +++ b/test/pending/run/t4728.check @@ -0,0 +1,2 @@ +1 +2
\ No newline at end of file diff --git a/test/pending/run/t4728.scala b/test/pending/run/t4728.scala new file mode 100644 index 0000000000..36f7860613 --- /dev/null +++ b/test/pending/run/t4728.scala @@ -0,0 +1,11 @@ +class X +class Y extends X +object Ambiguous { + def f(x: X) = 1 + def f(ys: Y*) = 2 +} + +object Test extends App { + println(Ambiguous.f(new X)) + println(Ambiguous.f(new Y)) +}
\ No newline at end of file diff --git a/test/pending/run/t5610a.check b/test/pending/run/t5610a.check new file mode 100644 index 0000000000..2aa46b3b91 --- /dev/null +++ b/test/pending/run/t5610a.check @@ -0,0 +1 @@ +Stroke a kitten diff --git a/test/pending/run/t5610a.scala b/test/pending/run/t5610a.scala new file mode 100644 index 0000000000..f20b295762 --- /dev/null +++ b/test/pending/run/t5610a.scala @@ -0,0 +1,19 @@ +object Test extends App { + class Result(_str: => String) { + lazy val str = _str + } + + def foo(str: => String)(i: Int) = new Result(str) + + def bar(f: Int => Result) = f(42) + + var test: String = null + val result = bar(foo(test)) + test = "bar" + + if (result.str == null) { + println("Destroy ALL THE THINGS!!!") + } else { + println("Stroke a kitten") + } +}
\ No newline at end of file diff --git a/test/pending/run/t5610b.check b/test/pending/run/t5610b.check new file mode 100644 index 0000000000..2aa46b3b91 --- /dev/null +++ b/test/pending/run/t5610b.check @@ -0,0 +1 @@ +Stroke a kitten diff --git a/test/pending/run/t5610b.scala b/test/pending/run/t5610b.scala new file mode 100644 index 0000000000..d922d6333c --- /dev/null +++ b/test/pending/run/t5610b.scala @@ -0,0 +1,21 @@ +object Bug { + def main(args: Array[String]) { + var test: String = null + val result = bar(foo(test)) + test = "bar" + + if (result.str == null) { + println("Destroy ALL THE THINGS!!!") + } else { + println("Stroke a kitten") + } + } + + class Result(_str: => String) { + lazy val str = _str + } + + def foo(str: => String)(i: Int) = new Result(str) + + def bar(f: Int => Result) = f(42) +}
\ No newline at end of file diff --git a/test/pending/run/t5676.flags b/test/pending/run/t5676.flags new file mode 100644 index 0000000000..e1b37447c9 --- /dev/null +++ b/test/pending/run/t5676.flags @@ -0,0 +1 @@ +-Xexperimental
\ No newline at end of file diff --git a/test/pending/run/t5676.scala b/test/pending/run/t5676.scala new file mode 100644 index 0000000000..3ff498eaa2 --- /dev/null +++ b/test/pending/run/t5676.scala @@ -0,0 +1,25 @@ + + + + +class Bar[T] + + +class Foo[T] { + object A extends Bar[T] +} + + +class Baz[S] extends Foo[S] { + override object A extends Bar[S] +} + + +object Test { + + def main(a: Array[String]) { + val b = new Baz[Any] + println(b) + } + +} diff --git a/test/pending/run/t5695.check b/test/pending/run/t5695.check new file mode 100644 index 0000000000..d50069ab4f --- /dev/null +++ b/test/pending/run/t5695.check @@ -0,0 +1,2 @@ +.. +.. diff --git a/test/pending/run/t5695/part_1.scala b/test/pending/run/t5695/part_1.scala new file mode 100644 index 0000000000..b8e8f8e52f --- /dev/null +++ b/test/pending/run/t5695/part_1.scala @@ -0,0 +1,12 @@ +import language.experimental.macros +import scala.reflect.makro.Context + +object Defs { + + def mkInt = macro mkIntImpl + def mkIntImpl(c: Context): c.Expr[Any] = { + println(c.enclosingApplication) + c.reify{ 23 } + } + +} diff --git a/test/pending/run/t5695/part_2.scala b/test/pending/run/t5695/part_2.scala new file mode 100644 index 0000000000..d34219437d --- /dev/null +++ b/test/pending/run/t5695/part_2.scala @@ -0,0 +1,8 @@ +import Defs._ + +object Test extends App { + + val i1 = mkInt + val i2 = identity(mkInt) + +} diff --git a/test/pending/run/t5698/client.scala b/test/pending/run/t5698/client.scala new file mode 100644 index 0000000000..de672c1809 --- /dev/null +++ b/test/pending/run/t5698/client.scala @@ -0,0 +1,9 @@ +package client + + + +object Client extends App { + val peer = actors.remote.Node("localhost", 23456) + val a = actors.remote.RemoteActor.select(peer, 'test) + a ! server.TestMsg +} diff --git a/test/pending/run/t5698/server.scala b/test/pending/run/t5698/server.scala new file mode 100644 index 0000000000..e8f3cea225 --- /dev/null +++ b/test/pending/run/t5698/server.scala @@ -0,0 +1,22 @@ +package server + + + +object Server extends App { + + class ServerActor extends actors.Actor { + def act() { + actors.remote.RemoteActor.alive(23456) + actors.remote.RemoteActor.register('test, actors.Actor.self) + loop { + react { + case TestMsg => println("Yay!") + } + } + } + } + + val a = new ServerActor + a.start() + +} diff --git a/test/pending/run/t5698/testmsg.scala b/test/pending/run/t5698/testmsg.scala new file mode 100644 index 0000000000..004ff0b8c7 --- /dev/null +++ b/test/pending/run/t5698/testmsg.scala @@ -0,0 +1,5 @@ +package server + + + +case object TestMsg diff --git a/test/pending/run/t5722.scala b/test/pending/run/t5722.scala new file mode 100644 index 0000000000..21ace060d6 --- /dev/null +++ b/test/pending/run/t5722.scala @@ -0,0 +1,6 @@ +object Test extends App { + def foo[T: ClassTag] = println(classOf[T]) + foo[Int] + foo[Array[Int]] + foo[List[Int]] +}
\ No newline at end of file diff --git a/test/pending/run/t5726a.scala b/test/pending/run/t5726a.scala new file mode 100644 index 0000000000..24d828a159 --- /dev/null +++ b/test/pending/run/t5726a.scala @@ -0,0 +1,17 @@ +import language.dynamics + +class DynamicTest extends Dynamic { + def selectDynamic(name: String) = s"value of $name" + def updateDynamic(name: String)(value: Any) { + println(s"You have just updated property '$name' with value: $value") + } +} + +object MyApp extends App { + def testing() { + val test = new DynamicTest + test.firstName = "John" + } + + testing() +}
\ No newline at end of file diff --git a/test/pending/run/t5726b.scala b/test/pending/run/t5726b.scala new file mode 100644 index 0000000000..839dcf40b5 --- /dev/null +++ b/test/pending/run/t5726b.scala @@ -0,0 +1,16 @@ +import language.dynamics + +class DynamicTest extends Dynamic { + def updateDynamic(name: String)(value: Any) { + println(s"You have just updated property '$name' with value: $value") + } +} + +object MyApp extends App { + def testing() { + val test = new DynamicTest + test.firstName = "John" + } + + testing() +}
\ No newline at end of file diff --git a/test/scaladoc/resources/package-object-res.scala b/test/scaladoc/resources/package-object-res.scala new file mode 100644 index 0000000000..17d5c0a499 --- /dev/null +++ b/test/scaladoc/resources/package-object-res.scala @@ -0,0 +1,14 @@ +/** This package have A and B. + */ +package test { + trait A { def hi = "hello" } + trait B { def bye = "bye!" } +} + +/** This package object extends A and B. + */ +package object test extends A with B { + override def hi = "good morning!" + override def bye = "good bye!" + protected def thank = "thank you!" +} diff --git a/test/scaladoc/run/package-object.check b/test/scaladoc/run/package-object.check new file mode 100644 index 0000000000..4297847e73 --- /dev/null +++ b/test/scaladoc/run/package-object.check @@ -0,0 +1,2 @@ +List((test.B,B), (test.A,A), (scala.AnyRef,AnyRef), (scala.Any,Any)) +Done. diff --git a/test/scaladoc/run/package-object.scala b/test/scaladoc/run/package-object.scala new file mode 100644 index 0000000000..fd36a8df7b --- /dev/null +++ b/test/scaladoc/run/package-object.scala @@ -0,0 +1,15 @@ +import scala.tools.nsc.doc.model._ +import scala.tools.partest.ScaladocModelTest +import language._ + +object Test extends ScaladocModelTest { + override def resourceFile = "package-object-res.scala" + override def scaladocSettings = "" + def testModel(root: Package) = { + import access._ + + val p = root._package("test") + println(p.linearization) + } +} + diff --git a/test/scaladoc/run/usecase-var-expansion.check b/test/scaladoc/run/usecase-var-expansion.check new file mode 100644 index 0000000000..3faa4735c0 --- /dev/null +++ b/test/scaladoc/run/usecase-var-expansion.check @@ -0,0 +1,4 @@ +newSource:8: error: Incorrect variable expansion for $Coll in use case. Does the variable expand to wiki syntax when documenting class Test2? + * @usecase def foo: $Coll[T] + ^ +Done. diff --git a/test/scaladoc/run/usecase-var-expansion.scala b/test/scaladoc/run/usecase-var-expansion.scala new file mode 100644 index 0000000000..e86ea4a835 --- /dev/null +++ b/test/scaladoc/run/usecase-var-expansion.scala @@ -0,0 +1,26 @@ +import scala.tools.nsc.doc.model._ +import scala.tools.partest.ScaladocModelTest +import language._ + +object Test extends ScaladocModelTest { + + override def code = """ + /** + * @define Coll `Test` + */ + class Test[T] { + /** + * member $Coll + * @usecase def foo: $Coll[T] + * usecase $Coll + */ + def foo(implicit err: String): Test[T] = sys.error(err) + } + + /** @define Coll {{{some `really` < !! >> invalid $$$ thing}}} */ + class Test2[T] extends Test[Int] + """ + + def scaladocSettings = "" + def testModel(root: Package) = () +} |