diff options
Diffstat (limited to 'test/files/run')
439 files changed, 2803 insertions, 624 deletions
diff --git a/test/files/run/Course-2002-01.check b/test/files/run/Course-2002-01.check index 17b30bf3c2..16b491d6e2 100644 --- a/test/files/run/Course-2002-01.check +++ b/test/files/run/Course-2002-01.check @@ -1,3 +1,6 @@ +Course-2002-01.scala:41: warning: method loop in object M0 does nothing other than call itself recursively + def loop: Int = loop; + ^ 232 667 11 diff --git a/test/files/run/Meter.check b/test/files/run/Meter.check index b7e2eac125..c79c51a294 100644 --- a/test/files/run/Meter.check +++ b/test/files/run/Meter.check @@ -1,3 +1,6 @@ +Meter.scala:72: warning: a.Meter and Int are unrelated: they will never compare equal + println("x == 1: "+(x == 1)) + ^ 2.0 4.0m false diff --git a/test/files/run/MeterCaseClass.check b/test/files/run/MeterCaseClass.check index 2528753657..2782704f9f 100644 --- a/test/files/run/MeterCaseClass.check +++ b/test/files/run/MeterCaseClass.check @@ -1,3 +1,6 @@ +MeterCaseClass.scala:69: warning: comparing values of types a.Meter and Int using `==' will always yield false + println("x == 1: "+(x == 1)) + ^ 2.0 Meter(4.0) false diff --git a/test/files/run/Predef.readLine.scala b/test/files/run/Predef.readLine.scala index 9f07936638..54809f8071 100644 --- a/test/files/run/Predef.readLine.scala +++ b/test/files/run/Predef.readLine.scala @@ -1,4 +1,5 @@ import java.io.StringReader +import scala.io.ReadStdin.readLine object Test extends App { Console.withIn(new StringReader("")) { @@ -7,4 +8,4 @@ object Test extends App { readLine("%s prompt\n", "fancy") readLine("%s %s prompt\n", "immensely", "fancy") } -}
\ No newline at end of file +} diff --git a/test/files/run/SymbolsTest.scala b/test/files/run/SymbolsTest.scala index 53caa5e62f..d5948ea168 100644 --- a/test/files/run/SymbolsTest.scala +++ b/test/files/run/SymbolsTest.scala @@ -1,6 +1,5 @@ - - +import scala.language.reflectiveCalls class Slazz { val s1 = 'myFirstSymbol diff --git a/test/files/run/WeakHashSetTest.scala b/test/files/run/WeakHashSetTest.scala new file mode 100644 index 0000000000..3c8f380150 --- /dev/null +++ b/test/files/run/WeakHashSetTest.scala @@ -0,0 +1,174 @@ +object Test { + def main(args: Array[String]) { + val test = scala.reflect.internal.util.WeakHashSetTest + test.checkEmpty + test.checkPlusEquals + test.checkPlusEqualsCollisions + test.checkRehashing + test.checkRehashCollisions + test.checkFindOrUpdate + test.checkMinusEquals + test.checkMinusEqualsCollisions + test.checkClear + test.checkIterator + test.checkIteratorCollisions + + // This test is commented out because it relies on gc behavior which isn't reliable enough in an automated environment + // test.checkRemoveUnreferencedObjects + } +} + +// put the main test object in the same package as WeakHashSet because +// it uses the package private "diagnostics" method +package scala.reflect.internal.util { + + object WeakHashSetTest { + // a class guaranteed to provide hash collisions + case class Collider(x : String) extends Comparable[Collider] with Serializable { + override def hashCode = 0 + def compareTo(y : Collider) = this.x compareTo y.x + } + + // basic emptiness check + def checkEmpty { + val hs = new WeakHashSet[String]() + assert(hs.size == 0) + hs.diagnostics.fullyValidate + } + + // make sure += works + def checkPlusEquals { + val hs = new WeakHashSet[String]() + val elements = List("hello", "goodbye") + elements foreach (hs += _) + assert(hs.size == 2) + assert(hs contains "hello") + assert(hs contains "goodbye") + hs.diagnostics.fullyValidate + } + + // make sure += works when there are collisions + def checkPlusEqualsCollisions { + val hs = new WeakHashSet[Collider]() + val elements = List("hello", "goodbye") map Collider + elements foreach (hs += _) + assert(hs.size == 2) + assert(hs contains Collider("hello")) + assert(hs contains Collider("goodbye")) + hs.diagnostics.fullyValidate + } + + // add a large number of elements to force rehashing and then validate + def checkRehashing { + val size = 200 + val hs = new WeakHashSet[String]() + val elements = (0 until size).toList map ("a" + _) + elements foreach (hs += _) + elements foreach {i => assert(hs contains i)} + hs.diagnostics.fullyValidate + } + + // make sure rehashing works properly when the set is rehashed + def checkRehashCollisions { + val size = 200 + val hs = new WeakHashSet[Collider]() + val elements = (0 until size).toList map {x => Collider("a" + x)} + elements foreach (hs += _) + elements foreach {i => assert(hs contains i)} + hs.diagnostics.fullyValidate + } + + // test that unreferenced objects are removed + // not run in an automated environment because gc behavior can't be relied on + def checkRemoveUnreferencedObjects { + val size = 200 + val hs = new WeakHashSet[Collider]() + val elements = (0 until size).toList map {x => Collider("a" + x)} + elements foreach (hs += _) + // don't throw the following into a retained collection so gc + // can remove them + for (i <- 0 until size) { + hs += Collider("b" + i) + } + System.gc() + Thread.sleep(1000) + assert(hs.size == 200) + elements foreach {i => assert(hs contains i)} + for (i <- 0 until size) { + assert(!(hs contains Collider("b" + i))) + } + hs.diagnostics.fullyValidate + } + + // make sure findOrUpdate returns the originally entered element + def checkFindOrUpdate { + val size = 200 + val hs = new WeakHashSet[Collider]() + val elements = (0 until size).toList map {x => Collider("a" + x)} + elements foreach {x => assert(hs findEntryOrUpdate x eq x)} + for (i <- 0 until size) { + // when we do a lookup the result should be the same reference we + // original put in + assert(hs findEntryOrUpdate(Collider("a" + i)) eq elements(i)) + } + hs.diagnostics.fullyValidate + } + + // check -= functionality + def checkMinusEquals { + val hs = new WeakHashSet[String]() + val elements = List("hello", "goodbye") + elements foreach (hs += _) + hs -= "goodbye" + assert(hs.size == 1) + assert(hs contains "hello") + assert(!(hs contains "goodbye")) + hs.diagnostics.fullyValidate + } + + // check -= when there are collisions + def checkMinusEqualsCollisions { + val hs = new WeakHashSet[Collider] + val elements = List(Collider("hello"), Collider("goodbye")) + elements foreach (hs += _) + hs -= Collider("goodbye") + assert(hs.size == 1) + assert(hs contains Collider("hello")) + assert(!(hs contains Collider("goodbye"))) + hs -= Collider("hello") + assert(hs.size == 0) + assert(!(hs contains Collider("hello"))) + hs.diagnostics.fullyValidate + } + + // check that the clear method actually cleans everything + def checkClear { + val size = 200 + val hs = new WeakHashSet[String]() + val elements = (0 until size).toList map ("a" + _) + elements foreach (hs += _) + hs.clear() + assert(hs.size == 0) + elements foreach {i => assert(!(hs contains i))} + hs.diagnostics.fullyValidate + } + + // check that the iterator covers all the contents + def checkIterator { + val hs = new WeakHashSet[String]() + val elements = (0 until 20).toList map ("a" + _) + elements foreach (hs += _) + assert(elements.iterator.toList.sorted == elements.sorted) + hs.diagnostics.fullyValidate + } + + // check that the iterator covers all the contents even when there is a collision + def checkIteratorCollisions { + val hs = new WeakHashSet[Collider] + val elements = (0 until 20).toList map {x => Collider("a" + x)} + elements foreach (hs += _) + assert(elements.iterator.toList.sorted == elements.sorted) + hs.diagnostics.fullyValidate + } + } +} diff --git a/test/files/run/abstypetags_serialize.scala b/test/files/run/abstypetags_serialize.scala index 93fb5dcd06..6ec97105fe 100644 --- a/test/files/run/abstypetags_serialize.scala +++ b/test/files/run/abstypetags_serialize.scala @@ -1,3 +1,4 @@ +import scala.language.higherKinds import java.io._ import scala.reflect.runtime.universe._ import scala.reflect.runtime.{universe => ru} @@ -30,4 +31,4 @@ object Test extends App { } qwe -}
\ No newline at end of file +} diff --git a/test/files/run/array-existential-bound.scala b/test/files/run/array-existential-bound.scala index bc442d39f7..b397c98111 100644 --- a/test/files/run/array-existential-bound.scala +++ b/test/files/run/array-existential-bound.scala @@ -10,8 +10,8 @@ object Test extends Fooz[Array[Int]] { def main(args: Array[String]): Unit = { println(f1.f0(Array[String]("a", "b"))) - println(f2.f0(1 to 1000 toArray)) + println(f2.f0((1 to 1000).toArray)) println(f3.f0((1 to 1000).toArray[Any])) - println(f4.f0('a' to 'z' toArray)) + println(f4.f0(('a' to 'z').toArray)) } } diff --git a/test/files/run/arrays.check b/test/files/run/arrays.check index b1f7fae1d1..c9a3a87268 100644 --- a/test/files/run/arrays.check +++ b/test/files/run/arrays.check @@ -1 +1,7 @@ +arrays.scala:248: warning: comparing values of types Unit and Unit using `==' will always yield true + check(xs(0) == u0, xs(0), u0); + ^ +arrays.scala:249: warning: comparing values of types Unit and Unit using `==' will always yield true + check(xs(1) == u1, xs(1), u1); + ^ checks: 2302 diff --git a/test/files/run/bitsets.scala b/test/files/run/bitsets.scala index 3bfb8c7ac3..5d49220749 100644 --- a/test/files/run/bitsets.scala +++ b/test/files/run/bitsets.scala @@ -4,6 +4,8 @@ //############################################################################ +import scala.language.postfixOps + object TestMutable { import scala.collection.mutable.BitSet diff --git a/test/files/run/bridges.scala b/test/files/run/bridges.scala index fda86eabc6..eb036bd781 100644 --- a/test/files/run/bridges.scala +++ b/test/files/run/bridges.scala @@ -3588,7 +3588,7 @@ object Test { errors = errors + 1; } } catch { - case exception => { + case exception: Throwable => { Console.print(name + " raised exception " + exception); Console.println; errors = errors + 1; diff --git a/test/files/run/bugs.scala b/test/files/run/bugs.scala index ca598603bb..9d2be42fb7 100644 --- a/test/files/run/bugs.scala +++ b/test/files/run/bugs.scala @@ -444,7 +444,7 @@ object Test { try { test; } catch { - case exception => + case exception: Throwable => Console.print("Exception in thread \"" + Thread.currentThread + "\" " + exception); Console.println; errors += 1 diff --git a/test/files/run/classmanifests_new_alias.scala b/test/files/run/classmanifests_new_alias.scala index 12bd93bab6..777bd5dd6d 100644 --- a/test/files/run/classmanifests_new_alias.scala +++ b/test/files/run/classmanifests_new_alias.scala @@ -1,5 +1,7 @@ + +@deprecated("Suppress warnings", since="2.11") object Test extends App { type CM[T] = ClassManifest[T] println(implicitly[CM[Int]]) println(implicitly[CM[Int]] eq Manifest.Int) -}
\ No newline at end of file +} diff --git a/test/files/run/classmanifests_new_core.scala b/test/files/run/classmanifests_new_core.scala index 63dbfab25c..0a9c58e8e1 100644 --- a/test/files/run/classmanifests_new_core.scala +++ b/test/files/run/classmanifests_new_core.scala @@ -1,4 +1,5 @@ +@deprecated("Suppress warnings", since="2.11") object Test extends App { println(classManifest[Int]) println(classManifest[Int] eq Manifest.Int) -}
\ No newline at end of file +} diff --git a/test/files/run/collections.scala b/test/files/run/collections.scala index 69c40fae80..1e4e8791ac 100644 --- a/test/files/run/collections.scala +++ b/test/files/run/collections.scala @@ -1,5 +1,6 @@ -import collection._ +import scala.collection._ import scala.compat.Platform.currentTime +import scala.language.postfixOps object Test extends App { diff --git a/test/files/run/colltest1.scala b/test/files/run/colltest1.scala index 54adeb7cda..9d77fc413a 100644 --- a/test/files/run/colltest1.scala +++ b/test/files/run/colltest1.scala @@ -1,4 +1,8 @@ -import collection._ +/* + * filter: inliner warning\(s\); re-run with -Yinline-warnings for details + */ +import scala.collection._ +import scala.language.postfixOps object Test extends App { diff --git a/test/files/run/comparable-comparator.scala b/test/files/run/comparable-comparator.scala index ac943c63bb..1707fb6e61 100644 --- a/test/files/run/comparable-comparator.scala +++ b/test/files/run/comparable-comparator.scala @@ -15,7 +15,8 @@ object Test { def compare(p1: C2, p2: C2) = p2.s compareTo p1.s } - val strs = "zip foo bar baz aggle bing bong" split ' ' toList + val words = "zip foo bar baz aggle bing bong" split ' ' + val strs = words.toList val c1s = strs map (x => new C1(x)) val c2s = strs map (x => new C2(x)) diff --git a/test/files/run/compiler-asSeenFrom.scala b/test/files/run/compiler-asSeenFrom.scala index 0d4b504d3c..bd3db0bf66 100644 --- a/test/files/run/compiler-asSeenFrom.scala +++ b/test/files/run/compiler-asSeenFrom.scala @@ -1,6 +1,10 @@ +/* + * filter: inliner warning\(s\); re-run with -Yinline-warnings for details + */ import scala.tools.nsc._ import scala.tools.partest.CompilerTest import scala.collection.{ mutable, immutable, generic } +import scala.language.postfixOps /** It's too messy but it's better than not having it. */ @@ -117,6 +121,5 @@ package ll { println(sigs.mkString(x + " { // after " + ph + "\n ", "\n ", "\n}\n")) } } - true } } diff --git a/test/files/run/concurrent-stream.scala b/test/files/run/concurrent-stream.scala index 42c695964e..9d5ba0428e 100644 --- a/test/files/run/concurrent-stream.scala +++ b/test/files/run/concurrent-stream.scala @@ -1,32 +1,33 @@ // test concurrent calls to Stream.tail +@deprecated("Suppress warnings", since="2.11") object Test { -def slowRange(from: Int, until: Int, cons: (Int, => Stream[Int]) => Stream[Int]): Stream[Int] = { - var current = from - def next: Stream[Int] = { - Thread.sleep(100) - if (current >= until) Stream.empty - else { - val stream = cons(current, next) - current += 1 - stream + def slowRange(from: Int, until: Int, cons: (Int, => Stream[Int]) => Stream[Int]): Stream[Int] = { + var current = from + def next: Stream[Int] = { + Thread.sleep(100) + if (current >= until) Stream.empty + else { + val stream = cons(current, next) + current += 1 + stream + } } + next } - next -} -def testCons(cons: (Int, => Stream[Int]) => Stream[Int]): Unit = { - import scala.actors.Actor._ + def testCons(cons: (Int, => Stream[Int]) => Stream[Int]): Unit = { + import scala.actors.Actor._ - val stream = slowRange(0, 10, cons) - val main = self - actor { main ! stream.toList } - actor { main ! stream.toList } - val eval0 = receive { case list: List[Int] => list } - val eval1 = receive { case list: List[Int] => list } - println("Evaluation 0: " + eval0) - println("Evaluation 1: " + eval1) -} + val stream = slowRange(0, 10, cons) + val main = self + actor { main ! stream.toList } + actor { main ! stream.toList } + val eval0 = receive { case list: List[Int @unchecked] => list } + val eval1 = receive { case list: List[Int @unchecked] => list } + println("Evaluation 0: " + eval0) + println("Evaluation 1: " + eval1) + } def main(args: Array[String]) { println("Testing standard cons.") diff --git a/test/files/run/contrib674.check b/test/files/run/contrib674.check new file mode 100644 index 0000000000..78325c1810 --- /dev/null +++ b/test/files/run/contrib674.check @@ -0,0 +1,3 @@ +contrib674.scala:15: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses + 1 + ^ diff --git a/test/files/run/contrib674.scala b/test/files/run/contrib674.scala index f6b46d13c6..45c9871fc4 100644 --- a/test/files/run/contrib674.scala +++ b/test/files/run/contrib674.scala @@ -5,11 +5,11 @@ object Test extends App { try { 1 } catch { - case e => + case e: Throwable => } finally { try { } catch { - case e => + case e: Throwable => } } 1 diff --git a/test/files/run/ctries-new/main.scala b/test/files/run/ctries-new/main.scala index d7fe087e4d..34f3ec2ccf 100644 --- a/test/files/run/ctries-new/main.scala +++ b/test/files/run/ctries-new/main.scala @@ -21,6 +21,9 @@ object Test { trait Spec { + implicit def implicitously = scala.language.implicitConversions + implicit def reflectively = scala.language.reflectiveCalls + implicit def str2ops(s: String) = new { def in[U](body: =>U) { // just execute body @@ -37,11 +40,11 @@ trait Spec { var produced = false try body catch { - case e => if (e.getClass == implicitly[ClassTag[T]].runtimeClass) produced = true + case e: Throwable => if (e.getClass == implicitly[ClassTag[T]].runtimeClass) produced = true } finally { assert(produced, "Did not produce exception of type: " + implicitly[ClassTag[T]]) } } } -}
\ No newline at end of file +} diff --git a/test/files/run/ctries-old/concmap.scala b/test/files/run/ctries-old/concmap.scala index 3ec0256afb..fccd4bed3e 100644 --- a/test/files/run/ctries-old/concmap.scala +++ b/test/files/run/ctries-old/concmap.scala @@ -2,6 +2,7 @@ import collection.concurrent.TrieMap +import Test.Spec object ConcurrentMapSpec extends Spec { diff --git a/test/files/run/ctries-old/iterator.scala b/test/files/run/ctries-old/iterator.scala index b953a40e00..585bdc0e48 100644 --- a/test/files/run/ctries-old/iterator.scala +++ b/test/files/run/ctries-old/iterator.scala @@ -5,6 +5,7 @@ import collection._ import collection.concurrent.TrieMap +import Test.Spec object IteratorSpec extends Spec { diff --git a/test/files/run/ctries-old/lnode.scala b/test/files/run/ctries-old/lnode.scala index 92a31088e5..3ff5414ac0 100644 --- a/test/files/run/ctries-old/lnode.scala +++ b/test/files/run/ctries-old/lnode.scala @@ -3,6 +3,7 @@ import collection.concurrent.TrieMap +import Test.Spec object LNodeSpec extends Spec { diff --git a/test/files/run/ctries-old/main.scala b/test/files/run/ctries-old/main.scala index 78ba7f0db1..f714bcdcdc 100644 --- a/test/files/run/ctries-old/main.scala +++ b/test/files/run/ctries-old/main.scala @@ -5,6 +5,7 @@ +@deprecated("Suppress warnings", since="2.11") object Test { def main(args: Array[String]) { @@ -14,11 +15,13 @@ object Test { SnapshotSpec.test() } -} trait Spec { + implicit def implicitously = scala.language.implicitConversions + implicit def reflectively = scala.language.reflectiveCalls + implicit def str2ops(s: String) = new { def in[U](body: =>U) { // just execute body @@ -35,7 +38,7 @@ trait Spec { var produced = false try body catch { - case e => if (e.getClass == implicitly[ClassManifest[T]].erasure) produced = true + case e: Throwable => if (e.getClass == implicitly[ClassManifest[T]].erasure) produced = true } finally { assert(produced, "Did not produce exception of type: " + implicitly[ClassManifest[T]]) } @@ -43,3 +46,4 @@ trait Spec { } } +} diff --git a/test/files/run/ctries-old/snapshot.scala b/test/files/run/ctries-old/snapshot.scala index 5fe77d445b..768b588f81 100644 --- a/test/files/run/ctries-old/snapshot.scala +++ b/test/files/run/ctries-old/snapshot.scala @@ -5,6 +5,7 @@ import collection._ import collection.concurrent.TrieMap +import Test.Spec object SnapshotSpec extends Spec { diff --git a/test/files/run/delay-bad.check b/test/files/run/delay-bad.check index 9d9c828a03..2ae88267c5 100644 --- a/test/files/run/delay-bad.check +++ b/test/files/run/delay-bad.check @@ -1,3 +1,9 @@ +delay-bad.scala:53: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses + f(new C { 5 }) + ^ +delay-bad.scala:73: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses + f(new { val x = 5 } with E() { 5 }) + ^ // new C { } diff --git a/test/files/run/delay-good.check b/test/files/run/delay-good.check index 8eb04c7cff..b4f6b04af7 100644 --- a/test/files/run/delay-good.check +++ b/test/files/run/delay-good.check @@ -1,3 +1,9 @@ +delay-good.scala:53: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses + f(new C { 5 }) + ^ +delay-good.scala:73: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses + f(new { val x = 5 } with E() { 5 }) + ^ // new C { } diff --git a/test/files/run/distinct.scala b/test/files/run/distinct.scala index 09e5a0734a..37bbe7805a 100644 --- a/test/files/run/distinct.scala +++ b/test/files/run/distinct.scala @@ -3,7 +3,7 @@ */ object Test { val alphabet = 'a' to 'z' mkString "" - val alphaList = 'a' to 'z' toList + val alphaList = ('a' to 'z').toList def shuffled = util.Random.shuffle(alphaList) def main(args: Array[String]): Unit = { diff --git a/test/files/run/enrich-gentraversable.scala b/test/files/run/enrich-gentraversable.scala index 52eded55fd..0f79a47030 100644 --- a/test/files/run/enrich-gentraversable.scala +++ b/test/files/run/enrich-gentraversable.scala @@ -1,3 +1,6 @@ +import scala.language.implicitConversions +import scala.language.postfixOps + object Test extends App { import scala.collection.{GenTraversableOnce,GenTraversableLike} import scala.collection.generic._ diff --git a/test/files/run/eta-expand-star2.check b/test/files/run/eta-expand-star2.check index ce01362503..cbf4781255 100644 --- a/test/files/run/eta-expand-star2.check +++ b/test/files/run/eta-expand-star2.check @@ -1 +1,2 @@ +warning: there were 1 deprecation warning(s); re-run with -deprecation for details hello diff --git a/test/files/run/exceptions-2.check b/test/files/run/exceptions-2.check index 9a3044cd4f..4f8244800a 100644 --- a/test/files/run/exceptions-2.check +++ b/test/files/run/exceptions-2.check @@ -1,3 +1,6 @@ +exceptions-2.scala:267: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses + try { 1 } catch { case e: java.io.IOException => () } + ^ nested1: Innermost finally Outermost finally diff --git a/test/files/run/exceptions-2.scala b/test/files/run/exceptions-2.scala index f5bbcca210..8d755c3809 100644 --- a/test/files/run/exceptions-2.scala +++ b/test/files/run/exceptions-2.scala @@ -42,7 +42,7 @@ object NoExcep { def method4 = try { Console.println(".."); } catch { - case _ => sys.error(".."); + case _: Throwable => sys.error(".."); } } @@ -136,7 +136,7 @@ object Test { try { sys.error("a"); } catch { - case _ => Console.println("Silently ignore exception in finally"); + case _: Throwable => Console.println("Silently ignore exception in finally"); } } } @@ -146,7 +146,7 @@ object Test { } finally { val fin = "Abc"; Console.println(fin); - }; + } def tryAndValInFinally: Unit = try { @@ -154,8 +154,8 @@ object Test { val fin = "Abc"; try { Console.println(fin); - } catch { case _ => () } - }; + } catch { case _: Throwable => () } + } def returnInBody: Unit = try { try { @@ -249,7 +249,7 @@ object Test { def execute(f: => Unit) = try { f; } catch { - case _ => (); + case _: Throwable => () } diff --git a/test/files/run/exceptions-nest.scala b/test/files/run/exceptions-nest.scala index 841e6b1c67..432d600d13 100644 --- a/test/files/run/exceptions-nest.scala +++ b/test/files/run/exceptions-nest.scala @@ -5,9 +5,9 @@ object Test extends App { println(test3) println(test4) println(test5) - try { println(test6) } catch { case _ => println("OK") } + try { println(test6) } catch { case _: Throwable => println("OK") } println(test7) - try { println(test8) } catch { case _ => println("OK") } + try { println(test8) } catch { case _: Throwable => println("OK") } println(test9) println(test10) println(test11) @@ -19,7 +19,7 @@ object Test extends App { x = 2 } catch { case _: NullPointerException => x = 3 - case _ => x = 4 + case _: Throwable => x = 4 } x } @@ -31,12 +31,12 @@ object Test extends App { try { x = 21 } catch { - case _ => x = 22 + case _: Throwable => x = 22 } x = 23 } catch { case _: NullPointerException => x = 3 - case _ => x = 4 + case _: Throwable => x = 4 } x } @@ -44,10 +44,10 @@ object Test extends App { def test3 = { var x = 1 try { - try{x = 2} catch { case _ => x = 4 } + try{x = 2} catch { case _: Throwable => x = 4 } } catch { case _: NullPointerException => x = 3 - case _ => x = 4 + case _: Throwable => x = 4 } x } @@ -58,7 +58,7 @@ object Test extends App { x = 2 } catch { case _: NullPointerException => x = 3 - case _ => x = 4 + case _: Throwable => x = 4 } try { x = 5 @@ -73,8 +73,8 @@ object Test extends App { try { x = 2 } catch { - case _: NullPointerException => try { x = 3 } catch { case f => throw f } - case _ => x = 4; try { x = 41 } catch { case _: Exception => x = 42 }; x = 43 + case _: NullPointerException => try { x = 3 } catch { case f: Throwable => throw f } + case _: Throwable => x = 4; try { x = 41 } catch { case _: Exception => x = 42 }; x = 43 } x } @@ -87,7 +87,7 @@ object Test extends App { } catch { case e: NullPointerException => throw e - case _ => + case _: Throwable => x = 3 return 1000 } finally { @@ -105,7 +105,7 @@ object Test extends App { try { x = 4 } catch { - case _ => x = 5 + case _: Throwable => x = 5 } } x @@ -116,7 +116,7 @@ object Test extends App { try { throw new NullPointerException } catch { - case e => throw e + case e: Throwable => throw e } x } @@ -124,7 +124,7 @@ object Test extends App { def test9 = { try { "" match { case s: String => 10 - }} catch { case _ => 20 } + }} catch { case _: Throwable => 20 } } var x10 = 1 @@ -135,7 +135,7 @@ object Test extends App { def test11 { try { () } - catch { case e => () } + catch { case e: Throwable => () } } class E1 extends Exception diff --git a/test/files/run/exceptions.scala b/test/files/run/exceptions.scala index 90f681e3c5..f0fe76946b 100644 --- a/test/files/run/exceptions.scala +++ b/test/files/run/exceptions.scala @@ -32,7 +32,7 @@ object exceptions { val value = try { map.lookup(key) } catch { - case e => e.getMessage() + case e: Throwable => e.getMessage() } check("lookup(" + key + ")", value, "KO"); } diff --git a/test/files/run/existentials-in-compiler.scala b/test/files/run/existentials-in-compiler.scala index 14c25849cb..f5a0aa98d0 100644 --- a/test/files/run/existentials-in-compiler.scala +++ b/test/files/run/existentials-in-compiler.scala @@ -1,3 +1,6 @@ +/* + * filter: inliner warning\(s\); re-run with -Yinline-warnings for details + */ import scala.tools.nsc._ import scala.tools.partest.CompilerTest import scala.collection.{ mutable, immutable, generic } @@ -71,14 +74,13 @@ package extest { } """ - def check(source: String, unit: global.CompilationUnit) = { - getRequiredPackage("extest").moduleClass.info.decls.toList.filter(_.isType).map(_.initialize).sortBy(_.name.toString) foreach { clazz => + override def check(source: String, unit: global.CompilationUnit) { + getPackage("extest").moduleClass.info.decls.toList.filter(_.isType).map(_.initialize).sortBy(_.name.toString) foreach { clazz => exitingTyper { clazz.info println(clazz.defString) println(" " + classExistentialType(clazz) + "\n") } } - true } } diff --git a/test/files/run/existentials.scala b/test/files/run/existentials.scala index 3977d47417..65acfd2ac0 100644 --- a/test/files/run/existentials.scala +++ b/test/files/run/existentials.scala @@ -1,3 +1,6 @@ +import scala.language.existentials +import scala.language.reflectiveCalls + class Foo { class Line { case class Cell[T](var x: T) diff --git a/test/files/run/existentials3-new.scala b/test/files/run/existentials3-new.scala index 110c8eff7a..6112a7b856 100644 --- a/test/files/run/existentials3-new.scala +++ b/test/files/run/existentials3-new.scala @@ -1,3 +1,4 @@ +import scala.language.existentials import scala.reflect.runtime.universe._ object Test { @@ -77,4 +78,4 @@ object Misc { } def g1 = o1.f1 _ def g2 = o1.f2 _ -}
\ No newline at end of file +} diff --git a/test/files/run/existentials3-old.scala b/test/files/run/existentials3-old.scala index 944160ff12..c021c0e71e 100644 --- a/test/files/run/existentials3-old.scala +++ b/test/files/run/existentials3-old.scala @@ -1,3 +1,5 @@ +import scala.language.existentials + object Test { trait ToS { final override def toString = getClass.getName } diff --git a/test/files/run/finally.scala b/test/files/run/finally.scala index 635123cc4d..01180fd217 100644 --- a/test/files/run/finally.scala +++ b/test/files/run/finally.scala @@ -7,7 +7,7 @@ object Test extends App { try { bar } catch { - case e => println(e) + case e: Throwable => println(e) } } @@ -17,7 +17,7 @@ object Test extends App { println("hi") } catch { - case e => println("SHOULD NOT GET HERE") + case e: Throwable => println("SHOULD NOT GET HERE") } finally { println("In Finally") @@ -30,7 +30,7 @@ object Test extends App { try { throw new Exception } catch { - case e => + case e: Throwable => println(e); return } finally println("in finally") @@ -41,7 +41,7 @@ object Test extends App { try { throw new Exception } catch { - case e => + case e: Throwable => println(e); throw e } finally println("in finally") @@ -52,7 +52,7 @@ object Test extends App { try { return } catch { - case e => + case e: Throwable => println(e); throw e } finally println("in finally") @@ -63,7 +63,7 @@ object Test extends App { try { throw new Exception } catch { - case e => + case e: Throwable => println(e); } finally println("in finally") } @@ -89,7 +89,7 @@ object Test extends App { throw new Exception } } catch { - case e => println(e) + case e: Throwable => println(e) } } @@ -99,7 +99,7 @@ object Test extends App { try { return 10 } finally { - try { () } catch { case _ => () } + try { () } catch { case _: Throwable => () } println("in finally 1") } } finally { @@ -111,7 +111,7 @@ object Test extends App { try { m } catch { - case e => println("COUGHT: " + e) + case e: Throwable => println("COUGHT: " + e) } println("-" * 40) } diff --git a/test/files/run/genericValueClass.scala b/test/files/run/genericValueClass.scala index 768e1f86a5..9398390a80 100644 --- a/test/files/run/genericValueClass.scala +++ b/test/files/run/genericValueClass.scala @@ -1,4 +1,6 @@ +import scala.language.implicitConversions + object Test extends App { class ArrowAssocClass[A](val __leftOfArrow: A) extends AnyVal { @inline def -> [B](y: B): Tuple2[A, B] = Tuple2(__leftOfArrow, y) diff --git a/test/files/run/getClassTest-old.scala b/test/files/run/getClassTest-old.scala index 951cc8d931..789dd4d162 100644 --- a/test/files/run/getClassTest-old.scala +++ b/test/files/run/getClassTest-old.scala @@ -50,6 +50,7 @@ class MoreAnyRefs { def f4 = (new A { def bippy() = 5 }).getClass() } +@deprecated("Suppress warnings", since="2.11") object Test { def returnTypes[T: Manifest] = ( manifest[T].erasure.getMethods.toList diff --git a/test/files/run/global-showdef.scala b/test/files/run/global-showdef.scala index 71ba7b8bb3..2a00ee51bd 100644 --- a/test/files/run/global-showdef.scala +++ b/test/files/run/global-showdef.scala @@ -1,6 +1,7 @@ import scala.tools.nsc._ -import io.{ AbstractFile } -import util.{ SourceFile, BatchSourceFile, stringFromStream } +import scala.reflect.io.AbstractFile +import scala.tools.nsc.util.stringFromStream +import scala.reflect.internal.util.{ SourceFile, BatchSourceFile } import scala.tools.nsc.reporters.ConsoleReporter object Test { @@ -53,7 +54,7 @@ object Bippy { val run = new compiler.Run() run.compileSources(List(src)) } - output split "\\n" toList + (output split "\\n").toList } def showClass(name: String) = lines("-Yshow:typer", "-Xshow-class", name) def showObject(name: String) = lines("-Yshow:typer", "-Xshow-object", name) diff --git a/test/files/run/impconvtimes.scala b/test/files/run/impconvtimes.scala index 8c5ab61779..477a16a890 100644 --- a/test/files/run/impconvtimes.scala +++ b/test/files/run/impconvtimes.scala @@ -1,3 +1,5 @@ +import scala.language.implicitConversions + object Test { abstract class Unit object NoUnit extends Unit diff --git a/test/files/run/implicits.scala b/test/files/run/implicits.scala index a30f60f6d0..5681a9d484 100644 --- a/test/files/run/implicits.scala +++ b/test/files/run/implicits.scala @@ -1,3 +1,5 @@ +import scala.language.implicitConversions + object A { object B { implicit def int2string(x: Int) = "["+x.toString+"]" diff --git a/test/files/run/indexedSeq.scala b/test/files/run/indexedSeq.scala index 9744f47f63..29a8be701d 100644 --- a/test/files/run/indexedSeq.scala +++ b/test/files/run/indexedSeq.scala @@ -1,10 +1,11 @@ object Test { - import scala.collection.{ mutable, immutable, generic } + import scala.collection.immutable def checkIdentity[A](xs: immutable.IndexedSeq[A]) = assert(xs.toIndexedSeq eq xs) def main(args: Array[String]): Unit = { - checkIdentity(immutable.Vector(1 to 10: _*)) - checkIdentity(1 to 10 toIndexedSeq) + def r = 1 to 10 + checkIdentity(immutable.Vector(r: _*)) + checkIdentity(r.toIndexedSeq) } } diff --git a/test/files/run/inner-obj-auto.scala b/test/files/run/inner-obj-auto.scala index aa2e29326f..35ca56ba3e 100644 --- a/test/files/run/inner-obj-auto.scala +++ b/test/files/run/inner-obj-auto.scala @@ -25,7 +25,7 @@ class Class2_1 { assert(ObjCounter == 1, "multiple instances: " + ObjCounter) println("ok") } catch { - case e => print("failed "); e.printStackTrace() + case e: Throwable => print("failed "); e.printStackTrace() } } @@ -54,7 +54,7 @@ object Object3_1 { assert(ObjCounter == 1, "multiple instances: " + ObjCounter) println("ok") } catch { - case e => print("failed "); e.printStackTrace() + case e: Throwable => print("failed "); e.printStackTrace() } } @@ -83,7 +83,7 @@ trait Trait4_1 { assert(ObjCounter == 1, "multiple instances: " + ObjCounter) println("ok") } catch { - case e => print("failed "); e.printStackTrace() + case e: Throwable => print("failed "); e.printStackTrace() } } @@ -112,7 +112,7 @@ class Class6_1 { assert(ObjCounter == 1, "multiple instances: " + ObjCounter) println("ok") } catch { - case e => print("failed "); e.printStackTrace() + case e: Throwable => print("failed "); e.printStackTrace() } } @@ -141,7 +141,7 @@ object Object7_1 { assert(ObjCounter == 1, "multiple instances: " + ObjCounter) println("ok") } catch { - case e => print("failed "); e.printStackTrace() + case e: Throwable => print("failed "); e.printStackTrace() } } @@ -170,7 +170,7 @@ trait Trait8_1 { assert(ObjCounter == 1, "multiple instances: " + ObjCounter) println("ok") } catch { - case e => print("failed "); e.printStackTrace() + case e: Throwable => print("failed "); e.printStackTrace() } } @@ -199,7 +199,7 @@ class Class10_1 { assert(ObjCounter == 1, "multiple instances: " + ObjCounter) println("ok") } catch { - case e => print("failed "); e.printStackTrace() + case e: Throwable => print("failed "); e.printStackTrace() } } @@ -228,7 +228,7 @@ object Object11_1 { assert(ObjCounter == 1, "multiple instances: " + ObjCounter) println("ok") } catch { - case e => print("failed "); e.printStackTrace() + case e: Throwable => print("failed "); e.printStackTrace() } } @@ -257,7 +257,7 @@ trait Trait12_1 { assert(ObjCounter == 1, "multiple instances: " + ObjCounter) println("ok") } catch { - case e => print("failed "); e.printStackTrace() + case e: Throwable => print("failed "); e.printStackTrace() } } @@ -286,7 +286,7 @@ class Class14_1 { assert(ObjCounter == 1, "multiple instances: " + ObjCounter) println("ok") } catch { - case e => print("failed "); e.printStackTrace() + case e: Throwable => print("failed "); e.printStackTrace() } } @@ -315,7 +315,7 @@ object Object15_1 { assert(ObjCounter == 1, "multiple instances: " + ObjCounter) println("ok") } catch { - case e => print("failed "); e.printStackTrace() + case e: Throwable => print("failed "); e.printStackTrace() } } @@ -344,7 +344,7 @@ trait Trait16_1 { assert(ObjCounter == 1, "multiple instances: " + ObjCounter) println("ok") } catch { - case e => print("failed "); e.printStackTrace() + case e: Throwable => print("failed "); e.printStackTrace() } } @@ -373,7 +373,7 @@ class Class18_1 { assert(ObjCounter == 1, "multiple instances: " + ObjCounter) println("ok") } catch { - case e => print("failed "); e.printStackTrace() + case e: Throwable => print("failed "); e.printStackTrace() } } @@ -402,7 +402,7 @@ object Object19_1 { assert(ObjCounter == 1, "multiple instances: " + ObjCounter) println("ok") } catch { - case e => print("failed "); e.printStackTrace() + case e: Throwable => print("failed "); e.printStackTrace() } } @@ -431,7 +431,7 @@ trait Trait20_1 { assert(ObjCounter == 1, "multiple instances: " + ObjCounter) println("ok") } catch { - case e => print("failed "); e.printStackTrace() + case e: Throwable => print("failed "); e.printStackTrace() } } @@ -460,7 +460,7 @@ class Class22_1 { assert(ObjCounter == 1, "multiple instances: " + ObjCounter) println("ok") } catch { - case e => print("failed "); e.printStackTrace() + case e: Throwable => print("failed "); e.printStackTrace() } } @@ -489,7 +489,7 @@ object Object23_1 { assert(ObjCounter == 1, "multiple instances: " + ObjCounter) println("ok") } catch { - case e => print("failed "); e.printStackTrace() + case e: Throwable => print("failed "); e.printStackTrace() } } @@ -518,7 +518,7 @@ trait Trait24_1 { assert(ObjCounter == 1, "multiple instances: " + ObjCounter) println("ok") } catch { - case e => print("failed "); e.printStackTrace() + case e: Throwable => print("failed "); e.printStackTrace() } } @@ -548,7 +548,7 @@ class Class26_1 { assert(ObjCounter == 1, "multiple instances: " + ObjCounter) println("ok") } catch { - case e => print("failed "); e.printStackTrace() + case e: Throwable => print("failed "); e.printStackTrace() } } @@ -579,7 +579,7 @@ object Object27_1 { assert(ObjCounter == 1, "multiple instances: " + ObjCounter) println("ok") } catch { - case e => print("failed "); e.printStackTrace() + case e: Throwable => print("failed "); e.printStackTrace() } } @@ -610,7 +610,7 @@ trait Trait28_1 { assert(ObjCounter == 1, "multiple instances: " + ObjCounter) println("ok") } catch { - case e => print("failed "); e.printStackTrace() + case e: Throwable => print("failed "); e.printStackTrace() } } @@ -641,7 +641,7 @@ class Class30_1 { assert(ObjCounter == 1, "multiple instances: " + ObjCounter) println("ok") } catch { - case e => print("failed "); e.printStackTrace() + case e: Throwable => print("failed "); e.printStackTrace() } } @@ -672,7 +672,7 @@ object Object31_1 { assert(ObjCounter == 1, "multiple instances: " + ObjCounter) println("ok") } catch { - case e => print("failed "); e.printStackTrace() + case e: Throwable => print("failed "); e.printStackTrace() } } @@ -703,7 +703,7 @@ trait Trait32_1 { assert(ObjCounter == 1, "multiple instances: " + ObjCounter) println("ok") } catch { - case e => print("failed "); e.printStackTrace() + case e: Throwable => print("failed "); e.printStackTrace() } } @@ -733,7 +733,7 @@ class Class34_1 { assert(ObjCounter == 1, "multiple instances: " + ObjCounter) println("ok") } catch { - case e => print("failed "); e.printStackTrace() + case e: Throwable => print("failed "); e.printStackTrace() } } @@ -762,7 +762,7 @@ object Object35_1 { assert(ObjCounter == 1, "multiple instances: " + ObjCounter) println("ok") } catch { - case e => print("failed "); e.printStackTrace() + case e: Throwable => print("failed "); e.printStackTrace() } } @@ -791,7 +791,7 @@ trait Trait36_1 { assert(ObjCounter == 1, "multiple instances: " + ObjCounter) println("ok") } catch { - case e => print("failed "); e.printStackTrace() + case e: Throwable => print("failed "); e.printStackTrace() } } @@ -820,7 +820,7 @@ class Class38_1 { assert(ObjCounter == 1, "multiple instances: " + ObjCounter) println("ok") } catch { - case e => print("failed "); e.printStackTrace() + case e: Throwable => print("failed "); e.printStackTrace() } } @@ -849,7 +849,7 @@ object Object39_1 { assert(ObjCounter == 1, "multiple instances: " + ObjCounter) println("ok") } catch { - case e => print("failed "); e.printStackTrace() + case e: Throwable => print("failed "); e.printStackTrace() } } @@ -878,7 +878,7 @@ trait Trait40_1 { assert(ObjCounter == 1, "multiple instances: " + ObjCounter) println("ok") } catch { - case e => print("failed "); e.printStackTrace() + case e: Throwable => print("failed "); e.printStackTrace() } } @@ -907,7 +907,7 @@ class Class42_1 { assert(ObjCounter == 1, "multiple instances: " + ObjCounter) println("ok") } catch { - case e => print("failed "); e.printStackTrace() + case e: Throwable => print("failed "); e.printStackTrace() } } @@ -936,7 +936,7 @@ object Object43_1 { assert(ObjCounter == 1, "multiple instances: " + ObjCounter) println("ok") } catch { - case e => print("failed "); e.printStackTrace() + case e: Throwable => print("failed "); e.printStackTrace() } } @@ -965,7 +965,7 @@ trait Trait44_1 { assert(ObjCounter == 1, "multiple instances: " + ObjCounter) println("ok") } catch { - case e => print("failed "); e.printStackTrace() + case e: Throwable => print("failed "); e.printStackTrace() } } @@ -994,7 +994,7 @@ class Class46_1 { assert(ObjCounter == 1, "multiple instances: " + ObjCounter) println("ok") } catch { - case e => print("failed "); e.printStackTrace() + case e: Throwable => print("failed "); e.printStackTrace() } } @@ -1023,7 +1023,7 @@ object Object47_1 { assert(ObjCounter == 1, "multiple instances: " + ObjCounter) println("ok") } catch { - case e => print("failed "); e.printStackTrace() + case e: Throwable => print("failed "); e.printStackTrace() } } @@ -1052,7 +1052,7 @@ trait Trait48_1 { assert(ObjCounter == 1, "multiple instances: " + ObjCounter) println("ok") } catch { - case e => print("failed "); e.printStackTrace() + case e: Throwable => print("failed "); e.printStackTrace() } } @@ -1081,7 +1081,7 @@ class Class50_1 { assert(ObjCounter == 1, "multiple instances: " + ObjCounter) println("ok") } catch { - case e => print("failed "); e.printStackTrace() + case e: Throwable => print("failed "); e.printStackTrace() } } @@ -1110,7 +1110,7 @@ object Object51_1 { assert(ObjCounter == 1, "multiple instances: " + ObjCounter) println("ok") } catch { - case e => print("failed "); e.printStackTrace() + case e: Throwable => print("failed "); e.printStackTrace() } } @@ -1139,7 +1139,7 @@ trait Trait52_1 { assert(ObjCounter == 1, "multiple instances: " + ObjCounter) println("ok") } catch { - case e => print("failed "); e.printStackTrace() + case e: Throwable => print("failed "); e.printStackTrace() } } @@ -1172,7 +1172,7 @@ class Class54_1 { assert(ObjCounter == 1, "multiple instances: " + ObjCounter) println("ok") } catch { - case e => print("multi-threaded failed "); e.printStackTrace() + case e: Throwable => print("multi-threaded failed "); e.printStackTrace() } } @@ -1205,7 +1205,7 @@ object Object55_1 { assert(ObjCounter == 1, "multiple instances: " + ObjCounter) println("ok") } catch { - case e => print("multi-threaded failed "); e.printStackTrace() + case e: Throwable => print("multi-threaded failed "); e.printStackTrace() } } @@ -1238,7 +1238,7 @@ trait Trait56_1 { assert(ObjCounter == 1, "multiple instances: " + ObjCounter) println("ok") } catch { - case e => print("multi-threaded failed "); e.printStackTrace() + case e: Throwable => print("multi-threaded failed "); e.printStackTrace() } } @@ -1271,7 +1271,7 @@ class Class58_1 { assert(ObjCounter == 1, "multiple instances: " + ObjCounter) println("ok") } catch { - case e => print("multi-threaded failed "); e.printStackTrace() + case e: Throwable => print("multi-threaded failed "); e.printStackTrace() } } @@ -1304,7 +1304,7 @@ object Object59_1 { assert(ObjCounter == 1, "multiple instances: " + ObjCounter) println("ok") } catch { - case e => print("multi-threaded failed "); e.printStackTrace() + case e: Throwable => print("multi-threaded failed "); e.printStackTrace() } } @@ -1337,7 +1337,7 @@ trait Trait60_1 { assert(ObjCounter == 1, "multiple instances: " + ObjCounter) println("ok") } catch { - case e => print("multi-threaded failed "); e.printStackTrace() + case e: Throwable => print("multi-threaded failed "); e.printStackTrace() } } @@ -1370,7 +1370,7 @@ class Class62_1 { assert(ObjCounter == 1, "multiple instances: " + ObjCounter) println("ok") } catch { - case e => print("multi-threaded failed "); e.printStackTrace() + case e: Throwable => print("multi-threaded failed "); e.printStackTrace() } } @@ -1403,7 +1403,7 @@ object Object63_1 { assert(ObjCounter == 1, "multiple instances: " + ObjCounter) println("ok") } catch { - case e => print("multi-threaded failed "); e.printStackTrace() + case e: Throwable => print("multi-threaded failed "); e.printStackTrace() } } @@ -1436,7 +1436,7 @@ trait Trait64_1 { assert(ObjCounter == 1, "multiple instances: " + ObjCounter) println("ok") } catch { - case e => print("multi-threaded failed "); e.printStackTrace() + case e: Throwable => print("multi-threaded failed "); e.printStackTrace() } } @@ -1469,7 +1469,7 @@ class Class66_1 { assert(ObjCounter == 1, "multiple instances: " + ObjCounter) println("ok") } catch { - case e => print("multi-threaded failed "); e.printStackTrace() + case e: Throwable => print("multi-threaded failed "); e.printStackTrace() } } @@ -1502,7 +1502,7 @@ object Object67_1 { assert(ObjCounter == 1, "multiple instances: " + ObjCounter) println("ok") } catch { - case e => print("multi-threaded failed "); e.printStackTrace() + case e: Throwable => print("multi-threaded failed "); e.printStackTrace() } } @@ -1535,7 +1535,7 @@ trait Trait68_1 { assert(ObjCounter == 1, "multiple instances: " + ObjCounter) println("ok") } catch { - case e => print("multi-threaded failed "); e.printStackTrace() + case e: Throwable => print("multi-threaded failed "); e.printStackTrace() } } @@ -1568,7 +1568,7 @@ class Class70_1 { assert(ObjCounter == 1, "multiple instances: " + ObjCounter) println("ok") } catch { - case e => print("multi-threaded failed "); e.printStackTrace() + case e: Throwable => print("multi-threaded failed "); e.printStackTrace() } } @@ -1601,7 +1601,7 @@ object Object71_1 { assert(ObjCounter == 1, "multiple instances: " + ObjCounter) println("ok") } catch { - case e => print("multi-threaded failed "); e.printStackTrace() + case e: Throwable => print("multi-threaded failed "); e.printStackTrace() } } @@ -1634,7 +1634,7 @@ trait Trait72_1 { assert(ObjCounter == 1, "multiple instances: " + ObjCounter) println("ok") } catch { - case e => print("multi-threaded failed "); e.printStackTrace() + case e: Throwable => print("multi-threaded failed "); e.printStackTrace() } } @@ -1667,7 +1667,7 @@ class Class74_1 { assert(ObjCounter == 1, "multiple instances: " + ObjCounter) println("ok") } catch { - case e => print("multi-threaded failed "); e.printStackTrace() + case e: Throwable => print("multi-threaded failed "); e.printStackTrace() } } @@ -1700,7 +1700,7 @@ object Object75_1 { assert(ObjCounter == 1, "multiple instances: " + ObjCounter) println("ok") } catch { - case e => print("multi-threaded failed "); e.printStackTrace() + case e: Throwable => print("multi-threaded failed "); e.printStackTrace() } } @@ -1733,7 +1733,7 @@ trait Trait76_1 { assert(ObjCounter == 1, "multiple instances: " + ObjCounter) println("ok") } catch { - case e => print("multi-threaded failed "); e.printStackTrace() + case e: Throwable => print("multi-threaded failed "); e.printStackTrace() } } @@ -1767,7 +1767,7 @@ class Class78_1 { assert(ObjCounter == 1, "multiple instances: " + ObjCounter) println("ok") } catch { - case e => print("multi-threaded failed "); e.printStackTrace() + case e: Throwable => print("multi-threaded failed "); e.printStackTrace() } } @@ -1802,7 +1802,7 @@ object Object79_1 { assert(ObjCounter == 1, "multiple instances: " + ObjCounter) println("ok") } catch { - case e => print("multi-threaded failed "); e.printStackTrace() + case e: Throwable => print("multi-threaded failed "); e.printStackTrace() } } @@ -1837,7 +1837,7 @@ trait Trait80_1 { assert(ObjCounter == 1, "multiple instances: " + ObjCounter) println("ok") } catch { - case e => print("multi-threaded failed "); e.printStackTrace() + case e: Throwable => print("multi-threaded failed "); e.printStackTrace() } } @@ -1872,7 +1872,7 @@ class Class82_1 { assert(ObjCounter == 1, "multiple instances: " + ObjCounter) println("ok") } catch { - case e => print("multi-threaded failed "); e.printStackTrace() + case e: Throwable => print("multi-threaded failed "); e.printStackTrace() } } @@ -1907,7 +1907,7 @@ object Object83_1 { assert(ObjCounter == 1, "multiple instances: " + ObjCounter) println("ok") } catch { - case e => print("multi-threaded failed "); e.printStackTrace() + case e: Throwable => print("multi-threaded failed "); e.printStackTrace() } } @@ -1942,7 +1942,7 @@ trait Trait84_1 { assert(ObjCounter == 1, "multiple instances: " + ObjCounter) println("ok") } catch { - case e => print("multi-threaded failed "); e.printStackTrace() + case e: Throwable => print("multi-threaded failed "); e.printStackTrace() } } @@ -1976,7 +1976,7 @@ class Class90_1 { assert(ObjCounter == 1, "multiple instances: " + ObjCounter) println("ok") } catch { - case e => print("multi-threaded failed "); e.printStackTrace() + case e: Throwable => print("multi-threaded failed "); e.printStackTrace() } } @@ -2009,7 +2009,7 @@ trait Trait92_1 { assert(ObjCounter == 1, "multiple instances: " + ObjCounter) println("ok") } catch { - case e => print("multi-threaded failed "); e.printStackTrace() + case e: Throwable => print("multi-threaded failed "); e.printStackTrace() } } diff --git a/test/files/run/interop_classtags_are_classmanifests.scala b/test/files/run/interop_classtags_are_classmanifests.scala index 91b9d89c6e..62d85c3ce3 100644 --- a/test/files/run/interop_classtags_are_classmanifests.scala +++ b/test/files/run/interop_classtags_are_classmanifests.scala @@ -1,5 +1,6 @@ -import scala.reflect.{ClassTag, classTag} +import scala.reflect.ClassTag +@deprecated("Suppress warnings", since="2.11") object Test extends App { def classTagIsClassManifest[T: ClassTag] = { println(classManifest[T]) @@ -8,4 +9,4 @@ object Test extends App { classTagIsClassManifest[Int] classTagIsClassManifest[String] classTagIsClassManifest[Array[Int]] -}
\ No newline at end of file +} diff --git a/test/files/run/interop_manifests_are_classtags.scala b/test/files/run/interop_manifests_are_classtags.scala index 03479e527a..705038ece7 100644 --- a/test/files/run/interop_manifests_are_classtags.scala +++ b/test/files/run/interop_manifests_are_classtags.scala @@ -1,5 +1,6 @@ import scala.reflect.{ClassTag, classTag} +@deprecated("Suppress warnings", since="2.11") object Test extends App { def classManifestIsClassTag[T: ClassManifest] = { println(classTag[T]) @@ -20,4 +21,4 @@ object Test extends App { manifestIsClassTag[Int] manifestIsClassTag[String] manifestIsClassTag[Array[Int]] -}
\ No newline at end of file +} diff --git a/test/files/run/interpolationArgs.scala b/test/files/run/interpolationArgs.scala index eb13767907..ffb254b63f 100644 --- a/test/files/run/interpolationArgs.scala +++ b/test/files/run/interpolationArgs.scala @@ -1,5 +1,5 @@ object Test extends App { - try { scala.StringContext("p1", "p2", "p3").s("e1") } catch { case ex => println(ex) } - try { scala.StringContext("p1").s("e1") } catch { case ex => println(ex) } + try { scala.StringContext("p1", "p2", "p3").s("e1") } catch { case ex: Throwable => println(ex) } + try { scala.StringContext("p1").s("e1") } catch { case ex: Throwable => println(ex) } } diff --git a/test/files/run/interpolationMultiline2.scala b/test/files/run/interpolationMultiline2.scala index f6a682c3ce..2de4c4b22e 100644 --- a/test/files/run/interpolationMultiline2.scala +++ b/test/files/run/interpolationMultiline2.scala @@ -2,14 +2,15 @@ object Test extends App { def test1(n: Int) = { val old = "old" - try { println(s"""Bob is ${s"$n"} years ${s"$old"}!""") } catch { case ex => println(ex) } - try { println(s"""Bob is ${f"$n"} years ${s"$old"}!""") } catch { case ex => println(ex) } - try { println(f"""Bob is ${s"$n"} years ${s"$old"}!""") } catch { case ex => println(ex) } - try { println(f"""Bob is ${f"$n"} years ${s"$old"}!""") } catch { case ex => println(ex) } - try { println(f"""Bob is ${f"$n%2d"} years ${s"$old"}!""") } catch { case ex => println(ex) } - try { println(f"""Bob is ${s"$n%2d"} years ${s"$old"}!""") } catch { case ex => println(ex) } - try { println(s"""Bob is ${f"$n%2d"} years ${s"$old"}!""") } catch { case ex => println(ex) } - try { println(s"""Bob is ${s"$n%2d"} years ${s"$old"}!""") } catch { case ex => println(ex) } + val catcher: PartialFunction[Throwable, Unit] = { case e => println(e) } + try { println(s"""Bob is ${s"$n"} years ${s"$old"}!""") } catch catcher + try { println(s"""Bob is ${f"$n"} years ${s"$old"}!""") } catch catcher + try { println(f"""Bob is ${s"$n"} years ${s"$old"}!""") } catch catcher + try { println(f"""Bob is ${f"$n"} years ${s"$old"}!""") } catch catcher + try { println(f"""Bob is ${f"$n%2d"} years ${s"$old"}!""") } catch catcher + try { println(f"""Bob is ${s"$n%2d"} years ${s"$old"}!""") } catch catcher + try { println(s"""Bob is ${f"$n%2d"} years ${s"$old"}!""") } catch catcher + try { println(s"""Bob is ${s"$n%2d"} years ${s"$old"}!""") } catch catcher } test1(1) diff --git a/test/files/run/io-position.scala b/test/files/run/io-position.scala index 1093704fa4..b227846fb4 100644 --- a/test/files/run/io-position.scala +++ b/test/files/run/io-position.scala @@ -1,7 +1,5 @@ object Test { - Console.setErr(Console.out) - - def main(args: Array[String]): Unit = { + def main(args: Array[String]): Unit = Console.withErr(Console.out) { try { xml.parsing.ConstructingParser.fromSource(io.Source.fromString("<foo>"), false).document() } catch { diff --git a/test/files/run/is-valid-num.scala b/test/files/run/is-valid-num.scala index 402eff99d6..19a3b9c7c0 100644 --- a/test/files/run/is-valid-num.scala +++ b/test/files/run/is-valid-num.scala @@ -1,3 +1,6 @@ +/* + * filter: inliner warning\(s\); re-run with -Yinline-warnings for details + */ object Test { def x = BigInt("10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000") def y = BigDecimal("" + (Short.MaxValue + 1) + ".0") diff --git a/test/files/run/issue192.scala b/test/files/run/issue192.scala index d8db8b5816..3c3b44a8fb 100644 --- a/test/files/run/issue192.scala +++ b/test/files/run/issue192.scala @@ -1,3 +1,5 @@ +import scala.language.reflectiveCalls + object Test extends App { def f1(p: Any{def unary_+ : Int}) = +p diff --git a/test/files/run/iterator-from.scala b/test/files/run/iterator-from.scala index 8dc6ae4e51..fb33f6b5ed 100644 --- a/test/files/run/iterator-from.scala +++ b/test/files/run/iterator-from.scala @@ -1,4 +1,6 @@ -// This file tests iteratorFrom, keysIteratorFrom, and valueIteratorFrom on various sorted sets and maps +/* This file tests iteratorFrom, keysIteratorFrom, and valueIteratorFrom on various sorted sets and maps + * filter: inliner warning\(s\); re-run with -Yinline-warnings for details + */ import scala.util.{Random => R} import scala.collection._ diff --git a/test/files/run/iterator-iterate-lazy.scala b/test/files/run/iterator-iterate-lazy.scala index 73886f192b..92b170062e 100644 --- a/test/files/run/iterator-iterate-lazy.scala +++ b/test/files/run/iterator-iterate-lazy.scala @@ -1,5 +1,5 @@ object Test { def main(args: Array[String]): Unit = { - Iterator.iterate(1 to 5 toList)(_.tail).takeWhile(_.nonEmpty).map(_.head).toList + Iterator.iterate((1 to 5).toList)(_.tail).takeWhile(_.nonEmpty).map(_.head).toList } } diff --git a/test/files/run/iterators.scala b/test/files/run/iterators.scala index b85291cd72..e2d0f93a05 100644 --- a/test/files/run/iterators.scala +++ b/test/files/run/iterators.scala @@ -4,6 +4,8 @@ //############################################################################ +import scala.language.postfixOps + object Test { def check_from: Int = { diff --git a/test/files/run/json.scala b/test/files/run/json.scala index a81f12564c..36e86ac5bb 100644 --- a/test/files/run/json.scala +++ b/test/files/run/json.scala @@ -1,13 +1,17 @@ +/* + * filter: inliner warning\(s\); re-run with -Yinline-warnings for details + */ import scala.util.parsing.json._ import scala.collection.immutable.TreeMap +@deprecated("Suppress warnings", since="2.11") object Test extends App { /* This method converts parsed JSON back into real JSON notation with objects in * sorted-key order. Not required by the spec, but it allows us to do a stable * toString comparison. */ def jsonToString(in : Any) : String = in match { case l : List[_] => "[" + l.map(jsonToString).mkString(", ") + "]" - case m : Map[String,_] => "{" + m.iterator.toList + case m : Map[String @unchecked,_] => "{" + m.iterator.toList .sortWith({ (x,y) => x._1 < y._1 }) .map({ case (k,v) => "\"" + k + "\": " + jsonToString(v) }) .mkString(", ") + "}" @@ -20,7 +24,7 @@ object Test extends App { */ def sortJSON(in : Any) : Any = in match { case l : List[_] => l.map(sortJSON) - case m : Map[String,_] => TreeMap(m.mapValues(sortJSON).iterator.toSeq : _*) + case m : Map[String @unchecked,_] => TreeMap(m.mapValues(sortJSON).iterator.toSeq : _*) // For the object versions, sort their contents, ugly casts and all... case JSONObject(data) => JSONObject(sortJSON(data).asInstanceOf[Map[String,Any]]) case JSONArray(data) => JSONArray(sortJSON(data).asInstanceOf[List[Any]]) diff --git a/test/files/run/lazy-exprs.check b/test/files/run/lazy-exprs.check index e77d204251..2efb8ceb4a 100644 --- a/test/files/run/lazy-exprs.check +++ b/test/files/run/lazy-exprs.check @@ -1,3 +1,11 @@ +lazy-exprs.scala:38: warning: match may not be exhaustive. +It would fail on the following input: Some((x: String forSome x not in Z1)) + t match { + ^ +lazy-exprs.scala:62: warning: match may not be exhaustive. +It would fail on the following input: Some((x: String forSome x not in LazyField)) + t match { + ^ forced <z1> lazy val in scrutinee: ok forced <z1> diff --git a/test/files/run/lazy-locals.check b/test/files/run/lazy-locals.check index d1cc754f2c..9e88a55d18 100644 --- a/test/files/run/lazy-locals.check +++ b/test/files/run/lazy-locals.check @@ -1,3 +1,9 @@ +lazy-locals.scala:153: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses + { + ^ +lazy-locals.scala:159: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses + { + ^ forced lazy val q q = 10 forced lazy val t diff --git a/test/files/run/list_map.scala b/test/files/run/list_map.scala new file mode 100755 index 0000000000..fba3aae228 --- /dev/null +++ b/test/files/run/list_map.scala @@ -0,0 +1,26 @@ +import collection.immutable.ListMap + +object Test { + def testImmutableMinus() { + val empty = ListMap.empty[Int, Int] + + val m0 = ListMap(1 -> 1, 2 -> 2) + val m1 = m0 - 3 + assert (m1 eq m0) + val m2 = m0 - 1 + assert (m2.size == 1) + val m3 = m2 - 2 + assert (m3 eq empty) + + val m4 = ListMap(1 -> 1, 2 -> 2, 3 -> 3) + val m5 = m4 - 1 + assert (m5 == ListMap(2 -> 2, 3 -> 3)) + assert (m5.toList == (2, 2)::(3, 3)::Nil) + + assert ((empty - 1) eq empty) + } + + def main(args: Array[String]) { + testImmutableMinus() + } +} diff --git a/test/files/run/lists-run.scala b/test/files/run/lists-run.scala index ccfe5bc260..5ff3ee353e 100644 --- a/test/files/run/lists-run.scala +++ b/test/files/run/lists-run.scala @@ -2,6 +2,8 @@ * * @author Stephane Micheloud */ +import scala.language.postfixOps + object Test { def main(args: Array[String]) { Test_multiset.run() // multiset operations: union, intersect, diff @@ -153,7 +155,7 @@ object Test3 { List.range(1, 10, 0) } catch { case e: IllegalArgumentException => () - case _ => throw new Error("List.range(1, 10, 0)") + case _: Throwable => throw new Error("List.range(1, 10, 0)") } assert(List.range(10, 0, -2) == List(10, 8, 6, 4, 2)) } diff --git a/test/files/run/literals.check b/test/files/run/literals.check index f53c879dea..6be5137994 100644 --- a/test/files/run/literals.check +++ b/test/files/run/literals.check @@ -1,3 +1,4 @@ +warning: there were 13 deprecation warning(s); re-run with -deprecation for details test '\u0024' == '$' was successful test '\u005f' == '_' was successful test 65.asInstanceOf[Char] == 'A' was successful @@ -43,7 +44,6 @@ test 0x8000000000000000L == -9223372036854775808L was successful test 0xffffffffffffffffL == -1L was successful test 1e1f == 10.0f was successful -test 2.f == 2.0f was successful test .3f == 0.3f was successful test 0f == 0.0f was successful test 3.14f == 3.14f was successful @@ -53,8 +53,6 @@ test 1.asInstanceOf[Float] == 1.0 was successful test 1l.asInstanceOf[Float] == 1.0 was successful test 1e1 == 10.0 was successful -test 2. == 2.0 was successful -test 2.d == 2.0 was successful test .3 == 0.3 was successful test 0.0 == 0.0 was successful test 0d == 0.0 was successful diff --git a/test/files/run/literals.scala b/test/files/run/literals.scala index 32bc29fda8..7676125339 100644 --- a/test/files/run/literals.scala +++ b/test/files/run/literals.scala @@ -105,7 +105,7 @@ object Test { // float check_success("1e1f == 10.0f", 1e1f, 10.0f) - check_success("2.f == 2.0f", 2.f, 2.0f) + //check_success("2.f == 2.0f", 2.f, 2.0f) check_success(".3f == 0.3f", .3f, 0.3f) check_success("0f == 0.0f", 0f, 0.0f) check_success("3.14f == 3.14f", 3.14f, 3.14f) @@ -118,8 +118,8 @@ object Test { // double check_success("1e1 == 10.0", 1e1, 10.0) - check_success("2. == 2.0", 2., 2.0) - check_success("2.d == 2.0", 2.d, 2.0) + //check_success("2. == 2.0", 2., 2.0) + //check_success("2.d == 2.0", 2.d, 2.0) check_success(".3 == 0.3", .3, 0.3) check_success("0.0 == 0.0", 0.0, 0.0) check_success("0d == 0.0", 0d, 0.0) diff --git a/test/files/run/macro-bodyexpandstoimpl/Impls_1.scala b/test/files/run/macro-bodyexpandstoimpl/Impls_1.scala index 9c1e4ee46d..56c5252f31 100644 --- a/test/files/run/macro-bodyexpandstoimpl/Impls_1.scala +++ b/test/files/run/macro-bodyexpandstoimpl/Impls_1.scala @@ -7,6 +7,8 @@ object Impls { def refToFoo_impl(c: Ctx)(dummy: c.Expr[Int]) = { import c.universe._ val body = Select(Ident(TermName("Impls")), TermName("foo")) + val global = c.universe.asInstanceOf[scala.tools.nsc.Global] + global.analyzer.markMacroImplRef(body.asInstanceOf[global.Tree]) c.Expr[Int](body) } }
\ No newline at end of file diff --git a/test/files/run/macro-bundle.check b/test/files/run/macro-bundle.check new file mode 100644 index 0000000000..2107454960 --- /dev/null +++ b/test/files/run/macro-bundle.check @@ -0,0 +1,3 @@ +() +Int +() diff --git a/test/files/run/macro-declared-in-annotation.flags b/test/files/run/macro-bundle.flags index cd66464f2f..cd66464f2f 100644 --- a/test/files/run/macro-declared-in-annotation.flags +++ b/test/files/run/macro-bundle.flags diff --git a/test/files/run/macro-bundle/Impls_Macros_1.scala b/test/files/run/macro-bundle/Impls_Macros_1.scala new file mode 100644 index 0000000000..3f651c9a43 --- /dev/null +++ b/test/files/run/macro-bundle/Impls_Macros_1.scala @@ -0,0 +1,13 @@ +import scala.reflect.macros.Context +import scala.reflect.macros.Macro + +trait Impl extends Macro { + def mono = c.literalUnit + def poly[T: c.WeakTypeTag] = c.literal(c.weakTypeOf[T].toString) + def weird = macro mono +} + +object Macros { + def mono = macro Impl.mono + def poly[T] = macro Impl.poly[T] +}
\ No newline at end of file diff --git a/test/files/run/macro-bundle/Test_2.scala b/test/files/run/macro-bundle/Test_2.scala new file mode 100644 index 0000000000..428f809f9d --- /dev/null +++ b/test/files/run/macro-bundle/Test_2.scala @@ -0,0 +1,5 @@ +object Test extends App { + println(Macros.mono) + println(Macros.poly[Int]) + println(new Impl{val c = ???}.weird) +}
\ No newline at end of file diff --git a/test/files/run/macro-def-infer-return-type-a.check b/test/files/run/macro-def-infer-return-type-a.check deleted file mode 100644 index f70d7bba4a..0000000000 --- a/test/files/run/macro-def-infer-return-type-a.check +++ /dev/null @@ -1 +0,0 @@ -42
\ No newline at end of file diff --git a/test/files/run/macro-def-infer-return-type-a/Impls_1.scala b/test/files/run/macro-def-infer-return-type-a/Impls_1.scala deleted file mode 100644 index 52c9f9c3e9..0000000000 --- a/test/files/run/macro-def-infer-return-type-a/Impls_1.scala +++ /dev/null @@ -1,5 +0,0 @@ -import scala.reflect.macros.{Context => Ctx} - -object Impls { - def foo(c: Ctx)(x: c.Expr[Int]) = x -} diff --git a/test/files/run/macro-def-infer-return-type-a/Macros_Test_2.scala b/test/files/run/macro-def-infer-return-type-a/Macros_Test_2.scala deleted file mode 100644 index 60fe9dc1c2..0000000000 --- a/test/files/run/macro-def-infer-return-type-a/Macros_Test_2.scala +++ /dev/null @@ -1,4 +0,0 @@ -object Test extends App { - def foo(x: Int) = macro Impls.foo - println(foo(42)) -}
\ No newline at end of file diff --git a/test/files/run/macro-def-infer-return-type-b/Impls_Macros_1.scala b/test/files/run/macro-def-infer-return-type-b/Impls_Macros_1.scala deleted file mode 100644 index 8a0f18c01b..0000000000 --- a/test/files/run/macro-def-infer-return-type-b/Impls_Macros_1.scala +++ /dev/null @@ -1,10 +0,0 @@ -import scala.reflect.macros.{Context => Ctx} - -object Impls { - def foo[T](c: Ctx)(x: c.Expr[T]) = - throw new Error("an implementation is missing") -} - -object Macros { - def foo[T](x: T) = macro Impls.foo[T] -}
\ No newline at end of file diff --git a/test/files/run/macro-def-infer-return-type-b/Test_2.scala b/test/files/run/macro-def-infer-return-type-b/Test_2.scala deleted file mode 100644 index 9e57b90b57..0000000000 --- a/test/files/run/macro-def-infer-return-type-b/Test_2.scala +++ /dev/null @@ -1,8 +0,0 @@ -object Test extends App { - import scala.reflect.runtime.universe._ - import scala.reflect.runtime.{currentMirror => cm} - import scala.tools.reflect.ToolBox - val tree = Apply(Select(Ident(TermName("Macros")), TermName("foo")), List(Literal(Constant(42)))) - try cm.mkToolBox().eval(tree) - catch { case ex: Throwable => println(ex.getMessage) } -} diff --git a/test/files/run/macro-def-infer-return-type-c.check b/test/files/run/macro-def-infer-return-type-c.check deleted file mode 100644 index f70d7bba4a..0000000000 --- a/test/files/run/macro-def-infer-return-type-c.check +++ /dev/null @@ -1 +0,0 @@ -42
\ No newline at end of file diff --git a/test/files/run/macro-def-infer-return-type-c/Impls_1.scala b/test/files/run/macro-def-infer-return-type-c/Impls_1.scala deleted file mode 100644 index 78db67eebf..0000000000 --- a/test/files/run/macro-def-infer-return-type-c/Impls_1.scala +++ /dev/null @@ -1,5 +0,0 @@ -import scala.reflect.macros.{Context => Ctx} - -object Impls { - def foo[T](c: Ctx)(x: c.Expr[T]): c.Expr[T] = x -} diff --git a/test/files/run/macro-def-infer-return-type-c/Macros_Test_2.scala b/test/files/run/macro-def-infer-return-type-c/Macros_Test_2.scala deleted file mode 100644 index 967d16f6de..0000000000 --- a/test/files/run/macro-def-infer-return-type-c/Macros_Test_2.scala +++ /dev/null @@ -1,4 +0,0 @@ -object Test extends App { - def foo[T](x: T) = macro Impls.foo[T] - println(foo(42)) -}
\ No newline at end of file diff --git a/test/files/run/macro-def-infer-return-type-b.check b/test/files/run/macro-def-infer-return-type.check index ae2dc7a06f..308e881960 100644 --- a/test/files/run/macro-def-infer-return-type-b.check +++ b/test/files/run/macro-def-infer-return-type.check @@ -1,6 +1,8 @@ +42 reflective compilation has failed: exception during macro expansion: java.lang.Error: an implementation is missing - at Impls$.foo(Impls_Macros_1.scala:5) + at Impls2$.foo(Impls_1.scala:9) +42 diff --git a/test/files/run/macro-declared-in-anonymous.flags b/test/files/run/macro-def-infer-return-type.flags index cd66464f2f..cd66464f2f 100644 --- a/test/files/run/macro-declared-in-anonymous.flags +++ b/test/files/run/macro-def-infer-return-type.flags diff --git a/test/files/run/macro-def-infer-return-type/Impls_1.scala b/test/files/run/macro-def-infer-return-type/Impls_1.scala new file mode 100644 index 0000000000..f8636fe725 --- /dev/null +++ b/test/files/run/macro-def-infer-return-type/Impls_1.scala @@ -0,0 +1,14 @@ +import scala.reflect.macros.Context + +object Impls1 { + def foo(c: Context)(x: c.Expr[Int]) = x +} + +object Impls2 { + def foo[T](c: Context)(x: c.Expr[T]) = + throw new Error("an implementation is missing") +} + +object Impls3 { + def foo[T](c: Context)(x: c.Expr[T]): c.Expr[T] = x +} diff --git a/test/files/run/macro-def-infer-return-type/Macros_Test_2.scala b/test/files/run/macro-def-infer-return-type/Macros_Test_2.scala new file mode 100644 index 0000000000..f579586b7f --- /dev/null +++ b/test/files/run/macro-def-infer-return-type/Macros_Test_2.scala @@ -0,0 +1,24 @@ +object Macros1 { + def foo(x: Int) = macro Impls1.foo +} + +object Macros2 { + def foo[T](x: T) = macro Impls2.foo[T] +} + +object Macros3 { + def foo[T](x: T) = macro Impls3.foo[T] +} + +object Test extends App { + println(Macros1.foo(42)) + + import scala.reflect.runtime.universe._ + import scala.reflect.runtime.{currentMirror => cm} + import scala.tools.reflect.ToolBox + val tree = Apply(Select(Ident(TermName("Macros2")), TermName("foo")), List(Literal(Constant(42)))) + try cm.mkToolBox().eval(tree) + catch { case ex: Throwable => println(ex.getMessage) } + + println(Macros3.foo(42)) +} diff --git a/test/files/run/macro-def-path-dependent-b.check b/test/files/run/macro-def-path-dependent-b.check deleted file mode 100644 index 7658ad2c24..0000000000 --- a/test/files/run/macro-def-path-dependent-b.check +++ /dev/null @@ -1 +0,0 @@ -it works diff --git a/test/files/run/macro-def-path-dependent-c.check b/test/files/run/macro-def-path-dependent-c.check deleted file mode 100644 index 7658ad2c24..0000000000 --- a/test/files/run/macro-def-path-dependent-c.check +++ /dev/null @@ -1 +0,0 @@ -it works diff --git a/test/files/run/macro-def-path-dependent-d1.check b/test/files/run/macro-def-path-dependent-d1.check deleted file mode 100644 index 7658ad2c24..0000000000 --- a/test/files/run/macro-def-path-dependent-d1.check +++ /dev/null @@ -1 +0,0 @@ -it works diff --git a/test/files/run/macro-def-path-dependent-d1/Test_2.scala b/test/files/run/macro-def-path-dependent-d1/Test_2.scala deleted file mode 100644 index 7dffc5107d..0000000000 --- a/test/files/run/macro-def-path-dependent-d1/Test_2.scala +++ /dev/null @@ -1,3 +0,0 @@ -object Test extends App { - println("it works") -}
\ No newline at end of file diff --git a/test/files/run/macro-def-path-dependent-d2.check b/test/files/run/macro-def-path-dependent-d2.check deleted file mode 100644 index 7658ad2c24..0000000000 --- a/test/files/run/macro-def-path-dependent-d2.check +++ /dev/null @@ -1 +0,0 @@ -it works diff --git a/test/files/run/macro-def-path-dependent-d2.flags b/test/files/run/macro-def-path-dependent-d2.flags deleted file mode 100644 index cd66464f2f..0000000000 --- a/test/files/run/macro-def-path-dependent-d2.flags +++ /dev/null @@ -1 +0,0 @@ --language:experimental.macros
\ No newline at end of file diff --git a/test/files/run/macro-def-path-dependent-d2/Test_3.scala b/test/files/run/macro-def-path-dependent-d2/Test_3.scala deleted file mode 100644 index 7dffc5107d..0000000000 --- a/test/files/run/macro-def-path-dependent-d2/Test_3.scala +++ /dev/null @@ -1,3 +0,0 @@ -object Test extends App { - println("it works") -}
\ No newline at end of file diff --git a/test/files/run/macro-declared-in-annotation.check b/test/files/run/macro-def-path-dependent.check index 7658ad2c24..7658ad2c24 100644 --- a/test/files/run/macro-declared-in-annotation.check +++ b/test/files/run/macro-def-path-dependent.check diff --git a/test/files/run/macro-declared-in-block.flags b/test/files/run/macro-def-path-dependent.flags index cd66464f2f..cd66464f2f 100644 --- a/test/files/run/macro-declared-in-block.flags +++ b/test/files/run/macro-def-path-dependent.flags diff --git a/test/files/run/macro-def-path-dependent-a/Test_2.scala b/test/files/run/macro-def-path-dependent/Dummy.scala index 7dffc5107d..7dffc5107d 100644 --- a/test/files/run/macro-def-path-dependent-a/Test_2.scala +++ b/test/files/run/macro-def-path-dependent/Dummy.scala diff --git a/test/files/run/macro-def-path-dependent-a/Impls_Macros_1.scala b/test/files/run/macro-def-path-dependent/Test_1.scala index 3a91e41ff9..06c15e16c9 100644 --- a/test/files/run/macro-def-path-dependent-a/Impls_Macros_1.scala +++ b/test/files/run/macro-def-path-dependent/Test_1.scala @@ -1,3 +1,5 @@ +package test1 + import scala.reflect.macros.{Context => Ctx} trait Exprs { diff --git a/test/files/run/macro-def-path-dependent-b/Impls_Macros_1.scala b/test/files/run/macro-def-path-dependent/Test_2.scala index cf9f9ebd0e..f1e9909981 100644 --- a/test/files/run/macro-def-path-dependent-b/Impls_Macros_1.scala +++ b/test/files/run/macro-def-path-dependent/Test_2.scala @@ -1,3 +1,5 @@ +package test2 + import scala.reflect.macros.{Context => Ctx} trait Exprs { diff --git a/test/files/run/macro-def-path-dependent-c/Impls_Macros_1.scala b/test/files/run/macro-def-path-dependent/Test_3.scala index 6cb374d9ba..9f5efe5e47 100644 --- a/test/files/run/macro-def-path-dependent-c/Impls_Macros_1.scala +++ b/test/files/run/macro-def-path-dependent/Test_3.scala @@ -1,3 +1,5 @@ +package test3 + import scala.reflect.macros.{Context => Ctx} trait Exprs { diff --git a/test/files/run/macro-def-path-dependent-d1/Impls_Macros_1.scala b/test/files/run/macro-def-path-dependent/Test_4.scala index 69d9708b2a..3af920d739 100644 --- a/test/files/run/macro-def-path-dependent-d1/Impls_Macros_1.scala +++ b/test/files/run/macro-def-path-dependent/Test_4.scala @@ -1,3 +1,5 @@ +package test4 + import scala.reflect.runtime.universe._ import scala.reflect.macros.Context import scala.reflect.api.Universe diff --git a/test/files/run/macro-def-path-dependent-d2/Impls_1.scala b/test/files/run/macro-def-path-dependent/Test_5.scala index 7fa9c3579e..bc32fb92de 100644 --- a/test/files/run/macro-def-path-dependent-d2/Impls_1.scala +++ b/test/files/run/macro-def-path-dependent/Test_5.scala @@ -1,3 +1,5 @@ +package test56 + import scala.reflect.runtime.universe._ import scala.reflect.macros.Context import scala.reflect.api.Universe diff --git a/test/files/run/macro-def-path-dependent-d2/Macros_2.scala b/test/files/run/macro-def-path-dependent/Test_6.scala index 65ce4d8bd2..6267743473 100644 --- a/test/files/run/macro-def-path-dependent-d2/Macros_2.scala +++ b/test/files/run/macro-def-path-dependent/Test_6.scala @@ -1,3 +1,5 @@ +package test56 + import scala.reflect.runtime.universe._ import scala.reflect.macros.Context import scala.reflect.api.Universe diff --git a/test/files/run/macro-duplicate.check b/test/files/run/macro-duplicate.check index e69de29bb2..58781b719a 100644 --- a/test/files/run/macro-duplicate.check +++ b/test/files/run/macro-duplicate.check @@ -0,0 +1,3 @@ +Test_2.scala:5: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses + Macros.foo + ^ diff --git a/test/files/run/macro-expand-implicit-macro-is-implicit/Macros_Test_2.scala b/test/files/run/macro-expand-implicit-macro-is-implicit/Macros_Test_2.scala index 81ebd63c5f..22047eeb36 100644 --- a/test/files/run/macro-expand-implicit-macro-is-implicit/Macros_Test_2.scala +++ b/test/files/run/macro-expand-implicit-macro-is-implicit/Macros_Test_2.scala @@ -1,4 +1,5 @@ object Macros { + import scala.language.implicitConversions implicit def foo(x: String): Option[Int] = macro Impls.foo } @@ -7,4 +8,4 @@ object Test extends App { println("2": Option[Int]) val s: Int = "2" getOrElse 0 println(s) -}
\ No newline at end of file +} diff --git a/test/files/run/macro-expand-implicit-macro-is-view.flags b/test/files/run/macro-expand-implicit-macro-is-view.flags deleted file mode 100644 index cd66464f2f..0000000000 --- a/test/files/run/macro-expand-implicit-macro-is-view.flags +++ /dev/null @@ -1 +0,0 @@ --language:experimental.macros
\ No newline at end of file diff --git a/test/files/run/macro-expand-implicit-macro-is-view/Macros_Test_2.scala b/test/files/run/macro-expand-implicit-macro-is-view/Macros_Test_2.scala index 0ff1fb80ca..0d99f32d7e 100644 --- a/test/files/run/macro-expand-implicit-macro-is-view/Macros_Test_2.scala +++ b/test/files/run/macro-expand-implicit-macro-is-view/Macros_Test_2.scala @@ -1,4 +1,7 @@ + object Macros { + import scala.language.experimental.macros + import scala.language.implicitConversions implicit def foo(x: String): Option[Int] = macro Impls.foo } @@ -6,4 +9,4 @@ object Test extends App { import Macros._ def bar[T <% Option[Int]](x: T) = println(x) println("2") -}
\ No newline at end of file +} diff --git a/test/files/run/macro-expand-nullary-generic.check b/test/files/run/macro-expand-nullary-generic.check index 42976f4baf..0470d239dc 100644 --- a/test/files/run/macro-expand-nullary-generic.check +++ b/test/files/run/macro-expand-nullary-generic.check @@ -1,6 +1,6 @@ -it works WeakTypeTag[Int] -it works WeakTypeTag[Int] -it works WeakTypeTag[Int] -it works WeakTypeTag[Int] -it works WeakTypeTag[Int] +fooNullary[Int] +fooEmpty[Int] +fooEmpty[Int] +barNullary[Int] +barEmpty[Int] kkthxbai diff --git a/test/files/run/macro-expand-nullary-generic/Impls_1.scala b/test/files/run/macro-expand-nullary-generic/Impls_1.scala index 39a9db0e14..5dfdd5c539 100644 --- a/test/files/run/macro-expand-nullary-generic/Impls_1.scala +++ b/test/files/run/macro-expand-nullary-generic/Impls_1.scala @@ -2,14 +2,14 @@ import scala.reflect.runtime.universe._ import scala.reflect.macros.{Context => Ctx} object Impls { - def impl[T: c.WeakTypeTag](c: Ctx) = { + def impl[T: c.WeakTypeTag](c: Ctx)(meth: String) = { import c.universe._ - val body = Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant("it works " + implicitly[c.WeakTypeTag[T]])))) + val body = Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant(s"$meth[${c.weakTypeOf[T]}]")))) c.Expr[Unit](body) } - def fooNullary[T: c.WeakTypeTag](c: Ctx) = impl[T](c) - def fooEmpty[T: c.WeakTypeTag](c: Ctx)() = impl[T](c) - def barNullary[T: c.WeakTypeTag](c: Ctx)(x: c.Expr[Int]) = impl[T](c) - def barEmpty[T: c.WeakTypeTag](c: Ctx)(x: c.Expr[Int])() = impl[T](c) + def fooNullary[T: c.WeakTypeTag](c: Ctx) = impl[T](c)("fooNullary") + def fooEmpty[T: c.WeakTypeTag](c: Ctx)() = impl[T](c)("fooEmpty") + def barNullary[T: c.WeakTypeTag](c: Ctx)(x: c.Expr[Int]) = impl[T](c)("barNullary") + def barEmpty[T: c.WeakTypeTag](c: Ctx)(x: c.Expr[Int])() = impl[T](c)("barEmpty") }
\ No newline at end of file diff --git a/test/files/run/macro-expand-nullary-nongeneric.check b/test/files/run/macro-expand-nullary-nongeneric.check index 9ab5f3a2bc..cb7e766394 100644 --- a/test/files/run/macro-expand-nullary-nongeneric.check +++ b/test/files/run/macro-expand-nullary-nongeneric.check @@ -1,6 +1,6 @@ -it works -it works -it works -it works -it works +fooNullary +fooEmpty +fooEmpty +barNullary +barEmpty kkthxbai diff --git a/test/files/run/macro-expand-nullary-nongeneric/Impls_1.scala b/test/files/run/macro-expand-nullary-nongeneric/Impls_1.scala index 41e50acc86..d23c671c84 100644 --- a/test/files/run/macro-expand-nullary-nongeneric/Impls_1.scala +++ b/test/files/run/macro-expand-nullary-nongeneric/Impls_1.scala @@ -1,14 +1,15 @@ +import scala.reflect.runtime.universe._ import scala.reflect.macros.{Context => Ctx} object Impls { - def impl(c: Ctx) = { + def impl(c: Ctx)(meth: String) = { import c.universe._ - val body = Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant("it works")))) + val body = Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant(meth)))) c.Expr[Unit](body) } - def fooNullary(c: Ctx) = impl(c) - def fooEmpty(c: Ctx)() = impl(c) - def barNullary(c: Ctx)(x: c.Expr[Int]) = impl(c) - def barEmpty(c: Ctx)(x: c.Expr[Int])() = impl(c) + def fooNullary(c: Ctx) = impl(c)("fooNullary") + def fooEmpty(c: Ctx)() = impl(c)("fooEmpty") + def barNullary(c: Ctx)(x: c.Expr[Int]) = impl(c)("barNullary") + def barEmpty(c: Ctx)(x: c.Expr[Int])() = impl(c)("barEmpty") }
\ No newline at end of file diff --git a/test/files/run/macro-expand-tparams-bounds-a.flags b/test/files/run/macro-expand-tparams-bounds-a.flags deleted file mode 100644 index cd66464f2f..0000000000 --- a/test/files/run/macro-expand-tparams-bounds-a.flags +++ /dev/null @@ -1 +0,0 @@ --language:experimental.macros
\ No newline at end of file diff --git a/test/files/run/macro-expand-tparams-bounds-a/Macros_Test_2.scala b/test/files/run/macro-expand-tparams-bounds-a/Macros_Test_2.scala deleted file mode 100644 index b498e6f65b..0000000000 --- a/test/files/run/macro-expand-tparams-bounds-a/Macros_Test_2.scala +++ /dev/null @@ -1,8 +0,0 @@ -object Macros { - def foo[U <: String] = macro Impls.foo[U] -} - -object Test extends App { - import Macros._ - foo[String] -}
\ No newline at end of file diff --git a/test/files/run/macro-expand-tparams-bounds-b.check b/test/files/run/macro-expand-tparams-bounds-b.check deleted file mode 100644 index e69de29bb2..0000000000 --- a/test/files/run/macro-expand-tparams-bounds-b.check +++ /dev/null diff --git a/test/files/run/macro-expand-tparams-bounds-b.flags b/test/files/run/macro-expand-tparams-bounds-b.flags deleted file mode 100644 index cd66464f2f..0000000000 --- a/test/files/run/macro-expand-tparams-bounds-b.flags +++ /dev/null @@ -1 +0,0 @@ --language:experimental.macros
\ No newline at end of file diff --git a/test/files/run/macro-expand-tparams-bounds-b/Impls_1.scala b/test/files/run/macro-expand-tparams-bounds-b/Impls_1.scala deleted file mode 100644 index c11c89151c..0000000000 --- a/test/files/run/macro-expand-tparams-bounds-b/Impls_1.scala +++ /dev/null @@ -1,7 +0,0 @@ -import scala.reflect.macros.{Context => Ctx} - -class C - -object Impls { - def foo[U <: C](c: Ctx): c.Expr[Unit] = c.literalUnit -} diff --git a/test/files/run/macro-expand-tparams-bounds-b/Macros_Test_2.scala b/test/files/run/macro-expand-tparams-bounds-b/Macros_Test_2.scala deleted file mode 100644 index 1a261e9f73..0000000000 --- a/test/files/run/macro-expand-tparams-bounds-b/Macros_Test_2.scala +++ /dev/null @@ -1,10 +0,0 @@ -class D extends C - -object Macros { - def foo[T <: D] = macro Impls.foo[T] -} - -object Test extends App { - import Macros._ - foo[D] -}
\ No newline at end of file diff --git a/test/files/run/macro-expand-tparams-bounds-a.check b/test/files/run/macro-expand-tparams-bounds.check index e69de29bb2..e69de29bb2 100644 --- a/test/files/run/macro-expand-tparams-bounds-a.check +++ b/test/files/run/macro-expand-tparams-bounds.check diff --git a/test/files/run/macro-declared-in-class-class.flags b/test/files/run/macro-expand-tparams-bounds.flags index cd66464f2f..cd66464f2f 100644 --- a/test/files/run/macro-declared-in-class-class.flags +++ b/test/files/run/macro-expand-tparams-bounds.flags diff --git a/test/files/run/macro-expand-tparams-bounds/Impls_1.scala b/test/files/run/macro-expand-tparams-bounds/Impls_1.scala new file mode 100644 index 0000000000..f9103aaf8f --- /dev/null +++ b/test/files/run/macro-expand-tparams-bounds/Impls_1.scala @@ -0,0 +1,12 @@ +import scala.reflect.macros.Context + +object Impls1 { + def foo[U <: String](c: Context): c.Expr[Unit] = c.literalUnit +} + +class C +class D extends C + +object Impls2 { + def foo[U <: C](c: Context): c.Expr[Unit] = c.literalUnit +} diff --git a/test/files/run/macro-expand-tparams-bounds/Macros_Test_2.scala b/test/files/run/macro-expand-tparams-bounds/Macros_Test_2.scala new file mode 100644 index 0000000000..37a4bcb2b9 --- /dev/null +++ b/test/files/run/macro-expand-tparams-bounds/Macros_Test_2.scala @@ -0,0 +1,12 @@ +object Macros1 { + def foo[U <: String] = macro Impls1.foo[U] +} + +object Macros2 { + def foo[T <: D] = macro Impls2.foo[T] +} + +object Test extends App { + Macros1.foo[String] + Macros2.foo[D] +} diff --git a/test/files/run/macro-expand-tparams-only-in-impl.flags b/test/files/run/macro-expand-tparams-only-in-impl.flags deleted file mode 100644 index cd66464f2f..0000000000 --- a/test/files/run/macro-expand-tparams-only-in-impl.flags +++ /dev/null @@ -1 +0,0 @@ --language:experimental.macros
\ No newline at end of file diff --git a/test/files/run/macro-expand-tparams-only-in-impl/Impls_1.scala b/test/files/run/macro-expand-tparams-only-in-impl/Impls_1.scala deleted file mode 100644 index 9b8dafaa97..0000000000 --- a/test/files/run/macro-expand-tparams-only-in-impl/Impls_1.scala +++ /dev/null @@ -1,5 +0,0 @@ -import scala.reflect.macros.{Context => Ctx} - -object Impls { - def foo[U <: String](c: Ctx): c.Expr[Unit] = c.literalUnit -} diff --git a/test/files/run/macro-expand-tparams-optional.flags b/test/files/run/macro-expand-tparams-optional.flags deleted file mode 100644 index cd66464f2f..0000000000 --- a/test/files/run/macro-expand-tparams-optional.flags +++ /dev/null @@ -1 +0,0 @@ --language:experimental.macros
\ No newline at end of file diff --git a/test/files/run/macro-expand-tparams-prefix-a.check b/test/files/run/macro-expand-tparams-prefix-a.check deleted file mode 100644 index ca44a4f652..0000000000 --- a/test/files/run/macro-expand-tparams-prefix-a.check +++ /dev/null @@ -1,4 +0,0 @@ -WeakTypeTag[Int] -WeakTypeTag[Int] -WeakTypeTag[String] -WeakTypeTag[Boolean] diff --git a/test/files/run/macro-expand-tparams-prefix-a.flags b/test/files/run/macro-expand-tparams-prefix-a.flags deleted file mode 100644 index cd66464f2f..0000000000 --- a/test/files/run/macro-expand-tparams-prefix-a.flags +++ /dev/null @@ -1 +0,0 @@ --language:experimental.macros
\ No newline at end of file diff --git a/test/files/run/macro-expand-tparams-prefix-a/Impls_1.scala b/test/files/run/macro-expand-tparams-prefix-a/Impls_1.scala deleted file mode 100644 index c729aada51..0000000000 --- a/test/files/run/macro-expand-tparams-prefix-a/Impls_1.scala +++ /dev/null @@ -1,11 +0,0 @@ -import scala.reflect.runtime.universe._ -import scala.reflect.macros.{Context => Ctx} - -object Impls { - def foo[U: c.WeakTypeTag](c: Ctx)(x: c.Expr[U]) = { - import c.universe._ - val U = implicitly[c.WeakTypeTag[U]] - val body = Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant(U.toString)))) - c.Expr[Unit](body) - } -}
\ No newline at end of file diff --git a/test/files/run/macro-expand-tparams-prefix-a/Macros_Test_2.scala b/test/files/run/macro-expand-tparams-prefix-a/Macros_Test_2.scala deleted file mode 100644 index 81ccb7ff42..0000000000 --- a/test/files/run/macro-expand-tparams-prefix-a/Macros_Test_2.scala +++ /dev/null @@ -1,10 +0,0 @@ -object Test extends App { - class C[T] { - def foo[U](x: U) = macro Impls.foo[U] - } - - new C[Int]().foo(42) - new C[Boolean]().foo(42) - new C[Int]().foo("42") - new C[String]().foo(true) -}
\ No newline at end of file diff --git a/test/files/run/macro-expand-tparams-prefix-b.check b/test/files/run/macro-expand-tparams-prefix-b.check deleted file mode 100644 index 2ff2ce435d..0000000000 --- a/test/files/run/macro-expand-tparams-prefix-b.check +++ /dev/null @@ -1,2 +0,0 @@ -WeakTypeTag[Boolean] WeakTypeTag[Int] -WeakTypeTag[Boolean] WeakTypeTag[String] diff --git a/test/files/run/macro-expand-tparams-prefix-b.flags b/test/files/run/macro-expand-tparams-prefix-b.flags deleted file mode 100644 index cd66464f2f..0000000000 --- a/test/files/run/macro-expand-tparams-prefix-b.flags +++ /dev/null @@ -1 +0,0 @@ --language:experimental.macros
\ No newline at end of file diff --git a/test/files/run/macro-expand-tparams-prefix-b/Impls_1.scala b/test/files/run/macro-expand-tparams-prefix-b/Impls_1.scala deleted file mode 100644 index 8880d13b04..0000000000 --- a/test/files/run/macro-expand-tparams-prefix-b/Impls_1.scala +++ /dev/null @@ -1,12 +0,0 @@ -import scala.reflect.runtime.universe._ -import scala.reflect.macros.{Context => Ctx} - -object Impls { - def foo[T: c.WeakTypeTag, U: c.WeakTypeTag](c: Ctx)(x: c.Expr[U]) = { - import c.universe._ - val T = implicitly[c.WeakTypeTag[T]] - val U = implicitly[c.WeakTypeTag[U]] - val body = Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant(T.toString + " " + U.toString)))) - c.Expr[Unit](body) - } -}
\ No newline at end of file diff --git a/test/files/run/macro-expand-tparams-prefix-b/Macros_Test_2.scala b/test/files/run/macro-expand-tparams-prefix-b/Macros_Test_2.scala deleted file mode 100644 index a4a0acfe8b..0000000000 --- a/test/files/run/macro-expand-tparams-prefix-b/Macros_Test_2.scala +++ /dev/null @@ -1,10 +0,0 @@ -object Test extends App { - class C[T] { - def foo[U](x: U) = macro Impls.foo[T, U] - } - - object D extends C[Boolean] - - D.foo(42) - D.foo("42") -}
\ No newline at end of file diff --git a/test/files/run/macro-expand-tparams-prefix-c1.check b/test/files/run/macro-expand-tparams-prefix-c1.check deleted file mode 100644 index 0f24f74db1..0000000000 --- a/test/files/run/macro-expand-tparams-prefix-c1.check +++ /dev/null @@ -1,3 +0,0 @@ -WeakTypeTag[Int] -WeakTypeTag[String] -WeakTypeTag[Boolean] diff --git a/test/files/run/macro-expand-tparams-prefix-c1.flags b/test/files/run/macro-expand-tparams-prefix-c1.flags deleted file mode 100644 index cd66464f2f..0000000000 --- a/test/files/run/macro-expand-tparams-prefix-c1.flags +++ /dev/null @@ -1 +0,0 @@ --language:experimental.macros
\ No newline at end of file diff --git a/test/files/run/macro-expand-tparams-prefix-c1/Impls_1.scala b/test/files/run/macro-expand-tparams-prefix-c1/Impls_1.scala deleted file mode 100644 index 2df42e969f..0000000000 --- a/test/files/run/macro-expand-tparams-prefix-c1/Impls_1.scala +++ /dev/null @@ -1,13 +0,0 @@ -import scala.reflect.runtime.universe._ -import scala.reflect.macros.{Context => Ctx} - -object Impls { - def foo[T, U: c.WeakTypeTag, V](c: Ctx)(implicit T: c.WeakTypeTag[T], V: c.WeakTypeTag[V]): c.Expr[Unit] = { - import c.universe._ - c.Expr(Block(List( - Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant(T.toString)))), - Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant(implicitly[c.WeakTypeTag[U]].toString)))), - Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant(V.toString))))), - Literal(Constant(())))) - } -}
\ No newline at end of file diff --git a/test/files/run/macro-expand-tparams-prefix-c1/Macros_Test_2.scala b/test/files/run/macro-expand-tparams-prefix-c1/Macros_Test_2.scala deleted file mode 100644 index 4fa0c8cb33..0000000000 --- a/test/files/run/macro-expand-tparams-prefix-c1/Macros_Test_2.scala +++ /dev/null @@ -1,11 +0,0 @@ -class D[T] { - class C[U] { - def foo[V] = macro Impls.foo[T, U, V] - } -} - -object Test extends App { - val outer1 = new D[Int] - val outer2 = new outer1.C[String] - outer2.foo[Boolean] -}
\ No newline at end of file diff --git a/test/files/run/macro-expand-tparams-prefix-c2.check b/test/files/run/macro-expand-tparams-prefix-c2.check deleted file mode 100644 index 0f24f74db1..0000000000 --- a/test/files/run/macro-expand-tparams-prefix-c2.check +++ /dev/null @@ -1,3 +0,0 @@ -WeakTypeTag[Int] -WeakTypeTag[String] -WeakTypeTag[Boolean] diff --git a/test/files/run/macro-expand-tparams-prefix-c2.flags b/test/files/run/macro-expand-tparams-prefix-c2.flags deleted file mode 100644 index cd66464f2f..0000000000 --- a/test/files/run/macro-expand-tparams-prefix-c2.flags +++ /dev/null @@ -1 +0,0 @@ --language:experimental.macros
\ No newline at end of file diff --git a/test/files/run/macro-expand-tparams-prefix-c2/Impls_Macros_1.scala b/test/files/run/macro-expand-tparams-prefix-c2/Impls_Macros_1.scala deleted file mode 100644 index 08817708d4..0000000000 --- a/test/files/run/macro-expand-tparams-prefix-c2/Impls_Macros_1.scala +++ /dev/null @@ -1,19 +0,0 @@ -import scala.reflect.runtime.universe._ -import scala.reflect.macros.{Context => Ctx} - -object Impls { - def foo[T, U: c.WeakTypeTag, V](c: Ctx)(implicit T: c.WeakTypeTag[T], V: c.WeakTypeTag[V]): c.Expr[Unit] = { - import c.universe._ - c.Expr(Block(List( - Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant(T.toString)))), - Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant(implicitly[c.WeakTypeTag[U]].toString)))), - Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant(V.toString))))), - Literal(Constant(())))) - } -} - -class D[T] { - class C[U] { - def foo[V] = macro Impls.foo[T, U, V] - } -}
\ No newline at end of file diff --git a/test/files/run/macro-expand-tparams-prefix-c2/Test_2.scala b/test/files/run/macro-expand-tparams-prefix-c2/Test_2.scala deleted file mode 100644 index e729d4a536..0000000000 --- a/test/files/run/macro-expand-tparams-prefix-c2/Test_2.scala +++ /dev/null @@ -1,5 +0,0 @@ -object Test extends App { - val outer1 = new D[Int] - val outer2 = new outer1.C[String] - outer2.foo[Boolean] -}
\ No newline at end of file diff --git a/test/files/run/macro-expand-tparams-prefix-d1.check b/test/files/run/macro-expand-tparams-prefix-d1.check deleted file mode 100644 index 7832503256..0000000000 --- a/test/files/run/macro-expand-tparams-prefix-d1.check +++ /dev/null @@ -1,3 +0,0 @@ -WeakTypeTag[T] -WeakTypeTag[U] -WeakTypeTag[Boolean] diff --git a/test/files/run/macro-expand-tparams-prefix-d1.flags b/test/files/run/macro-expand-tparams-prefix-d1.flags deleted file mode 100644 index cd66464f2f..0000000000 --- a/test/files/run/macro-expand-tparams-prefix-d1.flags +++ /dev/null @@ -1 +0,0 @@ --language:experimental.macros
\ No newline at end of file diff --git a/test/files/run/macro-expand-tparams-prefix-d1/Impls_1.scala b/test/files/run/macro-expand-tparams-prefix-d1/Impls_1.scala deleted file mode 100644 index 2df42e969f..0000000000 --- a/test/files/run/macro-expand-tparams-prefix-d1/Impls_1.scala +++ /dev/null @@ -1,13 +0,0 @@ -import scala.reflect.runtime.universe._ -import scala.reflect.macros.{Context => Ctx} - -object Impls { - def foo[T, U: c.WeakTypeTag, V](c: Ctx)(implicit T: c.WeakTypeTag[T], V: c.WeakTypeTag[V]): c.Expr[Unit] = { - import c.universe._ - c.Expr(Block(List( - Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant(T.toString)))), - Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant(implicitly[c.WeakTypeTag[U]].toString)))), - Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant(V.toString))))), - Literal(Constant(())))) - } -}
\ No newline at end of file diff --git a/test/files/run/macro-expand-tparams-prefix-d1/Macros_Test_2.scala b/test/files/run/macro-expand-tparams-prefix-d1/Macros_Test_2.scala deleted file mode 100644 index 8222a6d1e8..0000000000 --- a/test/files/run/macro-expand-tparams-prefix-d1/Macros_Test_2.scala +++ /dev/null @@ -1,11 +0,0 @@ -object Test extends App { - class D[T] { - class C[U] { - def foo[V] = macro Impls.foo[T, U, V] - foo[Boolean] - } - } - - val outer1 = new D[Int] - new outer1.C[String] -}
\ No newline at end of file diff --git a/test/files/run/macro-expand-tparams-prefix.check b/test/files/run/macro-expand-tparams-prefix.check new file mode 100644 index 0000000000..7397958066 --- /dev/null +++ b/test/files/run/macro-expand-tparams-prefix.check @@ -0,0 +1,20 @@ +===Macros1=== +WeakTypeTag[Int] +WeakTypeTag[Int] +WeakTypeTag[String] +WeakTypeTag[Boolean] +===Macros2=== +WeakTypeTag[Boolean] WeakTypeTag[Int] +WeakTypeTag[Boolean] WeakTypeTag[String] +===Macros3=== +WeakTypeTag[Int] +WeakTypeTag[String] +WeakTypeTag[Boolean] +===Macros4=== +WeakTypeTag[Int] +WeakTypeTag[String] +WeakTypeTag[Boolean] +===Macros5=== +WeakTypeTag[T] +WeakTypeTag[U] +WeakTypeTag[Boolean] diff --git a/test/files/run/macro-declared-in-class-object.flags b/test/files/run/macro-expand-tparams-prefix.flags index cd66464f2f..cd66464f2f 100644 --- a/test/files/run/macro-declared-in-class-object.flags +++ b/test/files/run/macro-expand-tparams-prefix.flags diff --git a/test/files/run/macro-expand-tparams-prefix/Impls_1.scala b/test/files/run/macro-expand-tparams-prefix/Impls_1.scala new file mode 100644 index 0000000000..e92396d1b4 --- /dev/null +++ b/test/files/run/macro-expand-tparams-prefix/Impls_1.scala @@ -0,0 +1,40 @@ +import scala.reflect.runtime.universe._ +import scala.reflect.macros.Context + +object Impls1 { + def foo[U: c.WeakTypeTag](c: Context)(x: c.Expr[U]) = { + import c.universe._ + val U = implicitly[c.WeakTypeTag[U]] + val body = Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant(U.toString)))) + c.Expr[Unit](body) + } +} + +object Impls2 { + def foo[T: c.WeakTypeTag, U: c.WeakTypeTag](c: Context)(x: c.Expr[U]) = { + import c.universe._ + val T = implicitly[c.WeakTypeTag[T]] + val U = implicitly[c.WeakTypeTag[U]] + val body = Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant(T.toString + " " + U.toString)))) + c.Expr[Unit](body) + } +} + +object Impls345 { + def foo[T, U: c.WeakTypeTag, V](c: Context)(implicit T: c.WeakTypeTag[T], V: c.WeakTypeTag[V]): c.Expr[Unit] = { + import c.universe._ + c.Expr(Block(List( + Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant(T.toString)))), + Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant(implicitly[c.WeakTypeTag[U]].toString)))), + Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant(V.toString))))), + Literal(Constant(())))) + } +} + +object Macros4 { + class D[T] { + class C[U] { + def foo[V] = macro Impls345.foo[T, U, V] + } + } +} diff --git a/test/files/run/macro-expand-tparams-prefix/Macros_Test_2.scala b/test/files/run/macro-expand-tparams-prefix/Macros_Test_2.scala new file mode 100644 index 0000000000..2b1730d36e --- /dev/null +++ b/test/files/run/macro-expand-tparams-prefix/Macros_Test_2.scala @@ -0,0 +1,57 @@ +object Macros1 { + class C[T] { + def foo[U](x: U) = macro Impls1.foo[U] + } +} + +object Macros2 { + class C[T] { + def foo[U](x: U) = macro Impls2.foo[T, U] + } +} + +object Macros3 { + class D[T] { + class C[U] { + def foo[V] = macro Impls345.foo[T, U, V] + } + } +} + +// object Macros4 is declared in Impls_1.scala + +object Macros5 { + class D[T] { + class C[U] { + def foo[V] = macro Impls345.foo[T, U, V] + foo[Boolean] + } + } +} + +object Test extends App { + println("===Macros1===") + new Macros1.C[Int]().foo(42) + new Macros1.C[Boolean]().foo(42) + new Macros1.C[Int]().foo("42") + new Macros1.C[String]().foo(true) + + println("===Macros2===") + object D2 extends Macros2.C[Boolean] + D2.foo(42) + D2.foo("42") + + println("===Macros3===") + val outer31 = new Macros3.D[Int] + val outer32 = new outer31.C[String] + outer32.foo[Boolean] + + println("===Macros4===") + val outer41 = new Macros4.D[Int] + val outer42 = new outer41.C[String] + outer42.foo[Boolean] + + println("===Macros5===") + val outer1 = new Macros5.D[Int] + new outer1.C[String] +}
\ No newline at end of file diff --git a/test/files/run/macro-declared-in-class.flags b/test/files/run/macro-impl-tparam-only-in-impl.flags index cd66464f2f..cd66464f2f 100644 --- a/test/files/run/macro-declared-in-class.flags +++ b/test/files/run/macro-impl-tparam-only-in-impl.flags diff --git a/test/files/run/macro-expand-tparams-bounds-a/Impls_1.scala b/test/files/run/macro-impl-tparam-only-in-impl/Impls_1.scala index 9b8dafaa97..9b8dafaa97 100644 --- a/test/files/run/macro-expand-tparams-bounds-a/Impls_1.scala +++ b/test/files/run/macro-impl-tparam-only-in-impl/Impls_1.scala diff --git a/test/files/run/macro-expand-tparams-only-in-impl/Macros_Test_2.scala b/test/files/run/macro-impl-tparam-only-in-impl/Macros_Test_2.scala index 218c7aec7f..218c7aec7f 100644 --- a/test/files/run/macro-expand-tparams-only-in-impl/Macros_Test_2.scala +++ b/test/files/run/macro-impl-tparam-only-in-impl/Macros_Test_2.scala diff --git a/test/files/run/macro-expand-tparams-optional.check b/test/files/run/macro-impl-tparam-typetag-is-optional.check index b4a0f394c1..b4a0f394c1 100644 --- a/test/files/run/macro-expand-tparams-optional.check +++ b/test/files/run/macro-impl-tparam-typetag-is-optional.check diff --git a/test/files/run/macro-declared-in-default-param.flags b/test/files/run/macro-impl-tparam-typetag-is-optional.flags index cd66464f2f..cd66464f2f 100644 --- a/test/files/run/macro-declared-in-default-param.flags +++ b/test/files/run/macro-impl-tparam-typetag-is-optional.flags diff --git a/test/files/run/macro-expand-tparams-optional/Impls_1.scala b/test/files/run/macro-impl-tparam-typetag-is-optional/Impls_1.scala index ace7a6cd26..ace7a6cd26 100644 --- a/test/files/run/macro-expand-tparams-optional/Impls_1.scala +++ b/test/files/run/macro-impl-tparam-typetag-is-optional/Impls_1.scala diff --git a/test/files/run/macro-expand-tparams-optional/Macros_Test_2.scala b/test/files/run/macro-impl-tparam-typetag-is-optional/Macros_Test_2.scala index e72c27881a..e72c27881a 100644 --- a/test/files/run/macro-expand-tparams-optional/Macros_Test_2.scala +++ b/test/files/run/macro-impl-tparam-typetag-is-optional/Macros_Test_2.scala diff --git a/test/files/run/macro-invalidusage-partialapplication-with-tparams.check b/test/files/run/macro-invalidusage-partialapplication-with-tparams.check index f1d5e925fa..326f3e08ca 100644 --- a/test/files/run/macro-invalidusage-partialapplication-with-tparams.check +++ b/test/files/run/macro-invalidusage-partialapplication-with-tparams.check @@ -1,3 +1,3 @@ reflective compilation has failed: -macros cannot be partially applied +too few argument lists for macro invocation diff --git a/test/files/run/macro-invalidusage-partialapplication.check b/test/files/run/macro-invalidusage-partialapplication.check index f1d5e925fa..326f3e08ca 100644 --- a/test/files/run/macro-invalidusage-partialapplication.check +++ b/test/files/run/macro-invalidusage-partialapplication.check @@ -1,3 +1,3 @@ reflective compilation has failed: -macros cannot be partially applied +too few argument lists for macro invocation diff --git a/test/files/run/macro-def-path-dependent-a.check b/test/files/run/macro-term-declared-in-annotation.check index 7658ad2c24..7658ad2c24 100644 --- a/test/files/run/macro-def-path-dependent-a.check +++ b/test/files/run/macro-term-declared-in-annotation.check diff --git a/test/files/run/macro-declared-in-implicit-class.flags b/test/files/run/macro-term-declared-in-annotation.flags index cd66464f2f..cd66464f2f 100644 --- a/test/files/run/macro-declared-in-implicit-class.flags +++ b/test/files/run/macro-term-declared-in-annotation.flags diff --git a/test/files/run/macro-declared-in-annotation/Impls_1.scala b/test/files/run/macro-term-declared-in-annotation/Impls_1.scala index 1ea06de679..1ea06de679 100644 --- a/test/files/run/macro-declared-in-annotation/Impls_1.scala +++ b/test/files/run/macro-term-declared-in-annotation/Impls_1.scala diff --git a/test/files/run/macro-declared-in-annotation/Macros_2.scala b/test/files/run/macro-term-declared-in-annotation/Macros_2.scala index 40d71c62fb..40d71c62fb 100644 --- a/test/files/run/macro-declared-in-annotation/Macros_2.scala +++ b/test/files/run/macro-term-declared-in-annotation/Macros_2.scala diff --git a/test/files/run/macro-declared-in-annotation/Test_3.scala b/test/files/run/macro-term-declared-in-annotation/Test_3.scala index 866487f028..866487f028 100644 --- a/test/files/run/macro-declared-in-annotation/Test_3.scala +++ b/test/files/run/macro-term-declared-in-annotation/Test_3.scala diff --git a/test/files/run/macro-declared-in-anonymous.check b/test/files/run/macro-term-declared-in-anonymous.check index 09b8d015a6..09b8d015a6 100644 --- a/test/files/run/macro-declared-in-anonymous.check +++ b/test/files/run/macro-term-declared-in-anonymous.check diff --git a/test/files/run/macro-declared-in-method.flags b/test/files/run/macro-term-declared-in-anonymous.flags index cd66464f2f..cd66464f2f 100644 --- a/test/files/run/macro-declared-in-method.flags +++ b/test/files/run/macro-term-declared-in-anonymous.flags diff --git a/test/files/run/macro-declared-in-anonymous/Impls_1.scala b/test/files/run/macro-term-declared-in-anonymous/Impls_1.scala index 348f3420f2..348f3420f2 100644 --- a/test/files/run/macro-declared-in-anonymous/Impls_1.scala +++ b/test/files/run/macro-term-declared-in-anonymous/Impls_1.scala diff --git a/test/files/run/macro-declared-in-anonymous/Macros_Test_2.scala b/test/files/run/macro-term-declared-in-anonymous/Macros_Test_2.scala index 8bd8c172c9..88cd29ae4f 100644 --- a/test/files/run/macro-declared-in-anonymous/Macros_Test_2.scala +++ b/test/files/run/macro-term-declared-in-anonymous/Macros_Test_2.scala @@ -1,4 +1,6 @@ +import scala.language.reflectiveCalls + object Test extends App { val macros = new { def foo = macro Impls.foo } macros.foo -}
\ No newline at end of file +} diff --git a/test/files/run/macro-declared-in-block.check b/test/files/run/macro-term-declared-in-block.check index 5e687db8bf..5e687db8bf 100644 --- a/test/files/run/macro-declared-in-block.check +++ b/test/files/run/macro-term-declared-in-block.check diff --git a/test/files/run/macro-declared-in-object-class.flags b/test/files/run/macro-term-declared-in-block.flags index cd66464f2f..cd66464f2f 100644 --- a/test/files/run/macro-declared-in-object-class.flags +++ b/test/files/run/macro-term-declared-in-block.flags diff --git a/test/files/run/macro-declared-in-block/Impls_1.scala b/test/files/run/macro-term-declared-in-block/Impls_1.scala index 348f3420f2..348f3420f2 100644 --- a/test/files/run/macro-declared-in-block/Impls_1.scala +++ b/test/files/run/macro-term-declared-in-block/Impls_1.scala diff --git a/test/files/run/macro-declared-in-block/Macros_Test_2.scala b/test/files/run/macro-term-declared-in-block/Macros_Test_2.scala index 69088e24bc..69088e24bc 100644 --- a/test/files/run/macro-declared-in-block/Macros_Test_2.scala +++ b/test/files/run/macro-term-declared-in-block/Macros_Test_2.scala diff --git a/test/files/run/macro-declared-in-class-class.check b/test/files/run/macro-term-declared-in-class-class.check index 47248d7af7..47248d7af7 100644 --- a/test/files/run/macro-declared-in-class-class.check +++ b/test/files/run/macro-term-declared-in-class-class.check diff --git a/test/files/run/macro-declared-in-object-object.flags b/test/files/run/macro-term-declared-in-class-class.flags index cd66464f2f..cd66464f2f 100644 --- a/test/files/run/macro-declared-in-object-object.flags +++ b/test/files/run/macro-term-declared-in-class-class.flags diff --git a/test/files/run/macro-declared-in-class-class/Impls_1.scala b/test/files/run/macro-term-declared-in-class-class/Impls_1.scala index 348f3420f2..348f3420f2 100644 --- a/test/files/run/macro-declared-in-class-class/Impls_1.scala +++ b/test/files/run/macro-term-declared-in-class-class/Impls_1.scala diff --git a/test/files/run/macro-declared-in-class-class/Macros_Test_2.scala b/test/files/run/macro-term-declared-in-class-class/Macros_Test_2.scala index 871857a97f..871857a97f 100644 --- a/test/files/run/macro-declared-in-class-class/Macros_Test_2.scala +++ b/test/files/run/macro-term-declared-in-class-class/Macros_Test_2.scala diff --git a/test/files/run/macro-declared-in-class-object.check b/test/files/run/macro-term-declared-in-class-object.check index 35af59e40f..35af59e40f 100644 --- a/test/files/run/macro-declared-in-class-object.check +++ b/test/files/run/macro-term-declared-in-class-object.check diff --git a/test/files/run/macro-declared-in-object.flags b/test/files/run/macro-term-declared-in-class-object.flags index cd66464f2f..cd66464f2f 100644 --- a/test/files/run/macro-declared-in-object.flags +++ b/test/files/run/macro-term-declared-in-class-object.flags diff --git a/test/files/run/macro-declared-in-class-object/Impls_1.scala b/test/files/run/macro-term-declared-in-class-object/Impls_1.scala index 348f3420f2..348f3420f2 100644 --- a/test/files/run/macro-declared-in-class-object/Impls_1.scala +++ b/test/files/run/macro-term-declared-in-class-object/Impls_1.scala diff --git a/test/files/run/macro-declared-in-class-object/Macros_Test_2.scala b/test/files/run/macro-term-declared-in-class-object/Macros_Test_2.scala index 994f9fe935..994f9fe935 100644 --- a/test/files/run/macro-declared-in-class-object/Macros_Test_2.scala +++ b/test/files/run/macro-term-declared-in-class-object/Macros_Test_2.scala diff --git a/test/files/run/macro-declared-in-class.check b/test/files/run/macro-term-declared-in-class.check index a1c1d7af8b..a1c1d7af8b 100644 --- a/test/files/run/macro-declared-in-class.check +++ b/test/files/run/macro-term-declared-in-class.check diff --git a/test/files/run/macro-declared-in-package-object.flags b/test/files/run/macro-term-declared-in-class.flags index cd66464f2f..cd66464f2f 100644 --- a/test/files/run/macro-declared-in-package-object.flags +++ b/test/files/run/macro-term-declared-in-class.flags diff --git a/test/files/run/macro-declared-in-class/Impls_1.scala b/test/files/run/macro-term-declared-in-class/Impls_1.scala index 348f3420f2..348f3420f2 100644 --- a/test/files/run/macro-declared-in-class/Impls_1.scala +++ b/test/files/run/macro-term-declared-in-class/Impls_1.scala diff --git a/test/files/run/macro-declared-in-class/Macros_Test_2.scala b/test/files/run/macro-term-declared-in-class/Macros_Test_2.scala index 1b9d13e775..1b9d13e775 100644 --- a/test/files/run/macro-declared-in-class/Macros_Test_2.scala +++ b/test/files/run/macro-term-declared-in-class/Macros_Test_2.scala diff --git a/test/files/run/macro-declared-in-default-param.check b/test/files/run/macro-term-declared-in-default-param.check index 6decd7aa4d..6decd7aa4d 100644 --- a/test/files/run/macro-declared-in-default-param.check +++ b/test/files/run/macro-term-declared-in-default-param.check diff --git a/test/files/run/macro-declared-in-refinement.flags b/test/files/run/macro-term-declared-in-default-param.flags index cd66464f2f..cd66464f2f 100644 --- a/test/files/run/macro-declared-in-refinement.flags +++ b/test/files/run/macro-term-declared-in-default-param.flags diff --git a/test/files/run/macro-declared-in-default-param/Impls_1.scala b/test/files/run/macro-term-declared-in-default-param/Impls_1.scala index 4380f40b04..4380f40b04 100644 --- a/test/files/run/macro-declared-in-default-param/Impls_1.scala +++ b/test/files/run/macro-term-declared-in-default-param/Impls_1.scala diff --git a/test/files/run/macro-declared-in-default-param/Macros_Test_2.scala b/test/files/run/macro-term-declared-in-default-param/Macros_Test_2.scala index 356029e63e..356029e63e 100644 --- a/test/files/run/macro-declared-in-default-param/Macros_Test_2.scala +++ b/test/files/run/macro-term-declared-in-default-param/Macros_Test_2.scala diff --git a/test/files/run/macro-declared-in-implicit-class.check b/test/files/run/macro-term-declared-in-implicit-class.check index 5dc968c08c..5dc968c08c 100644 --- a/test/files/run/macro-declared-in-implicit-class.check +++ b/test/files/run/macro-term-declared-in-implicit-class.check diff --git a/test/files/run/macro-declared-in-trait.flags b/test/files/run/macro-term-declared-in-implicit-class.flags index cd66464f2f..cd66464f2f 100644 --- a/test/files/run/macro-declared-in-trait.flags +++ b/test/files/run/macro-term-declared-in-implicit-class.flags diff --git a/test/files/run/macro-declared-in-implicit-class/Impls_Macros_1.scala b/test/files/run/macro-term-declared-in-implicit-class/Impls_Macros_1.scala index 4c009cc367..4c009cc367 100644 --- a/test/files/run/macro-declared-in-implicit-class/Impls_Macros_1.scala +++ b/test/files/run/macro-term-declared-in-implicit-class/Impls_Macros_1.scala diff --git a/test/files/run/macro-declared-in-implicit-class/Test_2.scala b/test/files/run/macro-term-declared-in-implicit-class/Test_2.scala index d0bc9cc38c..d0bc9cc38c 100644 --- a/test/files/run/macro-declared-in-implicit-class/Test_2.scala +++ b/test/files/run/macro-term-declared-in-implicit-class/Test_2.scala diff --git a/test/files/run/macro-declared-in-method.check b/test/files/run/macro-term-declared-in-method.check index 5e687db8bf..5e687db8bf 100644 --- a/test/files/run/macro-declared-in-method.check +++ b/test/files/run/macro-term-declared-in-method.check diff --git a/test/files/run/macro-def-infer-return-type-a.flags b/test/files/run/macro-term-declared-in-method.flags index cd66464f2f..cd66464f2f 100644 --- a/test/files/run/macro-def-infer-return-type-a.flags +++ b/test/files/run/macro-term-declared-in-method.flags diff --git a/test/files/run/macro-declared-in-method/Impls_1.scala b/test/files/run/macro-term-declared-in-method/Impls_1.scala index 348f3420f2..348f3420f2 100644 --- a/test/files/run/macro-declared-in-method/Impls_1.scala +++ b/test/files/run/macro-term-declared-in-method/Impls_1.scala diff --git a/test/files/run/macro-declared-in-method/Macros_Test_2.scala b/test/files/run/macro-term-declared-in-method/Macros_Test_2.scala index ed5c8b7c43..ed5c8b7c43 100644 --- a/test/files/run/macro-declared-in-method/Macros_Test_2.scala +++ b/test/files/run/macro-term-declared-in-method/Macros_Test_2.scala diff --git a/test/files/run/macro-declared-in-object-class.check b/test/files/run/macro-term-declared-in-object-class.check index 47248d7af7..47248d7af7 100644 --- a/test/files/run/macro-declared-in-object-class.check +++ b/test/files/run/macro-term-declared-in-object-class.check diff --git a/test/files/run/macro-def-infer-return-type-b.flags b/test/files/run/macro-term-declared-in-object-class.flags index cd66464f2f..cd66464f2f 100644 --- a/test/files/run/macro-def-infer-return-type-b.flags +++ b/test/files/run/macro-term-declared-in-object-class.flags diff --git a/test/files/run/macro-declared-in-object-class/Impls_1.scala b/test/files/run/macro-term-declared-in-object-class/Impls_1.scala index 348f3420f2..348f3420f2 100644 --- a/test/files/run/macro-declared-in-object-class/Impls_1.scala +++ b/test/files/run/macro-term-declared-in-object-class/Impls_1.scala diff --git a/test/files/run/macro-declared-in-object-class/Macros_Test_2.scala b/test/files/run/macro-term-declared-in-object-class/Macros_Test_2.scala index 204deed61c..204deed61c 100644 --- a/test/files/run/macro-declared-in-object-class/Macros_Test_2.scala +++ b/test/files/run/macro-term-declared-in-object-class/Macros_Test_2.scala diff --git a/test/files/run/macro-declared-in-object-object.check b/test/files/run/macro-term-declared-in-object-object.check index 35af59e40f..35af59e40f 100644 --- a/test/files/run/macro-declared-in-object-object.check +++ b/test/files/run/macro-term-declared-in-object-object.check diff --git a/test/files/run/macro-def-infer-return-type-c.flags b/test/files/run/macro-term-declared-in-object-object.flags index cd66464f2f..cd66464f2f 100644 --- a/test/files/run/macro-def-infer-return-type-c.flags +++ b/test/files/run/macro-term-declared-in-object-object.flags diff --git a/test/files/run/macro-declared-in-object-object/Impls_1.scala b/test/files/run/macro-term-declared-in-object-object/Impls_1.scala index 348f3420f2..348f3420f2 100644 --- a/test/files/run/macro-declared-in-object-object/Impls_1.scala +++ b/test/files/run/macro-term-declared-in-object-object/Impls_1.scala diff --git a/test/files/run/macro-declared-in-object-object/Macros_Test_2.scala b/test/files/run/macro-term-declared-in-object-object/Macros_Test_2.scala index e261a50f3d..e261a50f3d 100644 --- a/test/files/run/macro-declared-in-object-object/Macros_Test_2.scala +++ b/test/files/run/macro-term-declared-in-object-object/Macros_Test_2.scala diff --git a/test/files/run/macro-declared-in-object.check b/test/files/run/macro-term-declared-in-object.check index 4d955a96b1..4d955a96b1 100644 --- a/test/files/run/macro-declared-in-object.check +++ b/test/files/run/macro-term-declared-in-object.check diff --git a/test/files/run/macro-def-path-dependent-a.flags b/test/files/run/macro-term-declared-in-object.flags index cd66464f2f..cd66464f2f 100644 --- a/test/files/run/macro-def-path-dependent-a.flags +++ b/test/files/run/macro-term-declared-in-object.flags diff --git a/test/files/run/macro-declared-in-object/Impls_1.scala b/test/files/run/macro-term-declared-in-object/Impls_1.scala index 348f3420f2..348f3420f2 100644 --- a/test/files/run/macro-declared-in-object/Impls_1.scala +++ b/test/files/run/macro-term-declared-in-object/Impls_1.scala diff --git a/test/files/run/macro-declared-in-object/Macros_Test_2.scala b/test/files/run/macro-term-declared-in-object/Macros_Test_2.scala index a5a4862ba0..a5a4862ba0 100644 --- a/test/files/run/macro-declared-in-object/Macros_Test_2.scala +++ b/test/files/run/macro-term-declared-in-object/Macros_Test_2.scala diff --git a/test/files/run/macro-declared-in-package-object.check b/test/files/run/macro-term-declared-in-package-object.check index bc0069178d..bc0069178d 100644 --- a/test/files/run/macro-declared-in-package-object.check +++ b/test/files/run/macro-term-declared-in-package-object.check diff --git a/test/files/run/macro-def-path-dependent-b.flags b/test/files/run/macro-term-declared-in-package-object.flags index cd66464f2f..cd66464f2f 100644 --- a/test/files/run/macro-def-path-dependent-b.flags +++ b/test/files/run/macro-term-declared-in-package-object.flags diff --git a/test/files/run/macro-declared-in-package-object/Impls_1.scala b/test/files/run/macro-term-declared-in-package-object/Impls_1.scala index 348f3420f2..348f3420f2 100644 --- a/test/files/run/macro-declared-in-package-object/Impls_1.scala +++ b/test/files/run/macro-term-declared-in-package-object/Impls_1.scala diff --git a/test/files/run/macro-declared-in-package-object/Macros_Test_2.scala b/test/files/run/macro-term-declared-in-package-object/Macros_Test_2.scala index 54a5962e80..54a5962e80 100644 --- a/test/files/run/macro-declared-in-package-object/Macros_Test_2.scala +++ b/test/files/run/macro-term-declared-in-package-object/Macros_Test_2.scala diff --git a/test/files/run/macro-declared-in-refinement.check b/test/files/run/macro-term-declared-in-refinement.check index 09b8d015a6..09b8d015a6 100644 --- a/test/files/run/macro-declared-in-refinement.check +++ b/test/files/run/macro-term-declared-in-refinement.check diff --git a/test/files/run/macro-def-path-dependent-c.flags b/test/files/run/macro-term-declared-in-refinement.flags index cd66464f2f..cd66464f2f 100644 --- a/test/files/run/macro-def-path-dependent-c.flags +++ b/test/files/run/macro-term-declared-in-refinement.flags diff --git a/test/files/run/macro-declared-in-refinement/Impls_1.scala b/test/files/run/macro-term-declared-in-refinement/Impls_1.scala index 348f3420f2..348f3420f2 100644 --- a/test/files/run/macro-declared-in-refinement/Impls_1.scala +++ b/test/files/run/macro-term-declared-in-refinement/Impls_1.scala diff --git a/test/files/run/macro-declared-in-refinement/Macros_Test_2.scala b/test/files/run/macro-term-declared-in-refinement/Macros_Test_2.scala index f746c2da57..ff9a66d58a 100644 --- a/test/files/run/macro-declared-in-refinement/Macros_Test_2.scala +++ b/test/files/run/macro-term-declared-in-refinement/Macros_Test_2.scala @@ -1,6 +1,9 @@ + +import scala.language.reflectiveCalls + class Base object Test extends App { val macros = new Base { def foo = macro Impls.foo } macros.foo -}
\ No newline at end of file +} diff --git a/test/files/run/macro-declared-in-trait.check b/test/files/run/macro-term-declared-in-trait.check index 0d70ac74f3..0d70ac74f3 100644 --- a/test/files/run/macro-declared-in-trait.check +++ b/test/files/run/macro-term-declared-in-trait.check diff --git a/test/files/run/macro-def-path-dependent-d1.flags b/test/files/run/macro-term-declared-in-trait.flags index cd66464f2f..cd66464f2f 100644 --- a/test/files/run/macro-def-path-dependent-d1.flags +++ b/test/files/run/macro-term-declared-in-trait.flags diff --git a/test/files/run/macro-declared-in-trait/Impls_1.scala b/test/files/run/macro-term-declared-in-trait/Impls_1.scala index 348f3420f2..348f3420f2 100644 --- a/test/files/run/macro-declared-in-trait/Impls_1.scala +++ b/test/files/run/macro-term-declared-in-trait/Impls_1.scala diff --git a/test/files/run/macro-declared-in-trait/Macros_Test_2.scala b/test/files/run/macro-term-declared-in-trait/Macros_Test_2.scala index f75906b636..f75906b636 100644 --- a/test/files/run/macro-declared-in-trait/Macros_Test_2.scala +++ b/test/files/run/macro-term-declared-in-trait/Macros_Test_2.scala diff --git a/test/files/run/macro-toplevel-companion-b/Test_2.scala b/test/files/run/macro-toplevel-companion-b/Test_2.scala index ca202d053f..4e766bde89 100644 --- a/test/files/run/macro-toplevel-companion-b/Test_2.scala +++ b/test/files/run/macro-toplevel-companion-b/Test_2.scala @@ -7,5 +7,5 @@ import Macros._ object Test extends App { val tb = cm.mkToolBox() try tb.compile(Select(Ident(TermName("Macros")), TermName("foo"))) - catch { case ToolBoxError(message, _) => println("""macroSynthetic-.*?\.scala""".r.replaceAllIn(message, "<synthetic file name>")) } + catch { case ToolBoxError(message, _) => println("""(Found in|and) .*?compileLateSynthetic-.*?\.scala""".r.replaceAllIn(message, m => m.group(1) + " <synthetic file name>")) } }
\ No newline at end of file diff --git a/test/files/run/macro-toplevel-companion-c.scala b/test/files/run/macro-toplevel-companion-c.scala index 0e99903158..c315f8b942 100644 --- a/test/files/run/macro-toplevel-companion-c.scala +++ b/test/files/run/macro-toplevel-companion-c.scala @@ -45,7 +45,7 @@ object Test extends DirectTest { log("Compiling Test_2...") if (compileTest()) log("Success!") else log("Failed...") } - println("""macroSynthetic-.*?\.scala""".r.replaceAllIn(baos.toString, "<synthetic file name>")) + println("""(Found in|and) .*?compileLateSynthetic-.*?\.scala""".r.replaceAllIn(baos.toString, m => m.group(1) + " <synthetic file name>")) System.setErr(prevErr) } }
\ No newline at end of file diff --git a/test/files/run/manifests-new.scala b/test/files/run/manifests-new.scala index f1596dee81..8b42e3ca73 100644 --- a/test/files/run/manifests-new.scala +++ b/test/files/run/manifests-new.scala @@ -1,3 +1,6 @@ + + +import scala.language.{ higherKinds, postfixOps } import scala.reflect.runtime.universe._ object Test @@ -146,4 +149,4 @@ object Test } def main(args: Array[String]): Unit = runAllTests -}
\ No newline at end of file +} diff --git a/test/files/run/manifests-old.scala b/test/files/run/manifests-old.scala index 621689a254..d8b1e751d4 100644 --- a/test/files/run/manifests-old.scala +++ b/test/files/run/manifests-old.scala @@ -1,3 +1,6 @@ +import scala.language.{ higherKinds, postfixOps } + +@deprecated("Suppress warnings", since="2.11") object Test { object Variances extends Enumeration { @@ -144,4 +147,4 @@ object Test } def main(args: Array[String]): Unit = runAllTests -}
\ No newline at end of file +} diff --git a/test/files/run/mapConserve.scala b/test/files/run/mapConserve.scala index 013095b1de..330fb34ca1 100644 --- a/test/files/run/mapConserve.scala +++ b/test/files/run/mapConserve.scala @@ -1,3 +1,6 @@ +/* + * filter: inliner warning\(s\); re-run with -Yinline-warnings for details + */ import scala.annotation.tailrec import scala.collection.mutable.ListBuffer @@ -50,4 +53,4 @@ object Test { checkStackOverflow(); } -}
\ No newline at end of file +} diff --git a/test/files/run/misc.check b/test/files/run/misc.check index 9fa7b72d50..56116f8104 100644 --- a/test/files/run/misc.check +++ b/test/files/run/misc.check @@ -1,3 +1,27 @@ +misc.scala:46: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses + 42; + ^ +misc.scala:47: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses + 42l; + ^ +misc.scala:48: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses + 23.5f; + ^ +misc.scala:49: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses + 23.5; + ^ +misc.scala:50: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses + "Hello"; + ^ +misc.scala:51: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses + 32 + 45; + ^ +misc.scala:62: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses + x; + ^ +misc.scala:74: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses + 1 < 2; + ^ ### Hello ### 17 ### Bye diff --git a/test/files/run/names-defaults.check b/test/files/run/names-defaults.check index f253de71d6..0037822f3b 100644 --- a/test/files/run/names-defaults.check +++ b/test/files/run/names-defaults.check @@ -1,3 +1,7 @@ +names-defaults.scala:269: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses + spawn(b = { val ttt = 1; ttt }, a = 0) + ^ +warning: there were 4 deprecation warning(s); re-run with -deprecation for details 1: @ get: $ get: 2 diff --git a/test/files/run/names-defaults.scala b/test/files/run/names-defaults.scala index 220414f02a..05cd4a540c 100644 --- a/test/files/run/names-defaults.scala +++ b/test/files/run/names-defaults.scala @@ -1,3 +1,6 @@ + +import scala.language.{ higherKinds, existentials } + object Test extends App { def get[T](x: T) = { println("get: "+ x); x } diff --git a/test/files/run/no-pickle-skolems/Test_2.scala b/test/files/run/no-pickle-skolems/Test_2.scala index 90bb4c4f88..8fd6016aea 100644 --- a/test/files/run/no-pickle-skolems/Test_2.scala +++ b/test/files/run/no-pickle-skolems/Test_2.scala @@ -1,3 +1,5 @@ + +import scala.language.reflectiveCalls import scala.reflect.runtime.universe._ object Test { diff --git a/test/files/run/option-fold.scala b/test/files/run/option-fold.scala index d554ba4f9b..7e21403c2e 100644 --- a/test/files/run/option-fold.scala +++ b/test/files/run/option-fold.scala @@ -7,13 +7,14 @@ object Test { def g(x: Option[A]) = x.fold(-1) { case B => 0 case C(x) => x + case _ => ??? } def main(args: Array[String]): Unit = { - println(f(None)) - println(f(Some(5))) - println(g(None)) - println(g(Some(B))) - println(g(Some(C(1)))) + println(f(None)) //List() + println(f(Some(5))) //List(5) + println(g(None)) //-1 + println(g(Some(B))) //0 + println(g(Some(C(1)))) //1 } } diff --git a/test/files/run/patmat-exprs.scala b/test/files/run/patmat-exprs.scala index dfc78e2ca5..56e4e01598 100644 --- a/test/files/run/patmat-exprs.scala +++ b/test/files/run/patmat-exprs.scala @@ -1,3 +1,5 @@ + +import scala.language.{ implicitConversions } import runtime.ScalaRunTime object Test { @@ -576,4 +578,4 @@ trait Pattern { implicit def long2Constant[T](l: Long)(implicit num: NumericOps[T]): Leaf[T] = const(num.fromDouble(l.toDouble)) } -}
\ No newline at end of file +} diff --git a/test/files/run/patmat_unapp_abstype-new.check b/test/files/run/patmat_unapp_abstype-new.check index 42c54631d2..c5511e9516 100644 --- a/test/files/run/patmat_unapp_abstype-new.check +++ b/test/files/run/patmat_unapp_abstype-new.check @@ -1,3 +1,9 @@ +patmat_unapp_abstype-new.scala:21: warning: abstract type pattern TypesUser.this.TypeRef is unchecked since it is eliminated by erasure + case TypeRef(x) => println("TypeRef") + ^ +patmat_unapp_abstype-new.scala:53: warning: abstract type pattern Intermed.this.Foo is unchecked since it is eliminated by erasure + case Foo(x) => println("Foo") + ^ TypeRef MethodType Bar diff --git a/test/files/run/patmatnew.check b/test/files/run/patmatnew.check index e69de29bb2..56b8ac2f4f 100644 --- a/test/files/run/patmatnew.check +++ b/test/files/run/patmatnew.check @@ -0,0 +1,15 @@ +patmatnew.scala:351: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses + case 1 => "OK" + ^ +patmatnew.scala:352: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses + case 2 => assert(false); "KO" + ^ +patmatnew.scala:353: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses + case 3 => assert(false); "KO" + ^ +patmatnew.scala:670: warning: This catches all Throwables. If this is really intended, use `case e : Throwable` to clear this warning. + case e => { + ^ +patmatnew.scala:489: warning: unreachable code + case _ if false => + ^ diff --git a/test/files/run/patmatnew.scala b/test/files/run/patmatnew.scala index a6f8199457..fb49e0c924 100644 --- a/test/files/run/patmatnew.scala +++ b/test/files/run/patmatnew.scala @@ -1,3 +1,6 @@ + +import scala.language.{ postfixOps } + object Test { def main(args: Array[String]) { diff --git a/test/files/run/pc-conversions.scala b/test/files/run/pc-conversions.scala index 60ee59c3c4..b1ef3d963e 100644 --- a/test/files/run/pc-conversions.scala +++ b/test/files/run/pc-conversions.scala @@ -1,4 +1,6 @@ - +/* + * filter: inliner warning\(s\); re-run with -Yinline-warnings for details + */ import collection._ diff --git a/test/files/run/pf-catch.scala b/test/files/run/pf-catch.scala index ba0781fe89..dfe43dc750 100644 --- a/test/files/run/pf-catch.scala +++ b/test/files/run/pf-catch.scala @@ -1,3 +1,5 @@ + +import scala.language.{ postfixOps } object Test { def shortName(x: AnyRef) = x.getClass.getName split '.' last type Handler[+T] = PartialFunction[Throwable, T] @@ -27,7 +29,7 @@ object Test { def main(args: Array[String]): Unit = { try f1 - catch { case x => println(shortName(x) + " slipped by.") } + catch { case x: Throwable => println(shortName(x) + " slipped by.") } f2 } diff --git a/test/files/run/preinits.check b/test/files/run/preinits.check index 5584ab261e..e97a14b77f 100644 --- a/test/files/run/preinits.check +++ b/test/files/run/preinits.check @@ -1,3 +1,9 @@ +preinits.scala:2: warning: Implementation restriction: early definitions in traits are not initialized before the super class is initialized. +trait B extends { override val x = 1 } with A { println("B") } + ^ +preinits.scala:3: warning: Implementation restriction: early definitions in traits are not initialized before the super class is initialized. +trait C extends { override val x = 2 } with A + ^ A B 2 diff --git a/test/files/run/primitive-sigs-2-new.scala b/test/files/run/primitive-sigs-2-new.scala index cf6de9c81b..1f39667b18 100644 --- a/test/files/run/primitive-sigs-2-new.scala +++ b/test/files/run/primitive-sigs-2-new.scala @@ -1,3 +1,5 @@ + +import scala.language.{ postfixOps } import scala.reflect.{ClassTag, classTag} import java.{ lang => jl } @@ -29,4 +31,4 @@ object Test { println(new C f) c3m.sorted foreach println } -}
\ No newline at end of file +} diff --git a/test/files/run/primitive-sigs-2-old.scala b/test/files/run/primitive-sigs-2-old.scala index b7152f7e3d..0a4be93f22 100644 --- a/test/files/run/primitive-sigs-2-old.scala +++ b/test/files/run/primitive-sigs-2-old.scala @@ -1,3 +1,5 @@ + +import scala.language.{ postfixOps } import java.{ lang => jl } trait T[A] { diff --git a/test/files/run/private-inline.check b/test/files/run/private-inline.check index 209e3ef4b6..eee7f2973b 100644 --- a/test/files/run/private-inline.check +++ b/test/files/run/private-inline.check @@ -1 +1,7 @@ +private-inline.scala:24: warning: Could not inline required method wrapper1 because callee contains exception handlers / finally clause, and is invoked with non-empty operand stack. + def f1b() = identity(wrapper1(5)) + ^ +private-inline.scala:29: warning: Could not inline required method wrapper2 because callee contains exception handlers / finally clause, and is invoked with non-empty operand stack. + def f2b() = identity(wrapper2(5)) + ^ 20 diff --git a/test/files/run/private-inline.flags b/test/files/run/private-inline.flags index eb4d19bcb9..00d3643fd4 100644 --- a/test/files/run/private-inline.flags +++ b/test/files/run/private-inline.flags @@ -1 +1 @@ --optimise
\ No newline at end of file +-optimise -Yinline-warnings diff --git a/test/files/run/private-inline.scala b/test/files/run/private-inline.scala index a62007779c..72cabaeff0 100644 --- a/test/files/run/private-inline.scala +++ b/test/files/run/private-inline.scala @@ -43,7 +43,7 @@ object Test { val foundClass = ( try Class.forName(clazz) - catch { case _ => null } + catch { case _: Throwable => null } ) assert(foundClass == null, foundClass) diff --git a/test/files/run/programmatic-main.scala b/test/files/run/programmatic-main.scala index 7bc5c5dfcf..08335ca6f6 100644 --- a/test/files/run/programmatic-main.scala +++ b/test/files/run/programmatic-main.scala @@ -1,3 +1,5 @@ + +import scala.language.postfixOps import scala.tools.nsc._ import io.Path diff --git a/test/files/run/records.scala b/test/files/run/records.scala index 96b0b4cb0f..bae0d943ff 100644 --- a/test/files/run/records.scala +++ b/test/files/run/records.scala @@ -1,3 +1,6 @@ + +import scala.language.{ reflectiveCalls } + trait C { def f: Int } diff --git a/test/files/run/reflection-allmirrors-tostring.scala b/test/files/run/reflection-allmirrors-tostring.scala index 0ca387a6b1..41bab5ac0e 100644 --- a/test/files/run/reflection-allmirrors-tostring.scala +++ b/test/files/run/reflection-allmirrors-tostring.scala @@ -1,3 +1,5 @@ + +import scala.language.higherKinds import scala.reflect.runtime.universe._ class C { @@ -40,4 +42,4 @@ object Test extends App { val cc = typeOf[C].member(TypeName("C")).asClass println(cm.reflectClass(c).reflectConstructor(c.typeSignature.member(nme.CONSTRUCTOR).asMethod)) println(im.reflectClass(cc).reflectConstructor(cc.typeSignature.member(nme.CONSTRUCTOR).asMethod)) -}
\ No newline at end of file +} diff --git a/test/files/run/reflection-implicit.scala b/test/files/run/reflection-implicit.scala index 0bcb0bc3a0..f2b3ba960c 100644 --- a/test/files/run/reflection-implicit.scala +++ b/test/files/run/reflection-implicit.scala @@ -1,3 +1,5 @@ + +import scala.language.implicitConversions import scala.reflect.runtime.universe._ class C { @@ -12,4 +14,4 @@ object Test extends App { val param = decls.find(_.name.toString == "d").get.asMethod.paramss.last.head param.typeSignature println(param.isImplicit) -}
\ No newline at end of file +} diff --git a/test/files/run/reflection-magicsymbols-vanilla.scala b/test/files/run/reflection-magicsymbols-vanilla.scala index 26b70460eb..2bde3d8874 100644 --- a/test/files/run/reflection-magicsymbols-vanilla.scala +++ b/test/files/run/reflection-magicsymbols-vanilla.scala @@ -1,3 +1,5 @@ +import scala.language.postfixOps + class A { def foo1(x: Int*) = ??? def foo2(x: => Int) = ??? diff --git a/test/files/run/reify-each-node-type.scala b/test/files/run/reify-each-node-type.scala index a827da766d..425061f955 100644 --- a/test/files/run/reify-each-node-type.scala +++ b/test/files/run/reify-each-node-type.scala @@ -1,3 +1,5 @@ + +import scala.language.{ existentials, postfixOps } import scala.reflect.runtime.universe._ object r { diff --git a/test/files/run/reify-repl-fail-gracefully.check b/test/files/run/reify-repl-fail-gracefully.check index 1b0f3f2162..18cfd5a7ef 100644 --- a/test/files/run/reify-repl-fail-gracefully.check +++ b/test/files/run/reify-repl-fail-gracefully.check @@ -12,7 +12,7 @@ import scala.reflect.runtime.universe._ scala> scala> reify -<console>:12: error: macros cannot be partially applied +<console>:12: error: too few argument lists for macro invocation reify ^ diff --git a/test/files/run/reify_ann1b.check b/test/files/run/reify_ann1b.check index bc046a7455..a046dafeab 100644 --- a/test/files/run/reify_ann1b.check +++ b/test/files/run/reify_ann1b.check @@ -1,3 +1,8 @@ +reify_ann1b.scala:6: warning: Implementation restriction: subclassing Classfile does not +make your annotation visible at runtime. If that is what +you want, you must write the annotation class in Java. +class ann(bar: String) extends annotation.ClassfileAnnotation + ^ { @new ann(bar = "1a") @new ann(bar = "1b") class C[@new ann(bar = "2a") @new ann(bar = "2b") T] extends AnyRef { @new ann(bar = "3a") @new ann(bar = "3b") <paramaccessor> private[this] val x: T @ann(bar = "4a") @ann(bar = "4b") = _; diff --git a/test/files/run/reify_classfileann_a.check b/test/files/run/reify_classfileann_a.check index 0c919020a8..51f255b232 100644 --- a/test/files/run/reify_classfileann_a.check +++ b/test/files/run/reify_classfileann_a.check @@ -1,3 +1,8 @@ +reify_classfileann_a.scala:6: warning: Implementation restriction: subclassing Classfile does not +make your annotation visible at runtime. If that is what +you want, you must write the annotation class in Java. +class ann(bar: String, quux: Array[String] = Array(), baz: ann = null) extends annotation.ClassfileAnnotation + ^ { @new ann(bar = "1", quux = Array("2", "3"), baz = new ann(bar = "4")) class C extends AnyRef { def <init>() = { diff --git a/test/files/run/reify_classfileann_b.check b/test/files/run/reify_classfileann_b.check index c204fa8dc0..05f2e5bfc6 100644 --- a/test/files/run/reify_classfileann_b.check +++ b/test/files/run/reify_classfileann_b.check @@ -1,3 +1,8 @@ +reify_classfileann_b.scala:6: warning: Implementation restriction: subclassing Classfile does not +make your annotation visible at runtime. If that is what +you want, you must write the annotation class in Java. +class ann(bar: String, quux: Array[String] = Array(), baz: ann = null) extends annotation.ClassfileAnnotation + ^ { class C extends AnyRef { def <init>() = { diff --git a/test/files/run/reify_extendbuiltins.scala b/test/files/run/reify_extendbuiltins.scala index a2d546579d..46d5b7e55e 100644 --- a/test/files/run/reify_extendbuiltins.scala +++ b/test/files/run/reify_extendbuiltins.scala @@ -1,3 +1,5 @@ + +import scala.language.{ implicitConversions, postfixOps } import scala.reflect.runtime.universe._ import scala.tools.reflect.Eval @@ -12,4 +14,4 @@ object Test extends App { println("10! = " + (10!)) }.eval -}
\ No newline at end of file +} diff --git a/test/files/run/reify_implicits-new.scala b/test/files/run/reify_implicits-new.scala index 42a1deef26..1d90d907ea 100644 --- a/test/files/run/reify_implicits-new.scala +++ b/test/files/run/reify_implicits-new.scala @@ -1,3 +1,5 @@ + +import scala.language.{ implicitConversions, reflectiveCalls } import scala.reflect.{ClassTag, classTag} import scala.reflect.runtime.universe._ import scala.tools.reflect.Eval @@ -13,4 +15,4 @@ object Test extends App { val x = Array(2, 3, 1, 4) println("x = "+ x.sort((x: Int, y: Int) => x < y).toList) }.eval -}
\ No newline at end of file +} diff --git a/test/files/run/reify_implicits-old.scala b/test/files/run/reify_implicits-old.scala index 8ff256d2d4..a4e90488e5 100644 --- a/test/files/run/reify_implicits-old.scala +++ b/test/files/run/reify_implicits-old.scala @@ -1,3 +1,5 @@ + +import scala.language.{ implicitConversions, reflectiveCalls } import scala.reflect.runtime.universe._ import scala.tools.reflect.Eval @@ -12,4 +14,4 @@ object Test extends App { val x = Array(2, 3, 1, 4) println("x = "+ x.sort((x: Int, y: Int) => x < y).toList) }.eval -}
\ No newline at end of file +} diff --git a/test/files/run/reify_lazyevaluation.scala b/test/files/run/reify_lazyevaluation.scala index 5b310d95f7..3f2530ddee 100644 --- a/test/files/run/reify_lazyevaluation.scala +++ b/test/files/run/reify_lazyevaluation.scala @@ -1,3 +1,5 @@ + +import scala.language.{ implicitConversions } import scala.reflect.runtime.universe._ import scala.tools.reflect.Eval diff --git a/test/files/run/reify_lazyunit.check b/test/files/run/reify_lazyunit.check index 1b46c909be..579ecfe8aa 100644 --- a/test/files/run/reify_lazyunit.check +++ b/test/files/run/reify_lazyunit.check @@ -1,3 +1,6 @@ +reify_lazyunit.scala:6: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses + lazy val x = { 0; println("12")} + ^ 12 one two diff --git a/test/files/run/reify_printf.check b/test/files/run/reify_printf.check index e69de29bb2..3b18e512db 100644 --- a/test/files/run/reify_printf.check +++ b/test/files/run/reify_printf.check @@ -0,0 +1 @@ +hello world diff --git a/test/files/run/reify_printf.scala b/test/files/run/reify_printf.scala index 9932a58dfa..c4ade79837 100644 --- a/test/files/run/reify_printf.scala +++ b/test/files/run/reify_printf.scala @@ -9,13 +9,13 @@ import scala.reflect.internal.Types import scala.util.matching.Regex object Test extends App { - val output = new ByteArrayOutputStream() - Console.setOut(new PrintStream(output)) + //val output = new ByteArrayOutputStream() + //Console.setOut(new PrintStream(output)) val toolbox = cm.mkToolBox() val tree = tree_printf(reify("hello %s").tree, reify("world").tree) val evaluated = toolbox.eval(tree) - assert(output.toString() == "hello world", output.toString() +" == hello world") + //assert(output.toString() == "hello world", output.toString() +" == hello world") /* // upd. Oh, good old times, our very-very first experiments with macros :) @@ -68,4 +68,4 @@ object Test extends App { ): Tree Block((evals ++ prints).toList, Literal(Constant(()))) } -}
\ No newline at end of file +} diff --git a/test/files/run/repl-backticks.scala b/test/files/run/repl-backticks.scala index 5eaa1ec4c1..ec2691d9c5 100644 --- a/test/files/run/repl-backticks.scala +++ b/test/files/run/repl-backticks.scala @@ -8,7 +8,7 @@ object Test { `yield` </code>.text - def main(args: Array[String]) = { + def main(args: Array[String]) { val settings = new Settings() settings.classpath.value = System.getProperty("java.class.path") val repl = new interpreter.IMain(settings) diff --git a/test/files/run/repl-power.check b/test/files/run/repl-power.check index 9d63ecde94..1abb8e9d14 100644 --- a/test/files/run/repl-power.check +++ b/test/files/run/repl-power.check @@ -14,6 +14,7 @@ scala> global.emptyValDef // "it is imported twice in the same scope by ..." res0: $r.global.emptyValDef.type = private val _ = _ scala> val tp = ArrayClass[scala.util.Random] // magic with tags +warning: there were 1 feature warning(s); re-run with -feature for details tp: $r.global.Type = Array[scala.util.Random] scala> tp.memberType(Array_apply) // evidence diff --git a/test/files/run/repl-term-macros.check b/test/files/run/repl-term-macros.check new file mode 100644 index 0000000000..eae489c294 --- /dev/null +++ b/test/files/run/repl-term-macros.check @@ -0,0 +1,44 @@ +Type in expressions to have them evaluated. +Type :help for more information. + +scala> + +scala> import scala.reflect.macros.Context +import scala.reflect.macros.Context + +scala> import language.experimental.macros +import language.experimental.macros + +scala> + +scala> def impl1(c: Context) = c.literalUnit +impl1: (c: scala.reflect.macros.Context)c.Expr[Unit] + +scala> def foo1 = macro impl1 +defined term macro foo1: Unit + +scala> foo1 + +scala> + +scala> def impl2(c: Context)() = c.literalUnit +impl2: (c: scala.reflect.macros.Context)()c.Expr[Unit] + +scala> def foo2() = macro impl2 +defined term macro foo2: ()Unit + +scala> foo2() + +scala> + +scala> def impl3(c: Context)(x: c.Expr[Int])(y: c.Expr[Int]) = c.literalUnit +impl3: (c: scala.reflect.macros.Context)(x: c.Expr[Int])(y: c.Expr[Int])c.Expr[Unit] + +scala> def foo3(x: Int)(y: Int) = macro impl3 +defined term macro foo3: (x: Int)(y: Int)Unit + +scala> foo3(2)(3) + +scala> + +scala> diff --git a/test/files/run/repl-term-macros.scala b/test/files/run/repl-term-macros.scala new file mode 100644 index 0000000000..f826259be9 --- /dev/null +++ b/test/files/run/repl-term-macros.scala @@ -0,0 +1,20 @@ +import scala.tools.partest.ReplTest + +object Test extends ReplTest { + def code = """ + import scala.reflect.macros.Context +import language.experimental.macros + +def impl1(c: Context) = c.literalUnit +def foo1 = macro impl1 +foo1 + +def impl2(c: Context)() = c.literalUnit +def foo2() = macro impl2 +foo2() + +def impl3(c: Context)(x: c.Expr[Int])(y: c.Expr[Int]) = c.literalUnit +def foo3(x: Int)(y: Int) = macro impl3 +foo3(2)(3) + """ +}
\ No newline at end of file diff --git a/test/files/run/resetattrs-this.scala b/test/files/run/resetattrs-this.scala index 12afa3d712..2a55437273 100644 --- a/test/files/run/resetattrs-this.scala +++ b/test/files/run/resetattrs-this.scala @@ -4,8 +4,8 @@ import scala.tools.reflect.ToolBox object Test extends App { val tb = cm.mkToolBox() - val tree = Select(This(cm.staticPackage("scala").moduleClass), newTermName("Predef")) + val tree = Select(This(cm.staticPackage("scala").moduleClass), TermName("Predef")) val ttree = tb.typeCheck(tree) val rttree = tb.resetAllAttrs(ttree) println(tb.eval(rttree) == Predef) -}
\ No newline at end of file +} diff --git a/test/files/run/richs.scala b/test/files/run/richs.scala index 5ee573673d..4b5345757c 100644 --- a/test/files/run/richs.scala +++ b/test/files/run/richs.scala @@ -11,8 +11,8 @@ trait RichTest { val cn = this.getClass().getName() cn.substring(0, cn.length-1) } - def length[A](it: Iterator[A]) = it.toList length - def length[A](it: Iterable[A]) = it.toList length + def length[A](it: Iterator[A]) = it.toList.length + def length[A](it: Iterable[A]) = it.toList.length def run: Unit } object RichCharTest1 extends RichTest { diff --git a/test/files/run/runtime.check b/test/files/run/runtime.check index 990a087da0..d613c9bd42 100644 --- a/test/files/run/runtime.check +++ b/test/files/run/runtime.check @@ -1,3 +1,9 @@ +runtime.scala:141: warning: comparing values of types Null and Null using `eq' will always yield true + check(true , null eq null, null ne null); + ^ +runtime.scala:141: warning: comparing values of types Null and Null using `ne' will always yield false + check(true , null eq null, null ne null); + ^ <<< Test0 [false,true] [0,1,2] diff --git a/test/files/run/runtime.scala b/test/files/run/runtime.scala index a2ac204e8a..89348b294d 100644 --- a/test/files/run/runtime.scala +++ b/test/files/run/runtime.scala @@ -171,7 +171,7 @@ object Test { try { test; } catch { - case exception => { + case exception: Throwable => { //val name: String = Thread.currentThread().getName(); Console.print("Exception in thread \"" + name + "\" " + exception); Console.println; diff --git a/test/files/run/sequenceComparisons.scala b/test/files/run/sequenceComparisons.scala index 5d7958bc7e..f8ef17d77d 100644 --- a/test/files/run/sequenceComparisons.scala +++ b/test/files/run/sequenceComparisons.scala @@ -82,7 +82,7 @@ object Test { val sameElementsInputs = ( List(List(1,2,3,4,5)), - List(Nil, List(1), List(1,2), List(2,3,4), List(2,3,4,5), List(2,3,4,5,1), List(1,2,3,5,4), seq reverse) + List(Nil, List(1), List(1,2), List(2,3,4), List(2,3,4,5), List(2,3,4,5,1), List(1,2,3,5,4), seq.reverse) ) } diff --git a/test/files/run/settings-parse.scala b/test/files/run/settings-parse.scala index 2b04f55b24..2754feb972 100644 --- a/test/files/run/settings-parse.scala +++ b/test/files/run/settings-parse.scala @@ -1,3 +1,5 @@ + +import scala.language.postfixOps import scala.tools.nsc._ object Test { diff --git a/test/files/run/si5045.scala b/test/files/run/si5045.scala index e198b101f3..b0c3a4ddc4 100644 --- a/test/files/run/si5045.scala +++ b/test/files/run/si5045.scala @@ -1,3 +1,6 @@ + +import scala.language.postfixOps + object Test extends App { import scala.util.matching.{ Regex, UnanchoredRegex } diff --git a/test/files/run/slices.scala b/test/files/run/slices.scala index e31ea4046f..107b8e658a 100644 --- a/test/files/run/slices.scala +++ b/test/files/run/slices.scala @@ -1,3 +1,6 @@ + +import scala.language.postfixOps + object Test extends App { // lists diff --git a/test/files/run/spec-nlreturn.scala b/test/files/run/spec-nlreturn.scala index ec5e7229d3..a84160ecca 100644 --- a/test/files/run/spec-nlreturn.scala +++ b/test/files/run/spec-nlreturn.scala @@ -1,7 +1,8 @@ + object Test { def f(): Int = { try { - val g = 1 to 10 map { i => return 16 ; i } sum; + val g = (1 to 10 map { i => return 16 ; i }).sum g } catch { case x: runtime.NonLocalReturnControl[_] => diff --git a/test/files/run/stream_flatmap_odds.scala b/test/files/run/stream_flatmap_odds.scala index 6fb202ca68..1935253595 100644 --- a/test/files/run/stream_flatmap_odds.scala +++ b/test/files/run/stream_flatmap_odds.scala @@ -1,4 +1,4 @@ object Test extends App { lazy val odds: Stream[Int] = Stream(1) append ( odds flatMap {x => Stream(x + 2)} ) - println(odds take 42 force) + Console println (odds take 42).force } diff --git a/test/files/run/stringbuilder-drop.scala b/test/files/run/stringbuilder-drop.scala index a9e5a71762..422fb2bc7c 100644 --- a/test/files/run/stringbuilder-drop.scala +++ b/test/files/run/stringbuilder-drop.scala @@ -1,7 +1,7 @@ object Test { def main(args: Array[String]): Unit = { - val s = (new StringBuilder ++= "hello world") dropRight 1 toString; - assert(s == "hello worl") + val s = (new StringBuilder ++= "hello world") dropRight 1 + assert("" + s == "hello worl") } } diff --git a/test/files/run/stringbuilder.scala b/test/files/run/stringbuilder.scala index ef85fc02a6..a88ea38b92 100644 --- a/test/files/run/stringbuilder.scala +++ b/test/files/run/stringbuilder.scala @@ -1,3 +1,6 @@ + +import scala.language.reflectiveCalls + object Test extends App { val str = "ABCDEFGHIJKLMABCDEFGHIJKLM" val surrogateStr = "an old Turkic letter: \uD803\uDC22" @@ -33,8 +36,8 @@ object Test extends App { sameAnswers(_.lastIndexOf("KLM", 22)) // testing that the "reverse" implementation avoids reversing surrogate pairs - val jsb = new JavaStringBuilder(surrogateStr) reverse - val ssb = new ScalaStringBuilder(surrogateStr) reverseContents ; + val jsb = new JavaStringBuilder(surrogateStr).reverse + val ssb = new ScalaStringBuilder(surrogateStr).reverseContents assert(jsb.toString == ssb.toString) } diff --git a/test/files/run/stringinterpolation_macro-run.scala b/test/files/run/stringinterpolation_macro-run.scala index 9c59c334f8..1138cd0860 100644 --- a/test/files/run/stringinterpolation_macro-run.scala +++ b/test/files/run/stringinterpolation_macro-run.scala @@ -1,3 +1,6 @@ +/* + * filter: inliner warning\(s\); re-run with -Yinline-warnings for details + */ object Test extends App { // 'b' / 'B' (category: general) diff --git a/test/files/run/structural.scala b/test/files/run/structural.scala index 3a703d2cf1..2788717ec2 100644 --- a/test/files/run/structural.scala +++ b/test/files/run/structural.scala @@ -1,3 +1,6 @@ + +import scala.language.{ reflectiveCalls } + object test1 { val o1 = new Object { override def toString = "ohone" } @@ -164,7 +167,7 @@ object test3 { } catch { case e: Exc => println("caught") - case e => println(e) + case e: Throwable => println(e) } m(Rec) diff --git a/test/files/run/synchronized.check b/test/files/run/synchronized.check index dd9f4ef424..6e99739633 100644 --- a/test/files/run/synchronized.check +++ b/test/files/run/synchronized.check @@ -1,3 +1,4 @@ +warning: there were 14 inliner warning(s); re-run with -Yinline-warnings for details .|. c1.f1: OK .|. c1.fi: OK .|... c1.fv: OK diff --git a/test/files/run/synchronized.flags b/test/files/run/synchronized.flags index 1182725e86..49d036a887 100644 --- a/test/files/run/synchronized.flags +++ b/test/files/run/synchronized.flags @@ -1 +1 @@ --optimize
\ No newline at end of file +-optimize diff --git a/test/files/run/t0325.scala b/test/files/run/t0325.scala index 92331ab05f..048303206c 100644 --- a/test/files/run/t0325.scala +++ b/test/files/run/t0325.scala @@ -24,7 +24,7 @@ object Test { else println(ret) } catch { - case e@_ => println(which + " failed with " + e.getClass) + case e: Throwable => println(which + " failed with " + e.getClass) } } diff --git a/test/files/run/t0421-old.scala b/test/files/run/t0421-old.scala index 8d51013924..9b88b4789b 100644 --- a/test/files/run/t0421-old.scala +++ b/test/files/run/t0421-old.scala @@ -1,4 +1,6 @@ // ticket #421 + +@deprecated("Suppress warnings", since="2.11") object Test extends App { def transpose[A: ClassManifest](xss: Array[Array[A]]) = { diff --git a/test/files/run/t0432.scala b/test/files/run/t0432.scala index 8ba9015d81..b860a0874f 100644 --- a/test/files/run/t0432.scala +++ b/test/files/run/t0432.scala @@ -1,3 +1,6 @@ + +import scala.language.reflectiveCalls + object Test { type valueType = { def value: this.type } diff --git a/test/files/run/t0528.scala b/test/files/run/t0528.scala index a76f602ed3..68a9975173 100644 --- a/test/files/run/t0528.scala +++ b/test/files/run/t0528.scala @@ -1,3 +1,5 @@ + +import scala.language.{ existentials } trait Sequ[A] { def toArray: Array[T forSome {type T <: A}] } diff --git a/test/files/run/t0677-old.scala b/test/files/run/t0677-old.scala index 6c8a3a7e99..c0f1abae53 100644 --- a/test/files/run/t0677-old.scala +++ b/test/files/run/t0677-old.scala @@ -1,3 +1,6 @@ + + +@deprecated("Suppress warnings", since="2.11") object Test extends App { class X[T: ClassManifest] { val a = Array.ofDim[T](3, 4) diff --git a/test/files/run/t1005.scala b/test/files/run/t1005.scala index 60129bcc51..575ec43565 100644 --- a/test/files/run/t1005.scala +++ b/test/files/run/t1005.scala @@ -1,19 +1,20 @@ +import scala.language.postfixOps object Test { class Foo[T](x : Array[AnyRef]) { def bar = x.asInstanceOf[Array[T]] } class Bar[T](x : Array[T]) { def bar = x.asInstanceOf[Array[AnyRef]] } object FromMono{ - def main(args : Array[String]) = (new Foo[AnyRef](Array[AnyRef]("Halp!"))).bar + def mainer(args : Array[String]) = (new Foo[AnyRef](Array[AnyRef]("Halp!"))).bar } object FromPoly{ - def main(args : Array[String]) = (new Bar[AnyRef](Array[AnyRef]("Halp!"))).bar + def mainer(args : Array[String]) = (new Bar[AnyRef](Array[AnyRef]("Halp!"))).bar } def main(args: Array[String]): Unit = { - println(FromMono main null mkString) - println(FromPoly main null mkString) + println(FromMono mainer null mkString) + println(FromPoly mainer null mkString) } } diff --git a/test/files/run/t1110.scala b/test/files/run/t1110.scala index 824643868c..81917789c8 100644 --- a/test/files/run/t1110.scala +++ b/test/files/run/t1110.scala @@ -1,8 +1,12 @@ + + +import scala.language.{ reflectiveCalls } + class Stuff { def zoop(p: Any{def &(q: Int): Int}) = p & 7 def floop = new { def & = "Hello" } - assert((floop &) == "Hello") + assert((floop.&) == "Hello") assert(zoop(10) == 2) } diff --git a/test/files/run/t1141.scala b/test/files/run/t1141.scala index ee4f2e7fd2..b907b4798f 100644 --- a/test/files/run/t1141.scala +++ b/test/files/run/t1141.scala @@ -1,3 +1,7 @@ + + +import scala.language.reflectiveCalls + object Test extends App { val foo = new { def apply(args : String*) = args foreach println diff --git a/test/files/run/t1195-new.scala b/test/files/run/t1195-new.scala index 0f62b140c9..4f068c7d42 100644 --- a/test/files/run/t1195-new.scala +++ b/test/files/run/t1195-new.scala @@ -1,3 +1,5 @@ + +import scala.language.{ existentials } import scala.reflect.runtime.universe._ object Test { @@ -25,4 +27,4 @@ class A1[T] { class B1[U] { def f = { case class D(x: Int) extends A1[String] ; new D(5) } } -}
\ No newline at end of file +} diff --git a/test/files/run/t1195-old.scala b/test/files/run/t1195-old.scala index b46a3b70f5..f80734c228 100644 --- a/test/files/run/t1195-old.scala +++ b/test/files/run/t1195-old.scala @@ -1,3 +1,6 @@ + +import scala.language.{ existentials } + object Test { def f() = { case class Bar(x: Int); Bar } def g() = { case class Bar(x: Int); Bar(5) } diff --git a/test/files/run/t1368.check b/test/files/run/t1368.check new file mode 100644 index 0000000000..581e8a4039 --- /dev/null +++ b/test/files/run/t1368.check @@ -0,0 +1,3 @@ +t1368.scala:7: warning: Reference to uninitialized value blurp + def go3 = (new AnyRef with Happy with Sad { override val status = blurp ; val blurp = "happysad" }).status + ^ diff --git a/test/files/run/t1427.check b/test/files/run/t1427.check new file mode 100644 index 0000000000..11a3d2f4a9 --- /dev/null +++ b/test/files/run/t1427.check @@ -0,0 +1,3 @@ +t1427.scala:6: warning: abstract type X in type pattern Bob[_[_] <: Any] is unchecked since it is eliminated by erasure + case x: (Bob[X] forSome { type X[_] }) => true + ^ diff --git a/test/files/run/t1427.scala b/test/files/run/t1427.scala index 21bd71ffef..eeb2603c26 100644 --- a/test/files/run/t1427.scala +++ b/test/files/run/t1427.scala @@ -1,3 +1,6 @@ + +import scala.language.{ higherKinds } + class Bob[K[_]] { def foo(other: Any) = other match { case x: (Bob[X] forSome { type X[_] }) => true diff --git a/test/files/run/t1500.scala b/test/files/run/t1500.scala index 6d2e7ee05f..75a6e31cdf 100644 --- a/test/files/run/t1500.scala +++ b/test/files/run/t1500.scala @@ -16,7 +16,7 @@ object Test { </code>.text - def main(args: Array[String]) = { + def main(args: Array[String]) { val settings = new Settings() settings.classpath.value = System.getProperty("java.class.path") diff --git a/test/files/run/t1501.scala b/test/files/run/t1501.scala index a2f7bb3a65..71ad0aeb5c 100644 --- a/test/files/run/t1501.scala +++ b/test/files/run/t1501.scala @@ -27,7 +27,7 @@ object Test { </code>.text - def main(args: Array[String]) = { + def main(args: Array[String]) { val settings = new Settings() settings.classpath.value = System.getProperty("java.class.path") val tool = new interpreter.IMain(settings) diff --git a/test/files/run/t153.scala b/test/files/run/t153.scala index 82492fdbe6..3fdb423865 100644 --- a/test/files/run/t153.scala +++ b/test/files/run/t153.scala @@ -1,5 +1,5 @@ object Test extends App { def powers(x: Int) = if ((x&(x-1))==0) Some(x) else None val res = (Stream.range(1, 500000) flatMap powers).reverse - println(res take 42 force) + println((res take 42).force) } diff --git a/test/files/run/t1766.scala b/test/files/run/t1766.scala index 2afd883755..7d12451092 100644 --- a/test/files/run/t1766.scala +++ b/test/files/run/t1766.scala @@ -1,3 +1,6 @@ + +import scala.language.{ reflectiveCalls } + object Test extends App { class C(s: String) { diff --git a/test/files/run/t2106.check b/test/files/run/t2106.check new file mode 100644 index 0000000000..b14e9d1c41 --- /dev/null +++ b/test/files/run/t2106.check @@ -0,0 +1,3 @@ +t2106.scala:7: warning: Could not inline required method foo because access level required by callee not matched by caller. + def main(args: Array[String]): Unit = x.foo + ^ diff --git a/test/files/run/t2106.flags b/test/files/run/t2106.flags index eb4d19bcb9..00d3643fd4 100644 --- a/test/files/run/t2106.flags +++ b/test/files/run/t2106.flags @@ -1 +1 @@ --optimise
\ No newline at end of file +-optimise -Yinline-warnings diff --git a/test/files/run/t2106.scala b/test/files/run/t2106.scala index e8124dabab..55b89da805 100644 --- a/test/files/run/t2106.scala +++ b/test/files/run/t2106.scala @@ -4,5 +4,5 @@ class A extends Cloneable { object Test { val x = new A - def main(args: Array[String]) = x.foo + def main(args: Array[String]): Unit = x.foo } diff --git a/test/files/run/t2308a.scala b/test/files/run/t2308a.scala index abb568064a..200dee1ef6 100644 --- a/test/files/run/t2308a.scala +++ b/test/files/run/t2308a.scala @@ -1,3 +1,5 @@ + +import scala.language.{ higherKinds } object Test { trait T[M[_]] diff --git a/test/files/run/t2318.scala b/test/files/run/t2318.scala index 47d083eb9d..d7fd9fdd41 100644 --- a/test/files/run/t2318.scala +++ b/test/files/run/t2318.scala @@ -1,5 +1,7 @@ import java.security._ +import scala.language.{ reflectiveCalls } + object Test { trait Bar { def bar: Unit } diff --git a/test/files/run/t2333.scala b/test/files/run/t2333.scala index da43386572..7dc7a92df2 100644 --- a/test/files/run/t2333.scala +++ b/test/files/run/t2333.scala @@ -1,7 +1,7 @@ class A { def whatever() { lazy val a = 1 - lazy val b = try { 2 } catch { case _ => 0 } + lazy val b = try { 2 } catch { case _: Throwable => 0 } a b @@ -13,4 +13,4 @@ object Test { val a = new A a.whatever } -}
\ No newline at end of file +} diff --git a/test/files/run/t2417.scala b/test/files/run/t2417.scala index 2d0bc2d405..18b6c326b5 100644 --- a/test/files/run/t2417.scala +++ b/test/files/run/t2417.scala @@ -8,7 +8,7 @@ object Test { try { block } catch { - case x => failure = x + case x: Throwable => failure = x } } }) diff --git a/test/files/run/t2514.scala b/test/files/run/t2514.scala index 21c4afb472..cf5fa0ea02 100644 --- a/test/files/run/t2514.scala +++ b/test/files/run/t2514.scala @@ -1,3 +1,7 @@ + + +import scala.language.{ implicitConversions, postfixOps, reflectiveCalls } + object Test { implicit def x[A](a: A) = new { def xx = a } @@ -12,4 +16,4 @@ object Test assert(r5 == 24) } -}
\ No newline at end of file +} diff --git a/test/files/run/t2594_tcpoly.scala b/test/files/run/t2594_tcpoly.scala index e759ca8b0f..a9d26693f9 100644 --- a/test/files/run/t2594_tcpoly.scala +++ b/test/files/run/t2594_tcpoly.scala @@ -1,3 +1,6 @@ + +import scala.language.{ higherKinds } + trait Monad[M[_]] { def foo[A](a: M[A]): M[A] } @@ -15,4 +18,4 @@ object Test { } def main(as: Array[String]) { BarMonad[Int] foo (new Bar[Int, Int]) } -}
\ No newline at end of file +} diff --git a/test/files/run/t2636.scala b/test/files/run/t2636.scala index 3271f79ffc..6ae2248a26 100644 --- a/test/files/run/t2636.scala +++ b/test/files/run/t2636.scala @@ -1,3 +1,6 @@ + +import scala.language.{ reflectiveCalls } + object Test { type Foo = { def update(x: Int, value: String): Unit } @@ -32,4 +35,4 @@ object Test assert(arrApply(arr, 1) == "o") assert(arrApply(new { def apply(x: Int) = "tom" }, -100) == "tom") } -}
\ No newline at end of file +} diff --git a/test/files/run/t3038d.scala b/test/files/run/t3038d.scala index 9550165235..56cfcdb174 100644 --- a/test/files/run/t3038d.scala +++ b/test/files/run/t3038d.scala @@ -21,7 +21,7 @@ class Bar extends Foo with Serializable { def size = a @transient var second: Any = null - def checkMember { first } + def checkMember { if (first == null) print("") } private def writeObject(out: java.io.ObjectOutputStream) { serializeTo(out) diff --git a/test/files/run/t3050.scala b/test/files/run/t3050.scala index ca9d91e191..65b2674b69 100644 --- a/test/files/run/t3050.scala +++ b/test/files/run/t3050.scala @@ -2,7 +2,7 @@ object Test { def main(args: Array[String]): Unit = { val x = try { ("": Any) match { case List(_*) => true } } - catch { case _ => false } + catch { case _: Throwable => false } assert(!x) } diff --git a/test/files/run/t3175.scala b/test/files/run/t3175.scala index aff2e67d0d..5c6daead38 100644 --- a/test/files/run/t3175.scala +++ b/test/files/run/t3175.scala @@ -1,6 +1,9 @@ /** A bit down the road this test will examine * the bytecode. */ + +import scala.language.reflectiveCalls + object Test { def len(x:{ def length: Int }) = x.length def f1(x:{ def apply(x: Int): Long }) = x(0) diff --git a/test/files/run/t3232.scala b/test/files/run/t3232.scala index feff7e7089..4c6cb1e35c 100644 --- a/test/files/run/t3232.scala +++ b/test/files/run/t3232.scala @@ -15,7 +15,7 @@ object Test { // exception required List(e1, e2) foreach { f => try { f() ; assert(false) } - catch { case _ => () } + catch { case _: Throwable => () } } } } diff --git a/test/files/run/t3242.scala b/test/files/run/t3242.scala index f8defaa5cd..0a449d51f9 100644 --- a/test/files/run/t3242.scala +++ b/test/files/run/t3242.scala @@ -1,3 +1,6 @@ + +import scala.language.{ higherKinds } + object Test { def benchmarkA(num: Int) { diff --git a/test/files/run/t3361.scala b/test/files/run/t3361.scala index 7fbc6777f2..f739d17b86 100644 --- a/test/files/run/t3361.scala +++ b/test/files/run/t3361.scala @@ -57,7 +57,7 @@ object Test extends App { DoubleLinkedList().insert(ten) } catch { case _: IllegalArgumentException => require(true) - case _ => require(false) + case _: Throwable => require(false) } val zero = DoubleLinkedList(0) zero.insert(ten) @@ -87,7 +87,7 @@ object Test extends App { DoubleLinkedList().append(ten) } catch { case _: IllegalArgumentException => require(true) - case _ => require(false) + case _: Throwable => require(false) } val zero = DoubleLinkedList(0) zero.append(ten) diff --git a/test/files/run/t3425.check b/test/files/run/t3425.check new file mode 100644 index 0000000000..5be779bd74 --- /dev/null +++ b/test/files/run/t3425.check @@ -0,0 +1,4 @@ +123 +456 +789 +789 diff --git a/test/files/run/t3425.scala b/test/files/run/t3425.scala new file mode 100644 index 0000000000..c61d1071a5 --- /dev/null +++ b/test/files/run/t3425.scala @@ -0,0 +1,41 @@ +import scala.language.reflectiveCalls +object Other { + abstract class Foo { + type R1 <: { def x: Any } + type R2 <: R1 { def x: Int } + + def f(x: R2) = x.x + } + + abstract class Bar { + trait R0 { def x: Any } + type R1 <: R0 { def x: AnyVal } + type R2 <: R1 { def x: Int } + + def f(x: R2) = x.x + } +} +object Test { + trait A + trait B + def x(a: (A { val y: Int }) with B { val y: Int }) = a.y + + class C extends A with B { + val y = 456 + } + + class Bippy { def x: Int = 789 } + + def main(args: Array[String]): Unit = { + println(x(new A with B { val y = 123 })) + println(x(new C)) + + { val foo = new Other.Foo { type R1 = Bippy ; type R2 = Bippy } + println(foo.f(new Bippy)) + } + { val bar = new Other.Bar { type R1 = Bippy with R0 ; type R2 = R1 } + println(bar.f(new Bippy with bar.R0)) + } + } +} + diff --git a/test/files/run/t3425b.check b/test/files/run/t3425b.check new file mode 100644 index 0000000000..5d34c43de3 --- /dev/null +++ b/test/files/run/t3425b.check @@ -0,0 +1,152 @@ +==== Direct Calls ==== + +Any{val y: P} with C{val y: P} +Any{val y: P} with C{val y: Q} +Any{val y: P} with C{val y: R forSome { type R <: P with Q }} +Any{val y: Q} with C{val y: P} +Any{val y: Q} with C{val y: Q} +Any{val y: Q} with C{val y: R forSome { type R <: P with Q }} +Any{val y: R forSome { type R <: P with Q }} with C{val y: P} +Any{val y: R forSome { type R <: P with Q }} with C{val y: Q} +Any{val y: R forSome { type R <: P with Q }} with C{val y: R forSome { type R <: P with Q }} +A{val y: P} with C{val y: P} +A{val y: P} with C{val y: Q} +A{val y: P} with C{val y: R forSome { type R <: P with Q }} +A{val y: Q} with C{val y: P} +A{val y: Q} with C{val y: Q} +A{val y: Q} with C{val y: R forSome { type R <: P with Q }} +A{val y: R forSome { type R <: P with Q }} with C{val y: P} +A{val y: R forSome { type R <: P with Q }} with C{val y: Q} +A{val y: R forSome { type R <: P with Q }} with C{val y: R forSome { type R <: P with Q }} +B{val y: P} with C{val y: P} +B{val y: P} with C{val y: Q} +B{val y: P} with C{val y: R forSome { type R <: P with Q }} +B{val y: Q} with C{val y: P} +B{val y: Q} with C{val y: Q} +B{val y: Q} with C{val y: R forSome { type R <: P with Q }} +B{val y: R forSome { type R <: P with Q }} with C{val y: P} +B{val y: R forSome { type R <: P with Q }} with C{val y: Q} +B{val y: R forSome { type R <: P with Q }} with C{val y: R forSome { type R <: P with Q }} +C{val y: P} with C{val y: P} +C{val y: P} with C{val y: Q} +C{val y: P} with C{val y: R forSome { type R <: P with Q }} +C{val y: Q} with C{val y: P} +C{val y: Q} with C{val y: Q} +C{val y: Q} with C{val y: R forSome { type R <: P with Q }} +C{val y: R forSome { type R <: P with Q }} with C{val y: P} +C{val y: R forSome { type R <: P with Q }} with C{val y: Q} +C{val y: R forSome { type R <: P with Q }} with C{val y: R forSome { type R <: P with Q }} + + +==== Reflective Calls ==== + +Any{val y: P} with Any{val y: P} +Any{val y: P} with Any{val y: Q} +Any{val y: P} with Any{val y: R forSome { type R <: P with Q }} +Any{val y: P} with A{val y: P} +Any{val y: P} with A{val y: Q} +Any{val y: P} with A{val y: R forSome { type R <: P with Q }} +Any{val y: P} with B{val y: P} +Any{val y: P} with B{val y: Q} +Any{val y: P} with B{val y: R forSome { type R <: P with Q }} +Any{val y: Q} with Any{val y: P} +Any{val y: Q} with Any{val y: Q} +Any{val y: Q} with Any{val y: R forSome { type R <: P with Q }} +Any{val y: Q} with A{val y: P} +Any{val y: Q} with A{val y: Q} +Any{val y: Q} with A{val y: R forSome { type R <: P with Q }} +Any{val y: Q} with B{val y: P} +Any{val y: Q} with B{val y: Q} +Any{val y: Q} with B{val y: R forSome { type R <: P with Q }} +Any{val y: R forSome { type R <: P with Q }} with Any{val y: P} +Any{val y: R forSome { type R <: P with Q }} with Any{val y: Q} +Any{val y: R forSome { type R <: P with Q }} with Any{val y: R forSome { type R <: P with Q }} +Any{val y: R forSome { type R <: P with Q }} with A{val y: P} +Any{val y: R forSome { type R <: P with Q }} with A{val y: Q} +Any{val y: R forSome { type R <: P with Q }} with A{val y: R forSome { type R <: P with Q }} +Any{val y: R forSome { type R <: P with Q }} with B{val y: P} +Any{val y: R forSome { type R <: P with Q }} with B{val y: Q} +Any{val y: R forSome { type R <: P with Q }} with B{val y: R forSome { type R <: P with Q }} +A{val y: P} with Any{val y: P} +A{val y: P} with Any{val y: Q} +A{val y: P} with Any{val y: R forSome { type R <: P with Q }} +A{val y: P} with A{val y: P} +A{val y: P} with A{val y: Q} +A{val y: P} with A{val y: R forSome { type R <: P with Q }} +A{val y: P} with B{val y: P} +A{val y: P} with B{val y: Q} +A{val y: P} with B{val y: R forSome { type R <: P with Q }} +A{val y: Q} with Any{val y: P} +A{val y: Q} with Any{val y: Q} +A{val y: Q} with Any{val y: R forSome { type R <: P with Q }} +A{val y: Q} with A{val y: P} +A{val y: Q} with A{val y: Q} +A{val y: Q} with A{val y: R forSome { type R <: P with Q }} +A{val y: Q} with B{val y: P} +A{val y: Q} with B{val y: Q} +A{val y: Q} with B{val y: R forSome { type R <: P with Q }} +A{val y: R forSome { type R <: P with Q }} with Any{val y: P} +A{val y: R forSome { type R <: P with Q }} with Any{val y: Q} +A{val y: R forSome { type R <: P with Q }} with Any{val y: R forSome { type R <: P with Q }} +A{val y: R forSome { type R <: P with Q }} with A{val y: P} +A{val y: R forSome { type R <: P with Q }} with A{val y: Q} +A{val y: R forSome { type R <: P with Q }} with A{val y: R forSome { type R <: P with Q }} +A{val y: R forSome { type R <: P with Q }} with B{val y: P} +A{val y: R forSome { type R <: P with Q }} with B{val y: Q} +A{val y: R forSome { type R <: P with Q }} with B{val y: R forSome { type R <: P with Q }} +B{val y: P} with Any{val y: P} +B{val y: P} with Any{val y: Q} +B{val y: P} with Any{val y: R forSome { type R <: P with Q }} +B{val y: P} with A{val y: P} +B{val y: P} with A{val y: Q} +B{val y: P} with A{val y: R forSome { type R <: P with Q }} +B{val y: P} with B{val y: P} +B{val y: P} with B{val y: Q} +B{val y: P} with B{val y: R forSome { type R <: P with Q }} +B{val y: Q} with Any{val y: P} +B{val y: Q} with Any{val y: Q} +B{val y: Q} with Any{val y: R forSome { type R <: P with Q }} +B{val y: Q} with A{val y: P} +B{val y: Q} with A{val y: Q} +B{val y: Q} with A{val y: R forSome { type R <: P with Q }} +B{val y: Q} with B{val y: P} +B{val y: Q} with B{val y: Q} +B{val y: Q} with B{val y: R forSome { type R <: P with Q }} +B{val y: R forSome { type R <: P with Q }} with Any{val y: P} +B{val y: R forSome { type R <: P with Q }} with Any{val y: Q} +B{val y: R forSome { type R <: P with Q }} with Any{val y: R forSome { type R <: P with Q }} +B{val y: R forSome { type R <: P with Q }} with A{val y: P} +B{val y: R forSome { type R <: P with Q }} with A{val y: Q} +B{val y: R forSome { type R <: P with Q }} with A{val y: R forSome { type R <: P with Q }} +B{val y: R forSome { type R <: P with Q }} with B{val y: P} +B{val y: R forSome { type R <: P with Q }} with B{val y: Q} +B{val y: R forSome { type R <: P with Q }} with B{val y: R forSome { type R <: P with Q }} +C{val y: P} with Any{val y: P} +C{val y: P} with Any{val y: Q} +C{val y: P} with Any{val y: R forSome { type R <: P with Q }} +C{val y: P} with A{val y: P} +C{val y: P} with A{val y: Q} +C{val y: P} with A{val y: R forSome { type R <: P with Q }} +C{val y: P} with B{val y: P} +C{val y: P} with B{val y: Q} +C{val y: P} with B{val y: R forSome { type R <: P with Q }} +C{val y: Q} with Any{val y: P} +C{val y: Q} with Any{val y: Q} +C{val y: Q} with Any{val y: R forSome { type R <: P with Q }} +C{val y: Q} with A{val y: P} +C{val y: Q} with A{val y: Q} +C{val y: Q} with A{val y: R forSome { type R <: P with Q }} +C{val y: Q} with B{val y: P} +C{val y: Q} with B{val y: Q} +C{val y: Q} with B{val y: R forSome { type R <: P with Q }} +C{val y: R forSome { type R <: P with Q }} with Any{val y: P} +C{val y: R forSome { type R <: P with Q }} with Any{val y: Q} +C{val y: R forSome { type R <: P with Q }} with Any{val y: R forSome { type R <: P with Q }} +C{val y: R forSome { type R <: P with Q }} with A{val y: P} +C{val y: R forSome { type R <: P with Q }} with A{val y: Q} +C{val y: R forSome { type R <: P with Q }} with A{val y: R forSome { type R <: P with Q }} +C{val y: R forSome { type R <: P with Q }} with B{val y: P} +C{val y: R forSome { type R <: P with Q }} with B{val y: Q} +C{val y: R forSome { type R <: P with Q }} with B{val y: R forSome { type R <: P with Q }} + + diff --git a/test/files/run/t3425b/Base_1.scala b/test/files/run/t3425b/Base_1.scala new file mode 100644 index 0000000000..02e108b320 --- /dev/null +++ b/test/files/run/t3425b/Base_1.scala @@ -0,0 +1,89 @@ +trait P { def reflected: Boolean } +trait Q { def reflected: Boolean } +class PQ(val reflected: Boolean) extends P with Q { } + +trait A +trait B +trait C { val y: P } +class ABC extends A with B with C { + private def reflected = ( + Thread.currentThread.getStackTrace + takeWhile (_.getMethodName != "main") + exists (_.toString contains "java.lang.reflect.") + ) + lazy val y: PQ = new PQ(reflected) +} + +/*** The source used to generate the second file + Not otherwise used in the test except that compiling + it helps make sure it still compiles. + +****/ + +object Gen { + case class Tp(outer: String, elem: String) { + override def toString = s"$outer { val y: $elem }" + } + case class Pair(tp1: Tp, tp2: Tp) { + def expr = s"((new ABC): $tp)" + def tp = s"($tp1) with ($tp2)" + } + val traits = Vector("Any", "A", "B", "C") map ("%6s" format _) + val types = Vector("P", "Q", "R forSome { type R <: P with Q }") + val allTypes = for (c <- traits ; tp <- types) yield Tp(c, tp) + val pairs = allTypes flatMap (t1 => allTypes map (t2 => Pair(t1, t2))) + val indices = pairs.indices + + def aliases(idx: Int) = { + val p = pairs(idx) + import p._ + List( + s"type R1_$idx = $tp", + s"type R2_$idx = R1_$idx { val y: (${tp1.elem}) with (${tp2.elem}) }" + ) + } + + def mkMethodContent(pre: String)(f: Int => String) = + indices map (i => s"def $pre$i${f(i)}") mkString "\n " + + def content = List( + indices flatMap aliases mkString "\n ", + mkMethodContent("f")(i => s" = { val x = ${pairs(i).expr} ; x.y.reflected -> whatis(x).toString }"), + mkMethodContent("g")(i => s"""(x: R1_$i) = x.y"""), + mkMethodContent("h")(i => s"""(x: R2_$i) = x.y""") + ) mkString "\n " + + def fCalls = indices map ("f" + _) mkString ("\n ", ",\n ", "\n ") + + def main(args: Array[String]): Unit = { + // One cannot attain proper appreciation for the inadequacies of + // string interpolation without becoming one with the newline. + val nl = "\\n" + + println(s""" + |import scala.reflect.runtime.universe._ + |import scala.language._ + | + |object Test { + | def whatis[T: TypeTag](x: T) = typeOf[T] + | def sshow(label: String, xs: Traversable[Any]) { + | println("==== " + label + " ====$nl") + | xs.toList.map("" + _).sorted foreach println + | println("$nl") + | } + | + | $content + | lazy val fcalls = List($fCalls) + | + | def main(args: Array[String]) { + | sshow("Direct Calls", fcalls collect { case (false, n) => n }) + | sshow("Reflective Calls", fcalls collect { case (true, n) => n }) + | // For a good time try printing this - have to fix bugs in + | // reflection before that's going to be a good idea + | // println(typeOf[Test.type].typeSymbol.asClass.typeSignature) + | } + |} + """.stripMargin.trim + ) + } +} diff --git a/test/files/run/t3425b/Generated_2.scala b/test/files/run/t3425b/Generated_2.scala new file mode 100644 index 0000000000..f1699636f6 --- /dev/null +++ b/test/files/run/t3425b/Generated_2.scala @@ -0,0 +1,886 @@ +import scala.reflect.runtime.universe._ +import scala.language._ + +object Test { + def whatis[T: TypeTag](x: T) = typeOf[T] + def sshow(label: String, xs: Traversable[Any]) { + println("==== " + label + " ====\n") + xs.toList.map("" + _).sorted foreach println + println("\n") + } + + type R1_0 = ( Any { val y: P }) with ( Any { val y: P }) + type R2_0 = R1_0 { val y: (P) with (P) } + type R1_1 = ( Any { val y: P }) with ( Any { val y: Q }) + type R2_1 = R1_1 { val y: (P) with (Q) } + type R1_2 = ( Any { val y: P }) with ( Any { val y: R forSome { type R <: P with Q } }) + type R2_2 = R1_2 { val y: (P) with (R forSome { type R <: P with Q }) } + type R1_3 = ( Any { val y: P }) with ( A { val y: P }) + type R2_3 = R1_3 { val y: (P) with (P) } + type R1_4 = ( Any { val y: P }) with ( A { val y: Q }) + type R2_4 = R1_4 { val y: (P) with (Q) } + type R1_5 = ( Any { val y: P }) with ( A { val y: R forSome { type R <: P with Q } }) + type R2_5 = R1_5 { val y: (P) with (R forSome { type R <: P with Q }) } + type R1_6 = ( Any { val y: P }) with ( B { val y: P }) + type R2_6 = R1_6 { val y: (P) with (P) } + type R1_7 = ( Any { val y: P }) with ( B { val y: Q }) + type R2_7 = R1_7 { val y: (P) with (Q) } + type R1_8 = ( Any { val y: P }) with ( B { val y: R forSome { type R <: P with Q } }) + type R2_8 = R1_8 { val y: (P) with (R forSome { type R <: P with Q }) } + type R1_9 = ( Any { val y: P }) with ( C { val y: P }) + type R2_9 = R1_9 { val y: (P) with (P) } + type R1_10 = ( Any { val y: P }) with ( C { val y: Q }) + type R2_10 = R1_10 { val y: (P) with (Q) } + type R1_11 = ( Any { val y: P }) with ( C { val y: R forSome { type R <: P with Q } }) + type R2_11 = R1_11 { val y: (P) with (R forSome { type R <: P with Q }) } + type R1_12 = ( Any { val y: Q }) with ( Any { val y: P }) + type R2_12 = R1_12 { val y: (Q) with (P) } + type R1_13 = ( Any { val y: Q }) with ( Any { val y: Q }) + type R2_13 = R1_13 { val y: (Q) with (Q) } + type R1_14 = ( Any { val y: Q }) with ( Any { val y: R forSome { type R <: P with Q } }) + type R2_14 = R1_14 { val y: (Q) with (R forSome { type R <: P with Q }) } + type R1_15 = ( Any { val y: Q }) with ( A { val y: P }) + type R2_15 = R1_15 { val y: (Q) with (P) } + type R1_16 = ( Any { val y: Q }) with ( A { val y: Q }) + type R2_16 = R1_16 { val y: (Q) with (Q) } + type R1_17 = ( Any { val y: Q }) with ( A { val y: R forSome { type R <: P with Q } }) + type R2_17 = R1_17 { val y: (Q) with (R forSome { type R <: P with Q }) } + type R1_18 = ( Any { val y: Q }) with ( B { val y: P }) + type R2_18 = R1_18 { val y: (Q) with (P) } + type R1_19 = ( Any { val y: Q }) with ( B { val y: Q }) + type R2_19 = R1_19 { val y: (Q) with (Q) } + type R1_20 = ( Any { val y: Q }) with ( B { val y: R forSome { type R <: P with Q } }) + type R2_20 = R1_20 { val y: (Q) with (R forSome { type R <: P with Q }) } + type R1_21 = ( Any { val y: Q }) with ( C { val y: P }) + type R2_21 = R1_21 { val y: (Q) with (P) } + type R1_22 = ( Any { val y: Q }) with ( C { val y: Q }) + type R2_22 = R1_22 { val y: (Q) with (Q) } + type R1_23 = ( Any { val y: Q }) with ( C { val y: R forSome { type R <: P with Q } }) + type R2_23 = R1_23 { val y: (Q) with (R forSome { type R <: P with Q }) } + type R1_24 = ( Any { val y: R forSome { type R <: P with Q } }) with ( Any { val y: P }) + type R2_24 = R1_24 { val y: (R forSome { type R <: P with Q }) with (P) } + type R1_25 = ( Any { val y: R forSome { type R <: P with Q } }) with ( Any { val y: Q }) + type R2_25 = R1_25 { val y: (R forSome { type R <: P with Q }) with (Q) } + type R1_26 = ( Any { val y: R forSome { type R <: P with Q } }) with ( Any { val y: R forSome { type R <: P with Q } }) + type R2_26 = R1_26 { val y: (R forSome { type R <: P with Q }) with (R forSome { type R <: P with Q }) } + type R1_27 = ( Any { val y: R forSome { type R <: P with Q } }) with ( A { val y: P }) + type R2_27 = R1_27 { val y: (R forSome { type R <: P with Q }) with (P) } + type R1_28 = ( Any { val y: R forSome { type R <: P with Q } }) with ( A { val y: Q }) + type R2_28 = R1_28 { val y: (R forSome { type R <: P with Q }) with (Q) } + type R1_29 = ( Any { val y: R forSome { type R <: P with Q } }) with ( A { val y: R forSome { type R <: P with Q } }) + type R2_29 = R1_29 { val y: (R forSome { type R <: P with Q }) with (R forSome { type R <: P with Q }) } + type R1_30 = ( Any { val y: R forSome { type R <: P with Q } }) with ( B { val y: P }) + type R2_30 = R1_30 { val y: (R forSome { type R <: P with Q }) with (P) } + type R1_31 = ( Any { val y: R forSome { type R <: P with Q } }) with ( B { val y: Q }) + type R2_31 = R1_31 { val y: (R forSome { type R <: P with Q }) with (Q) } + type R1_32 = ( Any { val y: R forSome { type R <: P with Q } }) with ( B { val y: R forSome { type R <: P with Q } }) + type R2_32 = R1_32 { val y: (R forSome { type R <: P with Q }) with (R forSome { type R <: P with Q }) } + type R1_33 = ( Any { val y: R forSome { type R <: P with Q } }) with ( C { val y: P }) + type R2_33 = R1_33 { val y: (R forSome { type R <: P with Q }) with (P) } + type R1_34 = ( Any { val y: R forSome { type R <: P with Q } }) with ( C { val y: Q }) + type R2_34 = R1_34 { val y: (R forSome { type R <: P with Q }) with (Q) } + type R1_35 = ( Any { val y: R forSome { type R <: P with Q } }) with ( C { val y: R forSome { type R <: P with Q } }) + type R2_35 = R1_35 { val y: (R forSome { type R <: P with Q }) with (R forSome { type R <: P with Q }) } + type R1_36 = ( A { val y: P }) with ( Any { val y: P }) + type R2_36 = R1_36 { val y: (P) with (P) } + type R1_37 = ( A { val y: P }) with ( Any { val y: Q }) + type R2_37 = R1_37 { val y: (P) with (Q) } + type R1_38 = ( A { val y: P }) with ( Any { val y: R forSome { type R <: P with Q } }) + type R2_38 = R1_38 { val y: (P) with (R forSome { type R <: P with Q }) } + type R1_39 = ( A { val y: P }) with ( A { val y: P }) + type R2_39 = R1_39 { val y: (P) with (P) } + type R1_40 = ( A { val y: P }) with ( A { val y: Q }) + type R2_40 = R1_40 { val y: (P) with (Q) } + type R1_41 = ( A { val y: P }) with ( A { val y: R forSome { type R <: P with Q } }) + type R2_41 = R1_41 { val y: (P) with (R forSome { type R <: P with Q }) } + type R1_42 = ( A { val y: P }) with ( B { val y: P }) + type R2_42 = R1_42 { val y: (P) with (P) } + type R1_43 = ( A { val y: P }) with ( B { val y: Q }) + type R2_43 = R1_43 { val y: (P) with (Q) } + type R1_44 = ( A { val y: P }) with ( B { val y: R forSome { type R <: P with Q } }) + type R2_44 = R1_44 { val y: (P) with (R forSome { type R <: P with Q }) } + type R1_45 = ( A { val y: P }) with ( C { val y: P }) + type R2_45 = R1_45 { val y: (P) with (P) } + type R1_46 = ( A { val y: P }) with ( C { val y: Q }) + type R2_46 = R1_46 { val y: (P) with (Q) } + type R1_47 = ( A { val y: P }) with ( C { val y: R forSome { type R <: P with Q } }) + type R2_47 = R1_47 { val y: (P) with (R forSome { type R <: P with Q }) } + type R1_48 = ( A { val y: Q }) with ( Any { val y: P }) + type R2_48 = R1_48 { val y: (Q) with (P) } + type R1_49 = ( A { val y: Q }) with ( Any { val y: Q }) + type R2_49 = R1_49 { val y: (Q) with (Q) } + type R1_50 = ( A { val y: Q }) with ( Any { val y: R forSome { type R <: P with Q } }) + type R2_50 = R1_50 { val y: (Q) with (R forSome { type R <: P with Q }) } + type R1_51 = ( A { val y: Q }) with ( A { val y: P }) + type R2_51 = R1_51 { val y: (Q) with (P) } + type R1_52 = ( A { val y: Q }) with ( A { val y: Q }) + type R2_52 = R1_52 { val y: (Q) with (Q) } + type R1_53 = ( A { val y: Q }) with ( A { val y: R forSome { type R <: P with Q } }) + type R2_53 = R1_53 { val y: (Q) with (R forSome { type R <: P with Q }) } + type R1_54 = ( A { val y: Q }) with ( B { val y: P }) + type R2_54 = R1_54 { val y: (Q) with (P) } + type R1_55 = ( A { val y: Q }) with ( B { val y: Q }) + type R2_55 = R1_55 { val y: (Q) with (Q) } + type R1_56 = ( A { val y: Q }) with ( B { val y: R forSome { type R <: P with Q } }) + type R2_56 = R1_56 { val y: (Q) with (R forSome { type R <: P with Q }) } + type R1_57 = ( A { val y: Q }) with ( C { val y: P }) + type R2_57 = R1_57 { val y: (Q) with (P) } + type R1_58 = ( A { val y: Q }) with ( C { val y: Q }) + type R2_58 = R1_58 { val y: (Q) with (Q) } + type R1_59 = ( A { val y: Q }) with ( C { val y: R forSome { type R <: P with Q } }) + type R2_59 = R1_59 { val y: (Q) with (R forSome { type R <: P with Q }) } + type R1_60 = ( A { val y: R forSome { type R <: P with Q } }) with ( Any { val y: P }) + type R2_60 = R1_60 { val y: (R forSome { type R <: P with Q }) with (P) } + type R1_61 = ( A { val y: R forSome { type R <: P with Q } }) with ( Any { val y: Q }) + type R2_61 = R1_61 { val y: (R forSome { type R <: P with Q }) with (Q) } + type R1_62 = ( A { val y: R forSome { type R <: P with Q } }) with ( Any { val y: R forSome { type R <: P with Q } }) + type R2_62 = R1_62 { val y: (R forSome { type R <: P with Q }) with (R forSome { type R <: P with Q }) } + type R1_63 = ( A { val y: R forSome { type R <: P with Q } }) with ( A { val y: P }) + type R2_63 = R1_63 { val y: (R forSome { type R <: P with Q }) with (P) } + type R1_64 = ( A { val y: R forSome { type R <: P with Q } }) with ( A { val y: Q }) + type R2_64 = R1_64 { val y: (R forSome { type R <: P with Q }) with (Q) } + type R1_65 = ( A { val y: R forSome { type R <: P with Q } }) with ( A { val y: R forSome { type R <: P with Q } }) + type R2_65 = R1_65 { val y: (R forSome { type R <: P with Q }) with (R forSome { type R <: P with Q }) } + type R1_66 = ( A { val y: R forSome { type R <: P with Q } }) with ( B { val y: P }) + type R2_66 = R1_66 { val y: (R forSome { type R <: P with Q }) with (P) } + type R1_67 = ( A { val y: R forSome { type R <: P with Q } }) with ( B { val y: Q }) + type R2_67 = R1_67 { val y: (R forSome { type R <: P with Q }) with (Q) } + type R1_68 = ( A { val y: R forSome { type R <: P with Q } }) with ( B { val y: R forSome { type R <: P with Q } }) + type R2_68 = R1_68 { val y: (R forSome { type R <: P with Q }) with (R forSome { type R <: P with Q }) } + type R1_69 = ( A { val y: R forSome { type R <: P with Q } }) with ( C { val y: P }) + type R2_69 = R1_69 { val y: (R forSome { type R <: P with Q }) with (P) } + type R1_70 = ( A { val y: R forSome { type R <: P with Q } }) with ( C { val y: Q }) + type R2_70 = R1_70 { val y: (R forSome { type R <: P with Q }) with (Q) } + type R1_71 = ( A { val y: R forSome { type R <: P with Q } }) with ( C { val y: R forSome { type R <: P with Q } }) + type R2_71 = R1_71 { val y: (R forSome { type R <: P with Q }) with (R forSome { type R <: P with Q }) } + type R1_72 = ( B { val y: P }) with ( Any { val y: P }) + type R2_72 = R1_72 { val y: (P) with (P) } + type R1_73 = ( B { val y: P }) with ( Any { val y: Q }) + type R2_73 = R1_73 { val y: (P) with (Q) } + type R1_74 = ( B { val y: P }) with ( Any { val y: R forSome { type R <: P with Q } }) + type R2_74 = R1_74 { val y: (P) with (R forSome { type R <: P with Q }) } + type R1_75 = ( B { val y: P }) with ( A { val y: P }) + type R2_75 = R1_75 { val y: (P) with (P) } + type R1_76 = ( B { val y: P }) with ( A { val y: Q }) + type R2_76 = R1_76 { val y: (P) with (Q) } + type R1_77 = ( B { val y: P }) with ( A { val y: R forSome { type R <: P with Q } }) + type R2_77 = R1_77 { val y: (P) with (R forSome { type R <: P with Q }) } + type R1_78 = ( B { val y: P }) with ( B { val y: P }) + type R2_78 = R1_78 { val y: (P) with (P) } + type R1_79 = ( B { val y: P }) with ( B { val y: Q }) + type R2_79 = R1_79 { val y: (P) with (Q) } + type R1_80 = ( B { val y: P }) with ( B { val y: R forSome { type R <: P with Q } }) + type R2_80 = R1_80 { val y: (P) with (R forSome { type R <: P with Q }) } + type R1_81 = ( B { val y: P }) with ( C { val y: P }) + type R2_81 = R1_81 { val y: (P) with (P) } + type R1_82 = ( B { val y: P }) with ( C { val y: Q }) + type R2_82 = R1_82 { val y: (P) with (Q) } + type R1_83 = ( B { val y: P }) with ( C { val y: R forSome { type R <: P with Q } }) + type R2_83 = R1_83 { val y: (P) with (R forSome { type R <: P with Q }) } + type R1_84 = ( B { val y: Q }) with ( Any { val y: P }) + type R2_84 = R1_84 { val y: (Q) with (P) } + type R1_85 = ( B { val y: Q }) with ( Any { val y: Q }) + type R2_85 = R1_85 { val y: (Q) with (Q) } + type R1_86 = ( B { val y: Q }) with ( Any { val y: R forSome { type R <: P with Q } }) + type R2_86 = R1_86 { val y: (Q) with (R forSome { type R <: P with Q }) } + type R1_87 = ( B { val y: Q }) with ( A { val y: P }) + type R2_87 = R1_87 { val y: (Q) with (P) } + type R1_88 = ( B { val y: Q }) with ( A { val y: Q }) + type R2_88 = R1_88 { val y: (Q) with (Q) } + type R1_89 = ( B { val y: Q }) with ( A { val y: R forSome { type R <: P with Q } }) + type R2_89 = R1_89 { val y: (Q) with (R forSome { type R <: P with Q }) } + type R1_90 = ( B { val y: Q }) with ( B { val y: P }) + type R2_90 = R1_90 { val y: (Q) with (P) } + type R1_91 = ( B { val y: Q }) with ( B { val y: Q }) + type R2_91 = R1_91 { val y: (Q) with (Q) } + type R1_92 = ( B { val y: Q }) with ( B { val y: R forSome { type R <: P with Q } }) + type R2_92 = R1_92 { val y: (Q) with (R forSome { type R <: P with Q }) } + type R1_93 = ( B { val y: Q }) with ( C { val y: P }) + type R2_93 = R1_93 { val y: (Q) with (P) } + type R1_94 = ( B { val y: Q }) with ( C { val y: Q }) + type R2_94 = R1_94 { val y: (Q) with (Q) } + type R1_95 = ( B { val y: Q }) with ( C { val y: R forSome { type R <: P with Q } }) + type R2_95 = R1_95 { val y: (Q) with (R forSome { type R <: P with Q }) } + type R1_96 = ( B { val y: R forSome { type R <: P with Q } }) with ( Any { val y: P }) + type R2_96 = R1_96 { val y: (R forSome { type R <: P with Q }) with (P) } + type R1_97 = ( B { val y: R forSome { type R <: P with Q } }) with ( Any { val y: Q }) + type R2_97 = R1_97 { val y: (R forSome { type R <: P with Q }) with (Q) } + type R1_98 = ( B { val y: R forSome { type R <: P with Q } }) with ( Any { val y: R forSome { type R <: P with Q } }) + type R2_98 = R1_98 { val y: (R forSome { type R <: P with Q }) with (R forSome { type R <: P with Q }) } + type R1_99 = ( B { val y: R forSome { type R <: P with Q } }) with ( A { val y: P }) + type R2_99 = R1_99 { val y: (R forSome { type R <: P with Q }) with (P) } + type R1_100 = ( B { val y: R forSome { type R <: P with Q } }) with ( A { val y: Q }) + type R2_100 = R1_100 { val y: (R forSome { type R <: P with Q }) with (Q) } + type R1_101 = ( B { val y: R forSome { type R <: P with Q } }) with ( A { val y: R forSome { type R <: P with Q } }) + type R2_101 = R1_101 { val y: (R forSome { type R <: P with Q }) with (R forSome { type R <: P with Q }) } + type R1_102 = ( B { val y: R forSome { type R <: P with Q } }) with ( B { val y: P }) + type R2_102 = R1_102 { val y: (R forSome { type R <: P with Q }) with (P) } + type R1_103 = ( B { val y: R forSome { type R <: P with Q } }) with ( B { val y: Q }) + type R2_103 = R1_103 { val y: (R forSome { type R <: P with Q }) with (Q) } + type R1_104 = ( B { val y: R forSome { type R <: P with Q } }) with ( B { val y: R forSome { type R <: P with Q } }) + type R2_104 = R1_104 { val y: (R forSome { type R <: P with Q }) with (R forSome { type R <: P with Q }) } + type R1_105 = ( B { val y: R forSome { type R <: P with Q } }) with ( C { val y: P }) + type R2_105 = R1_105 { val y: (R forSome { type R <: P with Q }) with (P) } + type R1_106 = ( B { val y: R forSome { type R <: P with Q } }) with ( C { val y: Q }) + type R2_106 = R1_106 { val y: (R forSome { type R <: P with Q }) with (Q) } + type R1_107 = ( B { val y: R forSome { type R <: P with Q } }) with ( C { val y: R forSome { type R <: P with Q } }) + type R2_107 = R1_107 { val y: (R forSome { type R <: P with Q }) with (R forSome { type R <: P with Q }) } + type R1_108 = ( C { val y: P }) with ( Any { val y: P }) + type R2_108 = R1_108 { val y: (P) with (P) } + type R1_109 = ( C { val y: P }) with ( Any { val y: Q }) + type R2_109 = R1_109 { val y: (P) with (Q) } + type R1_110 = ( C { val y: P }) with ( Any { val y: R forSome { type R <: P with Q } }) + type R2_110 = R1_110 { val y: (P) with (R forSome { type R <: P with Q }) } + type R1_111 = ( C { val y: P }) with ( A { val y: P }) + type R2_111 = R1_111 { val y: (P) with (P) } + type R1_112 = ( C { val y: P }) with ( A { val y: Q }) + type R2_112 = R1_112 { val y: (P) with (Q) } + type R1_113 = ( C { val y: P }) with ( A { val y: R forSome { type R <: P with Q } }) + type R2_113 = R1_113 { val y: (P) with (R forSome { type R <: P with Q }) } + type R1_114 = ( C { val y: P }) with ( B { val y: P }) + type R2_114 = R1_114 { val y: (P) with (P) } + type R1_115 = ( C { val y: P }) with ( B { val y: Q }) + type R2_115 = R1_115 { val y: (P) with (Q) } + type R1_116 = ( C { val y: P }) with ( B { val y: R forSome { type R <: P with Q } }) + type R2_116 = R1_116 { val y: (P) with (R forSome { type R <: P with Q }) } + type R1_117 = ( C { val y: P }) with ( C { val y: P }) + type R2_117 = R1_117 { val y: (P) with (P) } + type R1_118 = ( C { val y: P }) with ( C { val y: Q }) + type R2_118 = R1_118 { val y: (P) with (Q) } + type R1_119 = ( C { val y: P }) with ( C { val y: R forSome { type R <: P with Q } }) + type R2_119 = R1_119 { val y: (P) with (R forSome { type R <: P with Q }) } + type R1_120 = ( C { val y: Q }) with ( Any { val y: P }) + type R2_120 = R1_120 { val y: (Q) with (P) } + type R1_121 = ( C { val y: Q }) with ( Any { val y: Q }) + type R2_121 = R1_121 { val y: (Q) with (Q) } + type R1_122 = ( C { val y: Q }) with ( Any { val y: R forSome { type R <: P with Q } }) + type R2_122 = R1_122 { val y: (Q) with (R forSome { type R <: P with Q }) } + type R1_123 = ( C { val y: Q }) with ( A { val y: P }) + type R2_123 = R1_123 { val y: (Q) with (P) } + type R1_124 = ( C { val y: Q }) with ( A { val y: Q }) + type R2_124 = R1_124 { val y: (Q) with (Q) } + type R1_125 = ( C { val y: Q }) with ( A { val y: R forSome { type R <: P with Q } }) + type R2_125 = R1_125 { val y: (Q) with (R forSome { type R <: P with Q }) } + type R1_126 = ( C { val y: Q }) with ( B { val y: P }) + type R2_126 = R1_126 { val y: (Q) with (P) } + type R1_127 = ( C { val y: Q }) with ( B { val y: Q }) + type R2_127 = R1_127 { val y: (Q) with (Q) } + type R1_128 = ( C { val y: Q }) with ( B { val y: R forSome { type R <: P with Q } }) + type R2_128 = R1_128 { val y: (Q) with (R forSome { type R <: P with Q }) } + type R1_129 = ( C { val y: Q }) with ( C { val y: P }) + type R2_129 = R1_129 { val y: (Q) with (P) } + type R1_130 = ( C { val y: Q }) with ( C { val y: Q }) + type R2_130 = R1_130 { val y: (Q) with (Q) } + type R1_131 = ( C { val y: Q }) with ( C { val y: R forSome { type R <: P with Q } }) + type R2_131 = R1_131 { val y: (Q) with (R forSome { type R <: P with Q }) } + type R1_132 = ( C { val y: R forSome { type R <: P with Q } }) with ( Any { val y: P }) + type R2_132 = R1_132 { val y: (R forSome { type R <: P with Q }) with (P) } + type R1_133 = ( C { val y: R forSome { type R <: P with Q } }) with ( Any { val y: Q }) + type R2_133 = R1_133 { val y: (R forSome { type R <: P with Q }) with (Q) } + type R1_134 = ( C { val y: R forSome { type R <: P with Q } }) with ( Any { val y: R forSome { type R <: P with Q } }) + type R2_134 = R1_134 { val y: (R forSome { type R <: P with Q }) with (R forSome { type R <: P with Q }) } + type R1_135 = ( C { val y: R forSome { type R <: P with Q } }) with ( A { val y: P }) + type R2_135 = R1_135 { val y: (R forSome { type R <: P with Q }) with (P) } + type R1_136 = ( C { val y: R forSome { type R <: P with Q } }) with ( A { val y: Q }) + type R2_136 = R1_136 { val y: (R forSome { type R <: P with Q }) with (Q) } + type R1_137 = ( C { val y: R forSome { type R <: P with Q } }) with ( A { val y: R forSome { type R <: P with Q } }) + type R2_137 = R1_137 { val y: (R forSome { type R <: P with Q }) with (R forSome { type R <: P with Q }) } + type R1_138 = ( C { val y: R forSome { type R <: P with Q } }) with ( B { val y: P }) + type R2_138 = R1_138 { val y: (R forSome { type R <: P with Q }) with (P) } + type R1_139 = ( C { val y: R forSome { type R <: P with Q } }) with ( B { val y: Q }) + type R2_139 = R1_139 { val y: (R forSome { type R <: P with Q }) with (Q) } + type R1_140 = ( C { val y: R forSome { type R <: P with Q } }) with ( B { val y: R forSome { type R <: P with Q } }) + type R2_140 = R1_140 { val y: (R forSome { type R <: P with Q }) with (R forSome { type R <: P with Q }) } + type R1_141 = ( C { val y: R forSome { type R <: P with Q } }) with ( C { val y: P }) + type R2_141 = R1_141 { val y: (R forSome { type R <: P with Q }) with (P) } + type R1_142 = ( C { val y: R forSome { type R <: P with Q } }) with ( C { val y: Q }) + type R2_142 = R1_142 { val y: (R forSome { type R <: P with Q }) with (Q) } + type R1_143 = ( C { val y: R forSome { type R <: P with Q } }) with ( C { val y: R forSome { type R <: P with Q } }) + type R2_143 = R1_143 { val y: (R forSome { type R <: P with Q }) with (R forSome { type R <: P with Q }) } + def f0 = { val x = ((new ABC): ( Any { val y: P }) with ( Any { val y: P })) ; x.y.reflected -> whatis(x).toString } + def f1 = { val x = ((new ABC): ( Any { val y: P }) with ( Any { val y: Q })) ; x.y.reflected -> whatis(x).toString } + def f2 = { val x = ((new ABC): ( Any { val y: P }) with ( Any { val y: R forSome { type R <: P with Q } })) ; x.y.reflected -> whatis(x).toString } + def f3 = { val x = ((new ABC): ( Any { val y: P }) with ( A { val y: P })) ; x.y.reflected -> whatis(x).toString } + def f4 = { val x = ((new ABC): ( Any { val y: P }) with ( A { val y: Q })) ; x.y.reflected -> whatis(x).toString } + def f5 = { val x = ((new ABC): ( Any { val y: P }) with ( A { val y: R forSome { type R <: P with Q } })) ; x.y.reflected -> whatis(x).toString } + def f6 = { val x = ((new ABC): ( Any { val y: P }) with ( B { val y: P })) ; x.y.reflected -> whatis(x).toString } + def f7 = { val x = ((new ABC): ( Any { val y: P }) with ( B { val y: Q })) ; x.y.reflected -> whatis(x).toString } + def f8 = { val x = ((new ABC): ( Any { val y: P }) with ( B { val y: R forSome { type R <: P with Q } })) ; x.y.reflected -> whatis(x).toString } + def f9 = { val x = ((new ABC): ( Any { val y: P }) with ( C { val y: P })) ; x.y.reflected -> whatis(x).toString } + def f10 = { val x = ((new ABC): ( Any { val y: P }) with ( C { val y: Q })) ; x.y.reflected -> whatis(x).toString } + def f11 = { val x = ((new ABC): ( Any { val y: P }) with ( C { val y: R forSome { type R <: P with Q } })) ; x.y.reflected -> whatis(x).toString } + def f12 = { val x = ((new ABC): ( Any { val y: Q }) with ( Any { val y: P })) ; x.y.reflected -> whatis(x).toString } + def f13 = { val x = ((new ABC): ( Any { val y: Q }) with ( Any { val y: Q })) ; x.y.reflected -> whatis(x).toString } + def f14 = { val x = ((new ABC): ( Any { val y: Q }) with ( Any { val y: R forSome { type R <: P with Q } })) ; x.y.reflected -> whatis(x).toString } + def f15 = { val x = ((new ABC): ( Any { val y: Q }) with ( A { val y: P })) ; x.y.reflected -> whatis(x).toString } + def f16 = { val x = ((new ABC): ( Any { val y: Q }) with ( A { val y: Q })) ; x.y.reflected -> whatis(x).toString } + def f17 = { val x = ((new ABC): ( Any { val y: Q }) with ( A { val y: R forSome { type R <: P with Q } })) ; x.y.reflected -> whatis(x).toString } + def f18 = { val x = ((new ABC): ( Any { val y: Q }) with ( B { val y: P })) ; x.y.reflected -> whatis(x).toString } + def f19 = { val x = ((new ABC): ( Any { val y: Q }) with ( B { val y: Q })) ; x.y.reflected -> whatis(x).toString } + def f20 = { val x = ((new ABC): ( Any { val y: Q }) with ( B { val y: R forSome { type R <: P with Q } })) ; x.y.reflected -> whatis(x).toString } + def f21 = { val x = ((new ABC): ( Any { val y: Q }) with ( C { val y: P })) ; x.y.reflected -> whatis(x).toString } + def f22 = { val x = ((new ABC): ( Any { val y: Q }) with ( C { val y: Q })) ; x.y.reflected -> whatis(x).toString } + def f23 = { val x = ((new ABC): ( Any { val y: Q }) with ( C { val y: R forSome { type R <: P with Q } })) ; x.y.reflected -> whatis(x).toString } + def f24 = { val x = ((new ABC): ( Any { val y: R forSome { type R <: P with Q } }) with ( Any { val y: P })) ; x.y.reflected -> whatis(x).toString } + def f25 = { val x = ((new ABC): ( Any { val y: R forSome { type R <: P with Q } }) with ( Any { val y: Q })) ; x.y.reflected -> whatis(x).toString } + def f26 = { val x = ((new ABC): ( Any { val y: R forSome { type R <: P with Q } }) with ( Any { val y: R forSome { type R <: P with Q } })) ; x.y.reflected -> whatis(x).toString } + def f27 = { val x = ((new ABC): ( Any { val y: R forSome { type R <: P with Q } }) with ( A { val y: P })) ; x.y.reflected -> whatis(x).toString } + def f28 = { val x = ((new ABC): ( Any { val y: R forSome { type R <: P with Q } }) with ( A { val y: Q })) ; x.y.reflected -> whatis(x).toString } + def f29 = { val x = ((new ABC): ( Any { val y: R forSome { type R <: P with Q } }) with ( A { val y: R forSome { type R <: P with Q } })) ; x.y.reflected -> whatis(x).toString } + def f30 = { val x = ((new ABC): ( Any { val y: R forSome { type R <: P with Q } }) with ( B { val y: P })) ; x.y.reflected -> whatis(x).toString } + def f31 = { val x = ((new ABC): ( Any { val y: R forSome { type R <: P with Q } }) with ( B { val y: Q })) ; x.y.reflected -> whatis(x).toString } + def f32 = { val x = ((new ABC): ( Any { val y: R forSome { type R <: P with Q } }) with ( B { val y: R forSome { type R <: P with Q } })) ; x.y.reflected -> whatis(x).toString } + def f33 = { val x = ((new ABC): ( Any { val y: R forSome { type R <: P with Q } }) with ( C { val y: P })) ; x.y.reflected -> whatis(x).toString } + def f34 = { val x = ((new ABC): ( Any { val y: R forSome { type R <: P with Q } }) with ( C { val y: Q })) ; x.y.reflected -> whatis(x).toString } + def f35 = { val x = ((new ABC): ( Any { val y: R forSome { type R <: P with Q } }) with ( C { val y: R forSome { type R <: P with Q } })) ; x.y.reflected -> whatis(x).toString } + def f36 = { val x = ((new ABC): ( A { val y: P }) with ( Any { val y: P })) ; x.y.reflected -> whatis(x).toString } + def f37 = { val x = ((new ABC): ( A { val y: P }) with ( Any { val y: Q })) ; x.y.reflected -> whatis(x).toString } + def f38 = { val x = ((new ABC): ( A { val y: P }) with ( Any { val y: R forSome { type R <: P with Q } })) ; x.y.reflected -> whatis(x).toString } + def f39 = { val x = ((new ABC): ( A { val y: P }) with ( A { val y: P })) ; x.y.reflected -> whatis(x).toString } + def f40 = { val x = ((new ABC): ( A { val y: P }) with ( A { val y: Q })) ; x.y.reflected -> whatis(x).toString } + def f41 = { val x = ((new ABC): ( A { val y: P }) with ( A { val y: R forSome { type R <: P with Q } })) ; x.y.reflected -> whatis(x).toString } + def f42 = { val x = ((new ABC): ( A { val y: P }) with ( B { val y: P })) ; x.y.reflected -> whatis(x).toString } + def f43 = { val x = ((new ABC): ( A { val y: P }) with ( B { val y: Q })) ; x.y.reflected -> whatis(x).toString } + def f44 = { val x = ((new ABC): ( A { val y: P }) with ( B { val y: R forSome { type R <: P with Q } })) ; x.y.reflected -> whatis(x).toString } + def f45 = { val x = ((new ABC): ( A { val y: P }) with ( C { val y: P })) ; x.y.reflected -> whatis(x).toString } + def f46 = { val x = ((new ABC): ( A { val y: P }) with ( C { val y: Q })) ; x.y.reflected -> whatis(x).toString } + def f47 = { val x = ((new ABC): ( A { val y: P }) with ( C { val y: R forSome { type R <: P with Q } })) ; x.y.reflected -> whatis(x).toString } + def f48 = { val x = ((new ABC): ( A { val y: Q }) with ( Any { val y: P })) ; x.y.reflected -> whatis(x).toString } + def f49 = { val x = ((new ABC): ( A { val y: Q }) with ( Any { val y: Q })) ; x.y.reflected -> whatis(x).toString } + def f50 = { val x = ((new ABC): ( A { val y: Q }) with ( Any { val y: R forSome { type R <: P with Q } })) ; x.y.reflected -> whatis(x).toString } + def f51 = { val x = ((new ABC): ( A { val y: Q }) with ( A { val y: P })) ; x.y.reflected -> whatis(x).toString } + def f52 = { val x = ((new ABC): ( A { val y: Q }) with ( A { val y: Q })) ; x.y.reflected -> whatis(x).toString } + def f53 = { val x = ((new ABC): ( A { val y: Q }) with ( A { val y: R forSome { type R <: P with Q } })) ; x.y.reflected -> whatis(x).toString } + def f54 = { val x = ((new ABC): ( A { val y: Q }) with ( B { val y: P })) ; x.y.reflected -> whatis(x).toString } + def f55 = { val x = ((new ABC): ( A { val y: Q }) with ( B { val y: Q })) ; x.y.reflected -> whatis(x).toString } + def f56 = { val x = ((new ABC): ( A { val y: Q }) with ( B { val y: R forSome { type R <: P with Q } })) ; x.y.reflected -> whatis(x).toString } + def f57 = { val x = ((new ABC): ( A { val y: Q }) with ( C { val y: P })) ; x.y.reflected -> whatis(x).toString } + def f58 = { val x = ((new ABC): ( A { val y: Q }) with ( C { val y: Q })) ; x.y.reflected -> whatis(x).toString } + def f59 = { val x = ((new ABC): ( A { val y: Q }) with ( C { val y: R forSome { type R <: P with Q } })) ; x.y.reflected -> whatis(x).toString } + def f60 = { val x = ((new ABC): ( A { val y: R forSome { type R <: P with Q } }) with ( Any { val y: P })) ; x.y.reflected -> whatis(x).toString } + def f61 = { val x = ((new ABC): ( A { val y: R forSome { type R <: P with Q } }) with ( Any { val y: Q })) ; x.y.reflected -> whatis(x).toString } + def f62 = { val x = ((new ABC): ( A { val y: R forSome { type R <: P with Q } }) with ( Any { val y: R forSome { type R <: P with Q } })) ; x.y.reflected -> whatis(x).toString } + def f63 = { val x = ((new ABC): ( A { val y: R forSome { type R <: P with Q } }) with ( A { val y: P })) ; x.y.reflected -> whatis(x).toString } + def f64 = { val x = ((new ABC): ( A { val y: R forSome { type R <: P with Q } }) with ( A { val y: Q })) ; x.y.reflected -> whatis(x).toString } + def f65 = { val x = ((new ABC): ( A { val y: R forSome { type R <: P with Q } }) with ( A { val y: R forSome { type R <: P with Q } })) ; x.y.reflected -> whatis(x).toString } + def f66 = { val x = ((new ABC): ( A { val y: R forSome { type R <: P with Q } }) with ( B { val y: P })) ; x.y.reflected -> whatis(x).toString } + def f67 = { val x = ((new ABC): ( A { val y: R forSome { type R <: P with Q } }) with ( B { val y: Q })) ; x.y.reflected -> whatis(x).toString } + def f68 = { val x = ((new ABC): ( A { val y: R forSome { type R <: P with Q } }) with ( B { val y: R forSome { type R <: P with Q } })) ; x.y.reflected -> whatis(x).toString } + def f69 = { val x = ((new ABC): ( A { val y: R forSome { type R <: P with Q } }) with ( C { val y: P })) ; x.y.reflected -> whatis(x).toString } + def f70 = { val x = ((new ABC): ( A { val y: R forSome { type R <: P with Q } }) with ( C { val y: Q })) ; x.y.reflected -> whatis(x).toString } + def f71 = { val x = ((new ABC): ( A { val y: R forSome { type R <: P with Q } }) with ( C { val y: R forSome { type R <: P with Q } })) ; x.y.reflected -> whatis(x).toString } + def f72 = { val x = ((new ABC): ( B { val y: P }) with ( Any { val y: P })) ; x.y.reflected -> whatis(x).toString } + def f73 = { val x = ((new ABC): ( B { val y: P }) with ( Any { val y: Q })) ; x.y.reflected -> whatis(x).toString } + def f74 = { val x = ((new ABC): ( B { val y: P }) with ( Any { val y: R forSome { type R <: P with Q } })) ; x.y.reflected -> whatis(x).toString } + def f75 = { val x = ((new ABC): ( B { val y: P }) with ( A { val y: P })) ; x.y.reflected -> whatis(x).toString } + def f76 = { val x = ((new ABC): ( B { val y: P }) with ( A { val y: Q })) ; x.y.reflected -> whatis(x).toString } + def f77 = { val x = ((new ABC): ( B { val y: P }) with ( A { val y: R forSome { type R <: P with Q } })) ; x.y.reflected -> whatis(x).toString } + def f78 = { val x = ((new ABC): ( B { val y: P }) with ( B { val y: P })) ; x.y.reflected -> whatis(x).toString } + def f79 = { val x = ((new ABC): ( B { val y: P }) with ( B { val y: Q })) ; x.y.reflected -> whatis(x).toString } + def f80 = { val x = ((new ABC): ( B { val y: P }) with ( B { val y: R forSome { type R <: P with Q } })) ; x.y.reflected -> whatis(x).toString } + def f81 = { val x = ((new ABC): ( B { val y: P }) with ( C { val y: P })) ; x.y.reflected -> whatis(x).toString } + def f82 = { val x = ((new ABC): ( B { val y: P }) with ( C { val y: Q })) ; x.y.reflected -> whatis(x).toString } + def f83 = { val x = ((new ABC): ( B { val y: P }) with ( C { val y: R forSome { type R <: P with Q } })) ; x.y.reflected -> whatis(x).toString } + def f84 = { val x = ((new ABC): ( B { val y: Q }) with ( Any { val y: P })) ; x.y.reflected -> whatis(x).toString } + def f85 = { val x = ((new ABC): ( B { val y: Q }) with ( Any { val y: Q })) ; x.y.reflected -> whatis(x).toString } + def f86 = { val x = ((new ABC): ( B { val y: Q }) with ( Any { val y: R forSome { type R <: P with Q } })) ; x.y.reflected -> whatis(x).toString } + def f87 = { val x = ((new ABC): ( B { val y: Q }) with ( A { val y: P })) ; x.y.reflected -> whatis(x).toString } + def f88 = { val x = ((new ABC): ( B { val y: Q }) with ( A { val y: Q })) ; x.y.reflected -> whatis(x).toString } + def f89 = { val x = ((new ABC): ( B { val y: Q }) with ( A { val y: R forSome { type R <: P with Q } })) ; x.y.reflected -> whatis(x).toString } + def f90 = { val x = ((new ABC): ( B { val y: Q }) with ( B { val y: P })) ; x.y.reflected -> whatis(x).toString } + def f91 = { val x = ((new ABC): ( B { val y: Q }) with ( B { val y: Q })) ; x.y.reflected -> whatis(x).toString } + def f92 = { val x = ((new ABC): ( B { val y: Q }) with ( B { val y: R forSome { type R <: P with Q } })) ; x.y.reflected -> whatis(x).toString } + def f93 = { val x = ((new ABC): ( B { val y: Q }) with ( C { val y: P })) ; x.y.reflected -> whatis(x).toString } + def f94 = { val x = ((new ABC): ( B { val y: Q }) with ( C { val y: Q })) ; x.y.reflected -> whatis(x).toString } + def f95 = { val x = ((new ABC): ( B { val y: Q }) with ( C { val y: R forSome { type R <: P with Q } })) ; x.y.reflected -> whatis(x).toString } + def f96 = { val x = ((new ABC): ( B { val y: R forSome { type R <: P with Q } }) with ( Any { val y: P })) ; x.y.reflected -> whatis(x).toString } + def f97 = { val x = ((new ABC): ( B { val y: R forSome { type R <: P with Q } }) with ( Any { val y: Q })) ; x.y.reflected -> whatis(x).toString } + def f98 = { val x = ((new ABC): ( B { val y: R forSome { type R <: P with Q } }) with ( Any { val y: R forSome { type R <: P with Q } })) ; x.y.reflected -> whatis(x).toString } + def f99 = { val x = ((new ABC): ( B { val y: R forSome { type R <: P with Q } }) with ( A { val y: P })) ; x.y.reflected -> whatis(x).toString } + def f100 = { val x = ((new ABC): ( B { val y: R forSome { type R <: P with Q } }) with ( A { val y: Q })) ; x.y.reflected -> whatis(x).toString } + def f101 = { val x = ((new ABC): ( B { val y: R forSome { type R <: P with Q } }) with ( A { val y: R forSome { type R <: P with Q } })) ; x.y.reflected -> whatis(x).toString } + def f102 = { val x = ((new ABC): ( B { val y: R forSome { type R <: P with Q } }) with ( B { val y: P })) ; x.y.reflected -> whatis(x).toString } + def f103 = { val x = ((new ABC): ( B { val y: R forSome { type R <: P with Q } }) with ( B { val y: Q })) ; x.y.reflected -> whatis(x).toString } + def f104 = { val x = ((new ABC): ( B { val y: R forSome { type R <: P with Q } }) with ( B { val y: R forSome { type R <: P with Q } })) ; x.y.reflected -> whatis(x).toString } + def f105 = { val x = ((new ABC): ( B { val y: R forSome { type R <: P with Q } }) with ( C { val y: P })) ; x.y.reflected -> whatis(x).toString } + def f106 = { val x = ((new ABC): ( B { val y: R forSome { type R <: P with Q } }) with ( C { val y: Q })) ; x.y.reflected -> whatis(x).toString } + def f107 = { val x = ((new ABC): ( B { val y: R forSome { type R <: P with Q } }) with ( C { val y: R forSome { type R <: P with Q } })) ; x.y.reflected -> whatis(x).toString } + def f108 = { val x = ((new ABC): ( C { val y: P }) with ( Any { val y: P })) ; x.y.reflected -> whatis(x).toString } + def f109 = { val x = ((new ABC): ( C { val y: P }) with ( Any { val y: Q })) ; x.y.reflected -> whatis(x).toString } + def f110 = { val x = ((new ABC): ( C { val y: P }) with ( Any { val y: R forSome { type R <: P with Q } })) ; x.y.reflected -> whatis(x).toString } + def f111 = { val x = ((new ABC): ( C { val y: P }) with ( A { val y: P })) ; x.y.reflected -> whatis(x).toString } + def f112 = { val x = ((new ABC): ( C { val y: P }) with ( A { val y: Q })) ; x.y.reflected -> whatis(x).toString } + def f113 = { val x = ((new ABC): ( C { val y: P }) with ( A { val y: R forSome { type R <: P with Q } })) ; x.y.reflected -> whatis(x).toString } + def f114 = { val x = ((new ABC): ( C { val y: P }) with ( B { val y: P })) ; x.y.reflected -> whatis(x).toString } + def f115 = { val x = ((new ABC): ( C { val y: P }) with ( B { val y: Q })) ; x.y.reflected -> whatis(x).toString } + def f116 = { val x = ((new ABC): ( C { val y: P }) with ( B { val y: R forSome { type R <: P with Q } })) ; x.y.reflected -> whatis(x).toString } + def f117 = { val x = ((new ABC): ( C { val y: P }) with ( C { val y: P })) ; x.y.reflected -> whatis(x).toString } + def f118 = { val x = ((new ABC): ( C { val y: P }) with ( C { val y: Q })) ; x.y.reflected -> whatis(x).toString } + def f119 = { val x = ((new ABC): ( C { val y: P }) with ( C { val y: R forSome { type R <: P with Q } })) ; x.y.reflected -> whatis(x).toString } + def f120 = { val x = ((new ABC): ( C { val y: Q }) with ( Any { val y: P })) ; x.y.reflected -> whatis(x).toString } + def f121 = { val x = ((new ABC): ( C { val y: Q }) with ( Any { val y: Q })) ; x.y.reflected -> whatis(x).toString } + def f122 = { val x = ((new ABC): ( C { val y: Q }) with ( Any { val y: R forSome { type R <: P with Q } })) ; x.y.reflected -> whatis(x).toString } + def f123 = { val x = ((new ABC): ( C { val y: Q }) with ( A { val y: P })) ; x.y.reflected -> whatis(x).toString } + def f124 = { val x = ((new ABC): ( C { val y: Q }) with ( A { val y: Q })) ; x.y.reflected -> whatis(x).toString } + def f125 = { val x = ((new ABC): ( C { val y: Q }) with ( A { val y: R forSome { type R <: P with Q } })) ; x.y.reflected -> whatis(x).toString } + def f126 = { val x = ((new ABC): ( C { val y: Q }) with ( B { val y: P })) ; x.y.reflected -> whatis(x).toString } + def f127 = { val x = ((new ABC): ( C { val y: Q }) with ( B { val y: Q })) ; x.y.reflected -> whatis(x).toString } + def f128 = { val x = ((new ABC): ( C { val y: Q }) with ( B { val y: R forSome { type R <: P with Q } })) ; x.y.reflected -> whatis(x).toString } + def f129 = { val x = ((new ABC): ( C { val y: Q }) with ( C { val y: P })) ; x.y.reflected -> whatis(x).toString } + def f130 = { val x = ((new ABC): ( C { val y: Q }) with ( C { val y: Q })) ; x.y.reflected -> whatis(x).toString } + def f131 = { val x = ((new ABC): ( C { val y: Q }) with ( C { val y: R forSome { type R <: P with Q } })) ; x.y.reflected -> whatis(x).toString } + def f132 = { val x = ((new ABC): ( C { val y: R forSome { type R <: P with Q } }) with ( Any { val y: P })) ; x.y.reflected -> whatis(x).toString } + def f133 = { val x = ((new ABC): ( C { val y: R forSome { type R <: P with Q } }) with ( Any { val y: Q })) ; x.y.reflected -> whatis(x).toString } + def f134 = { val x = ((new ABC): ( C { val y: R forSome { type R <: P with Q } }) with ( Any { val y: R forSome { type R <: P with Q } })) ; x.y.reflected -> whatis(x).toString } + def f135 = { val x = ((new ABC): ( C { val y: R forSome { type R <: P with Q } }) with ( A { val y: P })) ; x.y.reflected -> whatis(x).toString } + def f136 = { val x = ((new ABC): ( C { val y: R forSome { type R <: P with Q } }) with ( A { val y: Q })) ; x.y.reflected -> whatis(x).toString } + def f137 = { val x = ((new ABC): ( C { val y: R forSome { type R <: P with Q } }) with ( A { val y: R forSome { type R <: P with Q } })) ; x.y.reflected -> whatis(x).toString } + def f138 = { val x = ((new ABC): ( C { val y: R forSome { type R <: P with Q } }) with ( B { val y: P })) ; x.y.reflected -> whatis(x).toString } + def f139 = { val x = ((new ABC): ( C { val y: R forSome { type R <: P with Q } }) with ( B { val y: Q })) ; x.y.reflected -> whatis(x).toString } + def f140 = { val x = ((new ABC): ( C { val y: R forSome { type R <: P with Q } }) with ( B { val y: R forSome { type R <: P with Q } })) ; x.y.reflected -> whatis(x).toString } + def f141 = { val x = ((new ABC): ( C { val y: R forSome { type R <: P with Q } }) with ( C { val y: P })) ; x.y.reflected -> whatis(x).toString } + def f142 = { val x = ((new ABC): ( C { val y: R forSome { type R <: P with Q } }) with ( C { val y: Q })) ; x.y.reflected -> whatis(x).toString } + def f143 = { val x = ((new ABC): ( C { val y: R forSome { type R <: P with Q } }) with ( C { val y: R forSome { type R <: P with Q } })) ; x.y.reflected -> whatis(x).toString } + def g0(x: R1_0) = x.y + def g1(x: R1_1) = x.y + def g2(x: R1_2) = x.y + def g3(x: R1_3) = x.y + def g4(x: R1_4) = x.y + def g5(x: R1_5) = x.y + def g6(x: R1_6) = x.y + def g7(x: R1_7) = x.y + def g8(x: R1_8) = x.y + def g9(x: R1_9) = x.y + def g10(x: R1_10) = x.y + def g11(x: R1_11) = x.y + def g12(x: R1_12) = x.y + def g13(x: R1_13) = x.y + def g14(x: R1_14) = x.y + def g15(x: R1_15) = x.y + def g16(x: R1_16) = x.y + def g17(x: R1_17) = x.y + def g18(x: R1_18) = x.y + def g19(x: R1_19) = x.y + def g20(x: R1_20) = x.y + def g21(x: R1_21) = x.y + def g22(x: R1_22) = x.y + def g23(x: R1_23) = x.y + def g24(x: R1_24) = x.y + def g25(x: R1_25) = x.y + def g26(x: R1_26) = x.y + def g27(x: R1_27) = x.y + def g28(x: R1_28) = x.y + def g29(x: R1_29) = x.y + def g30(x: R1_30) = x.y + def g31(x: R1_31) = x.y + def g32(x: R1_32) = x.y + def g33(x: R1_33) = x.y + def g34(x: R1_34) = x.y + def g35(x: R1_35) = x.y + def g36(x: R1_36) = x.y + def g37(x: R1_37) = x.y + def g38(x: R1_38) = x.y + def g39(x: R1_39) = x.y + def g40(x: R1_40) = x.y + def g41(x: R1_41) = x.y + def g42(x: R1_42) = x.y + def g43(x: R1_43) = x.y + def g44(x: R1_44) = x.y + def g45(x: R1_45) = x.y + def g46(x: R1_46) = x.y + def g47(x: R1_47) = x.y + def g48(x: R1_48) = x.y + def g49(x: R1_49) = x.y + def g50(x: R1_50) = x.y + def g51(x: R1_51) = x.y + def g52(x: R1_52) = x.y + def g53(x: R1_53) = x.y + def g54(x: R1_54) = x.y + def g55(x: R1_55) = x.y + def g56(x: R1_56) = x.y + def g57(x: R1_57) = x.y + def g58(x: R1_58) = x.y + def g59(x: R1_59) = x.y + def g60(x: R1_60) = x.y + def g61(x: R1_61) = x.y + def g62(x: R1_62) = x.y + def g63(x: R1_63) = x.y + def g64(x: R1_64) = x.y + def g65(x: R1_65) = x.y + def g66(x: R1_66) = x.y + def g67(x: R1_67) = x.y + def g68(x: R1_68) = x.y + def g69(x: R1_69) = x.y + def g70(x: R1_70) = x.y + def g71(x: R1_71) = x.y + def g72(x: R1_72) = x.y + def g73(x: R1_73) = x.y + def g74(x: R1_74) = x.y + def g75(x: R1_75) = x.y + def g76(x: R1_76) = x.y + def g77(x: R1_77) = x.y + def g78(x: R1_78) = x.y + def g79(x: R1_79) = x.y + def g80(x: R1_80) = x.y + def g81(x: R1_81) = x.y + def g82(x: R1_82) = x.y + def g83(x: R1_83) = x.y + def g84(x: R1_84) = x.y + def g85(x: R1_85) = x.y + def g86(x: R1_86) = x.y + def g87(x: R1_87) = x.y + def g88(x: R1_88) = x.y + def g89(x: R1_89) = x.y + def g90(x: R1_90) = x.y + def g91(x: R1_91) = x.y + def g92(x: R1_92) = x.y + def g93(x: R1_93) = x.y + def g94(x: R1_94) = x.y + def g95(x: R1_95) = x.y + def g96(x: R1_96) = x.y + def g97(x: R1_97) = x.y + def g98(x: R1_98) = x.y + def g99(x: R1_99) = x.y + def g100(x: R1_100) = x.y + def g101(x: R1_101) = x.y + def g102(x: R1_102) = x.y + def g103(x: R1_103) = x.y + def g104(x: R1_104) = x.y + def g105(x: R1_105) = x.y + def g106(x: R1_106) = x.y + def g107(x: R1_107) = x.y + def g108(x: R1_108) = x.y + def g109(x: R1_109) = x.y + def g110(x: R1_110) = x.y + def g111(x: R1_111) = x.y + def g112(x: R1_112) = x.y + def g113(x: R1_113) = x.y + def g114(x: R1_114) = x.y + def g115(x: R1_115) = x.y + def g116(x: R1_116) = x.y + def g117(x: R1_117) = x.y + def g118(x: R1_118) = x.y + def g119(x: R1_119) = x.y + def g120(x: R1_120) = x.y + def g121(x: R1_121) = x.y + def g122(x: R1_122) = x.y + def g123(x: R1_123) = x.y + def g124(x: R1_124) = x.y + def g125(x: R1_125) = x.y + def g126(x: R1_126) = x.y + def g127(x: R1_127) = x.y + def g128(x: R1_128) = x.y + def g129(x: R1_129) = x.y + def g130(x: R1_130) = x.y + def g131(x: R1_131) = x.y + def g132(x: R1_132) = x.y + def g133(x: R1_133) = x.y + def g134(x: R1_134) = x.y + def g135(x: R1_135) = x.y + def g136(x: R1_136) = x.y + def g137(x: R1_137) = x.y + def g138(x: R1_138) = x.y + def g139(x: R1_139) = x.y + def g140(x: R1_140) = x.y + def g141(x: R1_141) = x.y + def g142(x: R1_142) = x.y + def g143(x: R1_143) = x.y + def h0(x: R2_0) = x.y + def h1(x: R2_1) = x.y + def h2(x: R2_2) = x.y + def h3(x: R2_3) = x.y + def h4(x: R2_4) = x.y + def h5(x: R2_5) = x.y + def h6(x: R2_6) = x.y + def h7(x: R2_7) = x.y + def h8(x: R2_8) = x.y + def h9(x: R2_9) = x.y + def h10(x: R2_10) = x.y + def h11(x: R2_11) = x.y + def h12(x: R2_12) = x.y + def h13(x: R2_13) = x.y + def h14(x: R2_14) = x.y + def h15(x: R2_15) = x.y + def h16(x: R2_16) = x.y + def h17(x: R2_17) = x.y + def h18(x: R2_18) = x.y + def h19(x: R2_19) = x.y + def h20(x: R2_20) = x.y + def h21(x: R2_21) = x.y + def h22(x: R2_22) = x.y + def h23(x: R2_23) = x.y + def h24(x: R2_24) = x.y + def h25(x: R2_25) = x.y + def h26(x: R2_26) = x.y + def h27(x: R2_27) = x.y + def h28(x: R2_28) = x.y + def h29(x: R2_29) = x.y + def h30(x: R2_30) = x.y + def h31(x: R2_31) = x.y + def h32(x: R2_32) = x.y + def h33(x: R2_33) = x.y + def h34(x: R2_34) = x.y + def h35(x: R2_35) = x.y + def h36(x: R2_36) = x.y + def h37(x: R2_37) = x.y + def h38(x: R2_38) = x.y + def h39(x: R2_39) = x.y + def h40(x: R2_40) = x.y + def h41(x: R2_41) = x.y + def h42(x: R2_42) = x.y + def h43(x: R2_43) = x.y + def h44(x: R2_44) = x.y + def h45(x: R2_45) = x.y + def h46(x: R2_46) = x.y + def h47(x: R2_47) = x.y + def h48(x: R2_48) = x.y + def h49(x: R2_49) = x.y + def h50(x: R2_50) = x.y + def h51(x: R2_51) = x.y + def h52(x: R2_52) = x.y + def h53(x: R2_53) = x.y + def h54(x: R2_54) = x.y + def h55(x: R2_55) = x.y + def h56(x: R2_56) = x.y + def h57(x: R2_57) = x.y + def h58(x: R2_58) = x.y + def h59(x: R2_59) = x.y + def h60(x: R2_60) = x.y + def h61(x: R2_61) = x.y + def h62(x: R2_62) = x.y + def h63(x: R2_63) = x.y + def h64(x: R2_64) = x.y + def h65(x: R2_65) = x.y + def h66(x: R2_66) = x.y + def h67(x: R2_67) = x.y + def h68(x: R2_68) = x.y + def h69(x: R2_69) = x.y + def h70(x: R2_70) = x.y + def h71(x: R2_71) = x.y + def h72(x: R2_72) = x.y + def h73(x: R2_73) = x.y + def h74(x: R2_74) = x.y + def h75(x: R2_75) = x.y + def h76(x: R2_76) = x.y + def h77(x: R2_77) = x.y + def h78(x: R2_78) = x.y + def h79(x: R2_79) = x.y + def h80(x: R2_80) = x.y + def h81(x: R2_81) = x.y + def h82(x: R2_82) = x.y + def h83(x: R2_83) = x.y + def h84(x: R2_84) = x.y + def h85(x: R2_85) = x.y + def h86(x: R2_86) = x.y + def h87(x: R2_87) = x.y + def h88(x: R2_88) = x.y + def h89(x: R2_89) = x.y + def h90(x: R2_90) = x.y + def h91(x: R2_91) = x.y + def h92(x: R2_92) = x.y + def h93(x: R2_93) = x.y + def h94(x: R2_94) = x.y + def h95(x: R2_95) = x.y + def h96(x: R2_96) = x.y + def h97(x: R2_97) = x.y + def h98(x: R2_98) = x.y + def h99(x: R2_99) = x.y + def h100(x: R2_100) = x.y + def h101(x: R2_101) = x.y + def h102(x: R2_102) = x.y + def h103(x: R2_103) = x.y + def h104(x: R2_104) = x.y + def h105(x: R2_105) = x.y + def h106(x: R2_106) = x.y + def h107(x: R2_107) = x.y + def h108(x: R2_108) = x.y + def h109(x: R2_109) = x.y + def h110(x: R2_110) = x.y + def h111(x: R2_111) = x.y + def h112(x: R2_112) = x.y + def h113(x: R2_113) = x.y + def h114(x: R2_114) = x.y + def h115(x: R2_115) = x.y + def h116(x: R2_116) = x.y + def h117(x: R2_117) = x.y + def h118(x: R2_118) = x.y + def h119(x: R2_119) = x.y + def h120(x: R2_120) = x.y + def h121(x: R2_121) = x.y + def h122(x: R2_122) = x.y + def h123(x: R2_123) = x.y + def h124(x: R2_124) = x.y + def h125(x: R2_125) = x.y + def h126(x: R2_126) = x.y + def h127(x: R2_127) = x.y + def h128(x: R2_128) = x.y + def h129(x: R2_129) = x.y + def h130(x: R2_130) = x.y + def h131(x: R2_131) = x.y + def h132(x: R2_132) = x.y + def h133(x: R2_133) = x.y + def h134(x: R2_134) = x.y + def h135(x: R2_135) = x.y + def h136(x: R2_136) = x.y + def h137(x: R2_137) = x.y + def h138(x: R2_138) = x.y + def h139(x: R2_139) = x.y + def h140(x: R2_140) = x.y + def h141(x: R2_141) = x.y + def h142(x: R2_142) = x.y + def h143(x: R2_143) = x.y + lazy val fcalls = List( + f0, + f1, + f2, + f3, + f4, + f5, + f6, + f7, + f8, + f9, + f10, + f11, + f12, + f13, + f14, + f15, + f16, + f17, + f18, + f19, + f20, + f21, + f22, + f23, + f24, + f25, + f26, + f27, + f28, + f29, + f30, + f31, + f32, + f33, + f34, + f35, + f36, + f37, + f38, + f39, + f40, + f41, + f42, + f43, + f44, + f45, + f46, + f47, + f48, + f49, + f50, + f51, + f52, + f53, + f54, + f55, + f56, + f57, + f58, + f59, + f60, + f61, + f62, + f63, + f64, + f65, + f66, + f67, + f68, + f69, + f70, + f71, + f72, + f73, + f74, + f75, + f76, + f77, + f78, + f79, + f80, + f81, + f82, + f83, + f84, + f85, + f86, + f87, + f88, + f89, + f90, + f91, + f92, + f93, + f94, + f95, + f96, + f97, + f98, + f99, + f100, + f101, + f102, + f103, + f104, + f105, + f106, + f107, + f108, + f109, + f110, + f111, + f112, + f113, + f114, + f115, + f116, + f117, + f118, + f119, + f120, + f121, + f122, + f123, + f124, + f125, + f126, + f127, + f128, + f129, + f130, + f131, + f132, + f133, + f134, + f135, + f136, + f137, + f138, + f139, + f140, + f141, + f142, + f143 + ) + + def main(args: Array[String]) { + sshow("Direct Calls", fcalls collect { case (false, n) => n }) + sshow("Reflective Calls", fcalls collect { case (true, n) => n }) + // For a good time try printing this - have to fix bugs in + // reflection before that's going to be a good idea + // println(typeOf[Test.type].typeSymbol.asClass.typeSignature) + } +} diff --git a/test/files/run/t3488.check b/test/files/run/t3488.check index 0d66ea1aee..314dfc7838 100644 --- a/test/files/run/t3488.check +++ b/test/files/run/t3488.check @@ -1,2 +1,8 @@ +t3488.scala:4: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses + println(foo { val List(_*)=List(0); 1 } ()) + ^ +t3488.scala:5: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses + println(foo { val List(_*)=List(0); 1 } (1)) + ^ 0 1 diff --git a/test/files/run/t3507-new.scala b/test/files/run/t3507-new.scala index f045755b8f..bd16849e8a 100644 --- a/test/files/run/t3507-new.scala +++ b/test/files/run/t3507-new.scala @@ -1,3 +1,5 @@ + +import scala.language.{ existentials } import scala.reflect.runtime.universe._ class A { @@ -14,4 +16,4 @@ object Test extends App { def mani[T: TypeTag](x: T) = println(typeOf[T]) mani/*[object _1.b.c]*/(c) // kaboom in manifestOfType / TreeGen.mkAttributedQualifier // --> _1 is not in scope here -}
\ No newline at end of file +} diff --git a/test/files/run/t3529.scala b/test/files/run/t3529.scala index bb82424bf6..a5977d0a6c 100644 --- a/test/files/run/t3529.scala +++ b/test/files/run/t3529.scala @@ -1,3 +1,4 @@ +import scala.language.postfixOps object Test { def main(args: Array[String]): Unit = { assert(1 to 10 drop 10 isEmpty) diff --git a/test/files/run/t3651.scala b/test/files/run/t3651.scala index 49ae173249..3a6dda0de3 100644 --- a/test/files/run/t3651.scala +++ b/test/files/run/t3651.scala @@ -5,6 +5,6 @@ class LongKlass( override val a: Long ) extends Klass[Long](a) object Test { def main(args: Array[String]) { val lk = new LongKlass(10) - lk.a + val a = lk.a } } diff --git a/test/files/run/t3705.scala b/test/files/run/t3705.scala index fcc020f28c..3ebf6fc95d 100644 --- a/test/files/run/t3705.scala +++ b/test/files/run/t3705.scala @@ -2,16 +2,16 @@ import scala.xml._ object Test { + // guard caused verifyerror in oldpatmat def updateNodes(ns: Seq[Node]): Seq[Node] = for(subnode <- ns) yield subnode match { case <d>{_}</d> if true => <d>abc</d> case Elem(prefix, label, attribs, scope, children @ _*) => - Elem(prefix, label, attribs, scope, updateNodes(children) : _*) + Elem(prefix, label, attribs, scope, minimizeEmpty = true, updateNodes(children) : _*) case other => other } def main(args: Array[String]): Unit = { updateNodes(<b />) - } } diff --git a/test/files/run/t3758-old.scala b/test/files/run/t3758-old.scala index f00254afee..d5e4a6cc1c 100644 --- a/test/files/run/t3758-old.scala +++ b/test/files/run/t3758-old.scala @@ -1,3 +1,5 @@ + +@deprecated("Suppress warnings", since="2.11") object Test { def main(args: Array[String]): Unit = { assert(classManifest[Array[String]].typeArguments contains classManifest[String]) @@ -7,4 +9,4 @@ object Test { assert(manifest[Array[Int]].typeArguments contains manifest[Int]) assert(manifest[Array[Float]].typeArguments contains manifest[Float]) } -}
\ No newline at end of file +} diff --git a/test/files/run/t3855.scala b/test/files/run/t3855.scala index e55714201f..d8029e16f0 100644 --- a/test/files/run/t3855.scala +++ b/test/files/run/t3855.scala @@ -3,11 +3,11 @@ object Test { def closure[A](f: () => A) = f() def f1(s: String) = { - var n = try { s.toInt } catch { case _ => 1 } + var n = try { s.toInt } catch { case _: Throwable => 1 } byval(n) } def f2(s: String) = { - var n = try { s.toInt } catch { case _ => 1 } + var n = try { s.toInt } catch { case _: Throwable => 1 } closure(() => n) } diff --git a/test/files/run/t3888.check b/test/files/run/t3888.check new file mode 100644 index 0000000000..844ca54682 --- /dev/null +++ b/test/files/run/t3888.check @@ -0,0 +1 @@ +warning: there were 1 deprecation warning(s); re-run with -deprecation for details diff --git a/test/files/run/t3888.scala b/test/files/run/t3888.scala index e0f1453b1d..1914072599 100644 --- a/test/files/run/t3888.scala +++ b/test/files/run/t3888.scala @@ -1,3 +1,6 @@ + +// in a match, which notion of equals prevails? +// extending Tuple doesn't seem to be at issue here. object Test { val T1 = new P @@ -23,4 +26,4 @@ object Test { class P extends Pair(1, 1) { override def equals(x: Any) = true -}
\ No newline at end of file +} diff --git a/test/files/run/t3935.scala b/test/files/run/t3935.scala index c66b1b0599..fa1bbf8d3f 100644 --- a/test/files/run/t3935.scala +++ b/test/files/run/t3935.scala @@ -9,7 +9,7 @@ object Test { try { assert(q.front != null) } catch { - case _ => + case _: Throwable => } } } diff --git a/test/files/run/t3964.scala b/test/files/run/t3964.scala index 80ba361a20..68ff9a44c4 100644 --- a/test/files/run/t3964.scala +++ b/test/files/run/t3964.scala @@ -1,3 +1,6 @@ + +import scala.language.implicitConversions + object Test { class Base object Bob extends Base diff --git a/test/files/run/t4047.check b/test/files/run/t4047.check index 2a942a70e0..3c41e6e244 100644 --- a/test/files/run/t4047.check +++ b/test/files/run/t4047.check @@ -1,3 +1,15 @@ +t4047.scala:23: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses + a.foo + ^ +t4047.scala:24: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses + a.foo + ^ +t4047.scala:26: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses + b.foo + ^ +t4047.scala:27: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses + b.foo + ^ Unit: called A.foo Unit: called B.foo Unit: called C.foo diff --git a/test/files/run/t4072.scala b/test/files/run/t4072.scala index 872072a4ce..bff2e0c7d2 100644 --- a/test/files/run/t4072.scala +++ b/test/files/run/t4072.scala @@ -1,5 +1,7 @@ import scala.tools.nsc._ +import scala.language.{ reflectiveCalls } + object Test { class DryRun { val compiler = new Global(new Settings()) { diff --git a/test/files/run/t4080.scala b/test/files/run/t4080.scala index 92740ed776..1d1418847d 100644 --- a/test/files/run/t4080.scala +++ b/test/files/run/t4080.scala @@ -1,4 +1,5 @@ import scala.collection.mutable.LinkedList +import java.util.NoSuchElementException object Test { def main(args: Array[String]) { @@ -6,7 +7,7 @@ object Test { ll.insert(LinkedList(0)) println(ll) val ll2 = LinkedList[Int]() - try println(ll2.head) - catch { case _ => () } + try println("Empty head? " + ll2.head) + catch { case _: NoSuchElementException => () } } } diff --git a/test/files/run/t4148.scala b/test/files/run/t4148.scala index 0739403594..6de0c8fe7a 100644 --- a/test/files/run/t4148.scala +++ b/test/files/run/t4148.scala @@ -1,7 +1,7 @@ object Test { - val x1 = try { "aaa".asInstanceOf[Int] } catch { case _ => "cce1" } - val x2 = try { (5: Any).asInstanceOf[Int] } catch { case _ => "cce2" } - val x3 = try { (new java.lang.Short(100.toShort).asInstanceOf[Int]) } catch { case _ => "cce3" } + val x1 = try { "aaa".asInstanceOf[Int] } catch { case _: Throwable => "cce1" } + val x2 = try { (5: Any).asInstanceOf[Int] } catch { case _: Throwable => "cce2" } + val x3 = try { (new java.lang.Short(100.toShort).asInstanceOf[Int]) } catch { case _: Throwable => "cce3" } def main(args: Array[String]): Unit = { List(x1, x2, x3) foreach println diff --git a/test/files/run/t4171.scala b/test/files/run/t4171.scala index fba2fb5ed6..7f6dfd48ce 100644 --- a/test/files/run/t4171.scala +++ b/test/files/run/t4171.scala @@ -1,3 +1,6 @@ + +import scala.language.{ reflectiveCalls } + object Test { val c = { class C; new C { def foo = 1 } } val a = { class B { def bar = 5 }; class C extends B; new C } diff --git a/test/files/run/t4398.scala b/test/files/run/t4398.scala index 1d57eb688d..87dc870afc 100644 --- a/test/files/run/t4398.scala +++ b/test/files/run/t4398.scala @@ -1,5 +1,7 @@ +import scala.language.{ postfixOps } + object Test { def main(args: Array[String]) { val x = 1 to 10 toSet diff --git a/test/files/run/t4560.scala b/test/files/run/t4560.scala index 9979199067..ee657e47eb 100644 --- a/test/files/run/t4560.scala +++ b/test/files/run/t4560.scala @@ -7,6 +7,9 @@ // TEST 1 // self-type is other trait + +import scala.language.{ reflectiveCalls } + trait Aa trait Ab diff --git a/test/files/run/t4660.scala b/test/files/run/t4660.scala index e57bb4bf25..9aac10ddfd 100644 --- a/test/files/run/t4660.scala +++ b/test/files/run/t4660.scala @@ -3,7 +3,7 @@ object Test { val traversable = 1 to 20 map (_.toString) def normalize(m: Map[Char, Traversable[String]]) = m.map { case (k,v) => (k, v.toList) } - val groupedFromView = (traversable view).groupBy(_(0)) + val groupedFromView = traversable.view.groupBy(_(0)) val groupedFromStrict = traversable.groupBy(_(0)) assert(normalize(groupedFromView) == normalize(groupedFromStrict)) diff --git a/test/files/run/t4680.check b/test/files/run/t4680.check index b5cfc651f2..b2e5209dc5 100644 --- a/test/files/run/t4680.check +++ b/test/files/run/t4680.check @@ -1,3 +1,9 @@ +t4680.scala:51: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses + new C { 5 } + ^ +t4680.scala:69: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses + new { val x = 5 } with E() { 5 } + ^ // new C { } diff --git a/test/files/run/t4729/S_2.scala b/test/files/run/t4729/S_2.scala index a80afb0257..f823433ded 100644 --- a/test/files/run/t4729/S_2.scala +++ b/test/files/run/t4729/S_2.scala @@ -1,3 +1,4 @@ +import scala.language.reflectiveCalls // Scala class: class ScalaVarArgs extends J_1 { // -- no problem on overriding it using ordinary class diff --git a/test/files/run/t4766.scala b/test/files/run/t4766.scala index c2a864ddb2..d67431f50e 100644 --- a/test/files/run/t4766.scala +++ b/test/files/run/t4766.scala @@ -1,3 +1,7 @@ + +import scala.language.postfixOps +import scala.language.reflectiveCalls + object Test extends App { val x = new { def > = 1 diff --git a/test/files/run/t4777.scala b/test/files/run/t4777.scala index 4a811d3b9a..6c7b856e39 100644 --- a/test/files/run/t4777.scala +++ b/test/files/run/t4777.scala @@ -3,6 +3,6 @@ class DefaultsTest(x: Int = 25) extends A(28) object DefaultsTest extends DefaultsTest(12) object Test extends App { - println(new DefaultsTest() a) - println(DefaultsTest a) + println(new DefaultsTest().a) + println(DefaultsTest.a) } diff --git a/test/files/run/t4794.scala b/test/files/run/t4794.scala index afe89fa429..720906f507 100644 --- a/test/files/run/t4794.scala +++ b/test/files/run/t4794.scala @@ -7,6 +7,7 @@ class Arr[@specialized A](val arr: Array[A]) { object Test { def main(args: Array[String]): Unit = { - println(classOf[Arr[_]].getMethods filter (_.getName contains "quux") size) // expect 10, not 1 + def quuxae = classOf[Arr[_]].getMethods filter (_.getName contains "quux") + println(quuxae.size) // expect 10, not 1 } } diff --git a/test/files/run/t4929.scala b/test/files/run/t4929.scala index 3208cd1b09..1b0e8672d5 100644 --- a/test/files/run/t4929.scala +++ b/test/files/run/t4929.scala @@ -2,6 +2,7 @@ import scala.util.parsing.json._ import java.util.concurrent._ import collection.JavaConversions._ +@deprecated("Suppress warnings", since="2.11") object Test extends App { val LIMIT = 2000 diff --git a/test/files/run/t498.scala b/test/files/run/t498.scala index b4ede951f0..5c10e6630f 100644 --- a/test/files/run/t498.scala +++ b/test/files/run/t498.scala @@ -1,3 +1,6 @@ + +import scala.language.postfixOps + object Test extends App { // the function passed to flatMap produces lots of empty streams, but this should not overflow the stack val res = Stream.from(1).flatMap(i => if (i < 3000) Stream.empty else List(1)) diff --git a/test/files/run/t5053.scala b/test/files/run/t5053.scala index e46dad5ac6..233edf6780 100644 --- a/test/files/run/t5053.scala +++ b/test/files/run/t5053.scala @@ -1,3 +1,6 @@ + +import scala.language.{ existentials } + object Test extends App { { val (left, right) = Seq((1, "a"), (1, "a"), (1, "a"), (3, "c")).view.unzip diff --git a/test/files/run/t5080.scala b/test/files/run/t5080.scala index ce72d13a54..acb6167f46 100644 --- a/test/files/run/t5080.scala +++ b/test/files/run/t5080.scala @@ -1,3 +1,7 @@ + +import scala.language.implicitConversions +import scala.language.reflectiveCalls + object Test extends App { abstract class Value { diff --git a/test/files/run/t5224.check b/test/files/run/t5224.check index e15c1c90eb..b11480acdf 100644 --- a/test/files/run/t5224.check +++ b/test/files/run/t5224.check @@ -1,3 +1,8 @@ +t5224.scala:3: warning: Implementation restriction: subclassing Classfile does not +make your annotation visible at runtime. If that is what +you want, you must write the annotation class in Java. +class Foo(bar: String) extends annotation.ClassfileAnnotation + ^ { @new Foo(bar = "qwe") class C extends AnyRef { def <init>() = { diff --git a/test/files/run/t5277_1.scala b/test/files/run/t5277_1.scala index a2d546579d..65232967c2 100644 --- a/test/files/run/t5277_1.scala +++ b/test/files/run/t5277_1.scala @@ -1,6 +1,7 @@ import scala.reflect.runtime.universe._ import scala.tools.reflect.Eval +import scala.language.{ implicitConversions, postfixOps } object Test extends App { reify { def fact(n: Int): BigInt = @@ -12,4 +13,4 @@ object Test extends App { println("10! = " + (10!)) }.eval -}
\ No newline at end of file +} diff --git a/test/files/run/t5284b.check b/test/files/run/t5284b.check index 98d9bcb75a..71426ad0b7 100644 --- a/test/files/run/t5284b.check +++ b/test/files/run/t5284b.check @@ -1 +1,4 @@ +t5284b.scala:27: warning: type S is unused or used in non-specializable positions. + def bar[@specialized(Int) W <: T, @specialized(Int) S](w: W) = id(w) + ^ 17 diff --git a/test/files/run/t5284c.check b/test/files/run/t5284c.check index 00750edc07..cf578ad102 100644 --- a/test/files/run/t5284c.check +++ b/test/files/run/t5284c.check @@ -1 +1,4 @@ +t5284c.scala:29: warning: type W is unused or used in non-specializable positions. + def bar[@specialized(Int) W <: T](ws: List[W]) = len(ws) + ^ 3 diff --git a/test/files/run/t5353.scala b/test/files/run/t5353.scala deleted file mode 100644 index 5208fe527f..0000000000 --- a/test/files/run/t5353.scala +++ /dev/null @@ -1,9 +0,0 @@ -object Test extends App { - def f(x: Boolean) = if (x) Array("abc") else Array() - try { - println(f(true).length) - println(f(false).length) - } catch { - case ex: Throwable => println(ex.getMessage) - } -} diff --git a/test/files/run/t5356.scala b/test/files/run/t5356.scala index ec17e036ad..dabb9ef855 100644 --- a/test/files/run/t5356.scala +++ b/test/files/run/t5356.scala @@ -1,3 +1,5 @@ + +import scala.language.{ reflectiveCalls } object Test { def f(x: Any { def toInt: Int }) = println(x.toInt + " " + x.getClass.getName) diff --git a/test/files/run/t5375.check b/test/files/run/t5375.check index 7d3002ffda..b1a57eeeec 100644 --- a/test/files/run/t5375.check +++ b/test/files/run/t5375.check @@ -1 +1 @@ -Composite throwable
\ No newline at end of file +Runtime exception diff --git a/test/files/run/t5375.scala b/test/files/run/t5375.scala index e4b329deae..826ecd841e 100644 --- a/test/files/run/t5375.scala +++ b/test/files/run/t5375.scala @@ -1,19 +1,8 @@ - - - -import collection.parallel.CompositeThrowable - - - -object Test { - - def main(args: Array[String]) { - val foos = (1 to 1000) toSeq; - try { - foos.par.map(i => if (i % 37 == 0) sys.error("i div 37") else i) - } catch { - case CompositeThrowable(thr) => println("Composite throwable") - } +object Test extends App { + val foos = (1 to 1000).toSeq + try + foos.par.map(i => if (i % 37 == 0) sys.error("i div 37") else i) + catch { + case ex: RuntimeException => println("Runtime exception") } - } diff --git a/test/files/run/t5380.check b/test/files/run/t5380.check new file mode 100644 index 0000000000..731a798301 --- /dev/null +++ b/test/files/run/t5380.check @@ -0,0 +1,9 @@ +t5380.scala:3: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses + val f = () => return try { 1 } catch { case _: Throwable => 0 } + ^ +t5380.scala:3: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses + val f = () => return try { 1 } catch { case _: Throwable => 0 } + ^ +t5380.scala:3: warning: enclosing method main has result type Unit: return value discarded + val f = () => return try { 1 } catch { case _: Throwable => 0 } + ^ diff --git a/test/files/run/t5380.scala b/test/files/run/t5380.scala index 6083161a9b..66d12a0ca6 100644 --- a/test/files/run/t5380.scala +++ b/test/files/run/t5380.scala @@ -1,6 +1,6 @@ object Test { def main(args: Array[String]) { - val f = () => return try { 1 } catch { case _ => 0 } + val f = () => return try { 1 } catch { case _: Throwable => 0 } f() } } diff --git a/test/files/run/t5428.scala b/test/files/run/t5428.scala index 106bb7fc31..fb58cbbe24 100644 --- a/test/files/run/t5428.scala +++ b/test/files/run/t5428.scala @@ -23,7 +23,7 @@ object Test { println(a) - a pop + a.pop } } diff --git a/test/files/run/t5568.flags b/test/files/run/t5568.flags new file mode 100644 index 0000000000..ad51758c39 --- /dev/null +++ b/test/files/run/t5568.flags @@ -0,0 +1 @@ +-nowarn diff --git a/test/files/run/t5629b.scala b/test/files/run/t5629b.scala index 6c908081b9..adb9ca5498 100644 --- a/test/files/run/t5629b.scala +++ b/test/files/run/t5629b.scala @@ -33,7 +33,7 @@ object Test extends App { val pf = newPF(1) println("=== pf(1):") - try { pf(1) } catch { case x => println(x) } + try { pf(1) } catch { case x: Throwable => println(x) } println("=== pf(42):") pf(42) println("=== done") diff --git a/test/files/run/t5699.scala b/test/files/run/t5699.scala index 5cef67e3b1..ec3b1d26b4 100755 --- a/test/files/run/t5699.scala +++ b/test/files/run/t5699.scala @@ -1,5 +1,5 @@ import scala.tools.partest.DirectTest -import scala.tools.nsc.util.BatchSourceFile +import scala.reflect.internal.util.BatchSourceFile object Test extends DirectTest { // Java code diff --git a/test/files/run/t576.scala b/test/files/run/t576.scala index 756a241572..5c8c9a90cb 100644 --- a/test/files/run/t576.scala +++ b/test/files/run/t576.scala @@ -1,3 +1,5 @@ +import scala.language.reflectiveCalls + class A { override def equals(other: Any) = other match { case _: this.type => true diff --git a/test/files/run/t5881.scala b/test/files/run/t5881.scala index 01bee29181..04b24b713d 100644 --- a/test/files/run/t5881.scala +++ b/test/files/run/t5881.scala @@ -1,6 +1,7 @@ +import scala.language.existentials import scala.reflect.ClassTag object Test extends App { println(implicitly[ClassTag[List[T forSome {type T <: List[T]}]]]) println(implicitly[ClassTag[List[Any]]]) -}
\ No newline at end of file +} diff --git a/test/files/run/t5912.scala b/test/files/run/t5912.scala index 7710d04396..9418e946d0 100644 --- a/test/files/run/t5912.scala +++ b/test/files/run/t5912.scala @@ -1,6 +1,7 @@ +import scala.language.existentials object Test extends App{ import scala.reflect.runtime.{currentMirror=>cm} import scala.tools.reflect._ import scala.reflect.runtime.universe._ val tree = cm.mkToolBox().typeCheck( Literal(Constant("test")) ) -}
\ No newline at end of file +} diff --git a/test/files/run/t5942.scala b/test/files/run/t5942.scala index 44a8be93f6..c90d29e1ca 100644 --- a/test/files/run/t5942.scala +++ b/test/files/run/t5942.scala @@ -5,6 +5,6 @@ import scala.tools.reflect._ object Test extends App { val tb = cm.mkToolBox() tb.parse("def x = {}") - try { tb.parse("def x = {") } catch { case _ => } + try { tb.parse("def x = {") } catch { case _: Throwable => } tb.parse("def x = {}") } diff --git a/test/files/run/t6011c.check b/test/files/run/t6011c.check new file mode 100644 index 0000000000..088e6fdaae --- /dev/null +++ b/test/files/run/t6011c.check @@ -0,0 +1,3 @@ +t6011c.scala:11: warning: unreachable code + case 1 => 3 // crash + ^ diff --git a/test/files/run/t603.scala b/test/files/run/t603.scala index b8825c933b..54fb8e6974 100644 --- a/test/files/run/t603.scala +++ b/test/files/run/t603.scala @@ -1,4 +1,6 @@ object forceDelay { + import scala.language.implicitConversions + class Susp[+A](lazyValue: => A) extends Function0[A] { private var func: () => Any = () => lazyValue private var value: Any = null diff --git a/test/files/run/t6039.scala b/test/files/run/t6039.scala deleted file mode 100644 index 9d811b0634..0000000000 --- a/test/files/run/t6039.scala +++ /dev/null @@ -1,18 +0,0 @@ -import scala.tools.partest._ - -object Test extends StoreReporterDirectTest { - private def compileCode(): Boolean = { - new java.io.File("util") mkdirs - val classpath = List(sys.props("partest.lib"), ".") mkString sys.props("path.separator") - log(s"classpath = $classpath") - compileString(newCompiler("-cp", classpath, "-d", testOutput.path))(packageCode) - } - def code = ??? - def packageCode = """ -package scala.bippy -class A { new util.Random() } -""" - def show(): Unit = { - assert(compileCode(), filteredInfos take 1 mkString "") - } -} diff --git a/test/files/run/t6102.check b/test/files/run/t6102.check index b6fc4c620b..97e455647b 100644 --- a/test/files/run/t6102.check +++ b/test/files/run/t6102.check @@ -1 +1,29 @@ -hello
\ No newline at end of file +[running phase parser on t6102.scala] +[running phase namer on t6102.scala] +[running phase packageobjects on t6102.scala] +[running phase typer on t6102.scala] +[running phase patmat on t6102.scala] +[running phase superaccessors on t6102.scala] +[running phase extmethods on t6102.scala] +[running phase pickler on t6102.scala] +[running phase refchecks on t6102.scala] +[running phase uncurry on t6102.scala] +[running phase tailcalls on t6102.scala] +[running phase specialize on t6102.scala] +[running phase explicitouter on t6102.scala] +[running phase erasure on t6102.scala] +[running phase posterasure on t6102.scala] +[running phase lazyvals on t6102.scala] +[running phase lambdalift on t6102.scala] +[running phase constructors on t6102.scala] +[running phase flatten on t6102.scala] +[running phase mixin on t6102.scala] +[running phase cleanup on t6102.scala] +[running phase icode on t6102.scala] +[running phase inliner on t6102.scala] +[running phase inlinehandlers on t6102.scala] +[running phase closelim on t6102.scala] +[running phase constopt on t6102.scala] +[running phase dce on t6102.scala] +[running phase jvm on icode] +hello diff --git a/test/files/run/t6113.scala b/test/files/run/t6113.scala index 321cae86a3..b77a56029a 100644 --- a/test/files/run/t6113.scala +++ b/test/files/run/t6113.scala @@ -1,6 +1,8 @@ +import scala.language.higherKinds + trait Foo[C[_]] object Test extends App { import scala.reflect.runtime.universe._ println(typeOf[Foo[({type l[X] = (Int, X)})#l]]) -}
\ No newline at end of file +} diff --git a/test/files/run/t6146b.check b/test/files/run/t6146b.check index 49ff70697e..2333b9d986 100644 --- a/test/files/run/t6146b.check +++ b/test/files/run/t6146b.check @@ -1,3 +1,7 @@ +t6146b.scala:15: warning: match may not be exhaustive. +It would fail on the following inputs: S2(), S3() + def foo(f: F[Int]) = f match { case X.S1 => } + ^ Type in expressions to have them evaluated. Type :help for more information. diff --git a/test/files/run/t6246.scala b/test/files/run/t6246.scala index 28765e1adf..2db87aa6d2 100644 --- a/test/files/run/t6246.scala +++ b/test/files/run/t6246.scala @@ -1,5 +1,6 @@ import scala.reflect.{ClassTag, classTag} +@deprecated("Suppress warnings", since="2.11") object Test extends App { def testValueClass(tag: ClassTag[_]) { println(s"runtimeClass = ${tag.runtimeClass}, toString = ${tag.toString}") @@ -23,4 +24,4 @@ object Test extends App { testValueClass(ClassTag.Double) testValueClass(ClassTag.Unit) testValueClass(ClassTag.Boolean) -}
\ No newline at end of file +} diff --git a/test/files/run/t6309.check b/test/files/run/t6309.check new file mode 100644 index 0000000000..7f8f011eb7 --- /dev/null +++ b/test/files/run/t6309.check @@ -0,0 +1 @@ +7 diff --git a/test/files/run/t6309.scala b/test/files/run/t6309.scala new file mode 100644 index 0000000000..7bbca63c2a --- /dev/null +++ b/test/files/run/t6309.scala @@ -0,0 +1,16 @@ +trait A { + def a: Int +} + +object Test { + def f(a: Int) = new { + //private val b = a + private[this] val b = a // crashes, sorry scalac + } with A { + def a = b + } + + def main(args: Array[String]) { + println(f(7).a) + } +} diff --git a/test/files/run/t6329_vanilla.scala b/test/files/run/t6329_vanilla.scala index f2d843896d..ec84f1f938 100644 --- a/test/files/run/t6329_vanilla.scala +++ b/test/files/run/t6329_vanilla.scala @@ -1,5 +1,6 @@ import scala.reflect.classTag +@deprecated("Suppress warnings", since="2.11") object Test extends App { println(classManifest[scala.List[_]]) println(classTag[scala.List[_]]) diff --git a/test/files/run/t6443.scala b/test/files/run/t6443.scala index 67fe2cab22..3ab8c345fe 100644 --- a/test/files/run/t6443.scala +++ b/test/files/run/t6443.scala @@ -1,3 +1,5 @@ +import scala.language.existentials + class Base class Derived extends Base diff --git a/test/files/run/t657.scala b/test/files/run/t657.scala index a9726092e7..e76b0292dd 100644 --- a/test/files/run/t657.scala +++ b/test/files/run/t657.scala @@ -1,3 +1,5 @@ + +import scala.language.{ implicitConversions } abstract class BaseList { type Node <: NodeImpl; implicit def convertNode(ni : NodeImpl) = ni.asInstanceOf[Node]; diff --git a/test/files/run/t6690.scala b/test/files/run/t6690.scala index 43ede967a0..15b1817e87 100644 --- a/test/files/run/t6690.scala +++ b/test/files/run/t6690.scala @@ -1,5 +1,7 @@ import scala.collection.mutable +import scala.language.{ reflectiveCalls } + object Test extends App { def last0(ml: mutable.MutableList[Int]) = ml.asInstanceOf[{def last0: mutable.LinkedList[Int]}].last0 diff --git a/test/files/run/t6731.scala b/test/files/run/t6731.scala index 89d212e91e..12357b935e 100644 --- a/test/files/run/t6731.scala +++ b/test/files/run/t6731.scala @@ -12,7 +12,7 @@ abstract class MonoDynamic extends Dynamic { def applyDynamic(name: String)(args: Any*): String = show(this + "." + name + mkArgs(args: _*)) def applyDynamicNamed(name: String)(args: (String, Any)*): String = show(this + "." + name + mkArgs(args: _*)) - override def toString = this.getClass.getName split '.' last + override def toString = (this.getClass.getName split '.').last } object Mono extends MonoDynamic { diff --git a/test/files/run/t6863.check b/test/files/run/t6863.check new file mode 100644 index 0000000000..030cb8b265 --- /dev/null +++ b/test/files/run/t6863.check @@ -0,0 +1,12 @@ +t6863.scala:38: warning: comparing values of types Unit and Unit using `==' will always yield true + assert({ () => x}.apply == ()) + ^ +t6863.scala:42: warning: comparing values of types Unit and Unit using `==' will always yield true + assert({ () => x}.apply == ()) + ^ +t6863.scala:46: warning: comparing values of types Unit and Unit using `==' will always yield true + assert({ () => x}.apply == ()) + ^ +t6863.scala:59: warning: comparing values of types Unit and Unit using `==' will always yield true + assert({ () => x }.apply == ()) + ^ diff --git a/test/files/run/t6863.scala b/test/files/run/t6863.scala index d77adb6af4..c4f3c2c885 100644 --- a/test/files/run/t6863.scala +++ b/test/files/run/t6863.scala @@ -51,7 +51,7 @@ object Test { assert({ () => x }.apply == "42") } def tryCatch() = { - var x = try { "42" } catch { case _ => "43" } + var x = try { "42" } catch { case _: Throwable => "43" } assert({ () => x }.apply == "42") } def `if`() = { @@ -85,7 +85,7 @@ object Test { def nested() = { var x = { val y = 42 - if(true) try "42" catch {case _ => "43"} + if(true) try "42" catch {case _: Throwable => "43"} else "44" } assert({ () => x }.apply == "42") diff --git a/test/files/run/t6969.scala b/test/files/run/t6969.scala index 8cfc28c1e5..c4561b4424 100644 --- a/test/files/run/t6969.scala +++ b/test/files/run/t6969.scala @@ -1,3 +1,7 @@ + + +import scala.language.{ reflectiveCalls } + object Test { private type Clearable = { def clear(): Unit } private def choke() = { diff --git a/test/files/run/t7047.check b/test/files/run/t7047.check index e69de29bb2..32bd581094 100644 --- a/test/files/run/t7047.check +++ b/test/files/run/t7047.check @@ -0,0 +1,3 @@ +Test_2.scala:2: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses + Macros.foo + ^ diff --git a/test/files/run/t7088.check b/test/files/run/t7088.check new file mode 100644 index 0000000000..1191247b6d --- /dev/null +++ b/test/files/run/t7088.check @@ -0,0 +1,2 @@ +1 +2 diff --git a/test/files/run/t7088.scala b/test/files/run/t7088.scala new file mode 100644 index 0000000000..5f0114b940 --- /dev/null +++ b/test/files/run/t7088.scala @@ -0,0 +1,13 @@ +object Test { + type Tag[X] = {type Tag = X} + type TaggedArray[T] = Array[T] with Tag[Any] + + def method[T: scala.reflect.ClassTag](a: TaggedArray[T], value: T) { + a.update(0, value) + a foreach println + } + + def main(args: Array[String]): Unit = { + method(Array(1, 2).asInstanceOf[TaggedArray[Int]], 1) + } +} diff --git a/test/files/run/t7096.scala b/test/files/run/t7096.scala index 2a93dcc571..2495102899 100644 --- a/test/files/run/t7096.scala +++ b/test/files/run/t7096.scala @@ -1,3 +1,6 @@ +/* + * filter: inliner warning\(s\); re-run with -Yinline-warnings for details + */ import scala.tools.partest._ import scala.tools.nsc._ diff --git a/test/files/run/t7120b.scala b/test/files/run/t7120b.scala index 9f6591aa06..0be4eb70a7 100644 --- a/test/files/run/t7120b.scala +++ b/test/files/run/t7120b.scala @@ -1,3 +1,6 @@ + +import scala.language.higherKinds + trait Base[A] { type B = A; } class C extends Base[String] { class D { diff --git a/test/files/run/t7157.check b/test/files/run/t7157.check new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/files/run/t7157.check @@ -0,0 +1 @@ +1 diff --git a/test/files/run/t7157/Impls_Macros_1.scala b/test/files/run/t7157/Impls_Macros_1.scala new file mode 100644 index 0000000000..ad3d96eb85 --- /dev/null +++ b/test/files/run/t7157/Impls_Macros_1.scala @@ -0,0 +1,15 @@ +import scala.reflect.macros.Context +import language.experimental.macros + +object Macros { + object AImpl { + def a(ctx: Context)(args: ctx.Expr[Any]*): ctx.Expr[Unit] = { + import ctx.universe._ + ctx.Expr[Unit](Apply(Ident(TermName("println")), List(Literal(Constant(1))))) + } + } + + implicit class A(context: StringContext) { + def a(args: Any*): Unit = macro AImpl.a + } +}
\ No newline at end of file diff --git a/test/files/run/macro-def-path-dependent-c/Test_2.scala b/test/files/run/t7157/Test_2.scala index 7dffc5107d..cceb5ca177 100644 --- a/test/files/run/macro-def-path-dependent-c/Test_2.scala +++ b/test/files/run/t7157/Test_2.scala @@ -1,3 +1,5 @@ +import Macros._ + object Test extends App { - println("it works") + a"" }
\ No newline at end of file diff --git a/test/files/run/t7171.check b/test/files/run/t7171.check new file mode 100644 index 0000000000..d826f6cb94 --- /dev/null +++ b/test/files/run/t7171.check @@ -0,0 +1,3 @@ +t7171.scala:2: warning: The outer reference in this type test cannot be checked at run time. + final case class A() + ^ diff --git a/test/files/run/t7171.flags b/test/files/run/t7171.flags new file mode 100644 index 0000000000..c02e5f2461 --- /dev/null +++ b/test/files/run/t7171.flags @@ -0,0 +1 @@ +-unchecked diff --git a/test/files/run/t7171.scala b/test/files/run/t7171.scala index 97585b9860..e0a1192228 100644 --- a/test/files/run/t7171.scala +++ b/test/files/run/t7171.scala @@ -16,7 +16,7 @@ object Test extends App { val a1 = new t1.A() val a2 = new t1.A() assert(t1.foo(a1)) - // as noted in the unchecked warning (tested in the corresponding neg test), + // as noted in the unchecked warning (also tested in the corresponding neg test), // the outer pointer isn't checked assert(t1.foo(a2)) } diff --git a/test/files/run/t7198.check b/test/files/run/t7198.check new file mode 100644 index 0000000000..6dad496f49 --- /dev/null +++ b/test/files/run/t7198.check @@ -0,0 +1,2 @@ +The quick brown fox jumped +And ran away with the vixen. diff --git a/test/files/run/t7198.scala b/test/files/run/t7198.scala new file mode 100644 index 0000000000..26e1d8805a --- /dev/null +++ b/test/files/run/t7198.scala @@ -0,0 +1,9 @@ +/* spew a few lines + * filter: Over the moon + */ +object Test extends App { + Console println "The quick brown fox jumped" + Console println "Over the moon" + Console println "And ran away with the vixen." + Console println "Java HotSpot(TM) 64-Bit Server VM warning: Failed to reserve shared memory (errno = 28)." +} diff --git a/test/files/run/t7240/Test_2.scala b/test/files/run/t7240/Test_2.scala index 2450bdabf9..5cc2cc7f78 100644 --- a/test/files/run/t7240/Test_2.scala +++ b/test/files/run/t7240/Test_2.scala @@ -1,3 +1,3 @@ object Test extends App { - bakery.Bakery.failure -}
\ No newline at end of file + val v = bakery.Bakery.failure +} diff --git a/test/files/run/t7271.check b/test/files/run/t7271.check index 6db301c21d..f7a23018ca 100644 --- a/test/files/run/t7271.check +++ b/test/files/run/t7271.check @@ -1,12 +1,12 @@ [[syntax trees at end of parser]] // newSource1.scala -[0:91]package [0:0]<empty> { - [0:91]class C extends [8:91][91]scala.AnyRef { +[6]package [6]<empty> { + [6]class C extends [8][91]scala.AnyRef { [8]def <init>() = [8]{ [NoPosition][NoPosition][NoPosition]super.<init>(); [8]() }; - [16:44]def quote = [28:44]<28:44><28:44>[28]StringContext([30:34]"foo", [40:44]"baz").s([35:39]this); - [51:85]def tripleQuote = [69:85]<69:85><69:85>[69]StringContext([71:75]"foo", [81:85]"baz").s([76:80]this) + [20]def quote = [28][28][28][28]StringContext([30]"foo", [40]"baz").s([35]this); + [55]def tripleQuote = [69][69][69][69]StringContext([71]"foo", [81]"baz").s([76]this) } } diff --git a/test/files/run/t7271.scala b/test/files/run/t7271.scala index 6fccf14d20..cb43331a29 100644 --- a/test/files/run/t7271.scala +++ b/test/files/run/t7271.scala @@ -4,6 +4,7 @@ import scala.tools.nsc._ import scala.tools.nsc.util.CommandLineParser import scala.tools.nsc.{Global, Settings, CompilerCommand} import scala.tools.nsc.reporters.ConsoleReporter +import scala.reflect.internal.Positions object Test extends DirectTest { @@ -29,6 +30,6 @@ object Test extends DirectTest { val settings = new Settings() settings.Xprintpos.value = true val command = new CompilerCommand((CommandLineParser tokenize extraSettings) ++ args.toList, settings) - new Global(command.settings, new ConsoleReporter(settings)) with interactive.RangePositions + new Global(command.settings, new ConsoleReporter(settings)) with Positions } } diff --git a/test/files/run/t7290.check b/test/files/run/t7290.check new file mode 100644 index 0000000000..aff48abd4a --- /dev/null +++ b/test/files/run/t7290.check @@ -0,0 +1,6 @@ +t7290.scala:4: warning: Pattern contains duplicate alternatives: 0 + case 0 | 0 => 0 + ^ +t7290.scala:5: warning: Pattern contains duplicate alternatives: 2, 3 + case 2 | 2 | 2 | 3 | 2 | 3 => 0 + ^ diff --git a/test/files/run/t7291.scala b/test/files/run/t7291.scala index 30c4261a81..d996c615ce 100644 --- a/test/files/run/t7291.scala +++ b/test/files/run/t7291.scala @@ -1,3 +1,6 @@ + +import scala.language.{ higherKinds, implicitConversions } + trait Fooable[T] object Fooable { implicit def conjure[T]: Fooable[T] = { diff --git a/test/files/run/t7319.check b/test/files/run/t7319.check index 966736915e..b5081f2d00 100644 --- a/test/files/run/t7319.check +++ b/test/files/run/t7319.check @@ -32,7 +32,14 @@ argument expression's type is not compatible with formal parameter type; convert(Some[Int](0)) ^ +scala> Range(1,2).toArray: Seq[_] +<console>:11: error: polymorphic expression cannot be instantiated to expected type; + found : [B >: Int]Array[B] + required: Seq[_] + Range(1,2).toArray: Seq[_] + ^ + scala> 0 -res1: Int = 0 +res2: Int = 0 scala> diff --git a/test/files/run/t7319.scala b/test/files/run/t7319.scala index 23ffeb977d..65a3ed922d 100644 --- a/test/files/run/t7319.scala +++ b/test/files/run/t7319.scala @@ -9,5 +9,6 @@ implicit def ma0[A](a: A): M[A] = null implicit def ma1[A](a: A): M[A] = null def convert[F[X <: F[X]]](builder: F[_ <: F[_]]) = 0 convert(Some[Int](0)) +Range(1,2).toArray: Seq[_] 0""" // before the fix, this line, and all that followed, re-issued the implicit ambiguity error. } diff --git a/test/files/run/t7375a.check b/test/files/run/t7375a.check new file mode 100644 index 0000000000..a0a15dfb2f --- /dev/null +++ b/test/files/run/t7375a.check @@ -0,0 +1,4 @@ +C1 +C2 +C1 +C2 diff --git a/test/files/run/t7375a.scala b/test/files/run/t7375a.scala new file mode 100644 index 0000000000..e46ad08f63 --- /dev/null +++ b/test/files/run/t7375a.scala @@ -0,0 +1,16 @@ +import scala.reflect.ClassTag + +class C1(val n: Int) extends AnyVal +class C2(val n: Int) extends AnyRef + +object Test { + type F1 = C1 + type F2 = C2 + + def main(args: Array[String]): Unit = { + println(implicitly[ClassTag[C1]]) + println(implicitly[ClassTag[C2]]) + println(implicitly[ClassTag[F1]]) + println(implicitly[ClassTag[F2]]) + } +} diff --git a/test/files/run/t7375b.check b/test/files/run/t7375b.check new file mode 100644 index 0000000000..d7578e28ba --- /dev/null +++ b/test/files/run/t7375b.check @@ -0,0 +1,4 @@ +Predef.this.classOf[C1] +Predef.this.classOf[C2] +Predef.this.classOf[C1] +Predef.this.classOf[C2] diff --git a/test/files/run/t7375b/Macros_1.scala b/test/files/run/t7375b/Macros_1.scala new file mode 100644 index 0000000000..70e79cc2b4 --- /dev/null +++ b/test/files/run/t7375b/Macros_1.scala @@ -0,0 +1,18 @@ +import language.experimental.macros +import scala.reflect.macros.Context + +class C1(val n: Int) extends AnyVal +class C2(val n: Int) extends AnyRef + +object Macros { + type F1 = C1 + type F2 = C2 + + def foo = macro impl + def impl(c: Context) = { + import c.universe._ + def test[T: c.TypeTag] = reify(println(c.literal(c.reifyRuntimeClass(c.typeOf[T]).toString).splice)).tree + def tests = Block(List(test[C1], test[C2], test[F1], test[F2]), Literal(Constant(()))) + c.Expr[Unit](tests) + } +}
\ No newline at end of file diff --git a/test/files/run/macro-def-path-dependent-b/Test_2.scala b/test/files/run/t7375b/Test_2.scala index 7dffc5107d..acfddae942 100644 --- a/test/files/run/macro-def-path-dependent-b/Test_2.scala +++ b/test/files/run/t7375b/Test_2.scala @@ -1,3 +1,3 @@ object Test extends App { - println("it works") + Macros.foo }
\ No newline at end of file diff --git a/test/files/run/t7436.scala b/test/files/run/t7436.scala new file mode 100644 index 0000000000..867a931e05 --- /dev/null +++ b/test/files/run/t7436.scala @@ -0,0 +1,9 @@ +class A(val p: Int*) + +class B(val p1: Int) extends A(p1) + +object Test { + def main(args: Array[String]) { + new B(1).p1 // threw java.lang.ClassCastException: scala.collection.mutable.WrappedArray$ofInt cannot be cast to java.lang.Integer + } +} diff --git a/test/files/run/t7507.scala b/test/files/run/t7507.scala new file mode 100644 index 0000000000..6c1959ddac --- /dev/null +++ b/test/files/run/t7507.scala @@ -0,0 +1,31 @@ +trait Cake extends Slice + +// Minimization +trait Slice { self: Cake => // must have self type that extends `Slice` + private[this] val bippy = () // must be private[this] + locally(bippy) +} + +// Originally reported bug: +trait Cake1 extends Slice1 +trait Slice1 { self: Cake1 => + import java.lang.String // any import will do! + val Tuple2(x, y) = ((1, 2)) +} + + +// Nesting +trait Cake3 extends Outer.Slice3 + +// Minimization +object Outer { + private[this] val bippy = () + trait Slice3 { self: Cake3 => + locally(bippy) + } +} + +object Test extends App { + val s1 = new Cake1 {} + assert((s1.x, s1.y) == (1, 2), (s1.x, s1.y)) +} diff --git a/test/files/run/t874.scala b/test/files/run/t874.scala index 41d124f728..7e70fc34eb 100644 --- a/test/files/run/t874.scala +++ b/test/files/run/t874.scala @@ -1,3 +1,5 @@ + +import scala.language.{ reflectiveCalls } object Test { abstract class Base { val U: { diff --git a/test/files/run/tcpoly_monads.scala b/test/files/run/tcpoly_monads.scala index cffbcc963b..6372851451 100644 --- a/test/files/run/tcpoly_monads.scala +++ b/test/files/run/tcpoly_monads.scala @@ -1,3 +1,6 @@ + +import scala.language.{ higherKinds, implicitConversions } + trait Monads { /** * class Monad m where diff --git a/test/files/run/tcpoly_overriding.scala b/test/files/run/tcpoly_overriding.scala index 86ba89f530..32174ad8bf 100644 --- a/test/files/run/tcpoly_overriding.scala +++ b/test/files/run/tcpoly_overriding.scala @@ -1,3 +1,6 @@ + +import scala.language.{ higherKinds } + abstract class A[t[x]] { def b: t[Int] } diff --git a/test/files/run/tcpoly_parseridioms.check b/test/files/run/tcpoly_parseridioms.check index 5fff2efb15..ab829e0a0e 100644 --- a/test/files/run/tcpoly_parseridioms.check +++ b/test/files/run/tcpoly_parseridioms.check @@ -1 +1,21 @@ +tcpoly_parseridioms.scala:18: warning: match may not be exhaustive. +It would fail on the following input: ParseResult() + case Success(next, x) => b(next) match { + ^ +tcpoly_parseridioms.scala:17: warning: match may not be exhaustive. +It would fail on the following input: ParseResult() + def apply(in: Input): ParseResult[Pair[T, U]] = a(in) match { + ^ +tcpoly_parseridioms.scala:30: warning: match may not be exhaustive. +It would fail on the following input: ParseResult() + case Failure(_, _) => b(in) match { + ^ +tcpoly_parseridioms.scala:28: warning: match may not be exhaustive. +It would fail on the following input: ParseResult() + def apply(in: Input): ParseResult[T] = a(in) match { + ^ +tcpoly_parseridioms.scala:39: warning: match may not be exhaustive. +It would fail on the following input: ParseResult() + def apply(in: Input): ParseResult[U] = a(in) match { + ^ Success(List(),Plus(1,2)) diff --git a/test/files/run/tcpoly_parseridioms.scala b/test/files/run/tcpoly_parseridioms.scala index 634240e44d..ec17e062db 100644 --- a/test/files/run/tcpoly_parseridioms.scala +++ b/test/files/run/tcpoly_parseridioms.scala @@ -1,3 +1,6 @@ + +import scala.language.{ higherKinds, implicitConversions, postfixOps } + trait Parsers { type Input = List[Char] diff --git a/test/files/run/toolbox_console_reporter.scala b/test/files/run/toolbox_console_reporter.scala index d672ccb9cb..ce28086c25 100644 --- a/test/files/run/toolbox_console_reporter.scala +++ b/test/files/run/toolbox_console_reporter.scala @@ -4,10 +4,10 @@ import scala.reflect.runtime.{currentMirror => cm} import scala.tools.reflect.{ToolBox, mkConsoleFrontEnd} object Test extends App { - val oldErr = Console.err; - val baos = new java.io.ByteArrayOutputStream(); - Console.setErr(new java.io.PrintStream(baos)); - try { + //val oldErr = Console.err; + val baos = new java.io.ByteArrayOutputStream() + val errs = new java.io.PrintStream(baos) + (Console withErr errs) { val toolbox = cm.mkToolBox(frontEnd = mkConsoleFrontEnd(), options = "-deprecation") toolbox.eval(reify{ object Utils { @@ -18,12 +18,11 @@ object Test extends App { Utils.foo }.tree) println("============compiler console=============") + errs.flush() println(baos.toString); println("=========================================") println("============compiler messages============") toolbox.frontEnd.infos.foreach(println(_)) println("=========================================") - } finally { - Console.setErr(oldErr); } -}
\ No newline at end of file +} diff --git a/test/files/run/tpeCache-tyconCache.check b/test/files/run/tpeCache-tyconCache.check new file mode 100644 index 0000000000..a892f5477a --- /dev/null +++ b/test/files/run/tpeCache-tyconCache.check @@ -0,0 +1,19 @@ +Type in expressions to have them evaluated. +Type :help for more information. + +scala> :power +** Power User mode enabled - BEEP WHIR GYVE ** +** :phase has been set to 'typer'. ** +** scala.tools.nsc._ has been imported ** +** global._, definitions._ also imported ** +** Try :help, :vals, power.<tab> ** + +scala> + +scala> AnyRefClass.tpe eq AnyRefClass.typeConstructor +res0: Boolean = true + +scala> AnyRefClass.tpe eq AnyRefClass.typeConstructor +res1: Boolean = true + +scala> diff --git a/test/files/run/tpeCache-tyconCache.scala b/test/files/run/tpeCache-tyconCache.scala new file mode 100644 index 0000000000..f907167a33 --- /dev/null +++ b/test/files/run/tpeCache-tyconCache.scala @@ -0,0 +1,10 @@ +import scala.tools.partest.ReplTest + +object Test extends ReplTest { + override def code = """ +:power + +AnyRefClass.tpe eq AnyRefClass.typeConstructor +AnyRefClass.tpe eq AnyRefClass.typeConstructor + """.trim +} diff --git a/test/files/run/transform.scala b/test/files/run/transform.scala index 5cc1c49d6f..82f924950d 100644 --- a/test/files/run/transform.scala +++ b/test/files/run/transform.scala @@ -1,5 +1,5 @@ object Test { - val x = 1 to 10 toBuffer + val x = (1 to 10).toBuffer def main(args: Array[String]): Unit = { x transform (_ * 2) diff --git a/test/files/run/try-2.check b/test/files/run/try-2.check index 6c4a024c93..987d3462df 100644 --- a/test/files/run/try-2.check +++ b/test/files/run/try-2.check @@ -1,3 +1,6 @@ +try-2.scala:41: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses + 10; + ^ exception happened Nothin diff --git a/test/files/run/try-2.scala b/test/files/run/try-2.scala index da321f2668..b55977ba8b 100644 --- a/test/files/run/try-2.scala +++ b/test/files/run/try-2.scala @@ -12,42 +12,42 @@ object Test { throw new Error(); } catch { - case _ => Console.println("exception happened\n"); + case _: Throwable => Console.println("exception happened\n"); } def tryUnitAll: Unit = try { Console.println("Nothin"); } catch { - case _ => sys.error("Bad, bad, lama!"); + case _: Throwable => sys.error("Bad, bad, lama!"); } def tryAllAll: Unit = try { throw new Error(); } catch { - case _ => sys.error("Bad, bad, lama!"); + case _: Throwable => sys.error("Bad, bad, lama!"); } def tryUnitUnit: Unit = try { Console.println("Nothin"); } catch { - case _ => Console.println("Nothin"); + case _: Throwable => Console.println("Nothin"); } def tryIntUnit: Unit = try { 10; } catch { - case _ => Console.println("Huh?"); + case _: Throwable => Console.println("Huh?"); } def execute(f: => Unit) = try { f; } catch { - case _ => (); + case _: Throwable => (); } diff --git a/test/files/run/try-catch-unify.scala b/test/files/run/try-catch-unify.scala index 8cb14d060e..151e549e5f 100644 --- a/test/files/run/try-catch-unify.scala +++ b/test/files/run/try-catch-unify.scala @@ -9,7 +9,7 @@ object Test { try { catching(classOf[NumberFormatException]) withTry (sys.error("O NOES")) } catch { - case t => println(t.getMessage) + case t: Throwable => println(t.getMessage) } println(nonFatalCatch withTry ("Hi".toDouble)) } diff --git a/test/files/run/try.check b/test/files/run/try.check index 3983e26060..f742ccb0df 100644 --- a/test/files/run/try.check +++ b/test/files/run/try.check @@ -1,3 +1,6 @@ +try.scala:65: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses + 1+1; + ^ 1 + 1 = 2 1 + 1 = 2 1 + 1 = 2 diff --git a/test/files/run/try.scala b/test/files/run/try.scala index e393c0b4b1..a4fdfd796b 100644 --- a/test/files/run/try.scala +++ b/test/files/run/try.scala @@ -45,7 +45,7 @@ object Test extends AnyRef with App { instance = try { "" //new String(); } catch { - case _ => + case _: Throwable => val cs = "aaa"; if (cs.length() > 0) { "" //new String(); @@ -65,13 +65,13 @@ object Test extends AnyRef with App { 1+1; () } catch { - case _ => + case _: Throwable => Console.println("2"); sys.error("for good"); } Console.println("a"); } catch { - case _ => (); + case _: Throwable => (); } class A { @@ -95,7 +95,7 @@ object Test extends AnyRef with App { try { null } catch { - case _ => null + case _: Throwable => null } new AnyRef { diff --git a/test/files/run/tuple-zipped.scala b/test/files/run/tuple-zipped.scala index b197183844..c8ba41f042 100644 --- a/test/files/run/tuple-zipped.scala +++ b/test/files/run/tuple-zipped.scala @@ -1,3 +1,6 @@ + +import scala.language.postfixOps + object Test { val xs1 = List.range(1, 100) val xs2 = xs1.view diff --git a/test/files/run/tuples.scala b/test/files/run/tuples.scala index 4854e36c96..a4ea9ddbcc 100644 --- a/test/files/run/tuples.scala +++ b/test/files/run/tuples.scala @@ -6,6 +6,7 @@ object Test extends App { Console.println(xyz) xyz match { case (1, "abc", true) => Console.println("OK") + case _ => ??? } def func(x: Int, y: String, z: Double) { Console.println("x = " + x + "; y = " + y + "; z = " + z); diff --git a/test/files/run/type-currying.scala b/test/files/run/type-currying.scala index f9764c64f0..5e31fef403 100644 --- a/test/files/run/type-currying.scala +++ b/test/files/run/type-currying.scala @@ -1,3 +1,6 @@ + + +import scala.language.{ higherKinds, reflectiveCalls } import scala.collection.{ mutable, immutable, generic } import generic.CanBuildFrom diff --git a/test/files/run/unapply.check b/test/files/run/unapply.check new file mode 100644 index 0000000000..847e3b381e --- /dev/null +++ b/test/files/run/unapply.check @@ -0,0 +1,3 @@ +unapply.scala:57: warning: comparing values of types Null and Null using `==' will always yield true + assert(doMatch2(b) == null) + ^ diff --git a/test/files/run/unittest_io.scala b/test/files/run/unittest_io.scala index 2cadb9b1df..2c3dacdf91 100644 --- a/test/files/run/unittest_io.scala +++ b/test/files/run/unittest_io.scala @@ -1,3 +1,5 @@ + +@deprecated("Suppress warnings", since="2.11") object Test { def main(args: Array[String]) { diff --git a/test/files/run/unreachable.scala b/test/files/run/unreachable.scala index 50a8d88b7c..99ac730746 100644 --- a/test/files/run/unreachable.scala +++ b/test/files/run/unreachable.scala @@ -1,3 +1,6 @@ +import scala.util.Random.nextInt +import scala.sys.error + object Test extends App { def unreachableNormalExit: Int = { return 42 @@ -6,14 +9,14 @@ object Test extends App { def unreachableIf: Int = { return 42 - if (util.Random.nextInt % 2 == 0) + if (nextInt % 2 == 0) 0 else 1 } def unreachableIfBranches: Int = { - if (util.Random.nextInt % 2 == 0) + if (nextInt % 2 == 0) return 42 else return 42 @@ -22,14 +25,14 @@ object Test extends App { } def unreachableOneLegIf: Int = { - if (util.Random.nextInt % 2 == 0) + if (nextInt % 2 == 0) return 42 return 42 } def unreachableLeftBranch: Int = { - val result = if (util.Random.nextInt % 2 == 0) + val result = if (nextInt % 2 == 0) return 42 else 42 @@ -38,7 +41,7 @@ object Test extends App { } def unreachableRightBranch: Int = { - val result = if (util.Random.nextInt % 2 == 0) + val result = if (nextInt % 2 == 0) 42 else return 42 @@ -89,7 +92,7 @@ object Test extends App { def unreachableSwitch: Int = { return 42 - val x = util.Random.nextInt % 2 + val x = nextInt % 2 x match { case 0 => return 0 case 1 => return 1 @@ -99,7 +102,7 @@ object Test extends App { } def unreachableAfterSwitch: Int = { - val x = util.Random.nextInt % 2 + val x = nextInt % 2 x match { case 0 => return 42 case 1 => return 41 + x @@ -122,4 +125,4 @@ object Test extends App { check(unreachableAfterFinally) check(unreachableSwitch) check(unreachableAfterSwitch) -}
\ No newline at end of file +} diff --git a/test/files/run/valueclasses-classmanifest-basic.scala b/test/files/run/valueclasses-classmanifest-basic.scala index c2aa08ef86..50addda359 100644 --- a/test/files/run/valueclasses-classmanifest-basic.scala +++ b/test/files/run/valueclasses-classmanifest-basic.scala @@ -1,5 +1,6 @@ class Foo(val x: Int) extends AnyVal +@deprecated("Suppress warnings", since="2.11") object Test extends App { println(classManifest[Foo]) -}
\ No newline at end of file +} diff --git a/test/files/run/valueclasses-classmanifest-existential.scala b/test/files/run/valueclasses-classmanifest-existential.scala index 11999df678..6bcd7cf942 100644 --- a/test/files/run/valueclasses-classmanifest-existential.scala +++ b/test/files/run/valueclasses-classmanifest-existential.scala @@ -1,5 +1,6 @@ class Foo[T](val x: T) extends AnyVal +@deprecated("Suppress warnings", since="2.11") object Test extends App { println(classManifest[Foo[_]]) -}
\ No newline at end of file +} diff --git a/test/files/run/valueclasses-classmanifest-generic.scala b/test/files/run/valueclasses-classmanifest-generic.scala index 280152dc1d..5efcaed959 100644 --- a/test/files/run/valueclasses-classmanifest-generic.scala +++ b/test/files/run/valueclasses-classmanifest-generic.scala @@ -1,5 +1,6 @@ class Foo[T](val x: T) extends AnyVal +@deprecated("Suppress warnings", since="2.11") object Test extends App { println(classManifest[Foo[String]]) -}
\ No newline at end of file +} diff --git a/test/files/run/vector1.scala b/test/files/run/vector1.scala index b37cfe82e8..2e335aded4 100644 --- a/test/files/run/vector1.scala +++ b/test/files/run/vector1.scala @@ -102,7 +102,7 @@ object Test { seqBack() } } catch { - case ex => + case ex: Throwable => //println("----------------") //a.debug throw ex diff --git a/test/files/run/view-iterator-stream.scala b/test/files/run/view-iterator-stream.scala index f91407f92c..c172b5cb99 100644 --- a/test/files/run/view-iterator-stream.scala +++ b/test/files/run/view-iterator-stream.scala @@ -1,3 +1,6 @@ + +import scala.language.postfixOps + import scala.collection.{ mutable, immutable, generic } import collection.TraversableView diff --git a/test/files/run/virtpatmat_alts.check b/test/files/run/virtpatmat_alts.check index 7a4ad0a741..f39e292fef 100644 --- a/test/files/run/virtpatmat_alts.check +++ b/test/files/run/virtpatmat_alts.check @@ -1 +1,7 @@ +virtpatmat_alts.scala:5: warning: match may not be exhaustive. + (true, true) match { + ^ +virtpatmat_alts.scala:9: warning: match may not be exhaustive. + List(5) match { + ^ OK 5 diff --git a/test/files/run/virtpatmat_alts.flags b/test/files/run/virtpatmat_alts.flags deleted file mode 100644 index 3f5a3100e4..0000000000 --- a/test/files/run/virtpatmat_alts.flags +++ /dev/null @@ -1 +0,0 @@ - -Xexperimental diff --git a/test/files/run/virtpatmat_alts.scala b/test/files/run/virtpatmat_alts.scala index b7717524e2..d1dfa8a4a1 100644 --- a/test/files/run/virtpatmat_alts.scala +++ b/test/files/run/virtpatmat_alts.scala @@ -1,3 +1,6 @@ +/* + * filter: It would fail on the following input + */ object Test extends App { (true, true) match { case (true, true) | (false, false) => 1 @@ -9,4 +12,4 @@ object Test extends App { case 7 :: Nil => println("FAILED") case Nil => println("FAILED") } -}
\ No newline at end of file +} diff --git a/test/files/run/virtpatmat_nested_lists.check b/test/files/run/virtpatmat_nested_lists.check index d8263ee986..ddf68eeedd 100644 --- a/test/files/run/virtpatmat_nested_lists.check +++ b/test/files/run/virtpatmat_nested_lists.check @@ -1 +1,4 @@ -2
\ No newline at end of file +virtpatmat_nested_lists.scala:5: warning: match may not be exhaustive. + List(List(1), List(2)) match { case x :: (y :: Nil) :: Nil => println(y) } + ^ +2 diff --git a/test/files/run/virtpatmat_nested_lists.flags b/test/files/run/virtpatmat_nested_lists.flags deleted file mode 100644 index 3f5a3100e4..0000000000 --- a/test/files/run/virtpatmat_nested_lists.flags +++ /dev/null @@ -1 +0,0 @@ - -Xexperimental diff --git a/test/files/run/virtpatmat_nested_lists.scala b/test/files/run/virtpatmat_nested_lists.scala index fef74cea15..d1aa68ea93 100644 --- a/test/files/run/virtpatmat_nested_lists.scala +++ b/test/files/run/virtpatmat_nested_lists.scala @@ -1,3 +1,6 @@ +/* + * filter: It would fail on the following input + */ object Test extends App { List(List(1), List(2)) match { case x :: (y :: Nil) :: Nil => println(y) } } diff --git a/test/files/run/virtpatmat_opt_sharing.check b/test/files/run/virtpatmat_opt_sharing.check index d00491fd7e..78ec61f19d 100644 --- a/test/files/run/virtpatmat_opt_sharing.check +++ b/test/files/run/virtpatmat_opt_sharing.check @@ -1 +1,4 @@ +virtpatmat_opt_sharing.scala:7: warning: match may not be exhaustive. + List(1, 3, 4, 7) match { + ^ 1 diff --git a/test/files/run/virtpatmat_opt_sharing.flags b/test/files/run/virtpatmat_opt_sharing.flags deleted file mode 100644 index 3f5a3100e4..0000000000 --- a/test/files/run/virtpatmat_opt_sharing.flags +++ /dev/null @@ -1 +0,0 @@ - -Xexperimental diff --git a/test/files/run/virtpatmat_opt_sharing.scala b/test/files/run/virtpatmat_opt_sharing.scala index 119e3050ea..d2c42cab48 100644 --- a/test/files/run/virtpatmat_opt_sharing.scala +++ b/test/files/run/virtpatmat_opt_sharing.scala @@ -1,3 +1,6 @@ +/* + * filter: It would fail on the following input + */ object Test extends App { virtMatch() def virtMatch() = { @@ -7,4 +10,4 @@ object Test extends App { case 1 :: 3 :: 4 :: 7 :: x => println(1) } } -}
\ No newline at end of file +} diff --git a/test/files/run/virtpatmat_staging.scala b/test/files/run/virtpatmat_staging.scala index c17b45043b..d444829b02 100644 --- a/test/files/run/virtpatmat_staging.scala +++ b/test/files/run/virtpatmat_staging.scala @@ -1,3 +1,6 @@ + +import scala.language.{ higherKinds, implicitConversions } + trait Intf { type Rep[+T] type M[+T] = Rep[Maybe[T]] @@ -9,7 +12,7 @@ trait Intf { def zero: M[Nothing] def one[T](x: Rep[T]): M[T] - def guard[T](cond: Rep[Boolean], then: => Rep[T]): M[T] + def guard[T](cond: Rep[Boolean], dann: => Rep[T]): M[T] def isSuccess[T, U](x: Rep[T])(f: Rep[T] => M[U]): Rep[Boolean] // used for isDefinedAt } @@ -33,7 +36,7 @@ trait Impl extends Intf { def runOrElse[T, U](in: Rep[T])(matcher: Rep[T] => M[U]): Rep[U] = ("runOrElse("+ in +", ?" + matcher("?") + ")") def zero: M[Nothing] = "zero" def one[T](x: Rep[T]): M[T] = "one("+x.toString+")" - def guard[T](cond: Rep[Boolean], then: => Rep[T]): M[T] = "guard("+cond+","+then+")" + def guard[T](cond: Rep[Boolean], dann: => Rep[T]): M[T] = s"guard($cond,$dann)" def isSuccess[T, U](x: Rep[T])(f: Rep[T] => M[U]): Rep[Boolean] = ("isSuccess("+x+", ?" + f("?") + ")") } diff --git a/test/files/run/virtpatmat_stringinterp.scala b/test/files/run/virtpatmat_stringinterp.scala index 213712f17a..c6c951e6e5 100644 --- a/test/files/run/virtpatmat_stringinterp.scala +++ b/test/files/run/virtpatmat_stringinterp.scala @@ -1,3 +1,6 @@ + +import scala.language.{ implicitConversions } + object Test extends App { case class Node(x: Int) @@ -10,4 +13,4 @@ object Test extends App { val x: Node = Node(0) x match { case xml"""<foo arg=$a/>""" => println(a) } -}
\ No newline at end of file +} diff --git a/test/files/run/virtpatmat_try.scala b/test/files/run/virtpatmat_try.scala index 46e67cb72e..dab2c89227 100644 --- a/test/files/run/virtpatmat_try.scala +++ b/test/files/run/virtpatmat_try.scala @@ -8,7 +8,7 @@ object Test extends App { } catch { // this should emit a "catch-switch" case y: A => println(y.x) case (_ : A | _ : B) => println("B") - case _ => println("other") + case _: Throwable => println("other") } try { @@ -17,7 +17,7 @@ object Test extends App { // case A(x) => println(x) case y: A => println(y.x) case x@((_ : A) | (_ : B)) => println(x) - case _ => println("other") + case _: Throwable => println("other") } def simpleTry { @@ -34,7 +34,7 @@ object Test extends App { } def wildcardTry { - try { bla } catch { case _ => bla } + try { bla } catch { case _: Throwable => bla } } def tryPlusFinally { @@ -44,4 +44,4 @@ object Test extends App { def catchAndPassToLambda { try { bla } catch { case ex: Exception => val f = () => ex } } -}
\ No newline at end of file +} diff --git a/test/files/run/virtpatmat_typed.check b/test/files/run/virtpatmat_typed.check index cec2740d18..9924d84148 100644 --- a/test/files/run/virtpatmat_typed.check +++ b/test/files/run/virtpatmat_typed.check @@ -1 +1,4 @@ +virtpatmat_typed.scala:5: warning: unreachable code + case x: String => println("FAILED") + ^ OK foo diff --git a/test/files/run/xml-loop-bug.scala b/test/files/run/xml-loop-bug.scala index 67637674b2..dc155dbb02 100644 --- a/test/files/run/xml-loop-bug.scala +++ b/test/files/run/xml-loop-bug.scala @@ -1,8 +1,14 @@ +import java.io.{ Console => _, _ } +import scala.io._ +import scala.xml.parsing._ object Test { def main(args: Array[String]): Unit = { - val sink = new java.io.PrintStream(new java.io.ByteArrayOutputStream()) - Console setOut sink - Console setErr sink - scala.xml.parsing.ConstructingParser.fromSource(scala.io.Source.fromString("<!DOCTYPE xmeml SYSTEM> <xmeml> <sequence> </sequence> </xmeml> "), true).document.docElem + val xml = "<!DOCTYPE xmeml SYSTEM> <xmeml> <sequence> </sequence> </xmeml> " + val sink = new PrintStream(new ByteArrayOutputStream()) + (Console withOut sink) { + (Console withErr sink) { + ConstructingParser.fromSource((Source fromString xml), true).document.docElem + } + } } } |