diff options
Diffstat (limited to 'test/files')
369 files changed, 1959 insertions, 2154 deletions
diff --git a/test/files/continuations-neg/function0.check b/test/files/continuations-neg/function0.check deleted file mode 100644 index 0a66763a0f..0000000000 --- a/test/files/continuations-neg/function0.check +++ /dev/null @@ -1,6 +0,0 @@ -function0.scala:11: error: type mismatch; - found : () => Int @scala.util.continuations.cpsParam[Int,Int] - required: () => Int - val g: () => Int = f - ^ -one error found diff --git a/test/files/continuations-neg/function0.scala b/test/files/continuations-neg/function0.scala deleted file mode 100644 index 4112ee3835..0000000000 --- a/test/files/continuations-neg/function0.scala +++ /dev/null @@ -1,16 +0,0 @@ -// $Id$ - -import scala.util.continuations._ - - -object Test { - - def main(args: Array[String]): Any = { - - val f = () => shift { k: (Int=>Int) => k(7) } - val g: () => Int = f - - println(reset(g())) - } - -}
\ No newline at end of file diff --git a/test/files/continuations-neg/function2.check b/test/files/continuations-neg/function2.check deleted file mode 100644 index 4b1a6227bc..0000000000 --- a/test/files/continuations-neg/function2.check +++ /dev/null @@ -1,6 +0,0 @@ -function2.scala:11: error: type mismatch; - found : () => Int - required: () => Int @scala.util.continuations.cpsParam[Int,Int] - val g: () => Int @cps[Int] = f - ^ -one error found diff --git a/test/files/continuations-neg/function2.scala b/test/files/continuations-neg/function2.scala deleted file mode 100644 index ae0fda509d..0000000000 --- a/test/files/continuations-neg/function2.scala +++ /dev/null @@ -1,16 +0,0 @@ -// $Id$ - -import scala.util.continuations._ - - -object Test { - - def main(args: Array[String]): Any = { - - val f = () => 7 - val g: () => Int @cps[Int] = f - - println(reset(g())) - } - -}
\ No newline at end of file diff --git a/test/files/continuations-neg/function3.check b/test/files/continuations-neg/function3.check deleted file mode 100644 index 4705ad9ed9..0000000000 --- a/test/files/continuations-neg/function3.check +++ /dev/null @@ -1,6 +0,0 @@ -function3.scala:10: error: type mismatch; - found : Int @scala.util.continuations.cpsParam[Int,Int] - required: Int - val g: () => Int = () => shift { k: (Int=>Int) => k(7) } - ^ -one error found diff --git a/test/files/continuations-neg/function3.scala b/test/files/continuations-neg/function3.scala deleted file mode 100644 index 0c3f1667e5..0000000000 --- a/test/files/continuations-neg/function3.scala +++ /dev/null @@ -1,15 +0,0 @@ -// $Id$ - -import scala.util.continuations._ - - -object Test { - - def main(args: Array[String]): Any = { - - val g: () => Int = () => shift { k: (Int=>Int) => k(7) } - - println(reset(g())) - } - -}
\ No newline at end of file diff --git a/test/files/continuations-neg/infer2.check b/test/files/continuations-neg/infer2.check deleted file mode 100644 index d92bc9c572..0000000000 --- a/test/files/continuations-neg/infer2.check +++ /dev/null @@ -1,4 +0,0 @@ -infer2.scala:14: error: illegal answer type modification: scala.util.continuations.cpsParam[String,Int] andThen scala.util.continuations.cpsParam[String,Int] - test { sym(); sym() } - ^ -one error found diff --git a/test/files/continuations-neg/infer2.scala b/test/files/continuations-neg/infer2.scala deleted file mode 100644 index a890ac1fc4..0000000000 --- a/test/files/continuations-neg/infer2.scala +++ /dev/null @@ -1,19 +0,0 @@ -// $Id$ - -import scala.util.continuations._ - - -object Test { - - def test(x: => Int @cpsParam[String,Int]) = 7 - - def sym() = shift { k: (Int => String) => 9 } - - - def main(args: Array[String]): Any = { - test { sym(); sym() } - } - -} - - diff --git a/test/files/continuations-neg/lazy.check b/test/files/continuations-neg/lazy.check deleted file mode 100644 index 3c460546be..0000000000 --- a/test/files/continuations-neg/lazy.check +++ /dev/null @@ -1,4 +0,0 @@ -lazy.scala:6: error: implementation restriction: cps annotations not allowed on lazy value definitions - lazy val x = shift((k:Unit=>Unit)=>k()) - ^ -one error found diff --git a/test/files/continuations-neg/lazy.scala b/test/files/continuations-neg/lazy.scala deleted file mode 100644 index 3c8169dd46..0000000000 --- a/test/files/continuations-neg/lazy.scala +++ /dev/null @@ -1,16 +0,0 @@ -import scala.util.continuations._ - -object Test { - - def foo() = { - lazy val x = shift((k:Unit=>Unit)=>k()) - println(x) - } - - def main(args: Array[String]) { - reset { - foo() - } - } - -}
\ No newline at end of file diff --git a/test/files/continuations-neg/t1929.check b/test/files/continuations-neg/t1929.check deleted file mode 100644 index b04a5b977d..0000000000 --- a/test/files/continuations-neg/t1929.check +++ /dev/null @@ -1,6 +0,0 @@ -t1929.scala:8: error: type mismatch; - found : Int @scala.util.continuations.cpsParam[String,String] @scala.util.continuations.cpsSynth - required: Int @scala.util.continuations.cpsParam[Int,String] - reset { - ^ -one error found diff --git a/test/files/continuations-neg/t1929.scala b/test/files/continuations-neg/t1929.scala deleted file mode 100644 index 02eda9170d..0000000000 --- a/test/files/continuations-neg/t1929.scala +++ /dev/null @@ -1,17 +0,0 @@ -// $Id$ - -import scala.util.continuations._ - - -object Test { - def main(args : Array[String]) { - reset { - println("up") - val x = shift((k:Int=>String) => k(8) + k(2)) - println("down " + x) - val y = shift((k:Int=>String) => k(3)) - println("down2 " + y) - y + x - } - } -}
\ No newline at end of file diff --git a/test/files/continuations-neg/t2285.check b/test/files/continuations-neg/t2285.check deleted file mode 100644 index d5dff6a4f2..0000000000 --- a/test/files/continuations-neg/t2285.check +++ /dev/null @@ -1,6 +0,0 @@ -t2285.scala:9: error: type mismatch; - found : Int @scala.util.continuations.cpsParam[String,String] @scala.util.continuations.cpsSynth - required: Int @scala.util.continuations.cpsParam[Int,String] - def foo() = reset { bar(); 7 } - ^ -one error found diff --git a/test/files/continuations-neg/t2285.scala b/test/files/continuations-neg/t2285.scala deleted file mode 100644 index f3c7f4c89c..0000000000 --- a/test/files/continuations-neg/t2285.scala +++ /dev/null @@ -1,11 +0,0 @@ -// $Id$ - -import scala.util.continuations._ - -object Test { - - def bar() = shift { k: (String => String) => k("1") } - - def foo() = reset { bar(); 7 } - -} diff --git a/test/files/continuations-neg/t2949.check b/test/files/continuations-neg/t2949.check deleted file mode 100644 index dd9768807c..0000000000 --- a/test/files/continuations-neg/t2949.check +++ /dev/null @@ -1,6 +0,0 @@ -t2949.scala:13: error: type mismatch; - found : Int - required: ? @scala.util.continuations.cpsParam[List[?],Any] - x * y - ^ -one error found diff --git a/test/files/continuations-neg/t2949.scala b/test/files/continuations-neg/t2949.scala deleted file mode 100644 index ce27c7c0e8..0000000000 --- a/test/files/continuations-neg/t2949.scala +++ /dev/null @@ -1,15 +0,0 @@ -// $Id$ - -import scala.util.continuations._ - -object Test { - - def reflect[A,B](xs : List[A]) = shift{ xs.flatMap[B, List[B]] } - def reify[A, B](x : A @cpsParam[List[A], B]) = reset{ List(x) } - - def main(args: Array[String]): Unit = println(reify { - val x = reflect[Int, Int](List(1,2,3)) - val y = reflect[Int, Int](List(2,4,8)) - x * y - }) -} diff --git a/test/files/continuations-neg/t3628.check b/test/files/continuations-neg/t3628.check deleted file mode 100644 index 6e390558ef..0000000000 --- a/test/files/continuations-neg/t3628.check +++ /dev/null @@ -1,4 +0,0 @@ -t3628.scala:4: error: not found: type Actor - val impl: Actor = actor { - ^ -one error found diff --git a/test/files/continuations-neg/t3628.scala b/test/files/continuations-neg/t3628.scala deleted file mode 100644 index c56e7752c4..0000000000 --- a/test/files/continuations-neg/t3628.scala +++ /dev/null @@ -1,11 +0,0 @@ -import scala.actors.Actor._ - -object Test { - val impl: Actor = actor { - loop { - react { - case 1 => impl ! 2 - } - } - } -} diff --git a/test/files/continuations-neg/t3718.check b/test/files/continuations-neg/t3718.check deleted file mode 100644 index 659104c1c6..0000000000 --- a/test/files/continuations-neg/t3718.check +++ /dev/null @@ -1,4 +0,0 @@ -t3718.scala:2: error: cannot cps-transform malformed (possibly in shift/reset placement) expression - scala.util.continuations.reset((_: Any).##) - ^ -one error found diff --git a/test/files/continuations-neg/t3718.scala b/test/files/continuations-neg/t3718.scala deleted file mode 100644 index a0fcb9d869..0000000000 --- a/test/files/continuations-neg/t3718.scala +++ /dev/null @@ -1,3 +0,0 @@ -object Test { - scala.util.continuations.reset((_: Any).##) -} diff --git a/test/files/continuations-neg/t5314-missing-result-type.check b/test/files/continuations-neg/t5314-missing-result-type.check deleted file mode 100644 index 341e580cf3..0000000000 --- a/test/files/continuations-neg/t5314-missing-result-type.check +++ /dev/null @@ -1,4 +0,0 @@ -t5314-missing-result-type.scala:6: error: method bar has return statement; needs result type - def bar(x:Int) = return foo(x) - ^ -one error found diff --git a/test/files/continuations-neg/t5314-missing-result-type.scala b/test/files/continuations-neg/t5314-missing-result-type.scala deleted file mode 100644 index d7c5043a86..0000000000 --- a/test/files/continuations-neg/t5314-missing-result-type.scala +++ /dev/null @@ -1,13 +0,0 @@ -import scala.util.continuations._ - -object Test extends App { - def foo(x:Int): Int @cps[Int] = x - - def bar(x:Int) = return foo(x) - - reset { - val res = bar(8) - println(res) - res - } -} diff --git a/test/files/continuations-neg/t5314-npe.check b/test/files/continuations-neg/t5314-npe.check deleted file mode 100644 index b5f024aa89..0000000000 --- a/test/files/continuations-neg/t5314-npe.check +++ /dev/null @@ -1,4 +0,0 @@ -t5314-npe.scala:2: error: method bar has return statement; needs result type - def bar(x:Int) = { return x; x } // NPE - ^ -one error found diff --git a/test/files/continuations-neg/t5314-npe.scala b/test/files/continuations-neg/t5314-npe.scala deleted file mode 100644 index 2b5966e07c..0000000000 --- a/test/files/continuations-neg/t5314-npe.scala +++ /dev/null @@ -1,3 +0,0 @@ -object Test extends App { - def bar(x:Int) = { return x; x } // NPE -} diff --git a/test/files/continuations-neg/t5314-return-reset.check b/test/files/continuations-neg/t5314-return-reset.check deleted file mode 100644 index 4c817ae14d..0000000000 --- a/test/files/continuations-neg/t5314-return-reset.check +++ /dev/null @@ -1,4 +0,0 @@ -t5314-return-reset.scala:14: error: return expression not allowed, since method calls CPS method - if (rnd.nextInt(100) > 50) return 5 // not allowed, since method is calling `reset` - ^ -one error found diff --git a/test/files/continuations-neg/t5314-return-reset.scala b/test/files/continuations-neg/t5314-return-reset.scala deleted file mode 100644 index df9d58e4cb..0000000000 --- a/test/files/continuations-neg/t5314-return-reset.scala +++ /dev/null @@ -1,21 +0,0 @@ -import scala.util.continuations._ -import scala.util.Random - -object Test extends App { - val rnd = new Random - - def foo(x: Int): Int @cps[Int] = shift { k => k(x) } - - def bar(x: Int): Int @cps[Int] = return foo(x) - - def caller(): Int = { - val v: Int = reset { - val res: Int = bar(8) - if (rnd.nextInt(100) > 50) return 5 // not allowed, since method is calling `reset` - 42 - } - v - } - - caller() -} diff --git a/test/files/continuations-neg/t5314-type-error.check b/test/files/continuations-neg/t5314-type-error.check deleted file mode 100644 index e66c9d833f..0000000000 --- a/test/files/continuations-neg/t5314-type-error.check +++ /dev/null @@ -1,6 +0,0 @@ -t5314-type-error.scala:7: error: type mismatch; - found : Int @scala.util.continuations.cpsParam[Int,Int] - required: Int @scala.util.continuations.cpsParam[String,String] - def bar(x:Int): Int @cps[String] = return foo(x) - ^ -one error found diff --git a/test/files/continuations-neg/t5314-type-error.scala b/test/files/continuations-neg/t5314-type-error.scala deleted file mode 100644 index e36ce6c203..0000000000 --- a/test/files/continuations-neg/t5314-type-error.scala +++ /dev/null @@ -1,17 +0,0 @@ -import scala.util.continuations._ - -object Test extends App { - def foo(x:Int): Int @cps[Int] = shift { k => k(x) } - - // should be a type error - def bar(x:Int): Int @cps[String] = return foo(x) - - def caller(): Unit = { - val v: String = reset { - val res: Int = bar(8) - "hello" - } - } - - caller() -} diff --git a/test/files/continuations-neg/t5445.check b/test/files/continuations-neg/t5445.check deleted file mode 100644 index eb2943b6a6..0000000000 --- a/test/files/continuations-neg/t5445.check +++ /dev/null @@ -1,4 +0,0 @@ -t5445.scala:4: error: cps annotations not allowed on by-value parameters or value definitions - def foo(block: Unit @suspendable ): Unit @suspendable = {} - ^ -one error found diff --git a/test/files/continuations-neg/t5445.scala b/test/files/continuations-neg/t5445.scala deleted file mode 100644 index cb6f8f686d..0000000000 --- a/test/files/continuations-neg/t5445.scala +++ /dev/null @@ -1,5 +0,0 @@ -import scala.util.continuations._ - -object Test { - def foo(block: Unit @suspendable ): Unit @suspendable = {} -} diff --git a/test/files/continuations-neg/trycatch2.check b/test/files/continuations-neg/trycatch2.check deleted file mode 100644 index 5ff2838bad..0000000000 --- a/test/files/continuations-neg/trycatch2.check +++ /dev/null @@ -1,7 +0,0 @@ -trycatch2.scala:11: error: only simple cps types allowed in try/catch blocks (found: Int @scala.util.continuations.cpsParam[String,Int]) - def foo1 = try { - ^ -trycatch2.scala:19: error: only simple cps types allowed in try/catch blocks (found: Int @scala.util.continuations.cpsParam[String,Int]) - def foo2 = try { - ^ -two errors found diff --git a/test/files/continuations-neg/trycatch2.scala b/test/files/continuations-neg/trycatch2.scala deleted file mode 100644 index ee0a180ed6..0000000000 --- a/test/files/continuations-neg/trycatch2.scala +++ /dev/null @@ -1,33 +0,0 @@ -// $Id$ - -import scala.util.continuations._ - -object Test { - - def fatal[T]: T = throw new Exception - def cpsIntStringInt = shift { k:(Int=>String) => k(3); 7 } - def cpsIntIntString = shift { k:(Int=>Int) => k(3); "7" } - - def foo1 = try { - fatal[Int] - cpsIntStringInt - } catch { - case ex: Throwable => - cpsIntStringInt - } - - def foo2 = try { - fatal[Int] - cpsIntStringInt - } catch { - case ex: Throwable => - cpsIntStringInt - } - - - def main(args: Array[String]): Unit = { - println(reset { foo1; "3" }) - println(reset { foo2; "3" }) - } - -} diff --git a/test/files/continuations-run/basics.check b/test/files/continuations-run/basics.check deleted file mode 100755 index 54c059fdcb..0000000000 --- a/test/files/continuations-run/basics.check +++ /dev/null @@ -1,2 +0,0 @@ -28 -28
\ No newline at end of file diff --git a/test/files/continuations-run/basics.scala b/test/files/continuations-run/basics.scala deleted file mode 100755 index 07b3de5194..0000000000 --- a/test/files/continuations-run/basics.scala +++ /dev/null @@ -1,23 +0,0 @@ -// $Id$ - -import scala.util.continuations._ - - -object Test { - - def m0() = { - shift((k:Int => Int) => k(k(7))) * 2 - } - - def m1() = { - 2 * shift((k:Int => Int) => k(k(7))) - } - - def main(args: Array[String]) { - - println(reset(m0())) - println(reset(m1())) - - } - -} diff --git a/test/files/continuations-run/function1.check b/test/files/continuations-run/function1.check deleted file mode 100644 index 7f8f011eb7..0000000000 --- a/test/files/continuations-run/function1.check +++ /dev/null @@ -1 +0,0 @@ -7 diff --git a/test/files/continuations-run/function1.scala b/test/files/continuations-run/function1.scala deleted file mode 100644 index 82dfe46c08..0000000000 --- a/test/files/continuations-run/function1.scala +++ /dev/null @@ -1,16 +0,0 @@ -// $Id$ - -import scala.util.continuations._ - - -object Test { - - def main(args: Array[String]): Unit = { - - val f = () => shift { k: (Int=>Int) => k(7) } - val g: () => Int @cps[Int] = f - - println(reset(g())) - } - -} diff --git a/test/files/continuations-run/function4.check b/test/files/continuations-run/function4.check deleted file mode 100644 index c7930257df..0000000000 --- a/test/files/continuations-run/function4.check +++ /dev/null @@ -1 +0,0 @@ -7
\ No newline at end of file diff --git a/test/files/continuations-run/function4.scala b/test/files/continuations-run/function4.scala deleted file mode 100644 index ccb432fe93..0000000000 --- a/test/files/continuations-run/function4.scala +++ /dev/null @@ -1,15 +0,0 @@ -// $Id$ - -import scala.util.continuations._ - - -object Test { - - def main(args: Array[String]): Unit = { - - val g: () => Int @cps[Int] = () => shift { k: (Int=>Int) => k(7) } - - println(reset(g())) - } - -} diff --git a/test/files/continuations-run/function5.check b/test/files/continuations-run/function5.check deleted file mode 100644 index c7930257df..0000000000 --- a/test/files/continuations-run/function5.check +++ /dev/null @@ -1 +0,0 @@ -7
\ No newline at end of file diff --git a/test/files/continuations-run/function5.scala b/test/files/continuations-run/function5.scala deleted file mode 100644 index a83eb80d08..0000000000 --- a/test/files/continuations-run/function5.scala +++ /dev/null @@ -1,15 +0,0 @@ -// $Id$ - -import scala.util.continuations._ - - -object Test { - - def main(args: Array[String]): Unit = { - - val g: () => Int @cps[Int] = () => 7 - - println(reset(g())) - } - -} diff --git a/test/files/continuations-run/function6.check b/test/files/continuations-run/function6.check deleted file mode 100644 index c7930257df..0000000000 --- a/test/files/continuations-run/function6.check +++ /dev/null @@ -1 +0,0 @@ -7
\ No newline at end of file diff --git a/test/files/continuations-run/function6.scala b/test/files/continuations-run/function6.scala deleted file mode 100644 index 13ef88bd9f..0000000000 --- a/test/files/continuations-run/function6.scala +++ /dev/null @@ -1,16 +0,0 @@ -// $Id$ - -import scala.util.continuations._ - - -object Test { - - def main(args: Array[String]): Unit = { - - val g: PartialFunction[Int, Int @cps[Int]] = { case x => 7 } - - println(reset(g(2))) - - } - -} diff --git a/test/files/continuations-run/ifelse0.scala b/test/files/continuations-run/ifelse0.scala deleted file mode 100644 index cbff72c77c..0000000000 --- a/test/files/continuations-run/ifelse0.scala +++ /dev/null @@ -1,18 +0,0 @@ -// $Id$ - -import scala.util.continuations._ - - -object Test { - - def test(x:Int) = if (x <= 7) - shift { k: (Int=>Int) => k(k(k(x))) } - else - shift { k: (Int=>Int) => k(x) } - - def main(args: Array[String]): Unit = { - println(reset(1 + test(7))) - println(reset(1 + test(8))) - } - -} diff --git a/test/files/continuations-run/ifelse1.check b/test/files/continuations-run/ifelse1.check deleted file mode 100644 index 86a3fbc0c1..0000000000 --- a/test/files/continuations-run/ifelse1.check +++ /dev/null @@ -1,4 +0,0 @@ -10 -9 -8 -11
\ No newline at end of file diff --git a/test/files/continuations-run/ifelse1.scala b/test/files/continuations-run/ifelse1.scala deleted file mode 100644 index f8e3cf2ca3..0000000000 --- a/test/files/continuations-run/ifelse1.scala +++ /dev/null @@ -1,25 +0,0 @@ -// $Id$ - -import scala.util.continuations._ - - -object Test { - - def test1(x:Int) = if (x <= 7) - shift { k: (Int=>Int) => k(k(k(x))) } - else - x - - def test2(x:Int) = if (x <= 7) - x - else - shift { k: (Int=>Int) => k(k(k(x))) } - - def main(args: Array[String]): Unit = { - println(reset(1 + test1(7))) - println(reset(1 + test1(8))) - println(reset(1 + test2(7))) - println(reset(1 + test2(8))) - } - -} diff --git a/test/files/continuations-run/ifelse2.check b/test/files/continuations-run/ifelse2.check deleted file mode 100644 index f97a95b08d..0000000000 --- a/test/files/continuations-run/ifelse2.check +++ /dev/null @@ -1,4 +0,0 @@ -abort -() -alive -() diff --git a/test/files/continuations-run/ifelse2.scala b/test/files/continuations-run/ifelse2.scala deleted file mode 100644 index f5ec864a06..0000000000 --- a/test/files/continuations-run/ifelse2.scala +++ /dev/null @@ -1,16 +0,0 @@ -// $Id$ - -import scala.util.continuations._ - - -object Test { - - def test(x:Int) = if (x <= 7) - shift { k: (Unit=>Unit) => println("abort") } - - def main(args: Array[String]): Unit = { - println(reset{ test(7); println("alive") }) - println(reset{ test(8); println("alive") }) - } - -} diff --git a/test/files/continuations-run/ifelse3.check b/test/files/continuations-run/ifelse3.check deleted file mode 100644 index 95b562c8e6..0000000000 --- a/test/files/continuations-run/ifelse3.check +++ /dev/null @@ -1,2 +0,0 @@ -6 -9 diff --git a/test/files/continuations-run/ifelse3.scala b/test/files/continuations-run/ifelse3.scala deleted file mode 100644 index 2c5b5765db..0000000000 --- a/test/files/continuations-run/ifelse3.scala +++ /dev/null @@ -1,21 +0,0 @@ -// $Id$ - -import scala.util.continuations._ - - -object Test { - - def util(x: Boolean) = shift { k: (Boolean=>Int) => k(x) } - - def test(x:Int) = if (util(x <= 7)) - x - 1 - else - x + 1 - - - def main(args: Array[String]): Unit = { - println(reset(test(7))) - println(reset(test(8))) - } - -} diff --git a/test/files/continuations-run/ifelse4.check b/test/files/continuations-run/ifelse4.check deleted file mode 100644 index 2545dd49a0..0000000000 --- a/test/files/continuations-run/ifelse4.check +++ /dev/null @@ -1,4 +0,0 @@ -10 -10 -10 -10 diff --git a/test/files/continuations-run/ifelse4.scala b/test/files/continuations-run/ifelse4.scala deleted file mode 100644 index 46ec15365e..0000000000 --- a/test/files/continuations-run/ifelse4.scala +++ /dev/null @@ -1,31 +0,0 @@ -import scala.util.continuations._ - -object Test { - def sh(x1:Int) = shift( (k: Int => Int) => k(k(k(x1)))) - - def testA(x1: Int): Int @cps[Int] = { - sh(x1) - if (x1==42) x1 else sh(x1) - } - - def testB(x1: Int): Int @cps[Int] = { - if (sh(x1)==43) x1 else x1 - } - - def testC(x1: Int): Int @cps[Int] = { - sh(x1) - if (sh(x1)==44) x1 else x1 - } - - def testD(x1: Int): Int @cps[Int] = { - sh(x1) - if (sh(x1)==45) x1 else sh(x1) - } - - def main(args: Array[String]): Unit = { - println(reset(1 + testA(7))) - println(reset(1 + testB(9))) - println(reset(1 + testC(9))) - println(reset(1 + testD(7))) - } -} diff --git a/test/files/continuations-run/implicit-infer-annotations.check b/test/files/continuations-run/implicit-infer-annotations.check deleted file mode 100644 index e8206c4319..0000000000 --- a/test/files/continuations-run/implicit-infer-annotations.check +++ /dev/null @@ -1,5 +0,0 @@ -Range(5, 6, 7, 8, 9, 10) -Range(5, 6, 7, 8, 9, 10) -15 -List(10, 1, 2, 3) -Range(5, 6, 7, 8, 9, 10) diff --git a/test/files/continuations-run/implicit-infer-annotations.scala b/test/files/continuations-run/implicit-infer-annotations.scala deleted file mode 100644 index 3f0e959f60..0000000000 --- a/test/files/continuations-run/implicit-infer-annotations.scala +++ /dev/null @@ -1,59 +0,0 @@ -import annotation._ - -object A { - class foo[-B,+C] extends StaticAnnotation with TypeConstraint - - def shift[A, B, C](fun: (A => B) => C): A @foo[B, C] = ??? - def reset[A, C](ctx: => (A @foo[A, C])): C = ??? - - def m1 = reset { shift { f: (Int => Range) => f(5) }.to(10) } -} - -object B { - import scala.util.continuations._ - - def m1 = reset { shift { f: (Int => Range) => f(5) }.to(10) } - def m2 = reset { val a = shift { f: (Int => Range) => f(5) } ; a.to(10) } - - val x1 = reset{ - shift{ cont: (Int => Range) => - cont(5) - }.to(10) - } - - val x2 = reset{ - val a = shift{ cont: (Int => Range) => - cont(5) - } - a.to(10) - } // x is now Range(5, 6, 7, 8, 9, 10) - - val x3 = reset{ - shift{ cont: (Int => Int) => - cont(5) - } + 10 - } // x is now 15 - - val x4 = reset{ - 10 :: shift{ cont: (List[Int] => List[Int]) => - cont(List(1, 2, 3)) - } - } // x is List(10, 1, 2, 3) - - val x5 = reset{ - new scala.runtime.RichInt(shift{ cont: (Int => Range) => - cont(5) - }) to 10 - } -} - -object Test { - def main(args: Array[String]): Unit = { - import B._ - println(x1) - println(x2) - println(x3) - println(x4) - println(x5) - } -} diff --git a/test/files/continuations-run/infer1.scala b/test/files/continuations-run/infer1.scala deleted file mode 100644 index 76f746da57..0000000000 --- a/test/files/continuations-run/infer1.scala +++ /dev/null @@ -1,33 +0,0 @@ -// $Id$ - -import scala.util.continuations._ - - -object Test { - - def test(x: => Int @cpsParam[String,Int]) = 7 - - def test2() = { - val x = shift { k: (Int => String) => 9 } - x - } - - def test3(x: => Int @cpsParam[Int,Int]) = 7 - - - def util() = shift { k: (String => String) => "7" } - - def main(args: Array[String]): Unit = { - test { shift { k: (Int => String) => 9 } } - test { shift { k: (Int => String) => 9 }; 2 } -// test { shift { k: (Int => String) => 9 }; util() } <-- doesn't work - test { shift { k: (Int => String) => 9 }; util(); 2 } - - - test { shift { k: (Int => String) => 9 }; { test3(0); 2 } } - - test3 { { test3(0); 2 } } - - } - -} diff --git a/test/files/continuations-run/match0.check b/test/files/continuations-run/match0.check deleted file mode 100644 index f8bc79860d..0000000000 --- a/test/files/continuations-run/match0.check +++ /dev/null @@ -1,2 +0,0 @@ -10 -9
\ No newline at end of file diff --git a/test/files/continuations-run/match0.scala b/test/files/continuations-run/match0.scala deleted file mode 100644 index 8769ed9fcb..0000000000 --- a/test/files/continuations-run/match0.scala +++ /dev/null @@ -1,18 +0,0 @@ -// $Id$ - -import scala.util.continuations._ - - -object Test { - - def test(x:Int) = x match { - case 7 => shift { k: (Int=>Int) => k(k(k(x))) } - case 8 => shift { k: (Int=>Int) => k(x) } - } - - def main(args: Array[String]): Unit = { - println(reset(1 + test(7))) - println(reset(1 + test(8))) - } - -} diff --git a/test/files/continuations-run/match1.check b/test/files/continuations-run/match1.check deleted file mode 100644 index 73053d3f4f..0000000000 --- a/test/files/continuations-run/match1.check +++ /dev/null @@ -1,2 +0,0 @@ -10 -9 diff --git a/test/files/continuations-run/match1.scala b/test/files/continuations-run/match1.scala deleted file mode 100644 index b89fb706b0..0000000000 --- a/test/files/continuations-run/match1.scala +++ /dev/null @@ -1,18 +0,0 @@ -// $Id$ - -import scala.util.continuations._ - - -object Test { - - def test(x:Int) = x match { - case 7 => shift { k: (Int=>Int) => k(k(k(x))) } - case _ => x - } - - def main(args: Array[String]): Unit = { - println(reset(1 + test(7))) - println(reset(1 + test(8))) - } - -} diff --git a/test/files/continuations-run/match2.check b/test/files/continuations-run/match2.check deleted file mode 100644 index cbf91349cc..0000000000 --- a/test/files/continuations-run/match2.check +++ /dev/null @@ -1,2 +0,0 @@ -B -B diff --git a/test/files/continuations-run/match2.scala b/test/files/continuations-run/match2.scala deleted file mode 100644 index 002d9b52dd..0000000000 --- a/test/files/continuations-run/match2.scala +++ /dev/null @@ -1,26 +0,0 @@ -// $Id$ - -import scala.util.continuations._ - - -object Test { - - def test1() = { - val (a, b) = shift { k: (((String,String)) => String) => k("A","B") } - b - } - - case class Elem[T,U](a: T, b: U) - - def test2() = { - val Elem(a,b) = shift { k: (Elem[String,String] => String) => k(Elem("A","B")) } - b - } - - - def main(args: Array[String]): Unit = { - println(reset(test1())) - println(reset(test2())) - } - -}
\ No newline at end of file diff --git a/test/files/continuations-run/patvirt.check b/test/files/continuations-run/patvirt.check deleted file mode 100644 index b5fa014ad3..0000000000 --- a/test/files/continuations-run/patvirt.check +++ /dev/null @@ -1,2 +0,0 @@ -10 -11 diff --git a/test/files/continuations-run/patvirt.scala b/test/files/continuations-run/patvirt.scala deleted file mode 100644 index cfbdda538d..0000000000 --- a/test/files/continuations-run/patvirt.scala +++ /dev/null @@ -1,32 +0,0 @@ -import scala.util.continuations._ - -object Test { - def sh(x1:Int) = shift( (k: Int => Int) => k(k(k(x1)))) - - def test(x1: Int) = { - val o7 = { - val o6 = { - val o3 = - if (7 == x1) Some(x1) - else None - - if (o3.isEmpty) None - else Some(sh(x1)) - } - if (o6.isEmpty) { - val o5 = - if (8 == x1) Some(x1) - else None - - if (o5.isEmpty) None - else Some(sh(x1)) - } else o6 - } - o7.get - } - - def main(args: Array[String]): Unit = { - println(reset(1 + test(7))) - println(reset(1 + test(8))) - } -} diff --git a/test/files/continuations-run/shift-pct.check b/test/files/continuations-run/shift-pct.check deleted file mode 100644 index fb190e770a..0000000000 --- a/test/files/continuations-run/shift-pct.check +++ /dev/null @@ -1,25 +0,0 @@ -d = 1, d2 = 1.0, pct = 1.000 -d = 2, d2 = 4.0, pct = 0.500 -d = 3, d2 = 9.0, pct = 0.333 -d = 4, d2 = 16.0, pct = 0.250 -d = 5, d2 = 25.0, pct = 0.200 -d = 6, d2 = 36.0, pct = 0.167 -d = 7, d2 = 49.0, pct = 0.143 -d = 8, d2 = 64.0, pct = 0.125 -d = 9, d2 = 81.0, pct = 0.111 -d = 10, d2 = 100.0, pct = 0.100 -d = 11, d2 = 121.0, pct = 0.091 -d = 12, d2 = 144.0, pct = 0.083 -d = 13, d2 = 169.0, pct = 0.077 -d = 14, d2 = 196.0, pct = 0.071 -d = 15, d2 = 225.0, pct = 0.067 -d = 16, d2 = 256.0, pct = 0.063 -d = 17, d2 = 289.0, pct = 0.059 -d = 18, d2 = 324.0, pct = 0.056 -d = 19, d2 = 361.0, pct = 0.053 -d = 20, d2 = 400.0, pct = 0.050 -d = 21, d2 = 441.0, pct = 0.048 -d = 22, d2 = 484.0, pct = 0.045 -d = 23, d2 = 529.0, pct = 0.043 -d = 24, d2 = 576.0, pct = 0.042 -d = 25, d2 = 625.0, pct = 0.040 diff --git a/test/files/continuations-run/shift-pct.scala b/test/files/continuations-run/shift-pct.scala deleted file mode 100644 index 7ef9922168..0000000000 --- a/test/files/continuations-run/shift-pct.scala +++ /dev/null @@ -1,30 +0,0 @@ -import scala.util.continuations._ - -object Test { - abstract class IfReturnRepro { - def s1: Double @cpsParam[Any, Unit] - def s2: Double @cpsParam[Any, Unit] - - def p(i: Int): Double @cpsParam[Unit, Any] = { - val px = s1 - val pct = if (px > 100) px else px / s2 - println("pct = %.3f".format(pct)) - pct - } - } - - def main(args: Array[String]) : Unit = { - var d: Double = 0d - def d2 = d * d - - val irr = new IfReturnRepro { - def s1 = shift(f => f(d)) - def s2 = shift(f => f(d2)) - } - 1 to 25 foreach { i => - d = i - print("d = " + i + ", d2 = " + d2 + ", ") - run(irr p i) - } - } -} diff --git a/test/files/continuations-run/t1807.check b/test/files/continuations-run/t1807.check deleted file mode 100644 index 56a6051ca2..0000000000 --- a/test/files/continuations-run/t1807.check +++ /dev/null @@ -1 +0,0 @@ -1
\ No newline at end of file diff --git a/test/files/continuations-run/t1807.scala b/test/files/continuations-run/t1807.scala deleted file mode 100644 index 278b3a9936..0000000000 --- a/test/files/continuations-run/t1807.scala +++ /dev/null @@ -1,14 +0,0 @@ -// $Id$ - -import scala.util.continuations._ - - -object Test { - def main(args: Array[String]): Unit = { - val z = reset { - val f: (() => Int @cps[Int]) = () => 1 - f() - } - println(z) - } -}
\ No newline at end of file diff --git a/test/files/continuations-run/t1808.scala b/test/files/continuations-run/t1808.scala deleted file mode 100644 index 125c7c1cdf..0000000000 --- a/test/files/continuations-run/t1808.scala +++ /dev/null @@ -1,10 +0,0 @@ -// $Id$ - -import scala.util.continuations._ - - -object Test { - def main(args: Array[String]): Unit = { - reset0 { 0 } - } -}
\ No newline at end of file diff --git a/test/files/continuations-run/t1820.scala b/test/files/continuations-run/t1820.scala deleted file mode 100644 index 7de6ccabef..0000000000 --- a/test/files/continuations-run/t1820.scala +++ /dev/null @@ -1,14 +0,0 @@ -// $Id$ - -import scala.util.continuations._ - - -object Test { - def shifted: Unit @suspendable = shift { (k: Unit => Unit) => () } - def test1(b: => Boolean) = { - reset { - if (b) shifted - } - } - def main(args: Array[String]): Unit = test1(true) -} diff --git a/test/files/continuations-run/t1821.check b/test/files/continuations-run/t1821.check deleted file mode 100644 index f7b76115db..0000000000 --- a/test/files/continuations-run/t1821.check +++ /dev/null @@ -1,4 +0,0 @@ -() -() -() -()
\ No newline at end of file diff --git a/test/files/continuations-run/t1821.scala b/test/files/continuations-run/t1821.scala deleted file mode 100644 index 55bf7b6f12..0000000000 --- a/test/files/continuations-run/t1821.scala +++ /dev/null @@ -1,20 +0,0 @@ -// $Id$ - -import scala.util.continuations._ - - -object Test { - def suspended[A](x: A): A @suspendable = x - def test1[A](x: A): A @suspendable = suspended(x) match { case x => x } - def test2[A](x: List[A]): A @suspendable = suspended(x) match { case List(x) => x } - - def test3[A](x: A): A @suspendable = x match { case x => x } - def test4[A](x: List[A]): A @suspendable = x match { case List(x) => x } - - def main(args: Array[String]) { - println(reset(test1())) - println(reset(test2(List(())))) - println(reset(test3())) - println(reset(test4(List(())))) - } -} diff --git a/test/files/continuations-run/t2864.check b/test/files/continuations-run/t2864.check deleted file mode 100644 index d411bb7c1a..0000000000 --- a/test/files/continuations-run/t2864.check +++ /dev/null @@ -1 +0,0 @@ -400 diff --git a/test/files/continuations-run/t2864.scala b/test/files/continuations-run/t2864.scala deleted file mode 100644 index 7a2579e45c..0000000000 --- a/test/files/continuations-run/t2864.scala +++ /dev/null @@ -1,30 +0,0 @@ -import scala.util.continuations._ -object Test { - - def double[B](n : Int)(k : Int => B) : B = k(n * 2) - - def main(args : Array[String]) { - reset { - val result1 = shift(double[Unit](100)) - val result2 = shift(double[Unit](result1)) - println(result2) - } - } - - def foo: Int @cps[Int] = { - val a0 = shift((k:Int=>Int) => k(0)) - val x0 = 2 - val a1 = shift((k:Int=>Int) => x0) - 0 - } - -/* - def bar: ControlContext[Int,Int,Int] = { - shiftR((k:Int=>Int) => k(0)).flatMap { a0 => - val x0 = 2 - shiftR((k:Int=>Int) => x0).map { a1 => - 0 - }} - } -*/ -}
\ No newline at end of file diff --git a/test/files/continuations-run/t2934.check b/test/files/continuations-run/t2934.check deleted file mode 100644 index a92586538e..0000000000 --- a/test/files/continuations-run/t2934.check +++ /dev/null @@ -1 +0,0 @@ -List(3, 4, 5) diff --git a/test/files/continuations-run/t2934.scala b/test/files/continuations-run/t2934.scala deleted file mode 100644 index a1b8ca9e04..0000000000 --- a/test/files/continuations-run/t2934.scala +++ /dev/null @@ -1,10 +0,0 @@ -import scala.util.continuations._ - -object Test { - def main(args : Array[String]) { - println(reset { - val x = shift(List(1,2,3).flatMap[Int, List[Int]]) - List(x + 2) - }) - } -} diff --git a/test/files/continuations-run/t3199.check b/test/files/continuations-run/t3199.check deleted file mode 100644 index a065247b8c..0000000000 --- a/test/files/continuations-run/t3199.check +++ /dev/null @@ -1 +0,0 @@ -Right(7) diff --git a/test/files/continuations-run/t3199.scala b/test/files/continuations-run/t3199.scala deleted file mode 100644 index 2cb73c005a..0000000000 --- a/test/files/continuations-run/t3199.scala +++ /dev/null @@ -1,20 +0,0 @@ -import _root_.scala.collection.Seq -import _root_.scala.util.control.Exception -import _root_.scala.util.continuations._ - -object Test { - - trait AbstractResource[+R <: AnyRef] { - def reflect[B] : R @cpsParam[B,Either[Throwable, B]] = shift(acquireFor) - def acquireFor[B](f : R => B) : Either[Throwable, B] = { - import Exception._ - catching(List(classOf[Throwable]) : _*) either (f(null.asInstanceOf[R])) - } - } - - def main(args: Array[String]) : Unit = { - val x = new AbstractResource[String] { } - val result = x.acquireFor( x => 7 ) - println(result) - } - } diff --git a/test/files/continuations-run/t3223.check b/test/files/continuations-run/t3223.check deleted file mode 100644 index ec635144f6..0000000000 --- a/test/files/continuations-run/t3223.check +++ /dev/null @@ -1 +0,0 @@ -9 diff --git a/test/files/continuations-run/t3223.scala b/test/files/continuations-run/t3223.scala deleted file mode 100644 index 75613fe5c7..0000000000 --- a/test/files/continuations-run/t3223.scala +++ /dev/null @@ -1,19 +0,0 @@ -import scala.util.continuations._ -object Test { - - def foo(x:Int) = { - try { - throw new Exception - shiftUnit0[Int,Int](7) - } catch { - case ex: Throwable => - val g = (a:Int)=>a - 9 - } - } - - def main(args: Array[String]) { - println(reset(foo(0))) - } - -} diff --git a/test/files/continuations-run/t3225.check b/test/files/continuations-run/t3225.check deleted file mode 100644 index df1a8a9ce4..0000000000 --- a/test/files/continuations-run/t3225.check +++ /dev/null @@ -1,12 +0,0 @@ -8 -8 -9 -9 -8 -9 -8 -8 -9 -9 -8 -9 diff --git a/test/files/continuations-run/t3225.scala b/test/files/continuations-run/t3225.scala deleted file mode 100644 index a0c9c91985..0000000000 --- a/test/files/continuations-run/t3225.scala +++ /dev/null @@ -1,56 +0,0 @@ -// $Id$ - -import scala.util.continuations._ - - -object Test { - - class Bla { - val x = 8 - def y[T] = 9 - } - -/* - def bla[A] = shift { k:(Bla=>A) => k(new Bla) } -*/ - - def bla1 = shift { k:(Bla=>Bla) => k(new Bla) } - def bla2 = shift { k:(Bla=>Int) => k(new Bla) } - - def fooA = bla2.x - def fooB[T] = bla2.y[T] - - def testMono() = { - println(reset(bla1).x) - println(reset(bla2.x)) - println(reset(bla2.y[Int])) - println(reset(bla2.y)) - println(reset(fooA)) - println(reset(fooB)) - 0 - } - - def blaX[A] = shift { k:(Bla=>A) => k(new Bla) } - - def fooX[A] = blaX[A].x - def fooY[A] = blaX[A].y[A] - - def testPoly() = { - println(reset(blaX[Bla]).x) - println(reset(blaX[Int].x)) - println(reset(blaX[Int].y[Int])) - println(reset(blaX[Int].y)) - println(reset(fooX[Int])) - println(reset(fooY[Int])) - 0 - } - - - // TODO: check whether this also applies to a::shift { k => ... } - - def main(args: Array[String]) { - testMono() - testPoly() - } - -} diff --git a/test/files/continuations-run/t3501.check b/test/files/continuations-run/t3501.check deleted file mode 100644 index 08adcfe27a..0000000000 --- a/test/files/continuations-run/t3501.check +++ /dev/null @@ -1,5 +0,0 @@ -42 -42 -42 -42 -42 diff --git a/test/files/continuations-run/t3501.scala b/test/files/continuations-run/t3501.scala deleted file mode 100644 index c43b3322be..0000000000 --- a/test/files/continuations-run/t3501.scala +++ /dev/null @@ -1,15 +0,0 @@ -import scala.util.continuations._ - -object Test { - def capture(): Int @suspendable = 42 - - def main(args: Array[String]): Unit = reset { - var i = 0 - while (i < 5) { - i += 1 - val y = capture() - val s = y - println(s) - } - } -} diff --git a/test/files/continuations-run/t5314-2.check b/test/files/continuations-run/t5314-2.check deleted file mode 100644 index 35b3c93780..0000000000 --- a/test/files/continuations-run/t5314-2.check +++ /dev/null @@ -1,5 +0,0 @@ -8 -hi -8 -from try -8 diff --git a/test/files/continuations-run/t5314-2.scala b/test/files/continuations-run/t5314-2.scala deleted file mode 100644 index e7e5d46f03..0000000000 --- a/test/files/continuations-run/t5314-2.scala +++ /dev/null @@ -1,44 +0,0 @@ -import scala.util.continuations._ - -class ReturnRepro { - def s1: Int @cps[Any] = shift { k => k(5) } - def caller = reset { println(p(3)) } - def caller2 = reset { println(p2(3)) } - def caller3 = reset { println(p3(3)) } - - def p(i: Int): Int @cps[Any] = { - val v= s1 + 3 - return v - } - - def p2(i: Int): Int @cps[Any] = { - val v = s1 + 3 - if (v > 0) { - println("hi") - return v - } else { - println("hi") - return 8 - } - } - - def p3(i: Int): Int @cps[Any] = { - val v = s1 + 3 - try { - println("from try") - return v - } catch { - case e: Exception => - println("from catch") - return 7 - } - } - -} - -object Test extends App { - val repro = new ReturnRepro - repro.caller - repro.caller2 - repro.caller3 -} diff --git a/test/files/continuations-run/t5314-3.check b/test/files/continuations-run/t5314-3.check deleted file mode 100644 index 71489f097c..0000000000 --- a/test/files/continuations-run/t5314-3.check +++ /dev/null @@ -1,4 +0,0 @@ -enter return expr -8 -hi -8 diff --git a/test/files/continuations-run/t5314-3.scala b/test/files/continuations-run/t5314-3.scala deleted file mode 100644 index c2fe8f6f87..0000000000 --- a/test/files/continuations-run/t5314-3.scala +++ /dev/null @@ -1,27 +0,0 @@ -import scala.util.continuations._ - -class ReturnRepro { - def s1: Int @cpsParam[Any, Unit] = shift { k => k(5) } - def caller = reset { println(p(3)) } - def caller2 = reset { println(p2(3)) } - - def p(i: Int): Int @cpsParam[Unit, Any] = { - val v= s1 + 3 - return { println("enter return expr"); v } - } - - def p2(i: Int): Int @cpsParam[Unit, Any] = { - val v = s1 + 3 - if (v > 0) { - return { println("hi"); v } - } else { - return { println("hi"); 8 } - } - } -} - -object Test extends App { - val repro = new ReturnRepro - repro.caller - repro.caller2 -} diff --git a/test/files/continuations-run/t5314-with-if.check b/test/files/continuations-run/t5314-with-if.check deleted file mode 100644 index 7f8f011eb7..0000000000 --- a/test/files/continuations-run/t5314-with-if.check +++ /dev/null @@ -1 +0,0 @@ -7 diff --git a/test/files/continuations-run/t5314-with-if.scala b/test/files/continuations-run/t5314-with-if.scala deleted file mode 100644 index 5840199a3c..0000000000 --- a/test/files/continuations-run/t5314-with-if.scala +++ /dev/null @@ -1,17 +0,0 @@ -import scala.util.continuations._ - -object Test extends App { - - def foo(x:Int): Int @cps[Int] = 7 - - def bar(x:Int): Int @cps[Int] = { - val v = foo(x) - if (v > 0) - return v - else - return 10 - } - - println(reset { bar(10) }) - -} diff --git a/test/files/continuations-run/t5314.check b/test/files/continuations-run/t5314.check deleted file mode 100644 index 61f5b25dc7..0000000000 --- a/test/files/continuations-run/t5314.check +++ /dev/null @@ -1,14 +0,0 @@ -t5314.scala:34: warning: expression 7 is cps-transformed unexpectedly - def bar3(x:Int): Int @cps[Int] = { foo2(x); if (x == 7) return 7 else return foo2(x) } - ^ -t5314.scala:35: warning: expression 7 is cps-transformed unexpectedly - def bar4(x:Int): Int @cps[Int] = { foo2(x); if (x == 7) return 7 else foo2(x) } - ^ -7 -7 -7 -8 -8 -hi -8 -8 diff --git a/test/files/continuations-run/t5314.scala b/test/files/continuations-run/t5314.scala deleted file mode 100644 index e448d8558d..0000000000 --- a/test/files/continuations-run/t5314.scala +++ /dev/null @@ -1,52 +0,0 @@ -import scala.util.continuations._ - -class ReturnRepro { - def s1: Int @cpsParam[Any, Unit] = shift { k => k(5) } - def caller = reset { println(p(3)) } - def caller2 = reset { println(p2(3)) } - - def p(i: Int): Int @cpsParam[Unit, Any] = { - val v= s1 + 3 - return v - } - - def p2(i: Int): Int @cpsParam[Unit, Any] = { - val v = s1 + 3 - if (v > 0) { - println("hi") - return v - } else { - println("hi") - return 8 - } - } -} - -object Test extends App { - def foo(x:Int): Int @cps[Int] = shift { k => k(x) } - - def bar(x:Int): Int @cps[Int] = return foo(x) - - def nocps(x: Int): Int = { return x; x } - - def foo2(x:Int): Int @cps[Int] = 7 - def bar2(x:Int): Int @cps[Int] = { foo2(x); return 7 } - def bar3(x:Int): Int @cps[Int] = { foo2(x); if (x == 7) return 7 else return foo2(x) } - def bar4(x:Int): Int @cps[Int] = { foo2(x); if (x == 7) return 7 else foo2(x) } - def bar5(x:Int): Int @cps[Int] = { foo2(x); if (x == 7) return 7 else 8 } - println(reset { bar2(10) }) - println(reset { bar3(10) }) - println(reset { bar4(10) }) - println(reset { bar5(10) }) - - /* original test case */ - val repro = new ReturnRepro - repro.caller - repro.caller2 - - reset { - val res = bar(8) - println(res) - res - } -} diff --git a/test/files/continuations-run/t5472.check b/test/files/continuations-run/t5472.check deleted file mode 100644 index 2468b6b27d..0000000000 --- a/test/files/continuations-run/t5472.check +++ /dev/null @@ -1,25 +0,0 @@ -t5472.scala:12: warning: expression case4(){ - if (x1.ne(null)) - matchEnd3(true) - else - case5() -} is cps-transformed unexpectedly - (location, accessors) <- new ContinuationizedParallelIterable(map) - ^ -t5472.scala:12: warning: expression case5(){ - matchEnd3(false) -} is cps-transformed unexpectedly - (location, accessors) <- new ContinuationizedParallelIterable(map) - ^ -t5472.scala:12: warning: expression matchEnd3(x: Boolean){ - x -} is cps-transformed unexpectedly - (location, accessors) <- new ContinuationizedParallelIterable(map) - ^ -t5472.scala:12: warning: expression matchEnd3(x: Int){ - x -} is cps-transformed unexpectedly - (location, accessors) <- new ContinuationizedParallelIterable(map) - ^ -warning: there were 1 deprecation warning(s); re-run with -deprecation for details -List(23, 23) diff --git a/test/files/continuations-run/t5472.scala b/test/files/continuations-run/t5472.scala deleted file mode 100644 index 060d267544..0000000000 --- a/test/files/continuations-run/t5472.scala +++ /dev/null @@ -1,91 +0,0 @@ -import scala.annotation._ -import scala.util.continuations._ -import java.util.concurrent.atomic._ - -@deprecated("Suppress warnings", since="2.11") -object Test { - def main(args: Array[String]) { - val map = Map("foo" -> 1, "bar" -> 2) - reset { - val mapped = - for { - (location, accessors) <- new ContinuationizedParallelIterable(map) - } yield { - shiftUnit0[Int, Unit](23) - } - println(mapped.toList) - } - } - -final class ContinuationizedParallelIterable[+A](protected val underline: Iterable[A]) { - def toList = underline.toList.sortBy(_.toString) - - final def filter(p: A => Boolean @suspendable): ContinuationizedParallelIterable[A] @suspendable = - shift( - new AtomicInteger(1) with ((ContinuationizedParallelIterable[A] => Unit) => Unit) { - private val results = new AtomicReference[List[A]](Nil) - - @tailrec - private def add(element: A) { - val old = results.get - if (!results.compareAndSet(old, element :: old)) { - add(element) - } - } - - override final def apply(continue: ContinuationizedParallelIterable[A] => Unit) { - for (element <- underline) { - super.incrementAndGet() - reset { - val pass = p(element) - if (pass) { - add(element) - } - if (super.decrementAndGet() == 0) { - continue(new ContinuationizedParallelIterable(results.get)) - } - } - } - if (super.decrementAndGet() == 0) { - continue(new ContinuationizedParallelIterable(results.get)) - } - } - }) - - final def foreach[U](f: A => U @suspendable): Unit @suspendable = - shift( - new AtomicInteger(1) with ((Unit => Unit) => Unit) { - override final def apply(continue: Unit => Unit) { - for (element <- underline) { - super.incrementAndGet() - reset { - f(element) - if (super.decrementAndGet() == 0) { - continue() - } - } - } - if (super.decrementAndGet() == 0) { - continue() - } - } - }) - - final def map[B: Manifest](f: A => B @suspendable): ContinuationizedParallelIterable[B] @suspendable = - shift( - new AtomicInteger(underline.size) with ((ContinuationizedParallelIterable[B] => Unit) => Unit) { - override final def apply(continue: ContinuationizedParallelIterable[B] => Unit) { - val results = new Array[B](super.get) - for ((element, i) <- underline.view.zipWithIndex) { - reset { - val result = f(element) - results(i) = result - if (super.decrementAndGet() == 0) { - continue(new ContinuationizedParallelIterable(results)) - } - } - } - } - }) -} -} diff --git a/test/files/continuations-run/t5506.check b/test/files/continuations-run/t5506.check deleted file mode 100644 index 38b76c63f1..0000000000 --- a/test/files/continuations-run/t5506.check +++ /dev/null @@ -1,7 +0,0 @@ -List(1, 2, 3) -List(1, 2, 3) -List(1, 2, 3) -List(1, 2, 3) -List(1, 2, 3) -List(1, 2, 3) -List(1, 2, 3) diff --git a/test/files/continuations-run/t5506.scala b/test/files/continuations-run/t5506.scala deleted file mode 100644 index 08f64c9db1..0000000000 --- a/test/files/continuations-run/t5506.scala +++ /dev/null @@ -1,58 +0,0 @@ -import scala.util.continuations._ - -object Test { - -def g: List[Int] @suspendable = List(1,2,3) - -def fp10: List[Int] @suspendable = { -g.map(x => x) -} - -def fp11: List[Int] @suspendable = { -val z = g.map(x => x) -z -} - - -def fp12: List[Int] @suspendable = { -val z = List(1,2,3) -z.map(x => x) -} - - - -def fp20: List[Int] @suspendable = { -g.map[Int,List[Int]](x => x) -} - - -def fp21: List[Int] @suspendable = { -val z = g.map[Int,List[Int]](x => x) -z -} - -def fp22: List[Int] @suspendable = { -val z = g.map[Int,List[Int]](x => x)(List.canBuildFrom[Int]) -z -} - -def fp23: List[Int] @suspendable = { -val z = g.map(x => x)(List.canBuildFrom[Int]) -z -} - - -def main(args: Array[String]) { - reset { - println(fp10) - println(fp11) - println(fp12) - - println(fp20) - println(fp21) - println(fp22) - println(fp23) - } -} - -} diff --git a/test/files/continuations-run/t5538.check b/test/files/continuations-run/t5538.check deleted file mode 100644 index d9d873663d..0000000000 --- a/test/files/continuations-run/t5538.check +++ /dev/null @@ -1,2 +0,0 @@ -warning: there were 1 feature warning(s); re-run with -feature for details -Future(Future(Future(Future(Future(List(1, 2, 3, 4, 5)))))) diff --git a/test/files/continuations-run/t5538.scala b/test/files/continuations-run/t5538.scala deleted file mode 100644 index 9f01624da1..0000000000 --- a/test/files/continuations-run/t5538.scala +++ /dev/null @@ -1,52 +0,0 @@ -import scala.util.continuations._ -import scala.collection.generic.CanBuildFrom - -import scala.language.{ implicitConversions } - -object Test { - - class ExecutionContext - - implicit def defaultExecutionContext = new ExecutionContext - - case class Future[+T](x:T) { - final def map[A](f: T => A): Future[A] = new Future[A](f(x)) - final def flatMap[A](f: T => Future[A]): Future[A] = f(x) - } - - class PromiseStream[A] { - override def toString = xs.toString - - var xs: List[A] = Nil - - final def +=(elem: A): this.type = { xs :+= elem; this } - - final def ++=(elem: Traversable[A]): this.type = { xs ++= elem; this } - - final def <<(elem: Future[A]): PromiseStream[A] @cps[Future[Any]] = - shift { cont: (PromiseStream[A] => Future[Any]) => elem map (a => cont(this += a)) } - - final def <<(elem1: Future[A], elem2: Future[A], elems: Future[A]*): PromiseStream[A] @cps[Future[Any]] = - shift { cont: (PromiseStream[A] => Future[Any]) => Future.flow(this << elem1 << elem2 <<< Future.sequence(elems.toSeq)) map cont } - - final def <<<(elems: Traversable[A]): PromiseStream[A] @cps[Future[Any]] = - shift { cont: (PromiseStream[A] => Future[Any]) => cont(this ++= elems) } - - final def <<<(elems: Future[Traversable[A]]): PromiseStream[A] @cps[Future[Any]] = - shift { cont: (PromiseStream[A] => Future[Any]) => elems map (as => cont(this ++= as)) } - } - - object Future { - - def sequence[A, M[_] <: Traversable[_]](in: M[Future[A]])(implicit cbf: CanBuildFrom[M[Future[A]], A, M[A]], executor: ExecutionContext): Future[M[A]] = - new Future(in.asInstanceOf[Traversable[Future[A]]].map((f:Future[A])=>f.x)(cbf.asInstanceOf[CanBuildFrom[Traversable[Future[A]], A, M[A]]])) - - def flow[A](body: => A @cps[Future[Any]])(implicit executor: ExecutionContext): Future[A] = reset(Future(body)).asInstanceOf[Future[A]] - - } - - def main(args: Array[String]) { - val p = new PromiseStream[Int] - println(Future.flow(p << (Future(1), Future(2), Future(3), Future(4), Future(5)))) - } -} diff --git a/test/files/continuations-run/trycatch0.check b/test/files/continuations-run/trycatch0.check deleted file mode 100644 index 36806909d0..0000000000 --- a/test/files/continuations-run/trycatch0.check +++ /dev/null @@ -1,2 +0,0 @@ -10 -10
\ No newline at end of file diff --git a/test/files/continuations-run/trycatch0.scala b/test/files/continuations-run/trycatch0.scala deleted file mode 100644 index d0b4a52a30..0000000000 --- a/test/files/continuations-run/trycatch0.scala +++ /dev/null @@ -1,25 +0,0 @@ -// $Id$ - -import scala.util.continuations._ - -object Test { - - def foo = try { - shift((k: Int=>Int) => k(7)) - } catch { - case ex: Throwable => - 9 - } - - def bar = try { - 7 - } catch { - case ex: Throwable => - shiftUnit0[Int,Int](9) - } - - def main(args: Array[String]): Unit = { - println(reset { foo + 3 }) - println(reset { bar + 3 }) - } -} diff --git a/test/files/continuations-run/trycatch1.check b/test/files/continuations-run/trycatch1.check deleted file mode 100644 index 061ecdcd54..0000000000 --- a/test/files/continuations-run/trycatch1.check +++ /dev/null @@ -1,10 +0,0 @@ -trycatch1.scala:34: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses - 7 - ^ -trycatch1.scala:18: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses - shift((k: Int=>Int) => k(7)) - ^ -12 -12 -12 -12 diff --git a/test/files/continuations-run/trycatch1.scala b/test/files/continuations-run/trycatch1.scala deleted file mode 100644 index 2a8db72a8b..0000000000 --- a/test/files/continuations-run/trycatch1.scala +++ /dev/null @@ -1,48 +0,0 @@ -// $Id$ - -import scala.util.continuations._ - -object Test { - - def fatal: Int = throw new Exception() - - def foo1 = try { - fatal - shift((k: Int=>Int) => k(7)) - } catch { - case ex: Throwable => - 9 - } - - def foo2 = try { - shift((k: Int=>Int) => k(7)) - fatal - } catch { - case ex: Throwable => - 9 - } - - def bar1 = try { - fatal - 7 - } catch { - case ex: Throwable => - shiftUnit0[Int,Int](9) // regular shift causes no-symbol doesn't have owner - } - - def bar2 = try { - 7 - fatal - } catch { - case ex: Throwable => - shiftUnit0[Int,Int](9) // regular shift causes no-symbol doesn't have owner - } - - def main(args: Array[String]): Unit = { - println(reset { foo1 + 3 }) - println(reset { foo2 + 3 }) - println(reset { bar1 + 3 }) - println(reset { bar2 + 3 }) - } - -} diff --git a/test/files/continuations-run/while0.check b/test/files/continuations-run/while0.check deleted file mode 100644 index d58c55a31d..0000000000 --- a/test/files/continuations-run/while0.check +++ /dev/null @@ -1 +0,0 @@ -9000 diff --git a/test/files/continuations-run/while0.scala b/test/files/continuations-run/while0.scala deleted file mode 100644 index e21745374e..0000000000 --- a/test/files/continuations-run/while0.scala +++ /dev/null @@ -1,22 +0,0 @@ -// $Id$ - -import scala.util.continuations._ - - -object Test { - - def foo(): Int @cps[Unit] = 2 - - def test(): Unit @cps[Unit] = { - var x = 0 - while (x < 9000) { // pick number large enough to require tail-call opt - x += foo() - } - println(x) - } - - def main(args: Array[String]): Unit = { - reset(test()) - } - -} diff --git a/test/files/continuations-run/while1.check b/test/files/continuations-run/while1.check deleted file mode 100644 index 3d5f0b9a46..0000000000 --- a/test/files/continuations-run/while1.check +++ /dev/null @@ -1,11 +0,0 @@ -up -up -up -up -up -10 -down -down -down -down -down diff --git a/test/files/continuations-run/while1.scala b/test/files/continuations-run/while1.scala deleted file mode 100644 index 7ba9f94881..0000000000 --- a/test/files/continuations-run/while1.scala +++ /dev/null @@ -1,22 +0,0 @@ -// $Id$ - -import scala.util.continuations._ - - -object Test { - - def foo(): Int @cps[Unit] = shift { k => println("up"); k(2); println("down") } - - def test(): Unit @cps[Unit] = { - var x = 0 - while (x < 9) { - x += foo() - } - println(x) - } - - def main(args: Array[String]): Unit = { - reset(test()) - } - -} diff --git a/test/files/continuations-run/while2.check b/test/files/continuations-run/while2.check deleted file mode 100644 index 9fe515181b..0000000000 --- a/test/files/continuations-run/while2.check +++ /dev/null @@ -1,19 +0,0 @@ -up -up -up -up -up -up -up -up -up -9000 -down -down -down -down -down -down -down -down -down diff --git a/test/files/continuations-run/while2.scala b/test/files/continuations-run/while2.scala deleted file mode 100644 index 3dbf2ad2fe..0000000000 --- a/test/files/continuations-run/while2.scala +++ /dev/null @@ -1,23 +0,0 @@ -// $Id$ - -import scala.util.continuations._ - - -object Test { - - def foo1(): Int @cps[Unit] = 2 - def foo2(): Int @cps[Unit] = shift { k => println("up"); k(2); println("down") } - - def test(): Unit @cps[Unit] = { - var x = 0 - while (x < 9000) { // pick number large enough to require tail-call opt - x += (if (x % 1000 != 0) foo1() else foo2()) - } - println(x) - } - - def main(args: Array[String]): Unit = { - reset(test()) - } - -} diff --git a/test/files/continuations-run/z1673.scala b/test/files/continuations-run/z1673.scala deleted file mode 100644 index 716b374860..0000000000 --- a/test/files/continuations-run/z1673.scala +++ /dev/null @@ -1,31 +0,0 @@ -import scala.util.continuations._ - -class MatchRepro { - def s: String @cps[Any] = shift { k => k("foo") } - - def p = { - val k = s - s match { case lit0 => } - } - - def q = { - val k = s - k match { case lit1 => } - } - - def r = { - s match { case "FOO" => } - } - - def t = { - val k = s - k match { case "FOO" => } - } -} - -object Test { - def main(args: Array[String]): Unit = { - val m = new MatchRepro - () - } -} diff --git a/test/files/instrumented/InstrumentationTest.check b/test/files/instrumented/InstrumentationTest.check index 0c570fa12c..c82d16bd34 100644 --- a/test/files/instrumented/InstrumentationTest.check +++ b/test/files/instrumented/InstrumentationTest.check @@ -1,3 +1,4 @@ +#partest !avian true Method call statistics: 1 Foo1.<init>()V @@ -8,3 +9,6 @@ Method call statistics: 1 scala/Predef$.println(Ljava/lang/Object;)V 1 scala/io/AnsiColor$class.$init$(Lscala/io/AnsiColor;)V 1 scala/runtime/BoxesRunTime.boxToBoolean(Z)Ljava/lang/Boolean; +#partest avian +!!!TEST SKIPPED!!! +Instrumentation is not supported on Avian. diff --git a/test/files/instrumented/InstrumentationTest.scala b/test/files/instrumented/InstrumentationTest.scala index 0e53f80857..458fd4974b 100644 --- a/test/files/instrumented/InstrumentationTest.scala +++ b/test/files/instrumented/InstrumentationTest.scala @@ -15,16 +15,21 @@ package instrumented { /** Tests if instrumentation itself works correctly */ object Test { def main(args: Array[String]) { - // force predef initialization before profiling - Predef - startProfiling() - val foo1 = new Foo1 - foo1.someMethod - val foo2 = new instrumented.Foo2 - foo2.someMethod - // should box the boolean - println(true) - stopProfiling() - printStatistics() + if (scala.tools.partest.utils.Properties.isAvian) { + println("!!!TEST SKIPPED!!!") + println("Instrumentation is not supported on Avian.") + } else { + // force predef initialization before profiling + Predef + startProfiling() + val foo1 = new Foo1 + foo1.someMethod + val foo2 = new instrumented.Foo2 + foo2.someMethod + // should box the boolean + println(true) + stopProfiling() + printStatistics() + } } } diff --git a/test/files/instrumented/inline-in-constructors.check b/test/files/instrumented/inline-in-constructors.check index c6c9ae4e15..b58c1d77d5 100644 --- a/test/files/instrumented/inline-in-constructors.check +++ b/test/files/instrumented/inline-in-constructors.check @@ -1,3 +1,7 @@ +#partest !avian Method call statistics: 1 instrumented/Bar.<init>(Z)V 1 instrumented/Foo.<init>(I)V +#partest avian +!!!TEST SKIPPED!!! +Instrumentation is not supported on Avian. diff --git a/test/files/instrumented/inline-in-constructors/test_3.scala b/test/files/instrumented/inline-in-constructors/test_3.scala index c4d4cc5f37..949e9945e7 100644 --- a/test/files/instrumented/inline-in-constructors/test_3.scala +++ b/test/files/instrumented/inline-in-constructors/test_3.scala @@ -3,13 +3,18 @@ import instrumented._ object Test { def main(args: Array[String]) { - // force predef initialization before profiling - Predef - MyPredef - startProfiling() - val a = new Foo(2) - val b = new Bar(true) - stopProfiling() - printStatistics() + if (scala.tools.partest.utils.Properties.isAvian) { + println("!!!TEST SKIPPED!!!") + println("Instrumentation is not supported on Avian.") + } else { + // force predef initialization before profiling + Predef + MyPredef + startProfiling() + val a = new Foo(2) + val b = new Bar(true) + stopProfiling() + printStatistics() + } } } diff --git a/test/files/neg/checksensible.check b/test/files/neg/checksensible.check index ef3aee5ee4..e5f1a38d96 100644 --- a/test/files/neg/checksensible.check +++ b/test/files/neg/checksensible.check @@ -28,9 +28,6 @@ checksensible.scala:27: warning: comparing values of types Int and Unit using `= checksensible.scala:29: warning: comparing values of types Int and String using `==' will always yield false 1 == "abc" ^ -checksensible.scala:29: warning: Int and String are unrelated: they will most likely never compare equal - 1 == "abc" - ^ checksensible.scala:33: warning: comparing values of types Some[Int] and Int using `==' will always yield false Some(1) == 1 // as above ^ @@ -64,18 +61,12 @@ checksensible.scala:51: warning: comparing values of types Int and Unit using `! checksensible.scala:52: warning: comparing values of types Int and Symbol using `!=' will always yield true (1 != 'sym) ^ -checksensible.scala:52: warning: Int and Symbol are unrelated: they will most likely always compare unequal - (1 != 'sym) - ^ checksensible.scala:58: warning: comparing a fresh object using `==' will always yield false ((x: Int) => x + 1) == null ^ checksensible.scala:59: warning: comparing a fresh object using `==' will always yield false Bep == ((_: Int) + 1) ^ -checksensible.scala:59: warning: Bep.type and Int => Int are unrelated: they will most likely never compare equal - Bep == ((_: Int) + 1) - ^ checksensible.scala:61: warning: comparing a fresh object using `==' will always yield false new Object == new Object ^ @@ -91,9 +82,6 @@ checksensible.scala:66: warning: comparing values of types Int and Null using `= checksensible.scala:71: warning: comparing values of types Bip and Bop using `==' will always yield false (x1 == x2) ^ -checksensible.scala:71: warning: Bip and Bop are unrelated: they will most likely never compare equal - (x1 == x2) - ^ checksensible.scala:81: warning: comparing values of types EqEqRefTest.this.C3 and EqEqRefTest.this.Z1 using `==' will always yield false c3 == z1 ^ @@ -106,12 +94,9 @@ checksensible.scala:83: warning: comparing values of types EqEqRefTest.this.Z1 a checksensible.scala:84: warning: comparing values of types EqEqRefTest.this.C3 and String using `!=' will always yield true c3 != "abc" ^ -checksensible.scala:84: warning: EqEqRefTest.this.C3 and String are unrelated: they will most likely always compare unequal - c3 != "abc" - ^ checksensible.scala:95: warning: comparing values of types Unit and Int using `!=' will always yield true while ((c = in.read) != -1) ^ error: No warnings can be incurred under -Xfatal-warnings. -38 warnings found +33 warnings found one error found diff --git a/test/files/neg/compile-time-only-a.check b/test/files/neg/compile-time-only-a.check index 1c4c72171f..9bc96f6b9b 100644 --- a/test/files/neg/compile-time-only-a.check +++ b/test/files/neg/compile-time-only-a.check @@ -1,49 +1,79 @@ -compile-time-only-a.scala:9: error: C3 +compile-time-only-a.scala:10: error: C3 @compileTimeOnly("C3") case class C3(x: Int) ^ -compile-time-only-a.scala:11: error: C4 +compile-time-only-a.scala:12: error: C4 @compileTimeOnly("C4") case class C4(x: Int) ^ -compile-time-only-a.scala:16: error: C5 +compile-time-only-a.scala:17: error: C5 implicit class C5(val x: Int) { ^ -compile-time-only-a.scala:28: error: C1 +compile-time-only-a.scala:32: error: C1 new C1() ^ -compile-time-only-a.scala:32: error: C2 +compile-time-only-a.scala:36: error: C2 C2 ^ -compile-time-only-a.scala:34: error: C3 +compile-time-only-a.scala:38: error: C3 new C3(2) ^ -compile-time-only-a.scala:37: error: C4 +compile-time-only-a.scala:41: error: C4 new C4(2) ^ -compile-time-only-a.scala:41: error: C5 +compile-time-only-a.scala:45: error: C5 2.ext ^ -compile-time-only-a.scala:42: error: C5 +compile-time-only-a.scala:46: error: C5 C5(2) ^ -compile-time-only-a.scala:45: error: C6.x +compile-time-only-a.scala:49: error: C6.x val _ = c6.x ^ -compile-time-only-a.scala:46: error: C6.foo +compile-time-only-a.scala:50: error: C6.foo c6.foo ^ -compile-time-only-a.scala:48: error: C6.y +compile-time-only-a.scala:51: error: C6.Foo + type Foo = c6.Foo + ^ +compile-time-only-a.scala:52: error: C6.y c6.y = c6.y ^ -compile-time-only-a.scala:48: error: C6.y +compile-time-only-a.scala:52: error: C6.y c6.y = c6.y ^ -compile-time-only-a.scala:54: error: placebo -@placebo - ^ -compile-time-only-a.scala:56: error: placebo +compile-time-only-a.scala:54: error: C7 + val c701: (C7, C7) = ??? + ^ +compile-time-only-a.scala:55: error: C7 + val c702: (C7 => C7) = ??? + ^ +compile-time-only-a.scala:56: error: C7 + val c703: { val x: C7 } = ??? + ^ +compile-time-only-a.scala:57: error: C7 + val c704: AnyRef with C7 = ??? + ^ +compile-time-only-a.scala:60: error: C7 + val c706: C7 Either C7 = ??? + ^ +compile-time-only-a.scala:61: error: C7 + val c707a: List[C7] = ??? + ^ +compile-time-only-a.scala:63: error: C7 + val c708a: T forSome { type T <: C7 } = ??? + ^ +compile-time-only-a.scala:66: error: C8 + val c709: (C8[Int], C8[C7]) = ??? + ^ +compile-time-only-a.scala:67: error: C8 + val c710: (C8[_] => C8[_]) = ??? + ^ +compile-time-only-a.scala:74: error: placebo +class Test { + ^ +compile-time-only-a.scala:75: error: placebo @placebo def x = (2: @placebo) - ^ -compile-time-only-a.scala:56: error: placebo + ^ +compile-time-only-a.scala:75: error: placebo @placebo def x = (2: @placebo) ^ -16 errors found +26 errors found diff --git a/test/files/neg/compile-time-only-a.scala b/test/files/neg/compile-time-only-a.scala index 43d36dfab1..533175a699 100644 --- a/test/files/neg/compile-time-only-a.scala +++ b/test/files/neg/compile-time-only-a.scala @@ -1,4 +1,5 @@ import scala.annotation.compileTimeOnly +import scala.language.existentials @compileTimeOnly("C1") class C1 object C1 @@ -24,6 +25,9 @@ class C6(@compileTimeOnly("C6.x") val x: Int) { @compileTimeOnly("C6.y") var y = 3 } +@compileTimeOnly("C7") class C7 +@compileTimeOnly("C8") class C8[T] + object Test extends App { new C1() C1 @@ -46,6 +50,21 @@ object Test extends App { c6.foo type Foo = c6.Foo c6.y = c6.y + + val c701: (C7, C7) = ??? + val c702: (C7 => C7) = ??? + val c703: { val x: C7 } = ??? + val c704: AnyRef with C7 = ??? + // https://groups.google.com/forum/#!topic/scala-internals/5n07TiCnBZU + // val c705: ({ @compileTimeOnly("C7") type C7[T] = List[T] })#C7[_] = ??? + val c706: C7 Either C7 = ??? + val c707a: List[C7] = ??? + val c707b = List[C7]() + val c708a: T forSome { type T <: C7 } = ??? + // https://groups.google.com/forum/#!topic/scala-internals/5n07TiCnBZU + // val c708b: T forSome { @compileTimeOnly("C7") type T } = ??? + val c709: (C8[Int], C8[C7]) = ??? + val c710: (C8[_] => C8[_]) = ??? } @compileTimeOnly("placebo") diff --git a/test/files/neg/compile-time-only-b.check b/test/files/neg/compile-time-only-b.check index 8292a0ddeb..50cdf57fb5 100644 --- a/test/files/neg/compile-time-only-b.check +++ b/test/files/neg/compile-time-only-b.check @@ -1,7 +1,13 @@ +compile-time-only-b.scala:9: error: splice must be enclosed within a reify {} block + val ignored1 = expr.splice + ^ +compile-time-only-b.scala:10: error: cannot use value except for signatures of macro implementations + val ignored2 = expr.value + ^ compile-time-only-b.scala:13: error: splice must be enclosed within a reify {} block val ignored3 = reify(fortyTwo).splice ^ compile-time-only-b.scala:14: error: cannot use value except for signatures of macro implementations val ignored4 = reify(fortyTwo).value ^ -two errors found +four errors found diff --git a/test/files/neg/macro-blackbox-extractor/Macros_1.scala b/test/files/neg/macro-blackbox-extractor/Macros_1.scala index 5c7748bec9..f0bfe53aa2 100644 --- a/test/files/neg/macro-blackbox-extractor/Macros_1.scala +++ b/test/files/neg/macro-blackbox-extractor/Macros_1.scala @@ -2,7 +2,7 @@ import scala.reflect.macros.BlackboxContext import language.experimental.macros object Extractor { - def unapply(x: Int) = macro Macros.unapplyImpl + def unapply(x: Int): Any = macro Macros.unapplyImpl } object Macros { diff --git a/test/files/neg/macro-blackbox-structural/Impls_Macros_1.scala b/test/files/neg/macro-blackbox-structural/Impls_Macros_1.scala index 08f1c21e89..f5e85d57ea 100644 --- a/test/files/neg/macro-blackbox-structural/Impls_Macros_1.scala +++ b/test/files/neg/macro-blackbox-structural/Impls_Macros_1.scala @@ -11,5 +11,5 @@ object Macros { """ } - def foo = macro impl + def foo: Any = macro impl }
\ No newline at end of file diff --git a/test/files/neg/macro-bundle-object.check b/test/files/neg/macro-bundle-object.check index 293f40a178..78e7119fa7 100644 --- a/test/files/neg/macro-bundle-object.check +++ b/test/files/neg/macro-bundle-object.check @@ -1,5 +1,5 @@ macro-bundle-object.scala:10: error: macro implementation has incompatible shape: - required: (c: scala.reflect.macros.BlackboxContext): c.Expr[Any] + required: (c: scala.reflect.macros.BlackboxContext): c.Expr[Nothing] or : (c: scala.reflect.macros.BlackboxContext): c.Tree found : : Nothing number of parameter sections differ diff --git a/test/files/neg/macro-invalidret.check b/test/files/neg/macro-invalidret.check index ea003a17ec..6c5baf76b4 100644 --- a/test/files/neg/macro-invalidret.check +++ b/test/files/neg/macro-invalidret.check @@ -12,4 +12,24 @@ Macros_Test_2.scala:3: error: macro implementation has incompatible shape: type mismatch for return type: reflect.runtime.universe.Literal does not conform to c.Expr[Any] def foo2 = macro Impls.foo2 ^ -two errors found +Macros_Test_2.scala:6: error: macro defs must have explicitly specified return types + def foo5 = macro Impls.foo5 + ^ +Macros_Test_2.scala:7: warning: macro defs must have explicitly specified return types (inference of Int from macro impl's c.Expr[Int] is deprecated and is going to stop working in 2.12) + def foo6 = macro Impls.foo6 + ^ +Macros_Test_2.scala:14: error: exception during macro expansion: +scala.NotImplementedError: an implementation is missing + at scala.Predef$.$qmark$qmark$qmark(Predef.scala:227) + at Impls$.foo3(Impls_1.scala:7) + + foo3 + ^ +Macros_Test_2.scala:15: error: macro implementation is missing + foo4 + ^ +Macros_Test_2.scala:17: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses + foo6 + ^ +two warnings found +5 errors found diff --git a/test/files/neg/macro-invalidret.flags b/test/files/neg/macro-invalidret.flags index cd66464f2f..946c53ec0e 100644 --- a/test/files/neg/macro-invalidret.flags +++ b/test/files/neg/macro-invalidret.flags @@ -1 +1,3 @@ --language:experimental.macros
\ No newline at end of file +-language:experimental.macros +-Xfatal-warnings +-deprecation
\ No newline at end of file diff --git a/test/files/neg/macro-invalidret/Impls_1.scala b/test/files/neg/macro-invalidret/Impls_1.scala index d957b74512..b32463899e 100644 --- a/test/files/neg/macro-invalidret/Impls_1.scala +++ b/test/files/neg/macro-invalidret/Impls_1.scala @@ -4,4 +4,7 @@ import scala.reflect.runtime.{universe => ru} object Impls { def foo1(c: BlackboxContext) = 2 def foo2(c: BlackboxContext) = ru.Literal(ru.Constant(42)) + def foo3(c: BlackboxContext) = ??? + def foo5(c: BlackboxContext) = c.universe.Literal(c.universe.Constant(42)) + def foo6(c: BlackboxContext) = c.Expr[Int](c.universe.Literal(c.universe.Constant(42))) } diff --git a/test/files/neg/macro-invalidret/Macros_Test_2.scala b/test/files/neg/macro-invalidret/Macros_Test_2.scala index f8880fa023..8840f492ab 100644 --- a/test/files/neg/macro-invalidret/Macros_Test_2.scala +++ b/test/files/neg/macro-invalidret/Macros_Test_2.scala @@ -1,10 +1,18 @@ object Macros { def foo1 = macro Impls.foo1 def foo2 = macro Impls.foo2 + def foo3 = macro Impls.foo3 + def foo4 = macro ??? + def foo5 = macro Impls.foo5 + def foo6 = macro Impls.foo6 } object Test extends App { import Macros._ foo1 foo2 + foo3 + foo4 + foo5 + foo6 }
\ No newline at end of file diff --git a/test/files/neg/macro-invalidsig-params-badtype.check b/test/files/neg/macro-invalidsig-params-badtype.check index 6d72185ff2..d6b5c5521d 100644 --- a/test/files/neg/macro-invalidsig-params-badtype.check +++ b/test/files/neg/macro-invalidsig-params-badtype.check @@ -1,5 +1,5 @@ Impls_Macros_1.scala:8: error: macro implementation has incompatible shape: - required: (c: scala.reflect.macros.BlackboxContext)(x: c.Expr[Int]): c.Expr[Any] + required: (c: scala.reflect.macros.BlackboxContext)(x: c.Expr[Int]): c.Expr[Nothing] or : (c: scala.reflect.macros.BlackboxContext)(x: c.Tree): c.Tree found : (c: scala.reflect.macros.BlackboxContext)(x: Int): Nothing type mismatch for parameter x: c.Expr[Int] does not conform to Int diff --git a/test/files/neg/macro-invalidsig.check b/test/files/neg/macro-invalidsig.check index e09d46146d..5ff4ed18cb 100644 --- a/test/files/neg/macro-invalidsig.check +++ b/test/files/neg/macro-invalidsig.check @@ -1,29 +1,29 @@ Macros_Test_2.scala:2: error: macro implementations cannot have implicit parameters other than WeakTypeTag evidences - def foo[U] = macro Impls1.foo[U] - ^ + def foo[U]: Int = macro Impls1.foo[U] + ^ Macros_Test_2.scala:6: error: macro implementation has incompatible shape: - required: (c: scala.reflect.macros.BlackboxContext): c.Expr[Any] + required: (c: scala.reflect.macros.BlackboxContext): c.Expr[Nothing] or : (c: scala.reflect.macros.BlackboxContext): c.Tree found : : Nothing number of parameter sections differ def foo = macro Impls2.foo ^ Macros_Test_2.scala:10: error: macro implementation has incompatible shape: - required: (c: scala.reflect.macros.BlackboxContext): c.Expr[Any] + required: (c: scala.reflect.macros.BlackboxContext): c.Expr[Nothing] or : (c: scala.reflect.macros.BlackboxContext): c.Tree found : (c: scala.reflect.api.Universe): Nothing type mismatch for parameter c: scala.reflect.macros.BlackboxContext does not conform to scala.reflect.api.Universe def foo = macro Impls3.foo ^ Macros_Test_2.scala:14: error: macro implementation has incompatible shape: - required: (c: scala.reflect.macros.BlackboxContext): c.Expr[Any] + required: (c: scala.reflect.macros.BlackboxContext): c.Expr[Nothing] or : (c: scala.reflect.macros.BlackboxContext): c.Tree found : (cs: scala.reflect.macros.BlackboxContext*): Nothing types incompatible for parameter cs: corresponding is not a vararg parameter def foo = macro Impls4.foo ^ Macros_Test_2.scala:18: error: macro implementation has incompatible shape: - required: (c: scala.reflect.macros.BlackboxContext)(x: c.Expr[Any]): c.Expr[Any] + required: (c: scala.reflect.macros.BlackboxContext)(x: c.Expr[Any]): c.Expr[Nothing] or : (c: scala.reflect.macros.BlackboxContext)(x: c.Tree): c.Tree found : (c: scala.reflect.macros.BlackboxContext): Nothing number of parameter sections differ @@ -33,35 +33,35 @@ Macros_Test_2.scala:22: error: macro implementations cannot have implicit parame def foo[U](x: Int) = macro Impls6.foo[T, U] ^ Macros_Test_2.scala:26: error: macro implementation has incompatible shape: - required: (c: scala.reflect.macros.BlackboxContext)(x: c.Expr[Int]): c.Expr[Any] + required: (c: scala.reflect.macros.BlackboxContext)(x: c.Expr[Int]): c.Expr[Nothing] or : (c: scala.reflect.macros.BlackboxContext)(x: c.Tree): c.Tree found : (c: scala.reflect.macros.BlackboxContext)(x: c.Expr[Int], y: c.Expr[Int]): Nothing parameter lists have different length, found extra parameter y: c.Expr[Int] def foo(x: Int) = macro Impls7.foo ^ Macros_Test_2.scala:30: error: macro implementation has incompatible shape: - required: (c: scala.reflect.macros.BlackboxContext)(x: c.Expr[Int]): c.Expr[Any] + required: (c: scala.reflect.macros.BlackboxContext)(x: c.Expr[Int]): c.Expr[Nothing] or : (c: scala.reflect.macros.BlackboxContext)(x: c.Tree): c.Tree found : (c: scala.reflect.macros.BlackboxContext)(x: c.universe.Symbol): Nothing type mismatch for parameter x: c.Expr[Int] does not conform to c.universe.Symbol def foo(x: Int) = macro Impls8.foo ^ Macros_Test_2.scala:34: error: macro implementation has incompatible shape: - required: (c: scala.reflect.macros.BlackboxContext)(x: c.Expr[Int], y: c.Expr[Int]): c.Expr[Any] + required: (c: scala.reflect.macros.BlackboxContext)(x: c.Expr[Int], y: c.Expr[Int]): c.Expr[Nothing] or : (c: scala.reflect.macros.BlackboxContext)(x: c.Tree, y: c.Tree): c.Tree found : (c: scala.reflect.macros.BlackboxContext)(xs: c.Expr[Int]*): Nothing parameter lists have different length, required extra parameter y: c.Expr[Int] def foo(x: Int, y: Int) = macro Impls9.foo ^ Macros_Test_2.scala:38: error: macro implementation has incompatible shape: - required: (c: scala.reflect.macros.BlackboxContext)(x: c.Expr[Int], y: c.Expr[Int]): c.Expr[Any] + required: (c: scala.reflect.macros.BlackboxContext)(x: c.Expr[Int], y: c.Expr[Int]): c.Expr[Nothing] or : (c: scala.reflect.macros.BlackboxContext)(x: c.Tree, y: c.Tree): c.Tree found : (c: scala.reflect.macros.BlackboxContext)(y: c.Expr[Int], x: c.Expr[Int]): Nothing parameter names differ: x != y def foo(x: Int, y: Int) = macro Impls10.foo ^ Macros_Test_2.scala:42: error: macro implementation has incompatible shape: - required: (c: scala.reflect.macros.BlackboxContext): c.Expr[Any] + required: (c: scala.reflect.macros.BlackboxContext): c.Expr[Nothing] or : (c: scala.reflect.macros.BlackboxContext): c.Tree found : (c: scala.reflect.macros.BlackboxContext)(U: c.universe.Type): Nothing number of parameter sections differ @@ -77,9 +77,9 @@ Macros_Test_2.scala:54: error: macro implementation reference has too few type a def foo = macro Impls14.foo ^ Macros_Test_2.scala:59: error: macro implementation reference has too few type arguments for method foo: [T, U, V](c: scala.reflect.macros.BlackboxContext)(implicit evidence$5: c.WeakTypeTag[T], implicit evidence$6: c.WeakTypeTag[U], implicit V: c.WeakTypeTag[V])c.Expr[Unit] - def foo15[V] = macro Impls15.foo - ^ + def foo15[V]: Unit = macro Impls15.foo + ^ Macros_Test_2.scala:60: error: wrong number of type parameters for method foo: [T, U, V](c: scala.reflect.macros.BlackboxContext)(implicit evidence$7: c.WeakTypeTag[T], implicit evidence$8: c.WeakTypeTag[U], implicit V: c.WeakTypeTag[V])c.Expr[Unit] - def foo16[V] = macro Impls16.foo[V] - ^ + def foo16[V]: Unit = macro Impls16.foo[V] + ^ 16 errors found diff --git a/test/files/neg/macro-invalidsig/Macros_Test_2.scala b/test/files/neg/macro-invalidsig/Macros_Test_2.scala index 0a6a321431..89a5302d8a 100644 --- a/test/files/neg/macro-invalidsig/Macros_Test_2.scala +++ b/test/files/neg/macro-invalidsig/Macros_Test_2.scala @@ -1,5 +1,5 @@ object Macros1 { - def foo[U] = macro Impls1.foo[U] + def foo[U]: Int = macro Impls1.foo[U] } object Macros2 { @@ -56,8 +56,8 @@ object Macros14 { class D[T] { class C[U] { - def foo15[V] = macro Impls15.foo - def foo16[V] = macro Impls16.foo[V] + def foo15[V]: Unit = macro Impls15.foo + def foo16[V]: Unit = macro Impls16.foo[V] } } diff --git a/test/files/neg/macro-invalidusage-badargs/Macros_Test_2.scala b/test/files/neg/macro-invalidusage-badargs/Macros_Test_2.scala index 0b3ca0590b..cf8accf94f 100644 --- a/test/files/neg/macro-invalidusage-badargs/Macros_Test_2.scala +++ b/test/files/neg/macro-invalidusage-badargs/Macros_Test_2.scala @@ -1,4 +1,4 @@ -object Macros { def foo(x: Int) = macro Impls.foo } +object Macros { def foo(x: Int): Int = macro Impls.foo } import Macros._ object Test extends App { diff --git a/test/files/neg/macro-invalidusage-badbounds/Macros_Test_2.scala b/test/files/neg/macro-invalidusage-badbounds/Macros_Test_2.scala index 3139599108..76397701f9 100644 --- a/test/files/neg/macro-invalidusage-badbounds/Macros_Test_2.scala +++ b/test/files/neg/macro-invalidusage-badbounds/Macros_Test_2.scala @@ -1,5 +1,5 @@ object Macros { - def foo[U <: String] = macro Impls.foo[U] + def foo[U <: String]: Unit = macro Impls.foo[U] } object Test extends App { diff --git a/test/files/neg/macro-invalidusage-badtargs.check b/test/files/neg/macro-invalidusage-badtargs.check index 6a9e1d6e6b..722ec03765 100644 --- a/test/files/neg/macro-invalidusage-badtargs.check +++ b/test/files/neg/macro-invalidusage-badtargs.check @@ -1,16 +1,16 @@ -Macros_Test_2.scala:11: error: macro method foo1: (x: Int)Int does not take type parameters. +Macros_Test_2.scala:13: error: macro method foo1: (x: Int)Int does not take type parameters. foo1[String](42) ^ -Macros_Test_2.scala:12: error: wrong number of type parameters for macro method foo2: [T](x: Int)Int +Macros_Test_2.scala:14: error: wrong number of type parameters for macro method foo2: [T](x: Int)Int foo2[String, String](42) ^ -Macros_Test_2.scala:13: error: wrong number of type parameters for macro method foo3: [T, U](x: Int)Int +Macros_Test_2.scala:15: error: wrong number of type parameters for macro method foo3: [T, U](x: Int)Int foo3[String](42) ^ -Macros_Test_2.scala:14: error: String takes no type parameters, expected: one +Macros_Test_2.scala:16: error: String takes no type parameters, expected: one foo4[String](42) ^ -Macros_Test_2.scala:15: error: kinds of the type arguments (List) do not conform to the expected kinds of the type parameters (type T). +Macros_Test_2.scala:17: error: kinds of the type arguments (List) do not conform to the expected kinds of the type parameters (type T). List's type parameters do not match type T's expected parameters: type A has no type parameters, but type U has one foo5[List](42) diff --git a/test/files/neg/macro-invalidusage-badtargs/Macros_Test_2.scala b/test/files/neg/macro-invalidusage-badtargs/Macros_Test_2.scala index fd16d163c3..47e51bbf44 100644 --- a/test/files/neg/macro-invalidusage-badtargs/Macros_Test_2.scala +++ b/test/files/neg/macro-invalidusage-badtargs/Macros_Test_2.scala @@ -1,9 +1,11 @@ +import scala.language.higherKinds + object Macros { - def foo1(x: Int) = macro Impls.foo - def foo2[T](x: Int) = macro Impls.foo - def foo3[T, U](x: Int) = macro Impls.foo - def foo4[T[_]](x: Int) = macro Impls.foo - def foo5[T[U[_]]](x: Int) = macro Impls.foo + def foo1(x: Int): Int = macro Impls.foo + def foo2[T](x: Int): Int = macro Impls.foo + def foo3[T, U](x: Int): Int = macro Impls.foo + def foo4[T[_]](x: Int): Int = macro Impls.foo + def foo5[T[U[_]]](x: Int): Int = macro Impls.foo } object Test extends App { diff --git a/test/files/neg/macro-invalidusage-methodvaluesyntax/Macros_Test_2.scala b/test/files/neg/macro-invalidusage-methodvaluesyntax/Macros_Test_2.scala index 343cec99b5..578aa45867 100644 --- a/test/files/neg/macro-invalidusage-methodvaluesyntax/Macros_Test_2.scala +++ b/test/files/neg/macro-invalidusage-methodvaluesyntax/Macros_Test_2.scala @@ -1,5 +1,5 @@ object Macros { - def foo = macro Impls.foo + def foo: Unit = macro Impls.foo } object Test extends App { diff --git a/test/files/neg/macro-override-macro-overrides-abstract-method-a.check b/test/files/neg/macro-override-macro-overrides-abstract-method-a.check index 8c8f039225..6b5d3013ba 100644 --- a/test/files/neg/macro-override-macro-overrides-abstract-method-a.check +++ b/test/files/neg/macro-override-macro-overrides-abstract-method-a.check @@ -1,5 +1,5 @@ Impls_Macros_1.scala:12: error: overriding method foo in trait Foo of type (x: Int)Int; macro method foo cannot be used here - term macros cannot override abstract methods - def foo(x: Int) = macro Impls.impl + def foo(x: Int): Int = macro Impls.impl ^ one error found diff --git a/test/files/neg/macro-override-macro-overrides-abstract-method-a/Impls_Macros_1.scala b/test/files/neg/macro-override-macro-overrides-abstract-method-a/Impls_Macros_1.scala index 0e8a5f3b01..9c05db83e3 100644 --- a/test/files/neg/macro-override-macro-overrides-abstract-method-a/Impls_Macros_1.scala +++ b/test/files/neg/macro-override-macro-overrides-abstract-method-a/Impls_Macros_1.scala @@ -9,5 +9,5 @@ trait Foo { } object Macros extends Foo { - def foo(x: Int) = macro Impls.impl + def foo(x: Int): Int = macro Impls.impl } diff --git a/test/files/neg/macro-override-method-overrides-macro.check b/test/files/neg/macro-override-method-overrides-macro.check index e8cba5d029..e396d65ff1 100644 --- a/test/files/neg/macro-override-method-overrides-macro.check +++ b/test/files/neg/macro-override-method-overrides-macro.check @@ -1,5 +1,5 @@ Macros_Test_2.scala:8: error: overriding macro method foo in class B of type (x: String)Unit; method foo cannot be used here - only term macros can override term macros - override def foo(x: String) = println("fooDString") + override def foo(x: String): Unit = println("fooDString") ^ one error found diff --git a/test/files/neg/macro-override-method-overrides-macro/Macros_Test_2.scala b/test/files/neg/macro-override-method-overrides-macro/Macros_Test_2.scala index 36821b05d8..d47157766e 100644 --- a/test/files/neg/macro-override-method-overrides-macro/Macros_Test_2.scala +++ b/test/files/neg/macro-override-method-overrides-macro/Macros_Test_2.scala @@ -1,15 +1,15 @@ class B { - def foo(x: String) = macro Impls.fooBString - def foo(x: Int) = macro Impls.fooBInt - def foo(x: Boolean) = println("fooBBoolean") + def foo(x: String): Unit = macro Impls.fooBString + def foo(x: Int): Unit = macro Impls.fooBInt + def foo(x: Boolean): Unit = println("fooBBoolean") } class D extends B { - override def foo(x: String) = println("fooDString") - override def foo(x: Int) = macro Impls.fooDInt + override def foo(x: String): Unit = println("fooDString") + override def foo(x: Int): Unit = macro Impls.fooDInt } class Z extends D { - override def foo(x: String) = macro Impls.fooZString - override def foo(x: Boolean) = println("fooZBoolean") + override def foo(x: String): Unit = macro Impls.fooZString + override def foo(x: Boolean): Unit = println("fooZBoolean") } diff --git a/test/files/neg/macro-quasiquotes.check b/test/files/neg/macro-quasiquotes.check index 338ad42b23..c690b61fe1 100644 --- a/test/files/neg/macro-quasiquotes.check +++ b/test/files/neg/macro-quasiquotes.check @@ -1,8 +1,8 @@ Macros_1.scala:14: error: macro implementation has incompatible shape: - required: (x: Impls.this.c.Expr[Int]): Impls.this.c.Expr[Any] + required: (x: Impls.this.c.Expr[Int]): Impls.this.c.Expr[Unit] or : (x: Impls.this.c.Tree): Impls.this.c.Tree found : (x: Impls.this.c.universe.Block): Impls.this.c.Tree type mismatch for parameter x: Impls.this.c.Expr[Int] does not conform to Impls.this.c.universe.Block - def m3(x: Int) = macro Impls.impl3 - ^ + def m3(x: Int): Unit = macro Impls.impl3 + ^ one error found diff --git a/test/files/neg/macro-quasiquotes/Macros_1.scala b/test/files/neg/macro-quasiquotes/Macros_1.scala index 7f0219e6ac..098e4b3b92 100644 --- a/test/files/neg/macro-quasiquotes/Macros_1.scala +++ b/test/files/neg/macro-quasiquotes/Macros_1.scala @@ -9,7 +9,7 @@ trait Impls extends BlackboxMacro { } object Macros { - def m1(x: Int) = macro Impls.impl1 - def m2(x: Int) = macro Impls.impl2 - def m3(x: Int) = macro Impls.impl3 + def m1(x: Int): Unit = macro Impls.impl1 + def m2(x: Int): Unit = macro Impls.impl2 + def m3(x: Int): Unit = macro Impls.impl3 }
\ No newline at end of file diff --git a/test/files/neg/macro-reify-splice-splice.check b/test/files/neg/macro-reify-splice-splice.check new file mode 100644 index 0000000000..bd1ea7acee --- /dev/null +++ b/test/files/neg/macro-reify-splice-splice.check @@ -0,0 +1,7 @@ +Macros_1.scala:8: error: the splice cannot be resolved statically, which means there is a cross-stage evaluation involved. +cross-stage evaluations need to be invoked explicitly, so we're showing you this error. +if you're sure this is not an oversight, add scala-compiler.jar to the classpath, +import `scala.tools.reflect.Eval` and call `<your expr>.eval` instead. + { c.universe.reify(c.universe.reify("hello world")) }.splice.splice + ^ +one error found diff --git a/test/files/run/macro-reify-splice-splice.flags b/test/files/neg/macro-reify-splice-splice.flags index cd66464f2f..cd66464f2f 100644 --- a/test/files/run/macro-reify-splice-splice.flags +++ b/test/files/neg/macro-reify-splice-splice.flags diff --git a/test/files/run/macro-reify-splice-splice/Macros_1.scala b/test/files/neg/macro-reify-splice-splice/Macros_1.scala index 691f22ad07..691f22ad07 100644 --- a/test/files/run/macro-reify-splice-splice/Macros_1.scala +++ b/test/files/neg/macro-reify-splice-splice/Macros_1.scala diff --git a/test/files/run/macro-reify-splice-splice/Test_2.scala b/test/files/neg/macro-reify-splice-splice/Test_2.scala index f697da6020..f697da6020 100644 --- a/test/files/run/macro-reify-splice-splice/Test_2.scala +++ b/test/files/neg/macro-reify-splice-splice/Test_2.scala diff --git a/test/files/neg/patmat-classtag-compound.check b/test/files/neg/patmat-classtag-compound.check new file mode 100644 index 0000000000..8a54c935bd --- /dev/null +++ b/test/files/neg/patmat-classtag-compound.check @@ -0,0 +1,6 @@ +patmat-classtag-compound.scala:12: warning: abstract type pattern A is unchecked since it is eliminated by erasure + case b: A with Bar => true + ^ +error: No warnings can be incurred under -Xfatal-warnings. +one warning found +one error found diff --git a/test/files/neg/patmat-classtag-compound.flags b/test/files/neg/patmat-classtag-compound.flags new file mode 100644 index 0000000000..144ddac9d3 --- /dev/null +++ b/test/files/neg/patmat-classtag-compound.flags @@ -0,0 +1 @@ +-unchecked -Xfatal-warnings diff --git a/test/files/neg/patmat-classtag-compound.scala b/test/files/neg/patmat-classtag-compound.scala new file mode 100644 index 0000000000..e2d0df0a02 --- /dev/null +++ b/test/files/neg/patmat-classtag-compound.scala @@ -0,0 +1,17 @@ +object Test extends App{ + trait Bar + trait Foo + // Failed to give an unchecked warning pre: https://github.com/scala/scala/pull/2848 + // + // Features interacting: + // - implicit class tags to enable type patterns on abstract types + // - type tests on compound types. + // + // We could try make these work together, but an unchecked warning is okay for now. + def x[A: reflect.ClassTag](a: Any): Boolean = a match{ + case b: A with Bar => true + case _ => false + } + println(x[Foo](new Bar{})) + println(x[String]("")) +} diff --git a/test/files/neg/quasiquotes-unliftable-not-found.check b/test/files/neg/quasiquotes-unliftable-not-found.check new file mode 100644 index 0000000000..5594aa1b15 --- /dev/null +++ b/test/files/neg/quasiquotes-unliftable-not-found.check @@ -0,0 +1,4 @@ +quasiquotes-unliftable-not-found.scala:4: error: Can't find reflect.runtime.universe.Unliftable[Test.C], consider providing it + val q"${c: C}" = q"()" + ^ +one error found diff --git a/test/files/neg/quasiquotes-unliftable-not-found.scala b/test/files/neg/quasiquotes-unliftable-not-found.scala new file mode 100644 index 0000000000..6a5efae43b --- /dev/null +++ b/test/files/neg/quasiquotes-unliftable-not-found.scala @@ -0,0 +1,5 @@ +object Test extends App { + import scala.reflect.runtime.universe._ + class C + val q"${c: C}" = q"()" +}
\ No newline at end of file diff --git a/test/files/neg/si7980.check b/test/files/neg/si7980.check new file mode 100644 index 0000000000..b085cabf1d --- /dev/null +++ b/test/files/neg/si7980.check @@ -0,0 +1,4 @@ +si7980.scala:7: error: Can't splice Nothing, bottom type values often indicate programmer mistake + println(q"class ${Name(X)} { }") + ^ +one error found diff --git a/test/files/neg/si7980.scala b/test/files/neg/si7980.scala new file mode 100644 index 0000000000..b21907de54 --- /dev/null +++ b/test/files/neg/si7980.scala @@ -0,0 +1,8 @@ +object Test extends App { + import scala.reflect.runtime.universe._ + def Name[T:TypeTag](name:String): T = implicitly[TypeTag[T]] match { + case t => newTypeName(name).asInstanceOf[T] + } + val X = "ASDF" + println(q"class ${Name(X)} { }") +} diff --git a/test/files/neg/t4928.check b/test/files/neg/t4928.check index 06d4f22522..18a5d57a62 100644 --- a/test/files/neg/t4928.check +++ b/test/files/neg/t4928.check @@ -1,5 +1,5 @@ t4928.scala:3: error: parameter 'a' is already specified at parameter position 1 -Note that that 'z' is not a parameter name of the invoked method. +Note that 'z' is not a parameter name of the invoked method. f(z = 0, a = 1) ^ one error found diff --git a/test/files/neg/t5426.check b/test/files/neg/t5426.check index c042cdcec3..98f3ddaaae 100644 --- a/test/files/neg/t5426.check +++ b/test/files/neg/t5426.check @@ -4,18 +4,12 @@ t5426.scala:2: warning: comparing values of types Some[Int] and Int using `==' w t5426.scala:3: warning: comparing values of types Int and Some[Int] using `==' will always yield false def f2 = 5 == Some(5) ^ -t5426.scala:3: warning: Int and Some[Int] are unrelated: they will most likely never compare equal - def f2 = 5 == Some(5) - ^ t5426.scala:8: warning: comparing values of types Int and Some[Int] using `==' will always yield false (x1 == x2) ^ -t5426.scala:8: warning: Int and Some[Int] are unrelated: they will most likely never compare equal - (x1 == x2) - ^ t5426.scala:9: warning: comparing values of types Some[Int] and Int using `==' will always yield false (x2 == x1) ^ error: No warnings can be incurred under -Xfatal-warnings. -6 warnings found +four warnings found one error found diff --git a/test/files/neg/t5663-badwarneq.check b/test/files/neg/t5663-badwarneq.check index 4b7795585b..732e4f44d0 100644 --- a/test/files/neg/t5663-badwarneq.check +++ b/test/files/neg/t5663-badwarneq.check @@ -25,9 +25,6 @@ t5663-badwarneq.scala:72: warning: ValueClass1 and Int are unrelated: they will t5663-badwarneq.scala:74: warning: comparing values of types Int and ValueClass1 using `==' will always yield false println(5 == new ValueClass1(5)) // bad ^ -t5663-badwarneq.scala:74: warning: Int and ValueClass1 are unrelated: they will never compare equal - println(5 == new ValueClass1(5)) // bad - ^ t5663-badwarneq.scala:78: warning: ValueClass2[String] and String are unrelated: they will never compare equal println(new ValueClass2("abc") == "abc") // bad ^ @@ -41,5 +38,5 @@ t5663-badwarneq.scala:82: warning: comparing values of types ValueClass3 and Int println(ValueClass3(5) == 5) // bad ^ error: No warnings can be incurred under -Xfatal-warnings. -14 warnings found +13 warnings found one error found diff --git a/test/files/neg/t5753/Impls_Macros_1.scala b/test/files/neg/t5753/Impls_Macros_1.scala index f93d731d40..0e81e21c77 100644 --- a/test/files/neg/t5753/Impls_Macros_1.scala +++ b/test/files/neg/t5753/Impls_Macros_1.scala @@ -1,6 +1,6 @@ import scala.reflect.macros.{BlackboxContext => Ctx} trait Impls { -def impl(c: Ctx)(x: c.Expr[Any]) = x + def impl(c: Ctx)(x: c.Expr[Any]) = x } diff --git a/test/files/neg/t5753/Test_2.scala b/test/files/neg/t5753/Test_2.scala index f1cad67fed..150850a0eb 100644 --- a/test/files/neg/t5753/Test_2.scala +++ b/test/files/neg/t5753/Test_2.scala @@ -1,7 +1,7 @@ import scala.reflect.macros.{BlackboxContext => Ctx} object Macros extends Impls { - def foo(x: Any) = macro impl + def foo(x: Any): Any = macro impl } object Test extends App { diff --git a/test/files/neg/t5903a/Macros_1.scala b/test/files/neg/t5903a/Macros_1.scala index 7888b888e1..ce1b035260 100644 --- a/test/files/neg/t5903a/Macros_1.scala +++ b/test/files/neg/t5903a/Macros_1.scala @@ -7,7 +7,7 @@ case object SomeTree extends Tree object NewQuasiquotes { implicit class QuasiquoteInterpolation(c: StringContext) { object nq { - def unapply(t: Tree) = macro QuasiquoteMacros.unapplyImpl + def unapply(t: Tree): Any = macro QuasiquoteMacros.unapplyImpl } } } diff --git a/test/files/neg/t5903b/Macros_1.scala b/test/files/neg/t5903b/Macros_1.scala index 46f0eee0f1..dfe9d8d489 100644 --- a/test/files/neg/t5903b/Macros_1.scala +++ b/test/files/neg/t5903b/Macros_1.scala @@ -4,7 +4,7 @@ import language.experimental.macros object Interpolation { implicit class TestInterpolation(c: StringContext) { object t { - def unapply[T](x: T) = macro Macros.unapplyImpl[T] + def unapply[T](x: T): Any = macro Macros.unapplyImpl[T] } } } diff --git a/test/files/neg/t5903c/Macros_1.scala b/test/files/neg/t5903c/Macros_1.scala index 281a06e93c..d13c3c2ec2 100644 --- a/test/files/neg/t5903c/Macros_1.scala +++ b/test/files/neg/t5903c/Macros_1.scala @@ -4,7 +4,7 @@ import language.experimental.macros object Interpolation { implicit class TestInterpolation(c: StringContext) { object t { - def unapply[T](x: T) = macro Macros.unapplyImpl[T] + def unapply[T](x: T): Any = macro Macros.unapplyImpl[T] } } } diff --git a/test/files/neg/t5903d/Macros_1.scala b/test/files/neg/t5903d/Macros_1.scala index 5dd6220e1a..2d26e998a1 100644 --- a/test/files/neg/t5903d/Macros_1.scala +++ b/test/files/neg/t5903d/Macros_1.scala @@ -4,7 +4,7 @@ import language.experimental.macros object Interpolation { implicit class TestInterpolation(c: StringContext) { object t { - def unapply(x: Int) = macro Macros.unapplyImpl + def unapply(x: Int): Any = macro Macros.unapplyImpl } } } diff --git a/test/files/neg/t5903e/Macros_1.scala b/test/files/neg/t5903e/Macros_1.scala index 997e6fd073..5bdc25b832 100644 --- a/test/files/neg/t5903e/Macros_1.scala +++ b/test/files/neg/t5903e/Macros_1.scala @@ -4,7 +4,7 @@ import language.experimental.macros object Interpolation { implicit class TestInterpolation(c: StringContext) { object t { - def unapply(x: Int) = macro Macros.unapplyImpl + def unapply(x: Int): Any = macro Macros.unapplyImpl } } } diff --git a/test/files/neg/t6231.check b/test/files/neg/t6231.check deleted file mode 100644 index 2428bf66d0..0000000000 --- a/test/files/neg/t6231.check +++ /dev/null @@ -1,6 +0,0 @@ -t6231.scala:4: error: Implementation restriction: local trait Bug$X$1 is unable to automatically capture the -free variable value ev$1 on behalf of <$anon: Function0>. You can manually assign it to a val inside the trait, -and refer that that val in <$anon: Function0>. For more details, see SI-6231. - def qux = { () => ev } - ^ -one error found diff --git a/test/files/neg/t6231.flags b/test/files/neg/t6231.flags deleted file mode 100644 index ac96850b69..0000000000 --- a/test/files/neg/t6231.flags +++ /dev/null @@ -1 +0,0 @@ --Ydelambdafy:inline
\ No newline at end of file diff --git a/test/files/neg/t6355.check b/test/files/neg/t6355.check deleted file mode 100644 index 607829d99a..0000000000 --- a/test/files/neg/t6355.check +++ /dev/null @@ -1,7 +0,0 @@ -t6355.scala:12: error: implementation restriction: applyDynamic cannot be overloaded except by methods with different numbers of type parameters, e.g. applyDynamic[T1](method: String)(arg: T1) and applyDynamic[T1, T2](method: String)(arg1: T1, arg2: T2) - def applyDynamic(name: String)(x: Int): Int = 2 - ^ -t6355.scala:18: error: implementation restriction: applyDynamic cannot be overloaded except by methods with different numbers of type parameters, e.g. applyDynamic[T1](method: String)(arg: T1) and applyDynamic[T1, T2](method: String)(arg1: T1, arg2: T2) - def applyDynamic[T1, T2](name: String)(x: String, y: T1, z: T2): Int = 3 - ^ -two errors found diff --git a/test/files/neg/t6355a.check b/test/files/neg/t6355a.check new file mode 100644 index 0000000000..5768d31f0b --- /dev/null +++ b/test/files/neg/t6355a.check @@ -0,0 +1,7 @@ +t6355a.scala:12: error: implementation restriction: applyDynamic cannot be overloaded except by methods with different numbers of type parameters, e.g. applyDynamic[T1](method: String)(arg: T1) and applyDynamic[T1, T2](method: String)(arg1: T1, arg2: T2) + def applyDynamic(name: String)(x: Int): Int = 2 + ^ +t6355a.scala:18: error: implementation restriction: applyDynamic cannot be overloaded except by methods with different numbers of type parameters, e.g. applyDynamic[T1](method: String)(arg: T1) and applyDynamic[T1, T2](method: String)(arg1: T1, arg2: T2) + def applyDynamic[T1, T2](name: String)(x: String, y: T1, z: T2): Int = 3 + ^ +two errors found diff --git a/test/files/neg/t6355.scala b/test/files/neg/t6355a.scala index 0500ed04c6..0500ed04c6 100644 --- a/test/files/neg/t6355.scala +++ b/test/files/neg/t6355a.scala diff --git a/test/files/neg/t6355b.check b/test/files/neg/t6355b.check new file mode 100644 index 0000000000..f827f07e53 --- /dev/null +++ b/test/files/neg/t6355b.check @@ -0,0 +1,11 @@ +t6355b.scala:14: error: value applyDynamic is not a member of A +error after rewriting to x.<applyDynamic: error>("bippy") +possible cause: maybe a wrong Dynamic method signature? + println(x.bippy(42)) + ^ +t6355b.scala:15: error: value applyDynamic is not a member of A +error after rewriting to x.<applyDynamic: error>("bippy") +possible cause: maybe a wrong Dynamic method signature? + println(x.bippy("42")) + ^ +two errors found diff --git a/test/files/neg/t6355b.scala b/test/files/neg/t6355b.scala new file mode 100644 index 0000000000..5f3c97cb0c --- /dev/null +++ b/test/files/neg/t6355b.scala @@ -0,0 +1,17 @@ +import scala.language.dynamics + +class A extends Dynamic { + def selectDynamic(method: String): B = new B(method) +} +class B(method: String) { + def apply(x: Int) = s"$method(x: Int) called with x = $x" + def apply(x: String) = s"""$method(x: String) called with x = "$x"""" +} + +object Test { + def main(args: Array[String]): Unit = { + val x = new A + println(x.bippy(42)) + println(x.bippy("42")) + } +} diff --git a/test/files/neg/t6446-missing.check b/test/files/neg/t6446-missing.check index cd867289c3..029c8057c3 100755 --- a/test/files/neg/t6446-missing.check +++ b/test/files/neg/t6446-missing.check @@ -1,4 +1,4 @@ -Warning: class not found: t6446.Ploogin +Error: unable to load class: t6446.Ploogin phase name id description ---------- -- ----------- parser 1 parse source into ASTs, perform simple desugaring diff --git a/test/files/neg/t6539.check b/test/files/neg/t6539.check index b647636338..8c94a8ad4c 100644 --- a/test/files/neg/t6539.check +++ b/test/files/neg/t6539.check @@ -7,4 +7,10 @@ Test_2.scala:3: error: cto may only be used as an argument to m Test_2.scala:5: error: cto may only be used as an argument to m M.cto // error ^ -three errors found +Test_2.scala:9: error: splice must be enclosed within a reify {} block + val splice = expr.splice + ^ +Test_2.scala:10: error: cannot use value except for signatures of macro implementations + val value = expr.value + ^ +5 errors found diff --git a/test/files/neg/t6920.check b/test/files/neg/t6920.check new file mode 100644 index 0000000000..ee4eafb83e --- /dev/null +++ b/test/files/neg/t6920.check @@ -0,0 +1,6 @@ +t6920.scala:9: error: too many arguments for method applyDynamicNamed: (values: Seq[(String, Any)])String +error after rewriting to CompilerError.this.test.applyDynamicNamed("crushTheCompiler")(scala.Tuple2("a", 1), scala.Tuple2("b", 2)) +possible cause: maybe a wrong Dynamic method signature? + test.crushTheCompiler(a = 1, b = 2) + ^ +one error found diff --git a/test/files/neg/t6920.scala b/test/files/neg/t6920.scala new file mode 100644 index 0000000000..b79d641698 --- /dev/null +++ b/test/files/neg/t6920.scala @@ -0,0 +1,10 @@ +import scala.language.dynamics + +class DynTest extends Dynamic { + def applyDynamicNamed(name: String)(values: Seq[(String, Any)]) = "test" +} + +class CompilerError { + val test = new DynTest + test.crushTheCompiler(a = 1, b = 2) +}
\ No newline at end of file diff --git a/test/files/neg/t712.check b/test/files/neg/t712.check index 6819dc0ce9..831e943063 100644 --- a/test/files/neg/t712.check +++ b/test/files/neg/t712.check @@ -1,4 +1,5 @@ t712.scala:10: error: value self is not a member of B.this.ParentImpl + Note: implicit method coerce is not applicable here because it comes after the application point and it lacks an explicit result type implicit def coerce(p : ParentImpl) = p.self; ^ one error found diff --git a/test/files/neg/t7519-b.check b/test/files/neg/t7519-b.check index 08d819eeec..bc8500b2b8 100644 --- a/test/files/neg/t7519-b.check +++ b/test/files/neg/t7519-b.check @@ -1,4 +1,4 @@ -Use_2.scala:6: error: type mismatch; +Use_2.scala:8: error: type mismatch; found : String required: Q val x: Q = ex.Mac.mac("asdf") diff --git a/test/files/neg/t7519-b/Use_2.scala b/test/files/neg/t7519-b/Use_2.scala index 413e40e25e..0d63eeed5b 100644 --- a/test/files/neg/t7519-b/Use_2.scala +++ b/test/files/neg/t7519-b/Use_2.scala @@ -1,3 +1,5 @@ +import scala.language.implicitConversions + trait Q trait K diff --git a/test/files/neg/t7756b.check b/test/files/neg/t7756b.check index e764783241..2817a7e230 100644 --- a/test/files/neg/t7756b.check +++ b/test/files/neg/t7756b.check @@ -1,9 +1,6 @@ t7756b.scala:3: warning: comparing values of types Int and String using `==' will always yield false case _ => 0 == "" ^ -t7756b.scala:3: warning: Int and String are unrelated: they will most likely never compare equal - case _ => 0 == "" - ^ error: No warnings can be incurred under -Xfatal-warnings. -two warnings found +one warning found one error found diff --git a/test/files/neg/t8006.check b/test/files/neg/t8006.check new file mode 100644 index 0000000000..fbac26e3ad --- /dev/null +++ b/test/files/neg/t8006.check @@ -0,0 +1,6 @@ +t8006.scala:3: error: too many arguments for method applyDynamicNamed: (value: (String, Any))String +error after rewriting to X.this.d.applyDynamicNamed("meth")(scala.Tuple2("value1", 10), scala.Tuple2("value2", 100)) +possible cause: maybe a wrong Dynamic method signature? + d.meth(value1 = 10, value2 = 100) // two arguments here, but only one is allowed + ^ +one error found diff --git a/test/files/neg/t8006.scala b/test/files/neg/t8006.scala new file mode 100644 index 0000000000..b2f71c1587 --- /dev/null +++ b/test/files/neg/t8006.scala @@ -0,0 +1,8 @@ +object X { + val d = new D + d.meth(value1 = 10, value2 = 100) // two arguments here, but only one is allowed +} +import language.dynamics +class D extends Dynamic { + def applyDynamicNamed(name: String)(value: (String, Any)) = name +}
\ No newline at end of file diff --git a/test/files/neg/t8024.check b/test/files/neg/t8024.check new file mode 100644 index 0000000000..bd551aa591 --- /dev/null +++ b/test/files/neg/t8024.check @@ -0,0 +1,6 @@ +t8024.scala:13: error: reference to sqrt is ambiguous; +it is both defined in package object p and imported subsequently by +import java.lang.Math.sqrt + sqrt(0d) + ^ +one error found diff --git a/test/files/neg/t8024.scala b/test/files/neg/t8024.scala new file mode 100644 index 0000000000..b4c2c5ebb9 --- /dev/null +++ b/test/files/neg/t8024.scala @@ -0,0 +1,14 @@ +package p + +trait NRoot[A] + +object `package` { + final def sqrt(x: Double): Double = Math.sqrt(x) + final def sqrt[A](a: A)(implicit ev: NRoot[A]): A = ??? +} + +object FastComplex { + import java.lang.Math.sqrt + + sqrt(0d) +} diff --git a/test/files/neg/t8024b.check b/test/files/neg/t8024b.check new file mode 100644 index 0000000000..9cd89bca53 --- /dev/null +++ b/test/files/neg/t8024b.check @@ -0,0 +1,6 @@ +t8024b.scala:15: error: reference to sqrt is ambiguous; +it is both defined in object FastComplex and imported subsequently by +import java.lang.Math.sqrt + sqrt(0d) + ^ +one error found diff --git a/test/files/neg/t8024b.scala b/test/files/neg/t8024b.scala new file mode 100644 index 0000000000..cf3d496365 --- /dev/null +++ b/test/files/neg/t8024b.scala @@ -0,0 +1,17 @@ +package p + +trait NRoot[A] + +object FastComplex { + final def sqrt(x: Double): Double = Math.sqrt(x) + final def sqrt[A](a: A)(implicit ev: NRoot[A]): A = ??? + + object Inner { + import java.lang.Math.sqrt + + // wrong message: + // error: reference to sqrt is ambiguous; + // it is both defined in object FastComplex and imported subsequently by + sqrt(0d) + } +} diff --git a/test/files/neg/t8104.check b/test/files/neg/t8104.check new file mode 100644 index 0000000000..69b3461bd5 --- /dev/null +++ b/test/files/neg/t8104.check @@ -0,0 +1,4 @@ +Test_2.scala:20: error: could not find implicit value for parameter e: Generic.Aux[Test.C,(Int, Int)] + implicitly[Generic.Aux[C, (Int, Int)]] + ^ +one error found diff --git a/test/files/neg/t8104/Macros_1.scala b/test/files/neg/t8104/Macros_1.scala new file mode 100644 index 0000000000..21d81a3687 --- /dev/null +++ b/test/files/neg/t8104/Macros_1.scala @@ -0,0 +1,11 @@ +import scala.reflect.macros.WhiteboxContext + +object Macros { + def impl[T](c: WhiteboxContext)(implicit T: c.WeakTypeTag[T]) = { + import c.universe._ + import definitions._ + val fields = T.tpe.declarations.toList.collect{ case x: TermSymbol if x.isVal && x.isCaseAccessor => x } + val Repr = appliedType(TupleClass(fields.length).asType.toType, fields.map(_.typeSignature)) + q"new Generic[$T]{ type Repr = $Repr }" + } +}
\ No newline at end of file diff --git a/test/files/neg/t8104/Test_2.scala b/test/files/neg/t8104/Test_2.scala new file mode 100644 index 0000000000..585f76c00f --- /dev/null +++ b/test/files/neg/t8104/Test_2.scala @@ -0,0 +1,21 @@ +trait Generic[T] { type Repr } +object Generic { + type Aux[T, Repr0] = Generic[T] { type Repr = Repr0 } + import scala.language.experimental.macros + implicit def materializeGeneric[T]: Generic[T] = macro Macros.impl[T] +} + +object Test extends App { + case class C(x: Int, y: Int) + + import scala.reflect.runtime.universe._ + def reprify[T, Repr](x: T)(implicit generic: Generic.Aux[T, Repr], tag: TypeTag[Repr]) = println(tag) + reprify(C(40, 2)) + + // this is a compilation error at the moment as explained in SI-8104 + // because matchesPt in implicit search says that depoly(<type of materializeGeneric>) isn't a subtype of Generic.Aux[C, (Int, Int)] + // which is rightfully so, because depoly only replaces type parameters, not type members with wildcard types + // however in the future we might want to relax the matchesPt check, so this might start compiling + // therefore, if you've broken this test, then you should be happy, because most likely you've just enabled an interesting use case! + implicitly[Generic.Aux[C, (Int, Int)]] +} diff --git a/test/files/pos/attachments-typed-another-ident/Impls_1.scala b/test/files/pos/attachments-typed-another-ident/Impls_1.scala index f84e56d714..6271359921 100644 --- a/test/files/pos/attachments-typed-another-ident/Impls_1.scala +++ b/test/files/pos/attachments-typed-another-ident/Impls_1.scala @@ -8,7 +8,7 @@ object Macros { import c.universe._ val ident = Ident(TermName("bar")) updateAttachment MyAttachment assert(ident.attachments.get[MyAttachment.type].isDefined, ident.attachments) - val typed = c.typeCheck(ident) + val typed = c.typecheck(ident) assert(typed.attachments.get[MyAttachment.type].isDefined, typed.attachments) c.Expr[Int](typed) } diff --git a/test/files/pos/attachments-typed-ident/Impls_1.scala b/test/files/pos/attachments-typed-ident/Impls_1.scala index 11d0f65844..f24ea88a5d 100644 --- a/test/files/pos/attachments-typed-ident/Impls_1.scala +++ b/test/files/pos/attachments-typed-ident/Impls_1.scala @@ -8,7 +8,7 @@ object Macros { import c.universe._ val ident = Ident(TermName("bar")) updateAttachment MyAttachment assert(ident.attachments.get[MyAttachment.type].isDefined, ident.attachments) - val typed = c.typeCheck(ident) + val typed = c.typecheck(ident) assert(typed.attachments.get[MyAttachment.type].isDefined, typed.attachments) c.Expr[Int](typed) } diff --git a/test/files/pos/macro-implicit-invalidate-on-error.scala b/test/files/pos/macro-implicit-invalidate-on-error.scala index 22cd2d34b4..f9756d965f 100644 --- a/test/files/pos/macro-implicit-invalidate-on-error.scala +++ b/test/files/pos/macro-implicit-invalidate-on-error.scala @@ -1,23 +1,20 @@ -package scala.reflect -package api - import scala.language.experimental.macros import scala.reflect.macros.Context -trait Liftable[T] { - def apply(universe: api.Universe, value: T): universe.Tree +trait LegacyLiftable[T] { + def apply(universe: scala.reflect.api.Universe, value: T): universe.Tree } -object Liftable { - implicit def liftCaseClass[T <: Product]: Liftable[T] = macro liftCaseClassImpl[T] +object LegacyLiftable { + implicit def liftCaseClass[T <: Product]: LegacyLiftable[T] = macro liftCaseClassImpl[T] - def liftCaseClassImpl[T: c.WeakTypeTag](c: Context): c.Expr[Liftable[T]] = { + def liftCaseClassImpl[T: c.WeakTypeTag](c: Context): c.Expr[LegacyLiftable[T]] = { import c.universe._ val tpe = weakTypeOf[T] if (!tpe.typeSymbol.asClass.isCaseClass) c.abort(c.enclosingPosition, "denied") val p = List(q"Literal(Constant(1))") - c.Expr[Liftable[T]] { q""" - new scala.reflect.api.Liftable[$tpe] { + c.Expr[LegacyLiftable[T]] { q""" + new LegacyLiftable[$tpe] { def apply(universe: scala.reflect.api.Universe, value: $tpe): universe.Tree = { import universe._ Apply(Select(Ident(TermName("C")), TermName("apply")), List(..$p)) diff --git a/test/files/pos/t5508-min-okay.scala b/test/files/pos/t5508-min-okay.scala new file mode 100644 index 0000000000..3a38b9c5ea --- /dev/null +++ b/test/files/pos/t5508-min-okay.scala @@ -0,0 +1,6 @@ +object Test { + trait NestedTrait { // must be nested and a trait + private val _st : Int = 0 // crashes if changed to private[this] + val escape = { () => _st } + } +} diff --git a/test/files/pos/t5508-min-okay2.scala b/test/files/pos/t5508-min-okay2.scala new file mode 100644 index 0000000000..935f28609c --- /dev/null +++ b/test/files/pos/t5508-min-okay2.scala @@ -0,0 +1,4 @@ +trait TopTrait { // must be nested and a trait + private[this] val _st : Int = 0 // crashes if TopTrait is not top level + val escape = { () => _st } +} diff --git a/test/files/pos/t5508-min.scala b/test/files/pos/t5508-min.scala new file mode 100644 index 0000000000..f59d2bd6ad --- /dev/null +++ b/test/files/pos/t5508-min.scala @@ -0,0 +1,6 @@ +object Test { + trait NestedTrait { // must be nested and a trait + private[this] val _st : Int = 0 // must be private[this] + val escape = { () => _st } + } +} diff --git a/test/files/pos/t5508.scala b/test/files/pos/t5508.scala new file mode 100644 index 0000000000..2b49758045 --- /dev/null +++ b/test/files/pos/t5508.scala @@ -0,0 +1,83 @@ +package TestTestters + +trait Test1 { + private[this] var _st : Int = 0 + def close : PartialFunction[Any,Any] = { + case x : Int => + _st = identity(_st) + } +} + +object Base1 { + trait Test2 { + private[this] var _st : Int = 0 + def close : PartialFunction[Any,Any] = { + case x : Int => + _st = identity(_st) + } + } +} + +class Test3 { + private[this] var _st : Int = 0 + def close : PartialFunction[Any,Any] = { + case x : Int => + _st = 1 + } +} + +object Base2 { + class Test4 { + private[this] var _st : Int = 0 + def close : PartialFunction[Any,Any] = { + case x : Int => + _st = 1 + } + } +} + +class Base3 { + trait Test5 { + private[this] var _st : Int = 0 + def close : PartialFunction[Any,Any] = { + case x : Int => + _st = 1 + } + } +} + +object Base4 { + trait Test6 { + private[this] var _st : Int = 0 + def close : PartialFunction[Any,Any] = { + case x : Int => () + } + } +} + +object Base5 { + trait Test7 { + private[this] var _st : Int = 0 + def close = () => { + _st = 1 + } + } +} + +object Base6 { + class Test8 { + private[this] var _st : Int = 0 + def close = () => { + _st = 1 + } + } +} + +object Base7 { + trait Test9 { + var st : Int = 0 + def close = () => { + st = 1 + } + } +} diff --git a/test/files/neg/t6231.scala b/test/files/pos/t6231.scala index 1e5b4e0e1a..1e5b4e0e1a 100644 --- a/test/files/neg/t6231.scala +++ b/test/files/pos/t6231.scala diff --git a/test/files/pos/t6231b.scala b/test/files/pos/t6231b.scala new file mode 100644 index 0000000000..b4ddfe785b --- /dev/null +++ b/test/files/pos/t6231b.scala @@ -0,0 +1,8 @@ +class Test { + def f1(t: String) = { + trait T { + def xs = Nil map (_ => t) + } + () + } +} diff --git a/test/files/pos/t6780.scala b/test/files/pos/t6780.scala new file mode 100644 index 0000000000..4a358046c6 --- /dev/null +++ b/test/files/pos/t6780.scala @@ -0,0 +1,20 @@ +object O { + implicit def i: Int = 0 +} + +import O._ + +trait Foo { + implicit val v1: Any + implicit def d1: Any + val v2: Any + implicit val v3: Any +} + +trait Bar1 extends Foo { + implicit val v1 = {implicitly[Int]; ()} // failed due to cycle in Context#implicits being broken with Nil. + def d1 = {implicitly[Int]; ()} // okay + implicit val v2 = {implicitly[Int]; ()} // okay + implicit val v3: Any = {implicitly[Int]; ()} // okay + +} diff --git a/test/files/pos/t7377/Macro_1.scala b/test/files/pos/t7377/Macro_1.scala index bb7ffb0f10..7280cfeaf5 100644 --- a/test/files/pos/t7377/Macro_1.scala +++ b/test/files/pos/t7377/Macro_1.scala @@ -2,6 +2,6 @@ import language.experimental._ import reflect.macros.BlackboxContext object M { - def noopImpl[A](c: BlackboxContext)(expr: c.Expr[A]): c.Expr[A] = c.Expr(c.typeCheck(c.resetLocalAttrs(expr.tree))) + def noopImpl[A](c: BlackboxContext)(expr: c.Expr[A]): c.Expr[A] = c.Expr(c.typecheck(c.resetLocalAttrs(expr.tree))) def noop[A](expr: A): A = macro noopImpl[A] } diff --git a/test/files/pos/t7461/Macros_1.scala b/test/files/pos/t7461/Macros_1.scala index 126e9c067a..89ae7c70e3 100644 --- a/test/files/pos/t7461/Macros_1.scala +++ b/test/files/pos/t7461/Macros_1.scala @@ -4,7 +4,7 @@ import language.experimental.macros object Macros { def impl(c: BlackboxContext) = { import c.universe._ - val wut = c.typeCheck(Select(Literal(Constant(10)), newTermName("$minus")), silent = true) + val wut = c.typecheck(Select(Literal(Constant(10)), newTermName("$minus")), silent = true) // println(showRaw(wut, printIds = true, printTypes = true)) c.Expr[Unit](q"()") } diff --git a/test/files/pos/t8001/Macros_1.scala b/test/files/pos/t8001/Macros_1.scala index 1f8dab51c1..fd26016d4b 100644 --- a/test/files/pos/t8001/Macros_1.scala +++ b/test/files/pos/t8001/Macros_1.scala @@ -2,7 +2,7 @@ import scala.language.experimental.macros import scala.reflect.macros.BlackboxContext object Macros { - def foo = macro impl + def foo: Unit = macro impl def impl(c: BlackboxContext) = { import c.universe._ q"()" diff --git a/test/files/pos/t8054.scala b/test/files/pos/t8054.scala new file mode 100644 index 0000000000..a7bb44b1ed --- /dev/null +++ b/test/files/pos/t8054.scala @@ -0,0 +1,31 @@ +trait D { + trait Manifest { + class Entry + } + + val M: Manifest + + def m: M.Entry = ??? +} + +object D1 extends D { + object M extends Manifest +} + +object D2 extends D { + val M: Manifest = ??? +} + +object Hello { + + def main(args: Array[String]) { + // 2.10.3 - ok + // 2.11.0-M7 - type mismatch; found : Seq[DB1.MANIFEST.Entry] + // required: Seq[DB1.MANIFEST.Entry] + val t1: D1.M.Entry = D1.m + + // 2.10.3 - ok + // 2.11.0-M7 - ok + val t2: D2.M.Entry = D2.m + } +} diff --git a/test/files/pos/t8060.scala b/test/files/pos/t8060.scala new file mode 100644 index 0000000000..90e014d74b --- /dev/null +++ b/test/files/pos/t8060.scala @@ -0,0 +1,11 @@ +trait M[F[_]] + +trait P[A] { + type CC[X] = P[X] + def f(p: A => Boolean): M[CC] +} + +trait Other { + // was infinite loop trying to dealias `x$1.CC` + def g[A](p: A => Boolean): P[A] => M[P] = _ f p +} diff --git a/test/files/presentation/ide-t1001326.check b/test/files/presentation/ide-t1001326.check deleted file mode 100644 index 0ac15faed4..0000000000 --- a/test/files/presentation/ide-t1001326.check +++ /dev/null @@ -1,4 +0,0 @@ -Unique OK -Unattributed OK -NeverModify OK -AlwaysParseTree OK
\ No newline at end of file diff --git a/test/files/presentation/ide-t1001326/src/a/A.scala b/test/files/presentation/ide-t1001326/src/a/A.scala deleted file mode 100644 index c82ca02231..0000000000 --- a/test/files/presentation/ide-t1001326/src/a/A.scala +++ /dev/null @@ -1,5 +0,0 @@ -package a - -class A { - def foo(s: String) = s + s -}
\ No newline at end of file diff --git a/test/files/presentation/parse-invariants.check b/test/files/presentation/parse-invariants.check new file mode 100644 index 0000000000..32e9c846ab --- /dev/null +++ b/test/files/presentation/parse-invariants.check @@ -0,0 +1,5 @@ +NoNewSymbolsEntered OK +Unique OK +Unattributed OK +NeverModify OK +AlwaysParseTree OK diff --git a/test/files/presentation/ide-t1001326/Test.scala b/test/files/presentation/parse-invariants/Test.scala index ff63b9770a..128896ccaa 100644 --- a/test/files/presentation/ide-t1001326/Test.scala +++ b/test/files/presentation/parse-invariants/Test.scala @@ -6,16 +6,32 @@ object Test extends InteractiveTest { override def execute(): Unit = { val sf = sourceFiles.find(_.file.name == "A.scala").head - uniqueParseTree_t1001326(sf) - unattributedParseTree_t1001326(sf) - neverModifyParseTree_t1001326(sf) - shouldAlwaysReturnParseTree_t1001326(sf) + noNewSymbols(sf) + uniqueParseTree(sf) + unattributedParseTree(sf) + neverModifyParseTree(sf) + shouldAlwaysReturnParseTree(sf) + } + + /** + * Asking for a parseTree should not enter any new symbols. + */ + private def noNewSymbols(sf: SourceFile) { + def nextId() = compiler.NoSymbol.newTermSymbol(compiler.TermName("dummy"), compiler.NoPosition, compiler.NoFlags).id + val id = nextId() + val tree = compiler.parseTree(sf) + val id2 = nextId() + if (id2 == id + 1) { + reporter.println("NoNewSymbolsEntered OK") + } else { + reporter.println("NoNewSymbolsEntered FAILED") + } } /** * Asking twice for a parseTree on the same source should always return a new tree */ - private def uniqueParseTree_t1001326(sf: SourceFile) { + private def uniqueParseTree(sf: SourceFile) { val parseTree1 = compiler.parseTree(sf) val parseTree2 = compiler.parseTree(sf) if (parseTree1 != parseTree2) { @@ -28,7 +44,7 @@ object Test extends InteractiveTest { /** * A parseTree should never contain any symbols or types */ - private def unattributedParseTree_t1001326(sf: SourceFile) { + private def unattributedParseTree(sf: SourceFile) { if (noSymbolsOrTypes(compiler.parseTree(sf))) { reporter.println("Unattributed OK") } else { @@ -39,7 +55,7 @@ object Test extends InteractiveTest { /** * Once you have obtained a parseTree it should never change */ - private def neverModifyParseTree_t1001326(sf: SourceFile) { + private def neverModifyParseTree(sf: SourceFile) { val parsedTree = compiler.parseTree(sf) loadSourceAndWaitUntilTypechecked(sf) if (noSymbolsOrTypes(parsedTree)) { @@ -52,7 +68,7 @@ object Test extends InteractiveTest { /** * Should always return a parse tree */ - private def shouldAlwaysReturnParseTree_t1001326(sf: SourceFile) { + private def shouldAlwaysReturnParseTree(sf: SourceFile) { loadSourceAndWaitUntilTypechecked(sf) if (noSymbolsOrTypes(compiler.parseTree(sf))) { reporter.println("AlwaysParseTree OK") diff --git a/test/files/presentation/parse-invariants/src/a/A.scala b/test/files/presentation/parse-invariants/src/a/A.scala new file mode 100644 index 0000000000..1ae78cad05 --- /dev/null +++ b/test/files/presentation/parse-invariants/src/a/A.scala @@ -0,0 +1,138 @@ +package syntax + +object Terms { + object Literals { + 0 + 0l + 0f + 0d + 0xb33f + 'c' + "string" + """ + multi-line + string + """ + 'symbol + true + false + null + () + } + + object Patterns { + 0 match { case 0 => } + 1 match { case (0 | 1) => } + 2 match { case _: Int => } + 3 match { case _ => } + Some(0) match { case Some(0) => } + Some(0) match { case name @ Some(_) => } + Some(Some(0)) match { case nested @ Some(deeper @ Some(_)) => } + List(1, 2, 3) match { case unapplySeq @ List(1, 2, _*) => } + 0 match { case i if i > 0 => } + List(1) match { case _: List[t] => List.empty[t] } + } + + object New { + class Foo + trait Bar + new Foo + new Foo { selfie => } + new Foo with Bar + new { val early = 1 } with Bar + new { val name = "anon "} + } + + def tuple = (1, 'two, "three") + def lambda = (x: Int, y: Int) => x + y + def lambda2 = (_: Int) + (_: Int) + def blocks = { { {}; {} }; {} } + def ascription = (1: Int) + def select = Nil.size + def method1 = "s".replace("foo", "bar") + def method2 = "s" + "s" + def method3 = Nil.foreach { e => } + def method4 = 1 :: 2 :: 3 :: Nil + def if1 = if (true) true else false + def if2 = if (true) true + def `return`: Int = { return 0 } + def `throw` = throw new Exception + def `match` = 0 match { case 0 => case _ => } + def `try` = try 0 catch { case _ => } finally 0 + def `while` = while(true) 0 + def `do while` = do 0 while(true) + def `for` = for (i <- 1 to 10; if i % 2 == 0; j = i + 1) j + def `for yield` = for (a <- List(List(1)); b <- a; c = b * 2) yield b + def interpolation = s"$tuple and maybe also $blocks" + def assign = { var x = 1; x = 2 } + def assign2 = { object o { var x = 1 }; o.x = 2 } + def update = { val v = collection.mutable.Seq(1); v(0) = 2 } + def `this` = this +} + +object Types { + type Reference = scala.App + type Tuple = (Int, String, Double) + type Function = (Int, String) => Double + type Refined = Int { val meta: Any } + type Lambda = ({ type F[T] = List[T] })#F[_] + type Infix = Int Either String + type Application = List[Int] + type Existential = List[T] forSome { type T } + object O { type T = Int } + type Dependent = O.T + class O { type T = Int } + type Selection = O#T +} + +object Definitions { + private val x1 = 0 + private[this] val x2 = 0 + private[Definitions] val x3 = 0 + protected val x4 = 0 + protected[AcessManagement] val x5 = 0 + val x1 = 1 + val x2: Int = 1 + val x3, y3 = 1 + lazy val x4 = 1 + implicit val x5 = 1 + final val x6 = 1 + lazy final val x7 = 1 + val Some(x8) = Some(0) + var x9 = 1 + var x10, y10 = 1 + var x11: Int = 1 + + implicit def implicitView: Option[Int] = None + def implicitArg1(implicit i: Int) = i + 2 + def implicitArg2[T: Fooable] = implicitly[Fooable[T]] + def bound1[T <: Int](x: T): T = x + def bound2[T >: Any](x: T): T = x + def bound3[T <% Int](x: T): Int = x + def vararg(args: Int*) = args.toList + def sum(x: Int, y: Int) = x + y + def multipleArgLists(x: Int)(y: Int) = x + y + + type _0 = Int + type _1[T] = List[T] + type _2[A, B] = Either[A, B] + + class Val(value: Int) extends AnyVal + implicit class Impl(value: Int) { def foo = "foo" } + abstract class Abs + sealed class Sealed + class Child extends Sealed + case class Point(x: Int, y: Int) + + trait Fooable[T] + trait Barable with Fooable[Barable] + + object Foo + object Foo with Fooable[Foo] + case object Zero +} + +package Packages { + package object PackageObject + package Nested { package Deeper { } } +} diff --git a/test/files/presentation/scope-completion-2.check b/test/files/presentation/scope-completion-2.check index 3a1dbd7cff..d94f7a4b56 100644 --- a/test/files/presentation/scope-completion-2.check +++ b/test/files/presentation/scope-completion-2.check @@ -1,12 +1,11 @@ reload: Completions.scala -askScopeCompletion at Completions.scala(16,4) +askScopeCompletion at Completions.scala(15,2) ================================================================================ -[response] askScopeCompletion at (16,4) -retrieved 11 members +[response] askScopeCompletion at (15,2) +retrieved 10 members class Completion1 extends AnyRef def <init>(): test.Completion1 -def test: Unit object Completion1 private class Cc1 extends AnyRef private class Co1 extends AnyRef @@ -17,19 +16,18 @@ private[this] val vc1: Int private[this] val vo1: Int ================================================================================ -askScopeCompletion at Completions.scala(32,4) +askScopeCompletion at Completions.scala(29,2) ================================================================================ -[response] askScopeCompletion at (32,4) -retrieved 11 members -[inaccessible] private[this] val vc1: Int +[response] askScopeCompletion at (29,2) +retrieved 10 members class Completion1 extends AnyRef def <init>(): test.Completion1.type -def test: Unit object Completion1 private class Cc1 extends AnyRef private class Co1 extends AnyRef private def fc1: Int private def fo1: Int private[this] val c: test.Completion1 +private[this] val vc1: Int private[this] val vo1: Int ================================================================================ diff --git a/test/files/presentation/scope-completion-2/src/Completions.scala b/test/files/presentation/scope-completion-2/src/Completions.scala index 96d38f1b85..f8d7cd6ba8 100644 --- a/test/files/presentation/scope-completion-2/src/Completions.scala +++ b/test/files/presentation/scope-completion-2/src/Completions.scala @@ -9,12 +9,10 @@ class Completion1 { private val vc1 = 0 private def fc1 = 0 - private class Cc1 - - def test { - // needs to be done in a method, because of SI-7280 - /*_*/ + private class Cc1 { } + + /*_*/ } object Completion1 { @@ -25,11 +23,9 @@ object Completion1 { private val vo1 = 0 private def fo1 = 0 - private class Co1 - - def test { - // needs to be done in a method, because of SI-7280 - /*_*/ + private class Co1 { } + + /*_*/ } diff --git a/test/files/presentation/scope-completion-3.check b/test/files/presentation/scope-completion-3.check index cf73e89a3b..df3007ab4e 100644 --- a/test/files/presentation/scope-completion-3.check +++ b/test/files/presentation/scope-completion-3.check @@ -12,13 +12,9 @@ retrieved 49 members [inaccessible] private object Ot2 [inaccessible] private type tb2 = Completion1.this.tb2 [inaccessible] private type tt2 = Completion1.this.tt2 -[inaccessible] private[this] val vb1: Int [inaccessible] private[this] val vb2: Int -[inaccessible] private[this] val vt1: Int [inaccessible] private[this] val vt2: Int -[inaccessible] private[this] var rb1: Int [inaccessible] private[this] var rb2: Int -[inaccessible] private[this] var rt1: Int [inaccessible] private[this] var rt2: Int abstract class Base1 extends AnyRef abstract trait Trait1 extends AnyRef @@ -42,13 +38,17 @@ private class Cc2 extends AnyRef private def fc2: Int private object Oc2 private type tc2 = Completion1.this.tc2 +private[this] val vb1: Int private[this] val vb3: Int private[this] val vc1: Int private[this] val vc2: Int +private[this] val vt1: Int private[this] val vt3: Int +private[this] var rb1: Int private[this] var rb3: Int private[this] var rc1: Int private[this] var rc2: Int +private[this] var rt1: Int private[this] var rt3: Int type tb1 = Completion1.this.tb1 type tc1 = Completion1.this.tc1 @@ -67,13 +67,9 @@ retrieved 49 members [inaccessible] private object Ot2 [inaccessible] private type tb2 = test.Completion2.tb2 [inaccessible] private type tt2 = test.Completion2.tt2 -[inaccessible] private[this] val vb1: Int [inaccessible] private[this] val vb2: Int -[inaccessible] private[this] val vt1: Int [inaccessible] private[this] val vt2: Int -[inaccessible] private[this] var rb1: Int [inaccessible] private[this] var rb2: Int -[inaccessible] private[this] var rt1: Int [inaccessible] private[this] var rt2: Int abstract class Base1 extends AnyRef abstract trait Trait1 extends AnyRef @@ -97,13 +93,17 @@ private class Co2 extends AnyRef private def fo2: Int private object Oo2 private type to2 = test.Completion2.to2 +private[this] val vb1: Int private[this] val vb3: Int private[this] val vo1: Int private[this] val vo2: Int +private[this] val vt1: Int private[this] val vt3: Int +private[this] var rb1: Int private[this] var rb3: Int private[this] var ro1: Int private[this] var ro2: Int +private[this] var rt1: Int private[this] var rt3: Int type tb1 = test.Completion2.tb1 type to1 = test.Completion2.to1 diff --git a/test/files/presentation/scope-completion-import.check b/test/files/presentation/scope-completion-import.check index d518b0c37a..220ffc399b 100644 --- a/test/files/presentation/scope-completion-import.check +++ b/test/files/presentation/scope-completion-import.check @@ -1,9 +1,13 @@ reload: Completions.scala -askScopeCompletion at Completions.scala(15,4) -================================================================================ -[response] askScopeCompletion at (15,4) -retrieved 10 members +askScopeCompletion at Completions.scala(23,4) +================================================================================ +[response] askScopeCompletion at (23,4) +retrieved 18 members +[inaccessible] private[this] val pVCCC: Int +[inaccessible] private[this] val pVOOO: Int +[inaccessible] private[this] var pRCCC: Int +[inaccessible] private[this] var pROOO: Int class C extends AnyRef class Foo extends AnyRef class Foo_1 extends AnyRef @@ -13,13 +17,21 @@ def <init>(): test.Foo def fCCC: Int def fOOO: Int object O +private[this] val vCCC: Int +private[this] val vOOO: Int +private[this] var rCCC: Int +private[this] var rOOO: Int val o: test.O.type ================================================================================ -askScopeCompletion at Completions.scala(19,4) -================================================================================ -[response] askScopeCompletion at (19,4) -retrieved 9 members +askScopeCompletion at Completions.scala(27,4) +================================================================================ +[response] askScopeCompletion at (27,4) +retrieved 17 members +[inaccessible] private[this] val pVCCC: Int +[inaccessible] private[this] val pVOOO: Int +[inaccessible] private[this] var pRCCC: Int +[inaccessible] private[this] var pROOO: Int class C extends AnyRef class Foo extends AnyRef class Foo_1 extends AnyRef @@ -29,12 +41,18 @@ def <init>(): test.Foo def fCCC: Int def fOOO: Int object O +private[this] val vCCC: Int +private[this] val vOOO: Int +private[this] var rCCC: Int +private[this] var rOOO: Int ================================================================================ -askScopeCompletion at Completions.scala(24,4) +askScopeCompletion at Completions.scala(32,4) ================================================================================ -[response] askScopeCompletion at (24,4) -retrieved 9 members +[response] askScopeCompletion at (32,4) +retrieved 13 members +[inaccessible] private[this] val pVCCC: Int +[inaccessible] private[this] var pRCCC: Int class C extends AnyRef class Foo extends AnyRef class Foo_1 extends AnyRef @@ -43,12 +61,14 @@ class Foo_3 extends AnyRef def <init>(): test.Foo def fCCC: Int object O +private[this] val vCCC: Int +private[this] var rCCC: Int val c: test.C ================================================================================ -askScopeCompletion at Completions.scala(27,5) +askScopeCompletion at Completions.scala(35,5) ================================================================================ -[response] askScopeCompletion at (27,5) +[response] askScopeCompletion at (35,5) retrieved 8 members class C extends AnyRef class Foo extends AnyRef @@ -60,10 +80,12 @@ object O val c: test.C ================================================================================ -askScopeCompletion at Completions.scala(30,5) +askScopeCompletion at Completions.scala(38,5) ================================================================================ -[response] askScopeCompletion at (30,5) -retrieved 9 members +[response] askScopeCompletion at (38,5) +retrieved 13 members +[inaccessible] private[this] val pVCCC: Int +[inaccessible] private[this] var pRCCC: Int class C extends AnyRef class Foo extends AnyRef class Foo_1 extends AnyRef @@ -72,13 +94,19 @@ class Foo_3 extends AnyRef def <init>(): test.Foo def fCCC: Int object O +private[this] val vCCC: Int +private[this] var rCCC: Int val c: test.C ================================================================================ -askScopeCompletion at Completions.scala(32,5) -================================================================================ -[response] askScopeCompletion at (32,5) -retrieved 10 members +askScopeCompletion at Completions.scala(40,5) +================================================================================ +[response] askScopeCompletion at (40,5) +retrieved 18 members +[inaccessible] private[this] val pVCCC: Int +[inaccessible] private[this] val pVOOO: Int +[inaccessible] private[this] var pRCCC: Int +[inaccessible] private[this] var pROOO: Int class C extends AnyRef class Foo extends AnyRef class Foo_1 extends AnyRef @@ -88,13 +116,21 @@ def <init>(): test.Foo def fCCC: Int def fOOO: Int object O +private[this] val vCCC: Int +private[this] val vOOO: Int +private[this] var rCCC: Int +private[this] var rOOO: Int val c: test.C ================================================================================ -askScopeCompletion at Completions.scala(41,4) -================================================================================ -[response] askScopeCompletion at (41,4) -retrieved 10 members +askScopeCompletion at Completions.scala(49,4) +================================================================================ +[response] askScopeCompletion at (49,4) +retrieved 18 members +[inaccessible] private[this] val pVCCC: Int +[inaccessible] private[this] val pVOOO: Int +[inaccessible] private[this] var pRCCC: Int +[inaccessible] private[this] var pROOO: Int class C extends AnyRef class Foo extends AnyRef class Foo_1 extends AnyRef @@ -105,12 +141,20 @@ def bar: Unit def fCCC: Int def fOOO: Int object O +private[this] val vCCC: Int +private[this] val vOOO: Int +private[this] var rCCC: Int +private[this] var rOOO: Int ================================================================================ -askScopeCompletion at Completions.scala(51,4) -================================================================================ -[response] askScopeCompletion at (51,4) -retrieved 11 members +askScopeCompletion at Completions.scala(59,4) +================================================================================ +[response] askScopeCompletion at (59,4) +retrieved 19 members +[inaccessible] private[this] val pVCCC: Int +[inaccessible] private[this] val pVOOO: Int +[inaccessible] private[this] var pRCCC: Int +[inaccessible] private[this] var pROOO: Int class C extends AnyRef class Foo extends AnyRef class Foo_1 extends AnyRef @@ -122,12 +166,18 @@ def fCCC: Int def fOOO: Int object O private[this] val o: test.O.type +private[this] val vCCC: Int +private[this] val vOOO: Int +private[this] var rCCC: Int +private[this] var rOOO: Int ================================================================================ -askScopeCompletion at Completions.scala(61,4) +askScopeCompletion at Completions.scala(69,4) ================================================================================ -[response] askScopeCompletion at (61,4) -retrieved 10 members +[response] askScopeCompletion at (69,4) +retrieved 14 members +[inaccessible] private[this] val pVCCC: Int +[inaccessible] private[this] var pRCCC: Int class C extends AnyRef class Foo extends AnyRef class Foo_1 extends AnyRef @@ -138,4 +188,6 @@ def bar: Unit def fCCC: Int object O private[this] val c: test.C +private[this] val vCCC: Int +private[this] var rCCC: Int ================================================================================ diff --git a/test/files/presentation/scope-completion-import/src/Completions.scala b/test/files/presentation/scope-completion-import/src/Completions.scala index 6e08321283..d30aa0b4e3 100644 --- a/test/files/presentation/scope-completion-import/src/Completions.scala +++ b/test/files/presentation/scope-completion-import/src/Completions.scala @@ -1,10 +1,18 @@ package test class C { + val vCCC : Int = 0 + var rCCC : Int = 0 + private val pVCCC : Int = 0 + private var pRCCC : Int = 0 def fCCC : Int = 0 } object O extends C { + val vOOO : Int = 0 + var rOOO : Int = 0 + private val pVOOO : Int = 0 + private var pROOO : Int = 0 def fOOO : Int = 0 } diff --git a/test/files/run/idempotency-case-classes.scala b/test/files/run/idempotency-case-classes.scala index 4da8393cb6..81e119582b 100644 --- a/test/files/run/idempotency-case-classes.scala +++ b/test/files/run/idempotency-case-classes.scala @@ -10,7 +10,7 @@ object Test extends App { } println(casee.eval) val tb = cm.mkToolBox() - val tcasee = tb.typeCheck(casee.tree) + val tcasee = tb.typecheck(casee.tree) println(tcasee) val rtcasee = tb.resetAllAttrs(tcasee) try { diff --git a/test/files/run/idempotency-extractors.scala b/test/files/run/idempotency-extractors.scala index fe033295f5..b66b043be1 100644 --- a/test/files/run/idempotency-extractors.scala +++ b/test/files/run/idempotency-extractors.scala @@ -10,7 +10,7 @@ object Test extends App { } println(extractor.eval) val tb = cm.mkToolBox() - val textractor = tb.typeCheck(extractor.tree) + val textractor = tb.typecheck(extractor.tree) println(textractor) val rtextractor = tb.resetAllAttrs(textractor) try { diff --git a/test/files/run/idempotency-labels.scala b/test/files/run/idempotency-labels.scala index 82d009751a..f1a185d3d0 100644 --- a/test/files/run/idempotency-labels.scala +++ b/test/files/run/idempotency-labels.scala @@ -11,7 +11,7 @@ object Test extends App { } println(label.eval) val tb = cm.mkToolBox() - val tlabel = tb.typeCheck(label.tree) + val tlabel = tb.typecheck(label.tree) println(tlabel) val rtlabel = tb.resetAllAttrs(tlabel) try { diff --git a/test/files/run/idempotency-lazy-vals.scala b/test/files/run/idempotency-lazy-vals.scala index 3531f9ff4b..e763f2f3f4 100644 --- a/test/files/run/idempotency-lazy-vals.scala +++ b/test/files/run/idempotency-lazy-vals.scala @@ -15,7 +15,7 @@ object Test extends App { } println(lazee.eval) val tb = cm.mkToolBox() - val tlazee = tb.typeCheck(lazee.tree) + val tlazee = tb.typecheck(lazee.tree) println(tlazee) val rtlazee = tb.resetAllAttrs(tlazee) try { diff --git a/test/files/run/idempotency-this.scala b/test/files/run/idempotency-this.scala index 5cd4226326..2db1efd2d1 100644 --- a/test/files/run/idempotency-this.scala +++ b/test/files/run/idempotency-this.scala @@ -9,7 +9,7 @@ object Test extends App { } println(thiss.eval) val tb = cm.mkToolBox() - val tthiss = tb.typeCheck(thiss.tree) + val tthiss = tb.typecheck(thiss.tree) println(tthiss) println(showRaw(tthiss)) val rtthiss = tb.resetAllAttrs(tthiss) diff --git a/test/files/run/iq.check b/test/files/run/iq.check index 81114ea181..311bf83ed4 100644 --- a/test/files/run/iq.check +++ b/test/files/run/iq.check @@ -1,4 +1,8 @@ Empty +q2: Queue(42, 0) +qa: Queue(42, 0) +qb: Queue(42, 0) +qc: Queue(42, 0) Head: 42 q5: Queue(0, 1, 2, 3, 4, 5, 6, 7, 8, 9) q5[5]: 5 diff --git a/test/files/run/iq.scala b/test/files/run/iq.scala index 31859cf867..1eb1d40e37 100644 --- a/test/files/run/iq.scala +++ b/test/files/run/iq.scala @@ -16,10 +16,21 @@ object iq { Console.println("Empty") } - /* Test infix enqueing. */ - //val q2 = q + 42 + 0 // deprecated + /* Test enqueing. */ val q2 = q.enqueue(42).enqueue(0) + val qa = q :+ 42 :+ 0 + assert(q2 == qa) + + val qb = 42 +: 0 +: q + assert(q2 == qb) + val qc = 42 +: q :+ 0 + assert(q2 == qc) + Console.println("q2: " + q2) + Console.println("qa: " + qa) + Console.println("qb: " + qb) + Console.println("qc: " + qc) + /* Test is empty and dequeue. * Expected: Head: 42 */ @@ -37,7 +48,7 @@ object iq { /* Test sequence enqueing. */ val q5: Queue[Any] = q4.enqueue(List(1,2,3,4,5,6,7,8,9)) /* Test toString. - * Expected: Head: q5: Queue(0,1,2,3,4,5,6,7,8,9) + * Expected: q5: Queue(0,1,2,3,4,5,6,7,8,9) */ Console.println("q5: " + q5) /* Test apply diff --git a/test/files/run/literals.check b/test/files/run/literals.check index 5f948762b7..ed7c6ca5b3 100644 --- a/test/files/run/literals.check +++ b/test/files/run/literals.check @@ -1,4 +1,4 @@ -warning: there were 18 deprecation warning(s); re-run with -deprecation for details +warning: there were 5 deprecation warning(s); re-run with -deprecation for details test '\u0024' == '$' was successful test '\u005f' == '_' was successful test 65.asInstanceOf[Char] == 'A' was successful @@ -7,28 +7,19 @@ test "\0x61\0x62".trim() == "x61\0x62" was successful test (65 : Byte) == 'A' was successful -test 01 == 1 was successful -test 010 == 8 was successful test 0X01 == 1 was successful test 0x01 == 1 was successful test 0x10 == 16 was successful test 0xa == 10 was successful test 0x0a == 10 was successful -test +01 == 1 was successful -test +010 == 8 was successful test +0x01 == 1 was successful test +0x10 == 16 was successful test +0xa == 10 was successful test +0x0a == 10 was successful -test -01 == -1 was successful -test -010 == -8 was successful test -0x01 == -1 was successful test -0x10 == -16 was successful test -0xa == -10 was successful test -0x0a == -10 was successful -test 017777777777 == 2147483647 was successful -test 020000000000 == -2147483648 was successful -test 037777777777 == -1 was successful test 0x7fffffff == 2147483647 was successful test 0x80000000 == -2147483648 was successful test 0xffffffff == -1 was successful @@ -36,9 +27,6 @@ test 0xffffffff == -1 was successful test 1l == 1L was successful test 1L == 1l was successful test 1.asInstanceOf[Long] == 1l was successful -test 0777777777777777777777L == 9223372036854775807L was successful -test 01000000000000000000000L == -9223372036854775808L was successful -test 01777777777777777777777L == -1L was successful test 0x7fffffffffffffffL == 9223372036854775807L was successful test 0x8000000000000000L == -9223372036854775808L was successful test 0xffffffffffffffffL == -1L was successful @@ -46,6 +34,7 @@ test 0xffffffffffffffffL == -1L was successful test 1e1f == 10.0f was successful test .3f == 0.3f was successful test 0f == 0.0f was successful +test 01.23f == 1.23f was successful test 3.14f == 3.14f was successful test 6.022e23f == 6.022e23f was successful test 09f == 9.0f was successful @@ -56,6 +45,8 @@ test 1e1 == 10.0 was successful test .3 == 0.3 was successful test 0.0 == 0.0 was successful test 0d == 0.0 was successful +test 01.23 == 1.23 was successful +test 01.23d == 1.23d was successful test 3.14 == 3.14 was successful test 1e-9d == 1.0e-9 was successful test 1e137 == 1.0e137 was successful diff --git a/test/files/run/literals.scala b/test/files/run/literals.scala index 7676125339..5f23e6b492 100644 --- a/test/files/run/literals.scala +++ b/test/files/run/literals.scala @@ -47,32 +47,22 @@ object Test { println // int - check_success("01 == 1", 01, 1) - check_success("010 == 8", 010, 8) check_success("0X01 == 1", 0X01, 1) check_success("0x01 == 1", 0x01, 1) check_success("0x10 == 16", 0x10, 16) check_success("0xa == 10", 0xa, 10) check_success("0x0a == 10", 0x0a, 10) - check_success("+01 == 1", +01, 1) - check_success("+010 == 8", +010, 8) check_success("+0x01 == 1", +0x01, 1) check_success("+0x10 == 16", +0x10, 16) check_success("+0xa == 10", +0xa, 10) check_success("+0x0a == 10", +0x0a, 10) - check_success("-01 == -1", -01, -1) - check_success("-010 == -8", -010, -8) check_success("-0x01 == -1", -0x01, -1) check_success("-0x10 == -16", -0x10, -16) check_success("-0xa == -10", -0xa, -10) check_success("-0x0a == -10", -0x0a, -10) - check_success("017777777777 == 2147483647", 017777777777, 2147483647) - check_success("020000000000 == -2147483648", 020000000000, -2147483648) - check_success("037777777777 == -1", 037777777777, -1) - check_success("0x7fffffff == 2147483647", 0x7fffffff, 2147483647) check_success("0x80000000 == -2147483648", 0x80000000, -2147483648) check_success("0xffffffff == -1", 0xffffffff, -1) @@ -84,13 +74,6 @@ object Test { check_success("1L == 1l", 1L, 1l) check_success("1.asInstanceOf[Long] == 1l", 1.asInstanceOf[Long], 1l) - check_success("0777777777777777777777L == 9223372036854775807L", - 0777777777777777777777L, 9223372036854775807L) - check_success("01000000000000000000000L == -9223372036854775808L", - 01000000000000000000000L, -9223372036854775808L) - check_success("01777777777777777777777L == -1L", - 01777777777777777777777L, -1L) - check_success("0x7fffffffffffffffL == 9223372036854775807L", 0x7fffffffffffffffL, 9223372036854775807L) check_success("0x8000000000000000L == -9223372036854775808L", @@ -105,9 +88,9 @@ object Test { // float check_success("1e1f == 10.0f", 1e1f, 10.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("01.23f == 1.23f", 01.23f, 1.23f) check_success("3.14f == 3.14f", 3.14f, 3.14f) check_success("6.022e23f == 6.022e23f", 6.022e23f, 6.022e23f) check_success("09f == 9.0f", 09f, 9.0f) @@ -118,11 +101,11 @@ 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(".3 == 0.3", .3, 0.3) check_success("0.0 == 0.0", 0.0, 0.0) check_success("0d == 0.0", 0d, 0.0) + check_success("01.23 == 1.23", 01.23, 1.23) + check_success("01.23d == 1.23d", 01.23d, 1.23d) check_success("3.14 == 3.14", 3.14, 3.14) check_success("1e-9d == 1.0e-9", 1e-9d, 1.0e-9) check_success("1e137 == 1.0e137", 1e137, 1.0e137) diff --git a/test/files/run/macro-bodyexpandstoimpl/Impls_1.scala b/test/files/run/macro-bodyexpandstoimpl/Impls_1.scala index 0a9f9a0ced..8506239952 100644 --- a/test/files/run/macro-bodyexpandstoimpl/Impls_1.scala +++ b/test/files/run/macro-bodyexpandstoimpl/Impls_1.scala @@ -4,7 +4,7 @@ import scala.reflect.macros.{BlackboxContext, WhiteboxContext} object Impls { def foo(c: BlackboxContext)(x: c.Expr[Int]) = x - def refToFoo(dummy: Int) = macro refToFoo_impl + def refToFoo(dummy: Int): Int = macro refToFoo_impl def refToFoo_impl(c: WhiteboxContext)(dummy: c.Expr[Int]) = { import c.universe._ val body = Select(Ident(TermName("Impls")), TermName("foo")) diff --git a/test/files/run/macro-bodyexpandstoimpl/Macros_Test_2.scala b/test/files/run/macro-bodyexpandstoimpl/Macros_Test_2.scala index cfcb59c17b..486e1de090 100644 --- a/test/files/run/macro-bodyexpandstoimpl/Macros_Test_2.scala +++ b/test/files/run/macro-bodyexpandstoimpl/Macros_Test_2.scala @@ -1,7 +1,7 @@ import scala.language.experimental.macros object Macros { - def foo(x: Int) = macro Impls.refToFoo(42) + def foo(x: Int): Int = macro Impls.refToFoo(42) } object Test extends App { diff --git a/test/files/run/macro-bundle-repl.check b/test/files/run/macro-bundle-repl.check index 795debded7..8487042d66 100644 --- a/test/files/run/macro-bundle-repl.check +++ b/test/files/run/macro-bundle-repl.check @@ -7,7 +7,7 @@ import scala.language.experimental.macros scala> import scala.reflect.macros.BlackboxMacro import scala.reflect.macros.BlackboxMacro -scala> trait Bar extends BlackboxMacro { def impl = { import c.universe._; c.Expr[Unit](q"()") } };def bar = macro Bar.impl +scala> trait Bar extends BlackboxMacro { def impl = { import c.universe._; c.Expr[Unit](q"()") } };def bar: Unit = macro Bar.impl defined trait Bar defined term macro bar: Unit @@ -16,7 +16,7 @@ scala> bar scala> trait Foo extends BlackboxMacro { def impl = { import c.universe._; c.Expr[Unit](q"()") } } defined trait Foo -scala> def foo = macro Foo.impl +scala> def foo: Unit = macro Foo.impl defined term macro foo: Unit scala> foo diff --git a/test/files/run/macro-bundle-repl.scala b/test/files/run/macro-bundle-repl.scala index 50811cdb65..db64f05943 100644 --- a/test/files/run/macro-bundle-repl.scala +++ b/test/files/run/macro-bundle-repl.scala @@ -4,10 +4,10 @@ object Test extends ReplTest { def code = """ import scala.language.experimental.macros import scala.reflect.macros.BlackboxMacro -trait Bar extends BlackboxMacro { def impl = { import c.universe._; c.Expr[Unit](q"()") } };def bar = macro Bar.impl +trait Bar extends BlackboxMacro { def impl = { import c.universe._; c.Expr[Unit](q"()") } };def bar: Unit = macro Bar.impl bar trait Foo extends BlackboxMacro { def impl = { import c.universe._; c.Expr[Unit](q"()") } } -def foo = macro Foo.impl +def foo: Unit = macro Foo.impl foo """ } diff --git a/test/files/run/macro-def-infer-return-type.check b/test/files/run/macro-def-infer-return-type.check deleted file mode 100644 index fbd164f139..0000000000 --- a/test/files/run/macro-def-infer-return-type.check +++ /dev/null @@ -1,8 +0,0 @@ -42 -reflective compilation has failed: - -exception during macro expansion: -java.lang.Error: an implementation is missing - at Impls2$.foo(Impls_1.scala:9) - -42 diff --git a/test/files/run/macro-def-infer-return-type.flags b/test/files/run/macro-def-infer-return-type.flags deleted file mode 100644 index cd66464f2f..0000000000 --- a/test/files/run/macro-def-infer-return-type.flags +++ /dev/null @@ -1 +0,0 @@ --language:experimental.macros
\ No newline at end of file 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 deleted file mode 100644 index c670b1e57e..0000000000 --- a/test/files/run/macro-def-infer-return-type/Impls_1.scala +++ /dev/null @@ -1,14 +0,0 @@ -import scala.reflect.macros.BlackboxContext - -object Impls1 { - def foo(c: BlackboxContext)(x: c.Expr[Int]) = x -} - -object Impls2 { - def foo[T](c: BlackboxContext)(x: c.Expr[T]) = - throw new Error("an implementation is missing") -} - -object Impls3 { - def foo[T](c: BlackboxContext)(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 deleted file mode 100644 index f579586b7f..0000000000 --- a/test/files/run/macro-def-infer-return-type/Macros_Test_2.scala +++ /dev/null @@ -1,24 +0,0 @@ -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/Test_1.scala b/test/files/run/macro-def-path-dependent/Test_1.scala index f9aa13c334..bba97fcae1 100644 --- a/test/files/run/macro-def-path-dependent/Test_1.scala +++ b/test/files/run/macro-def-path-dependent/Test_1.scala @@ -1,23 +1,25 @@ -package test1 - -import scala.reflect.macros.{BlackboxContext => Ctx} - -trait Exprs { - self: Universe => - - class Expr[T] -} - -trait Reifiers { - self: Universe => - - type Expr[T] - - def reify[T](expr: T) = macro Impls.reify[T] -} - -trait Universe extends Exprs with Reifiers - -object Impls { - def reify[T](cc: Ctx{ type PrefixType = Reifiers })(expr: cc.Expr[T]): cc.Expr[cc.prefix.value.Expr[T]] = ??? -} +// NOTE: blocked by SI-8049 + +// package test1 +// +// import scala.reflect.macros.{BlackboxContext => Ctx} +// +// trait Exprs { +// self: Universe => +// +// class Expr[T] +// } +// +// trait Reifiers { +// self: Universe => +// +// type Expr[T] +// +// def reify[T](expr: T): Expr[T] = macro Impls.reify[T] +// } +// +// trait Universe extends Exprs with Reifiers +// +// object Impls { +// def reify[T](cc: Ctx{ type PrefixType = Reifiers })(expr: cc.Expr[T]): cc.Expr[cc.prefix.value.Expr[T]] = ??? +// } diff --git a/test/files/run/macro-def-path-dependent/Test_2.scala b/test/files/run/macro-def-path-dependent/Test_2.scala index cdedaf2732..c884ab9d0b 100644 --- a/test/files/run/macro-def-path-dependent/Test_2.scala +++ b/test/files/run/macro-def-path-dependent/Test_2.scala @@ -14,7 +14,7 @@ trait Reifiers { } trait Universe extends Exprs with Reifiers { - def reify[T](expr: T) = macro Impls.reify[T] + def reify[T](expr: T): Expr[T] = macro Impls.reify[T] } object Impls { diff --git a/test/files/run/macro-def-path-dependent/Test_4.scala b/test/files/run/macro-def-path-dependent/Test_4.scala index e8a8cf3909..6562802013 100644 --- a/test/files/run/macro-def-path-dependent/Test_4.scala +++ b/test/files/run/macro-def-path-dependent/Test_4.scala @@ -5,7 +5,7 @@ import scala.reflect.macros.BlackboxContext import scala.reflect.api.Universe object Test { - def materializeTypeTag[T](u: Universe)(e: T) = macro materializeTypeTag_impl[T] + def materializeTypeTag[T](u: Universe)(e: T): u.TypeTag[T] = macro materializeTypeTag_impl[T] def materializeTypeTag_impl[T: c.WeakTypeTag](c: BlackboxContext)(u: c.Expr[Universe])(e: c.Expr[T]): c.Expr[u.value.TypeTag[T]] = ??? }
\ No newline at end of file diff --git a/test/files/run/macro-def-path-dependent/Test_6.scala b/test/files/run/macro-def-path-dependent/Test_6.scala index c8ddffc143..011e726b3f 100644 --- a/test/files/run/macro-def-path-dependent/Test_6.scala +++ b/test/files/run/macro-def-path-dependent/Test_6.scala @@ -5,5 +5,5 @@ import scala.reflect.macros.BlackboxContext import scala.reflect.api.Universe object Macros { - def materializeTypeTag[T](u: Universe)(e: T) = macro Impls.materializeTypeTag_impl[T] + def materializeTypeTag[T](u: Universe)(e: T): u.TypeTag[T] = macro Impls.materializeTypeTag_impl[T] }
\ No newline at end of file diff --git a/test/files/run/macro-expand-implicit-macro-has-implicit/Macros_Test_2.scala b/test/files/run/macro-expand-implicit-macro-has-implicit/Macros_Test_2.scala index ffb04dc80b..fec914632f 100644 --- a/test/files/run/macro-expand-implicit-macro-has-implicit/Macros_Test_2.scala +++ b/test/files/run/macro-expand-implicit-macro-has-implicit/Macros_Test_2.scala @@ -1,5 +1,5 @@ object Test extends App { implicit val x = 42 - def foo(implicit x: Int) = macro Impls.foo + def foo(implicit x: Int): Unit = macro Impls.foo foo }
\ No newline at end of file diff --git a/test/files/run/macro-expand-implicit-macro-is-val/Macros_Test_2.scala b/test/files/run/macro-expand-implicit-macro-is-val/Macros_Test_2.scala index b91b1016c9..2f21785bae 100644 --- a/test/files/run/macro-expand-implicit-macro-is-val/Macros_Test_2.scala +++ b/test/files/run/macro-expand-implicit-macro-is-val/Macros_Test_2.scala @@ -1,5 +1,5 @@ object Test extends App { - implicit def foo = macro Impls.foo + implicit def foo: Int = macro Impls.foo def bar(implicit x: Int) = println(x) bar }
\ No newline at end of file diff --git a/test/files/run/macro-expand-multiple-arglists/Macros_Test_2.scala b/test/files/run/macro-expand-multiple-arglists/Macros_Test_2.scala index fa4504b0ea..54b959983b 100644 --- a/test/files/run/macro-expand-multiple-arglists/Macros_Test_2.scala +++ b/test/files/run/macro-expand-multiple-arglists/Macros_Test_2.scala @@ -1,4 +1,4 @@ object Test extends App { - def foo(x: Int)(y: Int) = macro Impls.foo + def foo(x: Int)(y: Int): Unit = macro Impls.foo foo(40)(2) }
\ No newline at end of file diff --git a/test/files/run/macro-expand-nullary-generic/Macros_Test_2.scala b/test/files/run/macro-expand-nullary-generic/Macros_Test_2.scala index 2d5cf53c3c..edd9051754 100644 --- a/test/files/run/macro-expand-nullary-generic/Macros_Test_2.scala +++ b/test/files/run/macro-expand-nullary-generic/Macros_Test_2.scala @@ -1,8 +1,8 @@ object Macros { - def foo1[T] = macro Impls.fooNullary[T] - def foo2[T]() = macro Impls.fooEmpty[T] - def bar1[T](x: Int) = macro Impls.barNullary[T] - def bar2[T](x: Int)() = macro Impls.barEmpty[T] + def foo1[T]: Unit = macro Impls.fooNullary[T] + def foo2[T](): Unit = macro Impls.fooEmpty[T] + def bar1[T](x: Int): Unit = macro Impls.barNullary[T] + def bar2[T](x: Int)(): Unit = macro Impls.barEmpty[T] } object Test extends App { diff --git a/test/files/run/macro-expand-nullary-nongeneric/Macros_Test_2.scala b/test/files/run/macro-expand-nullary-nongeneric/Macros_Test_2.scala index 1f6d717956..51915dfb27 100644 --- a/test/files/run/macro-expand-nullary-nongeneric/Macros_Test_2.scala +++ b/test/files/run/macro-expand-nullary-nongeneric/Macros_Test_2.scala @@ -1,8 +1,8 @@ object Macros { - def foo1 = macro Impls.fooNullary - def foo2() = macro Impls.fooEmpty - def bar1(x: Int) = macro Impls.barNullary - def bar2(x: Int)() = macro Impls.barEmpty + def foo1: Unit = macro Impls.fooNullary + def foo2(): Unit = macro Impls.fooEmpty + def bar1(x: Int): Unit = macro Impls.barNullary + def bar2(x: Int)(): Unit = macro Impls.barEmpty } object Test extends App { diff --git a/test/files/run/macro-expand-overload/Macros_Test_2.scala b/test/files/run/macro-expand-overload/Macros_Test_2.scala index 7f61f85184..87cff2ecbd 100644 --- a/test/files/run/macro-expand-overload/Macros_Test_2.scala +++ b/test/files/run/macro-expand-overload/Macros_Test_2.scala @@ -1,13 +1,13 @@ object Macros { - def foo(x: String) = macro Impls.fooObjectString - def foo(x: Int) = macro Impls.fooObjectInt - def foo(x: Boolean) = println("fooObjectBoolean") + def foo(x: String): Unit = macro Impls.fooObjectString + def foo(x: Int): Unit = macro Impls.fooObjectInt + def foo(x: Boolean): Unit = println("fooObjectBoolean") } class Macros { - def foo(x: String) = macro Impls.fooClassString - def foo(x: Int) = macro Impls.fooClassInt - def foo(x: Boolean) = println("fooClassBoolean") + def foo(x: String): Unit = macro Impls.fooClassString + def foo(x: Int): Unit = macro Impls.fooClassInt + def foo(x: Boolean): Unit = println("fooClassBoolean") } object Test extends App { diff --git a/test/files/run/macro-expand-override/Macros_Test_2.scala b/test/files/run/macro-expand-override/Macros_Test_2.scala index f162773c95..160831c54e 100644 --- a/test/files/run/macro-expand-override/Macros_Test_2.scala +++ b/test/files/run/macro-expand-override/Macros_Test_2.scala @@ -1,17 +1,17 @@ class B { - def foo(x: String) = macro Impls.fooBString - def foo(x: Int) = macro Impls.fooBInt - def foo(x: Boolean) = println("fooBBoolean") + def foo(x: String): Unit = macro Impls.fooBString + def foo(x: Int): Unit = macro Impls.fooBInt + def foo(x: Boolean): Unit = println("fooBBoolean") } class D extends B { - //override def foo(x: String) = println("fooDString") => method cannot override a macro - override def foo(x: Int) = macro Impls.fooDInt + //override def foo(x: String): Unit = println("fooDString") => method cannot override a macro + override def foo(x: Int): Unit = macro Impls.fooDInt } class Z extends D { - override def foo(x: String) = macro Impls.fooZString - override def foo(x: Boolean) = println("fooZBoolean") + override def foo(x: String): Unit = macro Impls.fooZString + override def foo(x: Boolean): Unit = println("fooZBoolean") } object Test extends App { diff --git a/test/files/run/macro-expand-recursive/Macros_Test_2.scala b/test/files/run/macro-expand-recursive/Macros_Test_2.scala index 6ff691bdb1..5332fdacee 100644 --- a/test/files/run/macro-expand-recursive/Macros_Test_2.scala +++ b/test/files/run/macro-expand-recursive/Macros_Test_2.scala @@ -1,6 +1,6 @@ object Macros { - def foo = macro Impls.foo - def fooFoo = macro Impls.fooFoo + def foo: Unit = macro Impls.foo + def fooFoo: Unit = macro Impls.fooFoo } object Test extends App { 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 index 37a4bcb2b9..6cb2b53465 100644 --- a/test/files/run/macro-expand-tparams-bounds/Macros_Test_2.scala +++ b/test/files/run/macro-expand-tparams-bounds/Macros_Test_2.scala @@ -1,9 +1,9 @@ object Macros1 { - def foo[U <: String] = macro Impls1.foo[U] + def foo[U <: String]: Unit = macro Impls1.foo[U] } object Macros2 { - def foo[T <: D] = macro Impls2.foo[T] + def foo[T <: D]: Unit = macro Impls2.foo[T] } object Test extends App { diff --git a/test/files/run/macro-expand-tparams-explicit/Macros_Test_2.scala b/test/files/run/macro-expand-tparams-explicit/Macros_Test_2.scala index e72c27881a..2cf7b19d2a 100644 --- a/test/files/run/macro-expand-tparams-explicit/Macros_Test_2.scala +++ b/test/files/run/macro-expand-tparams-explicit/Macros_Test_2.scala @@ -1,4 +1,4 @@ object Test extends App { - def foo[U] = macro Impls.foo[U] + def foo[U]: Unit = macro Impls.foo[U] foo[Int] }
\ No newline at end of file diff --git a/test/files/run/macro-expand-tparams-implicit/Macros_Test_2.scala b/test/files/run/macro-expand-tparams-implicit/Macros_Test_2.scala index f8c573f509..1192931931 100644 --- a/test/files/run/macro-expand-tparams-implicit/Macros_Test_2.scala +++ b/test/files/run/macro-expand-tparams-implicit/Macros_Test_2.scala @@ -1,5 +1,5 @@ object Test extends App { - def foo[U](x: U) = macro Impls.foo[U] + def foo[U](x: U): Unit = macro Impls.foo[U] foo(42) foo("42") }
\ No newline at end of file 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 index 2b1730d36e..c8f68b4aff 100644 --- a/test/files/run/macro-expand-tparams-prefix/Macros_Test_2.scala +++ b/test/files/run/macro-expand-tparams-prefix/Macros_Test_2.scala @@ -1,19 +1,19 @@ object Macros1 { class C[T] { - def foo[U](x: U) = macro Impls1.foo[U] + def foo[U](x: U): Unit = macro Impls1.foo[U] } } object Macros2 { class C[T] { - def foo[U](x: U) = macro Impls2.foo[T, U] + def foo[U](x: U): Unit = macro Impls2.foo[T, U] } } object Macros3 { class D[T] { class C[U] { - def foo[V] = macro Impls345.foo[T, U, V] + def foo[V]: Unit = macro Impls345.foo[T, U, V] } } } @@ -23,7 +23,7 @@ object Macros3 { object Macros5 { class D[T] { class C[U] { - def foo[V] = macro Impls345.foo[T, U, V] + def foo[V]: Unit = macro Impls345.foo[T, U, V] foo[Boolean] } } diff --git a/test/files/run/macro-expand-varargs-explicit-over-nonvarargs-bad/Macros_Test_2.scala b/test/files/run/macro-expand-varargs-explicit-over-nonvarargs-bad/Macros_Test_2.scala index b844012d53..6d79b13419 100644 --- a/test/files/run/macro-expand-varargs-explicit-over-nonvarargs-bad/Macros_Test_2.scala +++ b/test/files/run/macro-expand-varargs-explicit-over-nonvarargs-bad/Macros_Test_2.scala @@ -1,5 +1,5 @@ object Macros { - def foo(xs: Int*) = macro Impls.foo + def foo(xs: Int*): Unit = macro Impls.foo } object Test extends App { diff --git a/test/files/run/macro-expand-varargs-explicit-over-nonvarargs-good/Macros_Test_2.scala b/test/files/run/macro-expand-varargs-explicit-over-nonvarargs-good/Macros_Test_2.scala index f127ebcde7..13d7cd5d5d 100644 --- a/test/files/run/macro-expand-varargs-explicit-over-nonvarargs-good/Macros_Test_2.scala +++ b/test/files/run/macro-expand-varargs-explicit-over-nonvarargs-good/Macros_Test_2.scala @@ -1,5 +1,5 @@ object Macros { - def foo(xs: Int*) = macro Impls.foo + def foo(xs: Int*): Unit = macro Impls.foo } object Test extends App { diff --git a/test/files/run/macro-expand-varargs-explicit-over-varargs/Macros_Test_2.scala b/test/files/run/macro-expand-varargs-explicit-over-varargs/Macros_Test_2.scala index f127ebcde7..13d7cd5d5d 100644 --- a/test/files/run/macro-expand-varargs-explicit-over-varargs/Macros_Test_2.scala +++ b/test/files/run/macro-expand-varargs-explicit-over-varargs/Macros_Test_2.scala @@ -1,5 +1,5 @@ object Macros { - def foo(xs: Int*) = macro Impls.foo + def foo(xs: Int*): Unit = macro Impls.foo } object Test extends App { diff --git a/test/files/run/macro-expand-varargs-implicit-over-nonvarargs/Macros_Test_2.scala b/test/files/run/macro-expand-varargs-implicit-over-nonvarargs/Macros_Test_2.scala index 2311ca0b95..9ab1be9e23 100644 --- a/test/files/run/macro-expand-varargs-implicit-over-nonvarargs/Macros_Test_2.scala +++ b/test/files/run/macro-expand-varargs-implicit-over-nonvarargs/Macros_Test_2.scala @@ -1,5 +1,5 @@ object Macros { - def foo(xs: Int*) = macro Impls.foo + def foo(xs: Int*): Unit = macro Impls.foo } object Test extends App { diff --git a/test/files/run/macro-expand-varargs-implicit-over-varargs/Macros_Test_2.scala b/test/files/run/macro-expand-varargs-implicit-over-varargs/Macros_Test_2.scala index 2311ca0b95..9ab1be9e23 100644 --- a/test/files/run/macro-expand-varargs-implicit-over-varargs/Macros_Test_2.scala +++ b/test/files/run/macro-expand-varargs-implicit-over-varargs/Macros_Test_2.scala @@ -1,5 +1,5 @@ object Macros { - def foo(xs: Int*) = macro Impls.foo + def foo(xs: Int*): Unit = macro Impls.foo } object Test extends App { diff --git a/test/files/run/macro-impl-tparam-only-in-impl/Macros_Test_2.scala b/test/files/run/macro-impl-tparam-only-in-impl/Macros_Test_2.scala index 218c7aec7f..4901e24481 100644 --- a/test/files/run/macro-impl-tparam-only-in-impl/Macros_Test_2.scala +++ b/test/files/run/macro-impl-tparam-only-in-impl/Macros_Test_2.scala @@ -1,5 +1,5 @@ object Macros { - def foo = macro Impls.foo[String] + def foo: Unit = macro Impls.foo[String] } object Test extends App { diff --git a/test/files/run/macro-impl-tparam-typetag-is-optional/Macros_Test_2.scala b/test/files/run/macro-impl-tparam-typetag-is-optional/Macros_Test_2.scala index e72c27881a..2cf7b19d2a 100644 --- a/test/files/run/macro-impl-tparam-typetag-is-optional/Macros_Test_2.scala +++ b/test/files/run/macro-impl-tparam-typetag-is-optional/Macros_Test_2.scala @@ -1,4 +1,4 @@ object Test extends App { - def foo[U] = macro Impls.foo[U] + def foo[U]: Unit = macro Impls.foo[U] foo[Int] }
\ No newline at end of file diff --git a/test/files/run/macro-quasiquotes/Macros_1.scala b/test/files/run/macro-quasiquotes/Macros_1.scala index c42baafdf4..81775d98e8 100644 --- a/test/files/run/macro-quasiquotes/Macros_1.scala +++ b/test/files/run/macro-quasiquotes/Macros_1.scala @@ -9,7 +9,7 @@ trait Impls extends BlackboxMacro { } object Macros { - def m1 = macro Impls.impl1 - def m2 = macro Impls.impl2 - def m3 = macro Impls.impl3 + def m1: Unit = macro Impls.impl1 + def m2: Unit = macro Impls.impl2 + def m3: Int = macro Impls.impl3 }
\ No newline at end of file diff --git a/test/files/run/macro-reflective-mamd-normal-mi.check b/test/files/run/macro-reflective-mamd-normal-mi.check index f77196b2db..920a139664 100644 --- a/test/files/run/macro-reflective-mamd-normal-mi.check +++ b/test/files/run/macro-reflective-mamd-normal-mi.check @@ -1,2 +1 @@ -warning: there were 1 deprecation warning(s); re-run with -deprecation for details 43 diff --git a/test/files/run/macro-reflective-mamd-normal-mi/Macros_Test_2.scala b/test/files/run/macro-reflective-mamd-normal-mi/Macros_Test_2.scala index 13cd953bde..ba12fb05e6 100644 --- a/test/files/run/macro-reflective-mamd-normal-mi/Macros_Test_2.scala +++ b/test/files/run/macro-reflective-mamd-normal-mi/Macros_Test_2.scala @@ -10,9 +10,9 @@ object Test extends App { val macrobody = Select(Ident(TermName("Impls")), TermName("foo")) val macroparam = ValDef(NoMods, TermName("x"), TypeTree(definitions.IntClass.toType), EmptyTree) - val macrodef = DefDef(Modifiers(MACRO), TermName("foo"), Nil, List(List(macroparam)), TypeTree(), macrobody) + val macrodef = DefDef(Modifiers(MACRO), TermName("foo"), Nil, List(List(macroparam)), Ident(TypeName("Int")), macrobody) val modulector = DefDef(NoMods, nme.CONSTRUCTOR, Nil, List(List()), TypeTree(), Block(List(Apply(Select(Super(This(tpnme.EMPTY), tpnme.EMPTY), nme.CONSTRUCTOR), List())), Literal(Constant(())))) - val module = ModuleDef(NoMods, TermName("Macros"), Template(Nil, emptyValDef, List(modulector, macrodef))) + val module = ModuleDef(NoMods, TermName("Macros"), Template(Nil, noSelfType, List(modulector, macrodef))) val macroapp = Apply(Select(Ident(TermName("Macros")), TermName("foo")), List(Literal(Constant(42)))) val tree = Block(List(macrodef, module), macroapp) val toolbox = cm.mkToolBox(options = "-language:experimental.macros") diff --git a/test/files/run/macro-reify-nested-a/Impls_Macros_1.scala b/test/files/run/macro-reify-nested-a/Impls_Macros_1.scala index ebd80c02ba..8f7a34a10a 100644 --- a/test/files/run/macro-reify-nested-a/Impls_Macros_1.scala +++ b/test/files/run/macro-reify-nested-a/Impls_Macros_1.scala @@ -26,7 +26,7 @@ object QueryableMacros{ import treeBuild._ val element_type = implicitly[c.WeakTypeTag[S]].tpe val foo = c.Expr[ru.Expr[Queryable[S]]]( - c.reifyTree( mkRuntimeUniverseRef, EmptyTree, c.typeCheck( + c.reifyTree( mkRuntimeUniverseRef, EmptyTree, c.typecheck( Utils[c.type](c).removeDoubleReify( Apply(Select(c.prefix.tree, TermName( name )), List( projection.tree )) ).asInstanceOf[Tree] diff --git a/test/files/run/macro-reify-nested-b/Impls_Macros_1.scala b/test/files/run/macro-reify-nested-b/Impls_Macros_1.scala index ebd80c02ba..8f7a34a10a 100644 --- a/test/files/run/macro-reify-nested-b/Impls_Macros_1.scala +++ b/test/files/run/macro-reify-nested-b/Impls_Macros_1.scala @@ -26,7 +26,7 @@ object QueryableMacros{ import treeBuild._ val element_type = implicitly[c.WeakTypeTag[S]].tpe val foo = c.Expr[ru.Expr[Queryable[S]]]( - c.reifyTree( mkRuntimeUniverseRef, EmptyTree, c.typeCheck( + c.reifyTree( mkRuntimeUniverseRef, EmptyTree, c.typecheck( Utils[c.type](c).removeDoubleReify( Apply(Select(c.prefix.tree, TermName( name )), List( projection.tree )) ).asInstanceOf[Tree] diff --git a/test/files/run/macro-reify-ref-to-packageless/Test_2.scala b/test/files/run/macro-reify-ref-to-packageless/Test_2.scala index 9d475f756d..c167b160be 100644 --- a/test/files/run/macro-reify-ref-to-packageless/Test_2.scala +++ b/test/files/run/macro-reify-ref-to-packageless/Test_2.scala @@ -1,4 +1,4 @@ object Test extends App { - def foo = macro Impls.foo + def foo: Int = macro Impls.foo println(foo) }
\ No newline at end of file diff --git a/test/files/run/macro-reify-splice-splice.check b/test/files/run/macro-reify-splice-splice.check deleted file mode 100644 index 3b18e512db..0000000000 --- a/test/files/run/macro-reify-splice-splice.check +++ /dev/null @@ -1 +0,0 @@ -hello world diff --git a/test/files/run/macro-reify-unreify/Macros_1.scala b/test/files/run/macro-reify-unreify/Macros_1.scala index d1e71b3311..055959018a 100644 --- a/test/files/run/macro-reify-unreify/Macros_1.scala +++ b/test/files/run/macro-reify-unreify/Macros_1.scala @@ -9,7 +9,7 @@ object Macros { import treeBuild._ val world = c.reifyTree(mkRuntimeUniverseRef, EmptyTree, s.tree) - val greeting = c.reifyTree(mkRuntimeUniverseRef, EmptyTree, c.typeCheck(Apply(Select(Literal(Constant("hello ")), TermName("$plus")), List(c.unreifyTree(world))))) + val greeting = c.reifyTree(mkRuntimeUniverseRef, EmptyTree, c.typecheck(Apply(Select(Literal(Constant("hello ")), TermName("$plus")), List(c.unreifyTree(world))))) val typedGreeting = c.Expr[String](greeting) c.universe.reify { diff --git a/test/files/run/macro-repl-dontexpand.check b/test/files/run/macro-repl-dontexpand.check index 3ba877b59d..9f538c04b6 100644 --- a/test/files/run/macro-repl-dontexpand.check +++ b/test/files/run/macro-repl-dontexpand.check @@ -5,12 +5,12 @@ scala> def bar1(c: scala.reflect.macros.BlackboxContext) = ??? bar1: (c: scala.reflect.macros.BlackboxContext)Nothing scala> def foo1 = macro bar1 -defined term macro foo1: Any +defined term macro foo1: Nothing scala> def bar2(c: scala.reflect.macros.WhiteboxContext) = ??? bar2: (c: scala.reflect.macros.WhiteboxContext)Nothing scala> def foo2 = macro bar2 -defined term macro foo2: Any +defined term macro foo2: Nothing scala> diff --git a/test/files/run/macro-subpatterns.check b/test/files/run/macro-subpatterns.check new file mode 100644 index 0000000000..b34d4bf4a1 --- /dev/null +++ b/test/files/run/macro-subpatterns.check @@ -0,0 +1,3 @@ +List((a @ Extractor((b @ Extractor((c @ _)))))) +List((b @ Extractor((c @ _)))) +List((c @ _)) diff --git a/test/files/run/macro-subpatterns/Macro_1.scala b/test/files/run/macro-subpatterns/Macro_1.scala new file mode 100644 index 0000000000..d8e86e27c6 --- /dev/null +++ b/test/files/run/macro-subpatterns/Macro_1.scala @@ -0,0 +1,18 @@ +import scala.reflect.macros.WhiteboxContext +import language.experimental.macros + +object Extractor { + def unapply(x: Any): Any = macro unapplyImpl + def unapplyImpl(c: WhiteboxContext)(x: c.Tree) = { + val st = c.universe.asInstanceOf[reflect.internal.SymbolTable] + import st._ + val subpatterns = x.attachments.get[SubpatternsAttachment].get.patterns + q""" + new { + def isEmpty = false + def get = ${subpatterns.toString} + def unapply(x: Any) = this + }.unapply(${x.asInstanceOf[st.Tree]}) + """.asInstanceOf[c.Tree] + } +} diff --git a/test/files/run/macro-subpatterns/Test_2.scala b/test/files/run/macro-subpatterns/Test_2.scala new file mode 100644 index 0000000000..dc6e668877 --- /dev/null +++ b/test/files/run/macro-subpatterns/Test_2.scala @@ -0,0 +1,5 @@ +object Test extends App { + 42 match { + case Extractor(a @ Extractor(b @ Extractor(c))) => println(a); println(b); println(c) + } +} diff --git a/test/files/run/macro-system-properties.check b/test/files/run/macro-system-properties.check index ea4c5a664a..ceed1079b2 100644 --- a/test/files/run/macro-system-properties.check +++ b/test/files/run/macro-system-properties.check @@ -9,7 +9,7 @@ scala> object GrabContext { def lastContext = Option(System.getProperties.get("lastContext").asInstanceOf[reflect.macros.runtime.Context]) // System.properties lets you stash true globals (unlike statics which are classloader scoped) def impl(c: BlackboxContext)() = { import c.universe._; System.getProperties.put("lastContext", c); c.Expr[Unit](q"()") } - def grab() = macro impl + def grab(): Unit = macro impl } defined object GrabContext diff --git a/test/files/run/macro-system-properties.scala b/test/files/run/macro-system-properties.scala index 73a3ef5910..3325c1747a 100644 --- a/test/files/run/macro-system-properties.scala +++ b/test/files/run/macro-system-properties.scala @@ -8,7 +8,7 @@ object Test extends ReplTest { def lastContext = Option(System.getProperties.get("lastContext").asInstanceOf[reflect.macros.runtime.Context]) // System.properties lets you stash true globals (unlike statics which are classloader scoped) def impl(c: BlackboxContext)() = { import c.universe._; System.getProperties.put("lastContext", c); c.Expr[Unit](q"()") } - def grab() = macro impl + def grab(): Unit = macro impl } object Test { class C(implicit a: Any) { GrabContext.grab } } object Test { class C(implicit a: Any) { GrabContext.grab } } diff --git a/test/files/run/macro-term-declared-in-anonymous/Macros_Test_2.scala b/test/files/run/macro-term-declared-in-anonymous/Macros_Test_2.scala index 88cd29ae4f..5039dffd5f 100644 --- a/test/files/run/macro-term-declared-in-anonymous/Macros_Test_2.scala +++ b/test/files/run/macro-term-declared-in-anonymous/Macros_Test_2.scala @@ -1,6 +1,6 @@ import scala.language.reflectiveCalls object Test extends App { - val macros = new { def foo = macro Impls.foo } + val macros = new { def foo: Unit = macro Impls.foo } macros.foo } diff --git a/test/files/run/macro-term-declared-in-block/Macros_Test_2.scala b/test/files/run/macro-term-declared-in-block/Macros_Test_2.scala index 69088e24bc..80bfc44bee 100644 --- a/test/files/run/macro-term-declared-in-block/Macros_Test_2.scala +++ b/test/files/run/macro-term-declared-in-block/Macros_Test_2.scala @@ -1,6 +1,6 @@ object Test extends App { { - def foo = macro Impls.foo + def foo: Unit = macro Impls.foo foo } }
\ No newline at end of file diff --git a/test/files/run/macro-term-declared-in-class-class/Macros_Test_2.scala b/test/files/run/macro-term-declared-in-class-class/Macros_Test_2.scala index 871857a97f..d6b1f9fab1 100644 --- a/test/files/run/macro-term-declared-in-class-class/Macros_Test_2.scala +++ b/test/files/run/macro-term-declared-in-class-class/Macros_Test_2.scala @@ -1,6 +1,6 @@ class Macros { class Macros { - def foo = macro Impls.foo + def foo: Unit = macro Impls.foo } } diff --git a/test/files/run/macro-term-declared-in-class-object/Macros_Test_2.scala b/test/files/run/macro-term-declared-in-class-object/Macros_Test_2.scala index 994f9fe935..957f666bb0 100644 --- a/test/files/run/macro-term-declared-in-class-object/Macros_Test_2.scala +++ b/test/files/run/macro-term-declared-in-class-object/Macros_Test_2.scala @@ -1,6 +1,6 @@ class Macros { object Macros { - def foo = macro Impls.foo + def foo: Unit = macro Impls.foo } } diff --git a/test/files/run/macro-term-declared-in-class/Macros_Test_2.scala b/test/files/run/macro-term-declared-in-class/Macros_Test_2.scala index 1b9d13e775..5898d94dc1 100644 --- a/test/files/run/macro-term-declared-in-class/Macros_Test_2.scala +++ b/test/files/run/macro-term-declared-in-class/Macros_Test_2.scala @@ -1,5 +1,5 @@ class Macros { - def foo = macro Impls.foo + def foo: Unit = macro Impls.foo } object Test extends App { diff --git a/test/files/run/macro-term-declared-in-default-param/Macros_Test_2.scala b/test/files/run/macro-term-declared-in-default-param/Macros_Test_2.scala index 356029e63e..16bd95b1e6 100644 --- a/test/files/run/macro-term-declared-in-default-param/Macros_Test_2.scala +++ b/test/files/run/macro-term-declared-in-default-param/Macros_Test_2.scala @@ -1,5 +1,5 @@ object Test extends App { - def foo(bar: String = { def foo = macro Impls.foo; foo }) = println(bar) + def foo(bar: String = { def foo: String = macro Impls.foo; foo }) = println(bar) foo() foo("it works") diff --git a/test/files/run/macro-term-declared-in-method/Macros_Test_2.scala b/test/files/run/macro-term-declared-in-method/Macros_Test_2.scala index ed5c8b7c43..523989df13 100644 --- a/test/files/run/macro-term-declared-in-method/Macros_Test_2.scala +++ b/test/files/run/macro-term-declared-in-method/Macros_Test_2.scala @@ -1,6 +1,6 @@ object Test extends App { def bar() = { - def foo = macro Impls.foo + def foo: Unit = macro Impls.foo foo } diff --git a/test/files/run/macro-term-declared-in-object-class/Macros_Test_2.scala b/test/files/run/macro-term-declared-in-object-class/Macros_Test_2.scala index 204deed61c..fe9dbef255 100644 --- a/test/files/run/macro-term-declared-in-object-class/Macros_Test_2.scala +++ b/test/files/run/macro-term-declared-in-object-class/Macros_Test_2.scala @@ -1,6 +1,6 @@ object Macros { class Macros { - def foo = macro Impls.foo + def foo: Unit = macro Impls.foo } } diff --git a/test/files/run/macro-term-declared-in-object-object/Macros_Test_2.scala b/test/files/run/macro-term-declared-in-object-object/Macros_Test_2.scala index e261a50f3d..4ba7551818 100644 --- a/test/files/run/macro-term-declared-in-object-object/Macros_Test_2.scala +++ b/test/files/run/macro-term-declared-in-object-object/Macros_Test_2.scala @@ -1,6 +1,6 @@ object Macros { object Macros { - def foo = macro Impls.foo + def foo: Unit = macro Impls.foo } } diff --git a/test/files/run/macro-term-declared-in-object/Macros_Test_2.scala b/test/files/run/macro-term-declared-in-object/Macros_Test_2.scala index a5a4862ba0..9ebf5d7dba 100644 --- a/test/files/run/macro-term-declared-in-object/Macros_Test_2.scala +++ b/test/files/run/macro-term-declared-in-object/Macros_Test_2.scala @@ -1,5 +1,5 @@ object Macros { - def foo = macro Impls.foo + def foo: Unit = macro Impls.foo } object Test extends App { diff --git a/test/files/run/macro-term-declared-in-package-object/Macros_Test_2.scala b/test/files/run/macro-term-declared-in-package-object/Macros_Test_2.scala index 54a5962e80..1f378b8bfd 100644 --- a/test/files/run/macro-term-declared-in-package-object/Macros_Test_2.scala +++ b/test/files/run/macro-term-declared-in-package-object/Macros_Test_2.scala @@ -1,5 +1,5 @@ package object Macros { - def foo = macro Impls.foo + def foo: Unit = macro Impls.foo } object Test extends App { diff --git a/test/files/run/macro-term-declared-in-refinement/Macros_Test_2.scala b/test/files/run/macro-term-declared-in-refinement/Macros_Test_2.scala index ff9a66d58a..b38616b71a 100644 --- a/test/files/run/macro-term-declared-in-refinement/Macros_Test_2.scala +++ b/test/files/run/macro-term-declared-in-refinement/Macros_Test_2.scala @@ -1,9 +1,8 @@ - import scala.language.reflectiveCalls class Base object Test extends App { - val macros = new Base { def foo = macro Impls.foo } + val macros = new Base { def foo: Unit = macro Impls.foo } macros.foo } diff --git a/test/files/run/macro-term-declared-in-trait/Macros_Test_2.scala b/test/files/run/macro-term-declared-in-trait/Macros_Test_2.scala index f75906b636..09c60df351 100644 --- a/test/files/run/macro-term-declared-in-trait/Macros_Test_2.scala +++ b/test/files/run/macro-term-declared-in-trait/Macros_Test_2.scala @@ -1,5 +1,5 @@ trait Base { - def foo = macro Impls.foo + def foo: Unit = macro Impls.foo } object Macros extends Base diff --git a/test/files/run/macro-typecheck-implicitsdisabled/Impls_Macros_1.scala b/test/files/run/macro-typecheck-implicitsdisabled/Impls_Macros_1.scala index 9f7d6f641c..ce937671cc 100644 --- a/test/files/run/macro-typecheck-implicitsdisabled/Impls_Macros_1.scala +++ b/test/files/run/macro-typecheck-implicitsdisabled/Impls_Macros_1.scala @@ -5,7 +5,7 @@ object Macros { import c.universe._ val tree1 = Apply(Select(Literal(Constant(1)), TermName("$minus$greater")), List(Literal(Constant(2)))) - val ttree1 = c.typeCheck(tree1, withImplicitViewsDisabled = false) + val ttree1 = c.typecheck(tree1, withImplicitViewsDisabled = false) c.Expr[String](Literal(Constant(ttree1.toString))) } @@ -16,7 +16,7 @@ object Macros { try { val tree2 = Apply(Select(Literal(Constant(1)), TermName("$minus$greater")), List(Literal(Constant(2)))) - val ttree2 = c.typeCheck(tree2, withImplicitViewsDisabled = true) + val ttree2 = c.typecheck(tree2, withImplicitViewsDisabled = true) c.Expr[String](Literal(Constant(ttree2.toString))) } catch { case ex: Throwable => diff --git a/test/files/run/macro-typecheck-macrosdisabled.check b/test/files/run/macro-typecheck-macrosdisabled.check index e0e880ab66..0579a4f4c8 100644 --- a/test/files/run/macro-typecheck-macrosdisabled.check +++ b/test/files/run/macro-typecheck-macrosdisabled.check @@ -1,4 +1,4 @@ -{ +({ val $u: reflect.runtime.universe.type = scala.reflect.runtime.`package`.universe; val $m: $u.Mirror = scala.reflect.runtime.`package`.universe.runtimeMirror(this.getClass().getClassLoader()); $u.Expr.apply[Int(2)]($m, { @@ -28,5 +28,5 @@ }; new $typecreator2() })) -} +}: reflect.runtime.universe.Expr[Int]) ru.reify[Int](2) diff --git a/test/files/run/macro-typecheck-macrosdisabled/Impls_Macros_1.scala b/test/files/run/macro-typecheck-macrosdisabled/Impls_Macros_1.scala index 41e58e0e4d..45b9a4fcc8 100644 --- a/test/files/run/macro-typecheck-macrosdisabled/Impls_Macros_1.scala +++ b/test/files/run/macro-typecheck-macrosdisabled/Impls_Macros_1.scala @@ -6,7 +6,7 @@ object Macros { val ru = Select(Select(Select(Select(Ident(TermName("scala")), TermName("reflect")), TermName("runtime")), TermName("package")), TermName("universe")) val tree1 = Apply(Select(ru, TermName("reify")), List(Literal(Constant(2)))) - val ttree1 = c.typeCheck(tree1, withMacrosDisabled = false) + val ttree1 = c.typecheck(tree1, withMacrosDisabled = false) c.Expr[String](Literal(Constant(ttree1.toString))) } @@ -22,7 +22,7 @@ object Macros { build.setTypeSignature(ru, rutpe) val tree2 = Apply(Select(Ident(ru), TermName("reify")), List(Literal(Constant(2)))) - val ttree2 = c.typeCheck(tree2, withMacrosDisabled = true) + val ttree2 = c.typecheck(tree2, withMacrosDisabled = true) c.Expr[String](Literal(Constant(ttree2.toString))) } diff --git a/test/files/run/macro-typecheck-macrosdisabled2.check b/test/files/run/macro-typecheck-macrosdisabled2.check index 347dfec1dc..c6e1c08d5d 100644 --- a/test/files/run/macro-typecheck-macrosdisabled2.check +++ b/test/files/run/macro-typecheck-macrosdisabled2.check @@ -1,4 +1,4 @@ -{ +({ val $u: reflect.runtime.universe.type = scala.reflect.runtime.`package`.universe; val $m: $u.Mirror = scala.reflect.runtime.`package`.universe.runtimeMirror(this.getClass().getClassLoader()); $u.Expr.apply[Array[Int]]($m, { @@ -28,5 +28,5 @@ }; new $typecreator2() })) -} +}: reflect.runtime.universe.Expr[Array[Int]]) ru.reify[Array[Int]](scala.Array.apply(2)) diff --git a/test/files/run/macro-typecheck-macrosdisabled2/Impls_Macros_1.scala b/test/files/run/macro-typecheck-macrosdisabled2/Impls_Macros_1.scala index 3d12020109..d37a654957 100644 --- a/test/files/run/macro-typecheck-macrosdisabled2/Impls_Macros_1.scala +++ b/test/files/run/macro-typecheck-macrosdisabled2/Impls_Macros_1.scala @@ -6,7 +6,7 @@ object Macros { val ru = Select(Select(Select(Select(Ident(TermName("scala")), TermName("reflect")), TermName("runtime")), TermName("package")), TermName("universe")) val tree1 = Apply(Select(ru, TermName("reify")), List(Apply(Select(Ident(TermName("scala")), TermName("Array")), List(Literal(Constant(2)))))) - val ttree1 = c.typeCheck(tree1, withMacrosDisabled = false) + val ttree1 = c.typecheck(tree1, withMacrosDisabled = false) c.Expr[String](Literal(Constant(ttree1.toString))) } @@ -22,7 +22,7 @@ object Macros { build.setTypeSignature(ru, rutpe) val tree2 = Apply(Select(Ident(ru), TermName("reify")), List(Apply(Select(Ident(TermName("scala")), TermName("Array")), List(Literal(Constant(2)))))) - val ttree2 = c.typeCheck(tree2, withMacrosDisabled = true) + val ttree2 = c.typecheck(tree2, withMacrosDisabled = true) c.Expr[String](Literal(Constant(ttree2.toString))) } diff --git a/test/files/run/macro-vampire-false-warning/Macros_1.scala b/test/files/run/macro-vampire-false-warning/Macros_1.scala index 5907461c84..bf75e924e8 100644 --- a/test/files/run/macro-vampire-false-warning/Macros_1.scala +++ b/test/files/run/macro-vampire-false-warning/Macros_1.scala @@ -22,7 +22,7 @@ object Macros { // val fields = kvps map { case (k, v) => q"@body($v) def ${TermName(k)} = macro Macros.selFieldImpl" } val fields = kvps map { case (k, v) => DefDef( Modifiers(MACRO, tpnme.EMPTY, List(Apply(Select(New(Ident(TypeName("body"))), nme.CONSTRUCTOR), List(v)))), - TermName(k), Nil, Nil, TypeTree(), Select(Ident(TermName("Macros")), TermName("selFieldImpl"))) } + TermName(k), Nil, Nil, Ident(TypeName("Any")), Select(Ident(TermName("Macros")), TermName("selFieldImpl"))) } // q"import scala.language.experimental.macros; class Workaround { ..$fields }; new Workaround{}" c.Expr[Any](Block( List( @@ -48,5 +48,5 @@ object Macros { } object mkObject { - def apply(xs: Any*) = macro Macros.mkObjectImpl + def apply(xs: Any*): Any = macro Macros.mkObjectImpl } diff --git a/test/files/run/macro-whitebox-extractor/Macros_1.scala b/test/files/run/macro-whitebox-extractor/Macros_1.scala index 4a1138fc9d..64053b8a24 100644 --- a/test/files/run/macro-whitebox-extractor/Macros_1.scala +++ b/test/files/run/macro-whitebox-extractor/Macros_1.scala @@ -2,7 +2,7 @@ import scala.reflect.macros.WhiteboxContext import language.experimental.macros object Extractor { - def unapply(x: Int) = macro Macros.unapplyImpl + def unapply(x: Int): Any = macro Macros.unapplyImpl } object Macros { diff --git a/test/files/run/macro-whitebox-structural/Impls_Macros_1.scala b/test/files/run/macro-whitebox-structural/Impls_Macros_1.scala index 1b975ca850..b8d0c042be 100644 --- a/test/files/run/macro-whitebox-structural/Impls_Macros_1.scala +++ b/test/files/run/macro-whitebox-structural/Impls_Macros_1.scala @@ -12,5 +12,5 @@ object Macros { """ } - def foo = macro impl + def foo: Any = macro impl }
\ No newline at end of file diff --git a/test/files/run/reflection-mem-typecheck.scala b/test/files/run/reflection-mem-typecheck.scala index a312c2c893..e3cabf689d 100644 --- a/test/files/run/reflection-mem-typecheck.scala +++ b/test/files/run/reflection-mem-typecheck.scala @@ -21,6 +21,6 @@ object Test extends MemoryTest { foo(List(new A {}, new B {})) """.trim snippet = snippet + "\n" + (List.fill(50)(snippet.split("\n").last) mkString "\n") - tb.typeCheck(tb.parse(snippet)) + tb.typecheck(tb.parse(snippet)) } }
\ No newline at end of file diff --git a/test/files/run/reify_ann1a.scala b/test/files/run/reify_ann1a.scala index c23048e463..e3ff9e532d 100644 --- a/test/files/run/reify_ann1a.scala +++ b/test/files/run/reify_ann1a.scala @@ -20,7 +20,7 @@ object Test extends App { // test 2: import and typecheck val toolbox = cm.mkToolBox() - val ttree = toolbox.typeCheck(tree) + val ttree = toolbox.typecheck(tree) println(ttree.toString) // test 3: import and compile diff --git a/test/files/run/reify_ann1b.scala b/test/files/run/reify_ann1b.scala index 29ce6021a2..30bafadf75 100644 --- a/test/files/run/reify_ann1b.scala +++ b/test/files/run/reify_ann1b.scala @@ -20,7 +20,7 @@ object Test extends App { // test 2: import and typecheck val toolbox = cm.mkToolBox() - val ttree = toolbox.typeCheck(tree) + val ttree = toolbox.typecheck(tree) println(ttree.toString) // test 3: import and compile diff --git a/test/files/run/reify_ann2a.scala b/test/files/run/reify_ann2a.scala index 53423e12c3..515fba015f 100644 --- a/test/files/run/reify_ann2a.scala +++ b/test/files/run/reify_ann2a.scala @@ -20,7 +20,7 @@ object Test extends App { // test 2: import and typecheck val toolbox = cm.mkToolBox() - val ttree = toolbox.typeCheck(tree) + val ttree = toolbox.typecheck(tree) println(ttree.toString) // test 3: import and compile diff --git a/test/files/run/reify_ann3.scala b/test/files/run/reify_ann3.scala index 4162fa532f..7098e928a7 100644 --- a/test/files/run/reify_ann3.scala +++ b/test/files/run/reify_ann3.scala @@ -14,7 +14,7 @@ object Test extends App { // test 2: import and typecheck val toolbox = cm.mkToolBox() - val ttree = toolbox.typeCheck(tree) + val ttree = toolbox.typecheck(tree) println(ttree.toString) // test 3: import and compile diff --git a/test/files/run/reify_ann4.scala b/test/files/run/reify_ann4.scala index 0aedb77b5e..f6426213df 100644 --- a/test/files/run/reify_ann4.scala +++ b/test/files/run/reify_ann4.scala @@ -18,7 +18,7 @@ object Test extends App { // test 2: import and typecheck val toolbox = cm.mkToolBox() - val ttree = toolbox.typeCheck(tree) + val ttree = toolbox.typecheck(tree) println(ttree.toString) // test 3: import and compile diff --git a/test/files/run/reify_ann5.scala b/test/files/run/reify_ann5.scala index d27be3b6d5..5e2f058a39 100644 --- a/test/files/run/reify_ann5.scala +++ b/test/files/run/reify_ann5.scala @@ -15,7 +15,7 @@ object Test extends App { // test 2: import and typecheck val toolbox = cm.mkToolBox() - val ttree = toolbox.typeCheck(tree) + val ttree = toolbox.typecheck(tree) println(ttree.toString) // test 3: import and compile diff --git a/test/files/run/reify_classfileann_a.scala b/test/files/run/reify_classfileann_a.scala index 1d51688e78..9ae12bff82 100644 --- a/test/files/run/reify_classfileann_a.scala +++ b/test/files/run/reify_classfileann_a.scala @@ -14,7 +14,7 @@ object Test extends App { // test 2: import and typecheck val toolbox = cm.mkToolBox() - val ttree = toolbox.typeCheck(tree) + val ttree = toolbox.typecheck(tree) println(ttree.toString) // test 3: import and compile diff --git a/test/files/run/reify_classfileann_b.scala b/test/files/run/reify_classfileann_b.scala index ef19e9240b..a0cb8f0b49 100644 --- a/test/files/run/reify_classfileann_b.scala +++ b/test/files/run/reify_classfileann_b.scala @@ -18,7 +18,7 @@ object Test extends App { // test 2: import and typecheck val toolbox = cm.mkToolBox() - val ttree = toolbox.typeCheck(tree) + val ttree = toolbox.typecheck(tree) println(ttree.toString) // test 3: import and compile diff --git a/test/files/run/repl-term-macros.check b/test/files/run/repl-term-macros.check index 64c46392a3..f73abb5dc3 100644 --- a/test/files/run/repl-term-macros.check +++ b/test/files/run/repl-term-macros.check @@ -12,7 +12,7 @@ scala> scala> def impl1(c: BlackboxContext) = { import c.universe._; c.Expr[Unit](q"()") } impl1: (c: scala.reflect.macros.BlackboxContext)c.Expr[Unit] -scala> def foo1 = macro impl1 +scala> def foo1: Unit = macro impl1 defined term macro foo1: Unit scala> foo1 @@ -22,7 +22,7 @@ scala> scala> def impl2(c: BlackboxContext)() = { import c.universe._; c.Expr[Unit](q"()") } impl2: (c: scala.reflect.macros.BlackboxContext)()c.Expr[Unit] -scala> def foo2() = macro impl2 +scala> def foo2(): Unit = macro impl2 defined term macro foo2: ()Unit scala> foo2() @@ -32,7 +32,7 @@ scala> scala> def impl3(c: BlackboxContext)(x: c.Expr[Int])(y: c.Expr[Int]) = { import c.universe._; c.Expr[Unit](q"()") } impl3: (c: scala.reflect.macros.BlackboxContext)(x: c.Expr[Int])(y: c.Expr[Int])c.Expr[Unit] -scala> def foo3(x: Int)(y: Int) = macro impl3 +scala> def foo3(x: Int)(y: Int): Unit = macro impl3 defined term macro foo3: (x: Int)(y: Int)Unit scala> foo3(2)(3) diff --git a/test/files/run/repl-term-macros.scala b/test/files/run/repl-term-macros.scala index a779638c00..b4660e258e 100644 --- a/test/files/run/repl-term-macros.scala +++ b/test/files/run/repl-term-macros.scala @@ -6,15 +6,15 @@ object Test extends ReplTest { import language.experimental.macros def impl1(c: BlackboxContext) = { import c.universe._; c.Expr[Unit](q"()") } -def foo1 = macro impl1 +def foo1: Unit = macro impl1 foo1 def impl2(c: BlackboxContext)() = { import c.universe._; c.Expr[Unit](q"()") } -def foo2() = macro impl2 +def foo2(): Unit = macro impl2 foo2() def impl3(c: BlackboxContext)(x: c.Expr[Int])(y: c.Expr[Int]) = { import c.universe._; c.Expr[Unit](q"()") } -def foo3(x: Int)(y: Int) = macro impl3 +def foo3(x: Int)(y: Int): Unit = 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 2a55437273..6150a4e265 100644 --- a/test/files/run/resetattrs-this.scala +++ b/test/files/run/resetattrs-this.scala @@ -5,7 +5,7 @@ import scala.tools.reflect.ToolBox object Test extends App { val tb = cm.mkToolBox() val tree = Select(This(cm.staticPackage("scala").moduleClass), TermName("Predef")) - val ttree = tb.typeCheck(tree) + val ttree = tb.typecheck(tree) val rttree = tb.resetAllAttrs(ttree) println(tb.eval(rttree) == Predef) } diff --git a/test/files/run/showraw_aliases.scala b/test/files/run/showraw_aliases.scala index 65b4fcb1cd..56bd13707d 100644 --- a/test/files/run/showraw_aliases.scala +++ b/test/files/run/showraw_aliases.scala @@ -7,7 +7,7 @@ object Test extends App { import scala.reflect.runtime.{universe => ru} ru """) - val ttree = tb.typeCheck(tree) + val ttree = tb.typecheck(tree) def stabilizeIds(s: String) = """#\d+""".r.replaceAllIn(s, "#<id>") def stabilizePositions(s: String) = """\d+""".r.replaceAllIn(s, "<offset>") diff --git a/test/files/run/showraw_tree_types_ids.scala b/test/files/run/showraw_tree_types_ids.scala index 198729e705..883af0110a 100644 --- a/test/files/run/showraw_tree_types_ids.scala +++ b/test/files/run/showraw_tree_types_ids.scala @@ -6,6 +6,6 @@ object Test extends App { val tree1 = reify(new collection.immutable.HashMap[String, String]) val tree2 = reify(new collection.mutable.HashMap[String, String]) def stabilize(s: String) = """#\d+""".r.replaceAllIn(s, "#<id>") - println(stabilize(showRaw(tb.typeCheck(tree1.tree), printIds = true, printTypes = true))) - println(stabilize(showRaw(tb.typeCheck(tree2.tree), printIds = true, printTypes = true))) + println(stabilize(showRaw(tb.typecheck(tree1.tree), printIds = true, printTypes = true))) + println(stabilize(showRaw(tb.typecheck(tree2.tree), printIds = true, printTypes = true))) }
\ No newline at end of file diff --git a/test/files/run/showraw_tree_types_typed.scala b/test/files/run/showraw_tree_types_typed.scala index d7ccc84ea3..3dd696c77e 100644 --- a/test/files/run/showraw_tree_types_typed.scala +++ b/test/files/run/showraw_tree_types_typed.scala @@ -5,6 +5,6 @@ object Test extends App { val tb = runtimeMirror(getClass.getClassLoader).mkToolBox() val tree1 = reify(new collection.immutable.HashMap[String, String]) val tree2 = reify(new collection.mutable.HashMap[String, String]) - println(showRaw(tb.typeCheck(tree1.tree), printTypes = true)) - println(showRaw(tb.typeCheck(tree2.tree), printTypes = true)) + println(showRaw(tb.typecheck(tree1.tree), printTypes = true)) + println(showRaw(tb.typecheck(tree2.tree), printTypes = true)) }
\ No newline at end of file diff --git a/test/files/run/showraw_tree_ultimate.scala b/test/files/run/showraw_tree_ultimate.scala index a8507623bc..e0d36e6bb7 100644 --- a/test/files/run/showraw_tree_ultimate.scala +++ b/test/files/run/showraw_tree_ultimate.scala @@ -6,6 +6,6 @@ object Test extends App { val tree1 = reify(new collection.immutable.HashMap[String, String]) val tree2 = reify(new collection.mutable.HashMap[String, String]) def stabilize(s: String) = """#\d+""".r.replaceAllIn(s, "#<id>") - println(stabilize(showRaw(tb.typeCheck(tree1.tree), printIds = true, printKinds = true, printTypes = true))) - println(stabilize(showRaw(tb.typeCheck(tree2.tree), printIds = true, printKinds = true, printTypes = true))) + println(stabilize(showRaw(tb.typecheck(tree1.tree), printIds = true, printKinds = true, printTypes = true))) + println(stabilize(showRaw(tb.typecheck(tree2.tree), printIds = true, printKinds = true, printTypes = true))) }
\ No newline at end of file diff --git a/test/files/continuations-run/t3199b.check b/test/files/run/t3199b.check index b5d8bb58d9..b5d8bb58d9 100644 --- a/test/files/continuations-run/t3199b.check +++ b/test/files/run/t3199b.check diff --git a/test/files/continuations-run/t3199b.scala b/test/files/run/t3199b.scala index 5010f2b085..5010f2b085 100644 --- a/test/files/continuations-run/t3199b.scala +++ b/test/files/run/t3199b.scala diff --git a/test/files/run/t4841-isolate-plugins.check b/test/files/run/t4841-isolate-plugins.check new file mode 100644 index 0000000000..a6462b424b --- /dev/null +++ b/test/files/run/t4841-isolate-plugins.check @@ -0,0 +1,2 @@ +My phase name is ploogin1_1 +My phase name is ploogin1_2 diff --git a/test/files/run/t4841-isolate-plugins/ploogin.scala b/test/files/run/t4841-isolate-plugins/ploogin.scala new file mode 100644 index 0000000000..bd8c7275ec --- /dev/null +++ b/test/files/run/t4841-isolate-plugins/ploogin.scala @@ -0,0 +1,30 @@ + +package t4841 + +import scala.tools.nsc.{ Global, Phase } +import scala.tools.nsc.plugins.{ Plugin, PluginComponent } +import scala.reflect.io.Path +import scala.reflect.io.File + +/** A test plugin. */ +class Ploogin(val global: Global, val name: String = "ploogin") extends Plugin { + import global._ + + val description = "A sample plugin for testing." + val components = List[PluginComponent](TestComponent) + + private object TestComponent extends PluginComponent { + val global: Ploogin.this.global.type = Ploogin.this.global + //override val runsBefore = List("refchecks") + val runsAfter = List("jvm") + val phaseName = Ploogin.this.name + override def description = "A sample phase that does so many things it's kind of hard to describe briefly." + def newPhase(prev: Phase) = new TestPhase(prev) + class TestPhase(prev: Phase) extends StdPhase(prev) { + override def description = TestComponent.this.description + def apply(unit: CompilationUnit) { + if (settings.developer) inform(s"My phase name is $phaseName") + } + } + } +} diff --git a/test/files/run/t4841-isolate-plugins/t4841-isolate-plugin.scala b/test/files/run/t4841-isolate-plugins/t4841-isolate-plugin.scala new file mode 100644 index 0000000000..5421922c9c --- /dev/null +++ b/test/files/run/t4841-isolate-plugins/t4841-isolate-plugin.scala @@ -0,0 +1,39 @@ + +import tools.nsc.plugins.PluginDescription +import tools.partest.DirectTest + +import java.io.File + +// show that plugins are on isolated class loaders +object Test extends DirectTest { + override def code = "class Code" + + override def extraSettings = s"-usejavacp" + + // plugin named ploogin1_1 or ploogin1_2, but not ploogin2_x + // Although the samples are in different classloaders, the plugin + // loader checks for distinctness by class name, so the names must differ. + def pluginCode(index: Int) = s""" + |package t4841 { + | class SamplePloogin$index(global: scala.tools.nsc.Global) extends Ploogin(global, s"$${PlooginCounter.named}_$index") + | object PlooginCounter { + | val count = new java.util.concurrent.atomic.AtomicInteger + | def named = s"ploogin$${count.incrementAndGet}" + | } + |}""".stripMargin.trim + + def compilePlugin(i: Int) = { + val out = (testOutput / s"p$i").createDirectory() + val args = Seq("-usejavacp", "-d", out.path) + compileString(newCompiler(args: _*))(pluginCode(i)) + val xml = PluginDescription(s"p$i", s"t4841.SamplePloogin$i").toXML + (out / "scalac-plugin.xml").toFile writeAll xml + out + } + + override def show() = { + val dirs = 1 to 2 map (compilePlugin(_)) + compile("-Xdev", s"-Xplugin:${dirs mkString ","}", "-usejavacp", "-d", testOutput.path) + } +} + diff --git a/test/files/run/t4841-no-plugin.check b/test/files/run/t4841-no-plugin.check new file mode 100644 index 0000000000..4338f0ce23 --- /dev/null +++ b/test/files/run/t4841-no-plugin.check @@ -0,0 +1 @@ +warning: No plugin in path t4841-no-plugin-run.obj/plugins.partest diff --git a/test/files/run/t4841-no-plugin.scala b/test/files/run/t4841-no-plugin.scala new file mode 100644 index 0000000000..d91bf7ee21 --- /dev/null +++ b/test/files/run/t4841-no-plugin.scala @@ -0,0 +1,17 @@ + +import tools.partest.DirectTest + +import java.io.File + +// warn only if no plugin on Xplugin path +object Test extends DirectTest { + override def code = "class Code" + + override def extraSettings = s"-usejavacp -d ${testOutput.path}" + + override def show() = { + val tmp = new File(testOutput.jfile, "plugins.partest").getAbsolutePath + compile("-Xdev", s"-Xplugin:$tmp", "-Xpluginsdir", tmp) + } +} + diff --git a/test/files/run/t5415.scala b/test/files/run/t5415.scala index c12e209bb7..65de86245b 100644 --- a/test/files/run/t5415.scala +++ b/test/files/run/t5415.scala @@ -8,5 +8,5 @@ object Test extends App{ import scala.reflect.runtime.{currentMirror => cm} import scala.tools.reflect.ToolBox val toolbox = cm.mkToolBox() - val ttree = toolbox.typeCheck(code.tree) + val ttree = toolbox.typecheck(code.tree) } diff --git a/test/files/run/t5418b.scala b/test/files/run/t5418b.scala index 08e8bb163b..c6172613d5 100644 --- a/test/files/run/t5418b.scala +++ b/test/files/run/t5418b.scala @@ -5,7 +5,7 @@ import scala.tools.reflect.ToolBox object Test extends App { val tb = cm.mkToolBox() val untyped = reify(new Object().getClass).tree - val typed = tb.typeCheck(untyped) + val typed = tb.typecheck(untyped) println(typed) println(showRaw(typed.tpe)) }
\ No newline at end of file diff --git a/test/files/run/t5704.scala b/test/files/run/t5704.scala index ddcbcc27b3..495a82e4f0 100644 --- a/test/files/run/t5704.scala +++ b/test/files/run/t5704.scala @@ -8,7 +8,7 @@ object Test extends App { def findUserByName( name:String ) = { val tree = reify{ "test" == name }.tree val toolbox = cm.mkToolBox() - toolbox.typeCheck(tree) match{ + toolbox.typecheck(tree) match{ case Apply(Select(lhs,op),rhs::Nil) => println(rhs.tpe) } diff --git a/test/files/run/t5816.scala b/test/files/run/t5816.scala index f0279e5703..e8367ea81e 100644 --- a/test/files/run/t5816.scala +++ b/test/files/run/t5816.scala @@ -6,7 +6,7 @@ object Test extends App { val toolbox = cm.mkToolBox() def printSource[T](expr: Expr[T]) { - val ttree = toolbox typeCheck expr.tree + val ttree = toolbox typecheck expr.tree println(ttree.toString) } diff --git a/test/files/run/t5894.scala b/test/files/run/t5894.scala index 55767d8889..5d482333f5 100644 --- a/test/files/run/t5894.scala +++ b/test/files/run/t5894.scala @@ -3,7 +3,7 @@ import language.experimental.macros class Test object Test { - def foo = macro fooImpl + def foo: Unit = macro fooImpl def fooImpl(c: reflect.macros.BlackboxContext) = { import c.universe._; c.Expr[Unit](q"()") } def main(args: Array[String]) { diff --git a/test/files/run/t5903a/Macros_1.scala b/test/files/run/t5903a/Macros_1.scala index 7888b888e1..ce1b035260 100644 --- a/test/files/run/t5903a/Macros_1.scala +++ b/test/files/run/t5903a/Macros_1.scala @@ -7,7 +7,7 @@ case object SomeTree extends Tree object NewQuasiquotes { implicit class QuasiquoteInterpolation(c: StringContext) { object nq { - def unapply(t: Tree) = macro QuasiquoteMacros.unapplyImpl + def unapply(t: Tree): Any = macro QuasiquoteMacros.unapplyImpl } } } diff --git a/test/files/run/t5903b/Macros_1.scala b/test/files/run/t5903b/Macros_1.scala index 8c03e5579d..97f15cec3b 100644 --- a/test/files/run/t5903b/Macros_1.scala +++ b/test/files/run/t5903b/Macros_1.scala @@ -4,7 +4,7 @@ import language.experimental.macros object Interpolation { implicit class TestInterpolation(c: StringContext) { object t { - def unapply[T](x: T) = macro Macros.unapplyImpl[T] + def unapply[T](x: T): Any = macro Macros.unapplyImpl[T] } } } diff --git a/test/files/run/t5903c/Macros_1.scala b/test/files/run/t5903c/Macros_1.scala index c9dfe9d60c..979284a263 100644 --- a/test/files/run/t5903c/Macros_1.scala +++ b/test/files/run/t5903c/Macros_1.scala @@ -4,7 +4,7 @@ import language.experimental.macros object Interpolation { implicit class TestInterpolation(c: StringContext) { object t { - def unapply[T](x: T) = macro Macros.unapplyImpl[T] + def unapply[T](x: T): Any = macro Macros.unapplyImpl[T] } } } diff --git a/test/files/run/t5903d/Macros_1.scala b/test/files/run/t5903d/Macros_1.scala index 8a57e27602..dc1989462b 100644 --- a/test/files/run/t5903d/Macros_1.scala +++ b/test/files/run/t5903d/Macros_1.scala @@ -4,7 +4,7 @@ import language.experimental.macros object Interpolation { implicit class TestInterpolation(c: StringContext) { object t { - def unapply(x: Int) = macro Macros.unapplyImpl + def unapply(x: Int): Any = macro Macros.unapplyImpl } } } diff --git a/test/files/run/t5912.scala b/test/files/run/t5912.scala index 9418e946d0..fc879a0537 100644 --- a/test/files/run/t5912.scala +++ b/test/files/run/t5912.scala @@ -3,5 +3,5 @@ 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")) ) + val tree = cm.mkToolBox().typecheck( Literal(Constant("test")) ) } diff --git a/test/files/run/t5940.scala b/test/files/run/t5940.scala index d98f267123..062f11c467 100644 --- a/test/files/run/t5940.scala +++ b/test/files/run/t5940.scala @@ -13,7 +13,7 @@ object Test extends DirectTest { object Macros { //import Impls._ def impl(c: BlackboxContext) = { import c.universe._; c.Expr[Unit](q"()") } - def foo = macro impl + def foo: Unit = macro impl } """ def compileMacros() = { diff --git a/test/files/run/t5943a1.scala b/test/files/run/t5943a1.scala index 00f4afa808..6bb828de85 100644 --- a/test/files/run/t5943a1.scala +++ b/test/files/run/t5943a1.scala @@ -5,5 +5,5 @@ import scala.tools.reflect.ToolBox object Test extends App { val tb = cm.mkToolBox() val expr = tb.parse("1 to 3 map (_+1)") - println(tb.typeCheck(expr)) + println(tb.typecheck(expr)) }
\ No newline at end of file diff --git a/test/files/run/t6023.scala b/test/files/run/t6023.scala index 07af3685a5..2753b93ac4 100644 --- a/test/files/run/t6023.scala +++ b/test/files/run/t6023.scala @@ -9,7 +9,7 @@ object Test extends App { // test 2: import and typecheck val toolbox = cm.mkToolBox() - val ttree = toolbox.typeCheck(tree) + val ttree = toolbox.typecheck(tree) println(ttree.toString) // test 3: import and compile diff --git a/test/files/run/t6355.check b/test/files/run/t6355.check new file mode 100644 index 0000000000..ce74ab38a2 --- /dev/null +++ b/test/files/run/t6355.check @@ -0,0 +1,2 @@ +bippy(x: Int) called with x = 42 +bippy(x: String) called with x = "42" diff --git a/test/files/run/t6355.scala b/test/files/run/t6355.scala new file mode 100644 index 0000000000..f1921391a3 --- /dev/null +++ b/test/files/run/t6355.scala @@ -0,0 +1,17 @@ +import scala.language.dynamics + +class A extends Dynamic { + def applyDynamic(method: String): B = new B(method) +} +class B(method: String) { + def apply(x: Int) = s"$method(x: Int) called with x = $x" + def apply(x: String) = s"""$method(x: String) called with x = "$x"""" +} + +object Test { + def main(args: Array[String]): Unit = { + val x = new A + println(x.bippy(42)) + println(x.bippy("42")) + } +} diff --git a/test/files/run/t6381.check b/test/files/run/t6381.check index dfc9d44850..ef08d0da09 100644 --- a/test/files/run/t6381.check +++ b/test/files/run/t6381.check @@ -10,7 +10,7 @@ scala> def pos_impl(c: reflect.macros.BlackboxContext): c.Expr[String] = { } pos_impl: (c: scala.reflect.macros.BlackboxContext)c.Expr[String] -scala> def pos = macro pos_impl +scala> def pos: String = macro pos_impl defined term macro pos: String scala> pos diff --git a/test/files/run/t6381.scala b/test/files/run/t6381.scala index 0e2264d8fa..c78dc13ed7 100644 --- a/test/files/run/t6381.scala +++ b/test/files/run/t6381.scala @@ -7,7 +7,7 @@ object Test extends ReplTest { | import c.universe._ | c.Expr[String](Literal(Constant(c.enclosingPosition.getClass.toString))) |} - |def pos = macro pos_impl + |def pos: String = macro pos_impl |pos |""".stripMargin.trim diff --git a/test/files/run/t6392b.scala b/test/files/run/t6392b.scala index f69a5aaf45..e43c1a2b03 100644 --- a/test/files/run/t6392b.scala +++ b/test/files/run/t6392b.scala @@ -5,5 +5,5 @@ import scala.tools.reflect.ToolBox object Test extends App { val tb = cm.mkToolBox() val c = tb.parse("object C") - println(showRaw(tb.typeCheck(c), printKinds = true)) + println(showRaw(tb.typecheck(c), printKinds = true)) }
\ No newline at end of file diff --git a/test/files/run/t6992.check b/test/files/run/t6992.check new file mode 100644 index 0000000000..1a0684c995 --- /dev/null +++ b/test/files/run/t6992.check @@ -0,0 +1,3 @@ +Int +42 +42 diff --git a/test/files/run/t6992/Macros_1.scala b/test/files/run/t6992/Macros_1.scala new file mode 100644 index 0000000000..25566dddbf --- /dev/null +++ b/test/files/run/t6992/Macros_1.scala @@ -0,0 +1,75 @@ +import scala.language.experimental.macros +import scala.reflect.macros.Context + +object Macros { + def foo(name: String): Any = macro foo_impl + def foo_impl(c: Context)(name: c.Expr[String]) = { + import c.universe._ + + val Literal(Constant(lit: String)) = name.tree + val anon = newTypeName(c.fresh) + + c.Expr(Block( + ClassDef( + Modifiers(Flag.FINAL), anon, Nil, Template( + Nil, noSelfType, List( + DefDef(Modifiers(), nme.CONSTRUCTOR, List(), List(List()), TypeTree(), Block(List(pendingSuperCall), Literal(Constant(())))), + TypeDef(Modifiers(), TypeName(lit), Nil, TypeTree(typeOf[Int])) + ) + ) + ), + Apply(Select(New(Ident(anon)), nme.CONSTRUCTOR), Nil) + )) + } + + def bar(name: String): Any = macro bar_impl + def bar_impl(c: Context)(name: c.Expr[String]) = { + import c.universe._ + + val Literal(Constant(lit: String)) = name.tree + val anon = newTypeName(c.fresh) + + c.Expr(Block( + ClassDef( + Modifiers(Flag.FINAL), anon, Nil, Template( + Nil, noSelfType, List( + DefDef(Modifiers(), nme.CONSTRUCTOR, List(), List(List()), TypeTree(), Block(List(pendingSuperCall), Literal(Constant(())))), + DefDef( + Modifiers(), TermName(lit), Nil, Nil, TypeTree(), + c.literal(42).tree + ) + ) + ) + ), + Apply(Select(New(Ident(anon)), nme.CONSTRUCTOR), Nil) + )) + } + + def baz(name: String): Any = macro baz_impl + def baz_impl(c: Context)(name: c.Expr[String]) = { + import c.universe._ + + val Literal(Constant(lit: String)) = name.tree + val anon = newTypeName(c.fresh) + val wrapper = newTypeName(c.fresh) + + c.Expr(Block( + ClassDef( + Modifiers(), anon, Nil, Template( + Nil, emptyValDef, List( + DefDef(Modifiers(), nme.CONSTRUCTOR, List(), List(List()), TypeTree(), Block(List(pendingSuperCall), Literal(Constant(())))), + DefDef( + Modifiers(), TermName(lit), Nil, Nil, TypeTree(), + c.literal(42).tree + ) + ) + ) + ), + ClassDef( + Modifiers(Flag.FINAL), wrapper, Nil, + Template(Ident(anon) :: Nil, noSelfType, DefDef(Modifiers(), nme.CONSTRUCTOR, List(), List(List()), TypeTree(), Block(List(pendingSuperCall), Literal(Constant(())))) :: Nil) + ), + Apply(Select(New(Ident(wrapper)), nme.CONSTRUCTOR), Nil) + )) + } +}
\ No newline at end of file diff --git a/test/files/run/t6992/Test_2.scala b/test/files/run/t6992/Test_2.scala new file mode 100644 index 0000000000..05282d6f5b --- /dev/null +++ b/test/files/run/t6992/Test_2.scala @@ -0,0 +1,12 @@ +import scala.language.reflectiveCalls + +object Test extends App { + val foo = Macros.foo("T") + println(scala.reflect.runtime.universe.weakTypeOf[foo.T].typeSymbol.typeSignature) + + val bar = Macros.bar("test") + println(bar.test) + + val baz = Macros.baz("test") + println(baz.test) +}
\ No newline at end of file diff --git a/test/files/run/t7185.check b/test/files/run/t7185.check index 38449b3497..ebf85b731f 100644 --- a/test/files/run/t7185.check +++ b/test/files/run/t7185.check @@ -21,7 +21,7 @@ tree: reflect.runtime.universe.Apply = } }() -scala> {val tb = reflect.runtime.currentMirror.mkToolBox(); tb.typeCheck(tree): Any} +scala> {val tb = reflect.runtime.currentMirror.mkToolBox(); tb.typecheck(tree): Any} res0: Any = { { diff --git a/test/files/run/t7185.scala b/test/files/run/t7185.scala index d9d913e78a..62d64246bc 100644 --- a/test/files/run/t7185.scala +++ b/test/files/run/t7185.scala @@ -7,6 +7,6 @@ import scala.reflect.runtime.universe._ object O { def apply() = 0 } val ORef = reify { O }.tree val tree = Apply(Block(Nil, Block(Nil, ORef)), Nil) -{val tb = reflect.runtime.currentMirror.mkToolBox(); tb.typeCheck(tree): Any} +{val tb = reflect.runtime.currentMirror.mkToolBox(); tb.typecheck(tree): Any} """ } diff --git a/test/files/continuations-run/ifelse0.check b/test/files/run/t7406.check index f8bc79860d..f599e28b8a 100644 --- a/test/files/continuations-run/ifelse0.check +++ b/test/files/run/t7406.check @@ -1,2 +1 @@ 10 -9
\ No newline at end of file diff --git a/test/files/run/t7406.scala b/test/files/run/t7406.scala new file mode 100644 index 0000000000..a8b35c91c9 --- /dev/null +++ b/test/files/run/t7406.scala @@ -0,0 +1,14 @@ +class Arne[@specialized(Long) T](x: T) { + val regularVal = x + lazy val lazyVal = x + + def apply(f: (T, T) => T): T = f(regularVal, lazyVal) +} + +object Test { + val arne = new Arne(5L) + def f = arne(_ + _) + def main(args: Array[String]): Unit = { + println(f) + } +} diff --git a/test/files/run/t7617b/Test_2.scala b/test/files/run/t7617b/Test_2.scala index e27f650e80..e1d9acdc31 100644 --- a/test/files/run/t7617b/Test_2.scala +++ b/test/files/run/t7617b/Test_2.scala @@ -2,7 +2,7 @@ import scala.language.dynamics import language.experimental.macros class C extends Dynamic { - def updateDynamic(name: String)(value: Any) = macro Macros.impl + def updateDynamic(name: String)(value: Any): Unit = macro Macros.impl } object Test extends App { diff --git a/test/files/run/t7777.check b/test/files/run/t7777.check new file mode 100644 index 0000000000..162ff2d2a2 --- /dev/null +++ b/test/files/run/t7777.check @@ -0,0 +1,7 @@ +foo(1, 2) +bar(4, 5) +foo(3) +bar(7) +apply(6) +apply(9) +foo(8) diff --git a/test/files/run/t7777/Macros_1.scala b/test/files/run/t7777/Macros_1.scala new file mode 100644 index 0000000000..459ab3edbb --- /dev/null +++ b/test/files/run/t7777/Macros_1.scala @@ -0,0 +1,17 @@ +import scala.language.experimental.macros +import scala.language.dynamics +import scala.reflect.macros.WhiteboxContext + +class DynMacro extends Dynamic { + def applyDynamic(s: String)(xs: Any*): DynMacro = + macro DynMacro.applyDynamicMacro +} + +object DynMacro extends DynMacro { + def applyDynamicMacro(c: WhiteboxContext)(s: c.Expr[String])(xs: c.Expr[Any]*): c.Expr[DynMacro] = { + import c.universe._ + val Literal(Constant(n: String)) = s.tree + val args = xs.map(_.tree.toString).mkString("(", ", ", ")") + c.Expr(q"println(${ n + args }); ${c.prefix.tree}") + } +}
\ No newline at end of file diff --git a/test/files/run/t7777/Test_2.scala b/test/files/run/t7777/Test_2.scala new file mode 100644 index 0000000000..1fe8b63bab --- /dev/null +++ b/test/files/run/t7777/Test_2.scala @@ -0,0 +1,6 @@ +object Test extends App { + DynMacro.foo(1, 2) // prints "foo(1, 2)" + DynMacro.foo(3).bar(4, 5) // prints "bar(4, 5)", then "foo(3)" + DynMacro(6).bar(7) // prints "bar(7)", then "apply(6)" + DynMacro.foo(8)(9) // Fails! +}
\ No newline at end of file diff --git a/test/files/run/t7871/Macros_1.scala b/test/files/run/t7871/Macros_1.scala index 778068deb3..801a6af4e7 100644 --- a/test/files/run/t7871/Macros_1.scala +++ b/test/files/run/t7871/Macros_1.scala @@ -7,7 +7,7 @@ case object SomeTree extends Tree object NewQuasiquotes { implicit class QuasiquoteInterpolation(c: StringContext) { object nq { - def unapply(t: Tree) = macro QuasiquoteMacros.unapplyImpl + def unapply(t: Tree): Any = macro QuasiquoteMacros.unapplyImpl } } } diff --git a/test/files/run/t7912.scala b/test/files/run/t7912.scala new file mode 100644 index 0000000000..3d603e0e97 --- /dev/null +++ b/test/files/run/t7912.scala @@ -0,0 +1,16 @@ +case object A { override def toString = ??? } + +object Test { + def foo: Int = (A: Any) match { + case 0 => 0 + } + def main(args: Array[String]): Unit = { + try { + foo + sys.error("no exception") + } catch { + case me: MatchError => assert(me.getMessage == "an instance of class A$", me.getMessage) + case ex: Throwable => sys.error("not a match error: " + ex.getClass) + } + } +} diff --git a/test/files/run/t8010.scala b/test/files/run/t8010.scala new file mode 100644 index 0000000000..8636bbd12e --- /dev/null +++ b/test/files/run/t8010.scala @@ -0,0 +1,22 @@ +trait Base { + def t = 1 + def t(n: Int) = n + def bt = 2 + def bt(n: Int) = n +} +trait Derived extends Base { + // was: double defintion error + override def t = 1 + super.t + override def t(n: Int) = 1 + super.t(n) + override def bt = 1 + super.bt + override def bt(n: Int) = 1 + super.bt(n) +} + +object Test extends App { + val d = new Derived {} + // not the focus of thie bug, but let's just check the runtime behaviour while we're here. + assert(d.t == 2) + assert(d.t(1) == 2) + assert(d.bt == 3) + assert(d.bt(1) == 2) +} diff --git a/test/files/run/t8017.flags b/test/files/run/t8017.flags new file mode 100644 index 0000000000..48b438ddf8 --- /dev/null +++ b/test/files/run/t8017.flags @@ -0,0 +1 @@ +-Ydelambdafy:method diff --git a/test/files/run/t8017/value-class-lambda.scala b/test/files/run/t8017/value-class-lambda.scala new file mode 100644 index 0000000000..370023b194 --- /dev/null +++ b/test/files/run/t8017/value-class-lambda.scala @@ -0,0 +1,40 @@ +object Test { + def testC { + val f1 = (c: C) => c.value + val f2 = (x: Int) => new C(x) + val f3 = (c1: C) => (c2: C) => (c1, c2) + val r1 = f2(2) + val r2 = f2(2) + val r3 = f3(r1)(r2) + val result = f1(r3._2) + assert(result == 2) + } + + def testD { + val f1 = (c: D) => c.value + val f2 = (x: String) => new D(x) + val f3 = (c1: D) => (c2: D) => (c1, c2) + val r1 = f2("2") + val r2 = f2("2") + val r3 = f3(r1)(r2) + val result = f1(r3._2) + assert(result == "2") + } + + def testE { + val f1 = (c: E[Int]) => c.value + val f2 = (x: Int) => new E(x) + val f3 = (c1: E[Int]) => (c2: E[Int]) => (c1, c2) + val r1 = f2(2) + val r2 = f2(2) + val r3 = f3(r1)(r2) + val result = f1(r3._2) + assert(result == 2) + } + + def main(args: Array[String]) { + testC + testD + testE + } +} diff --git a/test/files/run/t8017/value-class.scala b/test/files/run/t8017/value-class.scala new file mode 100644 index 0000000000..821239305f --- /dev/null +++ b/test/files/run/t8017/value-class.scala @@ -0,0 +1,3 @@ +class C(val value: Int) extends AnyVal +class D(val value: String) extends AnyVal +class E[A](val value: A) extends AnyVal diff --git a/test/files/run/t8029.scala b/test/files/run/t8029.scala new file mode 100644 index 0000000000..dbd5c41387 --- /dev/null +++ b/test/files/run/t8029.scala @@ -0,0 +1,57 @@ +import scala.tools.partest._ +import scala.tools.nsc._ + +object Test extends DirectTest { + + override def extraSettings: String = "-usejavacp -nowarn -Ystop-after:typer" + + override def code = "" // not used + + def code1 = """ +package object p1 { + trait A + object A +} + """ + + def code2 = """ +package object p2 { + class A + object A +} + """ + + def code3 = """ +package object p3 { + object A + trait A +} + """ + + def code4 = """ +package object p4 { + object A + trait A +} + """ + + def show() { + val global = newCompiler() + import global._ + def typecheck(code: String): Unit = { + val r = new Run + val sourceFile = newSources(code).head + global.reporter.reset() + r.compileSources(sourceFile :: Nil) + assert(!global.reporter.hasErrors) + } + + def typecheckTwice(code: String): Unit = { + typecheck(code) + typecheck(code) + } + + // was: illegal cyclic reference involving package ... + Seq(code1, code2, code3, code4) foreach typecheckTwice + } +} diff --git a/test/files/run/t8048a.check b/test/files/run/t8048a.check new file mode 100644 index 0000000000..8fb9e26e84 --- /dev/null +++ b/test/files/run/t8048a.check @@ -0,0 +1 @@ +Some(2) diff --git a/test/files/run/t8048a/Macros_1.scala b/test/files/run/t8048a/Macros_1.scala new file mode 100644 index 0000000000..f48e84f1de --- /dev/null +++ b/test/files/run/t8048a/Macros_1.scala @@ -0,0 +1,11 @@ +import scala.reflect.macros.WhiteboxContext +import scala.language.experimental.macros + +object Macros { + def impl(c: WhiteboxContext) = { + import c.universe._ + q"if (true) Some(2) else None" + } + + def foo: Any = macro impl +}
\ No newline at end of file diff --git a/test/files/run/t8048a/Test_2.scala b/test/files/run/t8048a/Test_2.scala new file mode 100644 index 0000000000..4e1c8b16b0 --- /dev/null +++ b/test/files/run/t8048a/Test_2.scala @@ -0,0 +1,4 @@ +object Test extends App { + val x: Option[Int] = Macros.foo + println(x) +}
\ No newline at end of file diff --git a/test/files/run/t8048b.check b/test/files/run/t8048b.check new file mode 100644 index 0000000000..083edaac24 --- /dev/null +++ b/test/files/run/t8048b.check @@ -0,0 +1,3 @@ +2 +2 +2 diff --git a/test/files/run/t8048b/Macros_1.scala b/test/files/run/t8048b/Macros_1.scala new file mode 100644 index 0000000000..b113af86ea --- /dev/null +++ b/test/files/run/t8048b/Macros_1.scala @@ -0,0 +1,37 @@ +// see the following discussions to understand what's being tested here: +// * https://issues.scala-lang.org/browse/SI-6992 +// * https://issues.scala-lang.org/browse/SI-8048 +// * http://stackoverflow.com/questions/14370842/getting-a-structural-type-with-an-anonymous-classs-methods-from-a-macro +// * http://stackoverflow.com/questions/18480707/method-cannot-be-accessed-in-macro-generated-class/18485004#18485004 +// * https://groups.google.com/forum/#!topic/scala-internals/eXQt-BPm4i8 + +import scala.language.experimental.macros +import scala.reflect.macros.WhiteboxContext + +object Macros { + def impl1(c: WhiteboxContext) = { + import c.universe._ + q""" + trait Foo { def x = 2 } + new Foo {} + """ + } + def foo1: Any = macro impl1 + + def impl2(c: WhiteboxContext) = { + import c.universe._ + q""" + class Foo { def x = 2 } + new Foo + """ + } + def foo2: Any = macro impl2 + + def impl3(c: WhiteboxContext) = { + import c.universe._ + q""" + new { def x = 2 } + """ + } + def foo3: Any = macro impl3 +}
\ No newline at end of file diff --git a/test/files/run/t8048b/Test_2.scala b/test/files/run/t8048b/Test_2.scala new file mode 100644 index 0000000000..fb410dab7a --- /dev/null +++ b/test/files/run/t8048b/Test_2.scala @@ -0,0 +1,5 @@ +object Test extends App { + println(Macros.foo1.x) + println(Macros.foo2.x) + println(Macros.foo3.x) +}
\ No newline at end of file diff --git a/test/files/run/t8091.check b/test/files/run/t8091.check new file mode 100644 index 0000000000..4c4e91774f --- /dev/null +++ b/test/files/run/t8091.check @@ -0,0 +1 @@ +börk börk diff --git a/test/files/run/t8091.scala b/test/files/run/t8091.scala new file mode 100644 index 0000000000..cd412d4c2a --- /dev/null +++ b/test/files/run/t8091.scala @@ -0,0 +1,4 @@ +object Test extends App { + val result = "börk börk" flatMap (ch ⇒ if (ch > 127) f"&#x${ch}%04x;" else "" + ch) + println(result) +}
\ No newline at end of file diff --git a/test/files/run/t8104.check b/test/files/run/t8104.check new file mode 100644 index 0000000000..c2593eb199 --- /dev/null +++ b/test/files/run/t8104.check @@ -0,0 +1 @@ +TypeTag[(Int, Int)] diff --git a/test/files/run/t8104/Macros_1.scala b/test/files/run/t8104/Macros_1.scala new file mode 100644 index 0000000000..21d81a3687 --- /dev/null +++ b/test/files/run/t8104/Macros_1.scala @@ -0,0 +1,11 @@ +import scala.reflect.macros.WhiteboxContext + +object Macros { + def impl[T](c: WhiteboxContext)(implicit T: c.WeakTypeTag[T]) = { + import c.universe._ + import definitions._ + val fields = T.tpe.declarations.toList.collect{ case x: TermSymbol if x.isVal && x.isCaseAccessor => x } + val Repr = appliedType(TupleClass(fields.length).asType.toType, fields.map(_.typeSignature)) + q"new Generic[$T]{ type Repr = $Repr }" + } +}
\ No newline at end of file diff --git a/test/files/run/t8104/Test_2.scala b/test/files/run/t8104/Test_2.scala new file mode 100644 index 0000000000..630176f175 --- /dev/null +++ b/test/files/run/t8104/Test_2.scala @@ -0,0 +1,16 @@ +trait Generic[T] { type Repr } +object Generic { + type Aux[T, Repr0] = Generic[T] { type Repr = Repr0 } + import scala.language.experimental.macros + implicit def materializeGeneric[T, Repr]: Generic.Aux[T, Repr] = macro Macros.impl[T] +} + +object Test extends App { + case class C(x: Int, y: Int) + + import scala.reflect.runtime.universe._ + def reprify[T, Repr](x: T)(implicit generic: Generic.Aux[T, Repr], tag: TypeTag[Repr]) = println(tag) + reprify(C(40, 2)) + + implicitly[Generic.Aux[C, (Int, Int)]] +} diff --git a/test/files/run/toolbox_current_run_compiles.scala b/test/files/run/toolbox_current_run_compiles.scala index bc6a9d343e..31e0a45eea 100644 --- a/test/files/run/toolbox_current_run_compiles.scala +++ b/test/files/run/toolbox_current_run_compiles.scala @@ -9,7 +9,7 @@ package pkg { val g = c.universe.asInstanceOf[scala.tools.nsc.Global] c.Expr[Boolean](Literal(Constant(g.currentRun.compiles(sym.asInstanceOf[g.Symbol])))) } - def compiles[T] = macro impl[T] + def compiles[T]: Boolean = macro impl[T] } } diff --git a/test/files/run/toolbox_typecheck_implicitsdisabled.scala b/test/files/run/toolbox_typecheck_implicitsdisabled.scala index 95a7056279..8c1a6e580c 100644 --- a/test/files/run/toolbox_typecheck_implicitsdisabled.scala +++ b/test/files/run/toolbox_typecheck_implicitsdisabled.scala @@ -10,7 +10,7 @@ object Test extends App { Import(Select(Ident(TermName("scala")), TermName("Predef")), List(ImportSelector(nme.WILDCARD, -1, null, -1)))), Apply(Select(Literal(Constant(1)), TermName("$minus$greater")), List(Literal(Constant(2)))) ) - val ttree1 = toolbox.typeCheck(tree1, withImplicitViewsDisabled = false) + val ttree1 = toolbox.typecheck(tree1, withImplicitViewsDisabled = false) println(ttree1) try { @@ -18,7 +18,7 @@ object Test extends App { Import(Select(Ident(TermName("scala")), TermName("Predef")), List(ImportSelector(nme.WILDCARD, -1, null, -1)))), Apply(Select(Literal(Constant(1)), TermName("$minus$greater")), List(Literal(Constant(2)))) ) - val ttree2 = toolbox.typeCheck(tree2, withImplicitViewsDisabled = true) + val ttree2 = toolbox.typecheck(tree2, withImplicitViewsDisabled = true) println(ttree2) } catch { case ex: Throwable => diff --git a/test/files/run/toolbox_typecheck_macrosdisabled.check b/test/files/run/toolbox_typecheck_macrosdisabled.check index 3de296f1ad..d9e79cdd19 100644 --- a/test/files/run/toolbox_typecheck_macrosdisabled.check +++ b/test/files/run/toolbox_typecheck_macrosdisabled.check @@ -1,4 +1,4 @@ -{ +({ val $u: ru.type = ru; val $m: $u.Mirror = ru.runtimeMirror({ final class $anon extends scala.AnyRef { @@ -37,5 +37,5 @@ }; new $typecreator2() })) -} +}: ru.Expr[Int]) ru.reify[Int](2) diff --git a/test/files/run/toolbox_typecheck_macrosdisabled.scala b/test/files/run/toolbox_typecheck_macrosdisabled.scala index 1f7fda8575..4cbeefd6e0 100644 --- a/test/files/run/toolbox_typecheck_macrosdisabled.scala +++ b/test/files/run/toolbox_typecheck_macrosdisabled.scala @@ -16,10 +16,10 @@ object Test extends App { build.setTypeSignature(ru, rutpe) val tree1 = Apply(Select(Ident(ru), TermName("reify")), List(Literal(Constant(2)))) - val ttree1 = toolbox.typeCheck(tree1, withMacrosDisabled = false) + val ttree1 = toolbox.typecheck(tree1, withMacrosDisabled = false) println(ttree1) val tree2 = Apply(Select(Ident(ru), TermName("reify")), List(Literal(Constant(2)))) - val ttree2 = toolbox.typeCheck(tree2, withMacrosDisabled = true) + val ttree2 = toolbox.typecheck(tree2, withMacrosDisabled = true) println(ttree2) } diff --git a/test/files/run/toolbox_typecheck_macrosdisabled2.check b/test/files/run/toolbox_typecheck_macrosdisabled2.check index 9810946024..8e554a6c8f 100644 --- a/test/files/run/toolbox_typecheck_macrosdisabled2.check +++ b/test/files/run/toolbox_typecheck_macrosdisabled2.check @@ -1,4 +1,4 @@ -{ +({ val $u: ru.type = ru; val $m: $u.Mirror = ru.runtimeMirror({ final class $anon extends scala.AnyRef { @@ -37,5 +37,5 @@ }; new $typecreator2() })) -} +}: ru.Expr[Array[Int]]) ru.reify[Array[Int]](scala.Array.apply(2)) diff --git a/test/files/run/toolbox_typecheck_macrosdisabled2.scala b/test/files/run/toolbox_typecheck_macrosdisabled2.scala index 7bfe3ba8a4..2fbd8f7c7a 100644 --- a/test/files/run/toolbox_typecheck_macrosdisabled2.scala +++ b/test/files/run/toolbox_typecheck_macrosdisabled2.scala @@ -16,10 +16,10 @@ object Test extends App { build.setTypeSignature(ru, rutpe) val tree1 = Apply(Select(Ident(ru), TermName("reify")), List(Apply(Select(Ident(TermName("scala")), TermName("Array")), List(Literal(Constant(2)))))) - val ttree1 = toolbox.typeCheck(tree1, withMacrosDisabled = false) + val ttree1 = toolbox.typecheck(tree1, withMacrosDisabled = false) println(ttree1) val tree2 = Apply(Select(Ident(ru), TermName("reify")), List(Apply(Select(Ident(TermName("scala")), TermName("Array")), List(Literal(Constant(2)))))) - val ttree2 = toolbox.typeCheck(tree2, withMacrosDisabled = true) + val ttree2 = toolbox.typecheck(tree2, withMacrosDisabled = true) println(ttree2) } diff --git a/test/files/scalacheck/quasiquotes/ArbitraryTreesAndNames.scala b/test/files/scalacheck/quasiquotes/ArbitraryTreesAndNames.scala index 7905a2ca15..c5cac3ea45 100644 --- a/test/files/scalacheck/quasiquotes/ArbitraryTreesAndNames.scala +++ b/test/files/scalacheck/quasiquotes/ArbitraryTreesAndNames.scala @@ -1,5 +1,4 @@ import org.scalacheck._, Prop._, Gen._, Arbitrary._ -import scala.reflect.api.{Liftable, Universe} import scala.reflect.runtime.universe._, Flag._ trait ArbitraryTreesAndNames { @@ -265,14 +264,8 @@ trait ArbitraryTreesAndNames { def genTreeIsTypeWrapped(size: Int) = for(tit <- genTreeIsType(size)) yield TreeIsType(tit) - implicit object liftTreeIsTerm extends Liftable[TreeIsTerm] { - def apply(universe: Universe, value: TreeIsTerm): universe.Tree = - value.tree.asInstanceOf[universe.Tree] - } - implicit object liftTreeIsType extends Liftable[TreeIsType] { - def apply(universe: Universe, value: TreeIsType): universe.Tree = - value.tree.asInstanceOf[universe.Tree] - } + implicit val liftTreeIsTerm = Liftable[TreeIsTerm] { _.tree } + implicit val liftTreeIsType = Liftable[TreeIsType] { _.tree } implicit def treeIsTerm2tree(tit: TreeIsTerm): Tree = tit.tree implicit def treeIsType2tree(tit: TreeIsType): Tree = tit.tree diff --git a/test/files/scalacheck/quasiquotes/DefinitionConstructionProps.scala b/test/files/scalacheck/quasiquotes/DefinitionConstructionProps.scala index 2ec679e78b..2af656c7c9 100644 --- a/test/files/scalacheck/quasiquotes/DefinitionConstructionProps.scala +++ b/test/files/scalacheck/quasiquotes/DefinitionConstructionProps.scala @@ -2,12 +2,25 @@ import org.scalacheck._, Prop._, Gen._, Arbitrary._ import scala.reflect.runtime.universe._, Flag._, build.ScalaDot object DefinitionConstructionProps - extends QuasiquoteProperties("definition construction") - with ClassConstruction - with TraitConstruction - with TypeDefConstruction - with ValDefConstruction - with PackageConstruction + extends QuasiquoteProperties("definition construction") + with ClassConstruction + with TraitConstruction + with TypeDefConstruction + with ValDefConstruction + with PackageConstruction { + property("SI-6842") = test { + val x: Tree = q"val x: Int" + assertEqAst(q"def f($x) = 0", "def f(x: Int) = 0") + assertEqAst(q"class C($x)", "class C(val x: Int)") + assertEqAst(q"class C { $x => }", "class C { x: Int => }") + assertEqAst(q"trait B { $x => }", "trait B { x: Int => }") + assertEqAst(q"object A { $x => }", "object A { x: Int => }") + val t: Tree = q"type T" + assertEqAst(q"def f[$t] = 0", "def f[T] = 0") + assertEqAst(q"class C[$t]", "class C[T]") + assertEqAst(q"trait B[$t]", "trait B[T]") + } +} trait ClassConstruction { self: QuasiquoteProperties => val anyRef = ScalaDot(TypeName("AnyRef")) @@ -283,7 +296,7 @@ trait MethodConstruction { self: QuasiquoteProperties => assertEqAst(q"@$a def foo", "@Foo[A,B] def foo") } - property("splice annotation with multiple argument lists") = test{ + property("splice annotation with multiple argument lists") = test { val a = q"new Foo(a)(b)" assertEqAst(q"@$a def foo", "@Foo(a)(b) def foo") } diff --git a/test/files/scalacheck/quasiquotes/DefinitionDeconstructionProps.scala b/test/files/scalacheck/quasiquotes/DefinitionDeconstructionProps.scala index dbd26bf72a..94465930ed 100644 --- a/test/files/scalacheck/quasiquotes/DefinitionDeconstructionProps.scala +++ b/test/files/scalacheck/quasiquotes/DefinitionDeconstructionProps.scala @@ -88,6 +88,22 @@ trait ClassDeconstruction { self: QuasiquoteProperties => matches("class Foo { self => bar(self) }") matches("case class Foo(x: Int)") } + + property("SI-7979") = test { + val PARAMACCESSOR = (1 << 29).toLong.asInstanceOf[FlagSet] + assertThrows[MatchError] { + val build.SyntacticClassDef(_, _, _, _, _, _, _, _, _) = + ClassDef( + Modifiers(), TypeName("Foo"), List(), + Template( + List(Select(Ident(TermName("scala")), TypeName("AnyRef"))), + noSelfType, + List( + //ValDef(Modifiers(PRIVATE | LOCAL | PARAMACCESSOR), TermName("x"), Ident(TypeName("Int")), EmptyTree), + DefDef(Modifiers(), nme.CONSTRUCTOR, List(), List(List(ValDef(Modifiers(PARAM | PARAMACCESSOR), TermName("x"), + Ident(TypeName("Int")), EmptyTree))), TypeTree(), Block(List(pendingSuperCall), Literal(Constant(()))))))) + } + } } trait ModsDeconstruction { self: QuasiquoteProperties => diff --git a/test/files/scalacheck/quasiquotes/ErrorProps.scala b/test/files/scalacheck/quasiquotes/ErrorProps.scala index cb46a60dbe..92d299bede 100644 --- a/test/files/scalacheck/quasiquotes/ErrorProps.scala +++ b/test/files/scalacheck/quasiquotes/ErrorProps.scala @@ -105,13 +105,6 @@ object ErrorProps extends QuasiquoteProperties("errors") { q"f($sb)" """) - property("casedef expected") = fails( - "reflect.runtime.universe.CaseDef expected but reflect.runtime.universe.Tree found", - """ - val t = EmptyTree - q"_ { case $t }" - """) - property("can't splice with ... card here") = fails( "Can't splice with ... here", """ @@ -179,6 +172,20 @@ object ErrorProps extends QuasiquoteProperties("errors") { val q"$m1 $m2 def foo" = EmptyTree """) + property("can't splice values of Null") = fails( + "Can't splice Null, bottom type values often indicate programmer mistake", + """ + val n = null + q"$n" + """) + + property("can't splice values of Nothing") = fails( + "Can't splice Nothing, bottom type values often indicate programmer mistake", + """ + def n = ??? + q"$n" + """) + // // Make sure a nice error is reported in this case // { import Flag._; val mods = NoMods; q"lazy $mods val x: Int" } }
\ No newline at end of file diff --git a/test/files/scalacheck/quasiquotes/LiftableProps.scala b/test/files/scalacheck/quasiquotes/LiftableProps.scala index 1271e1accd..539375d905 100644 --- a/test/files/scalacheck/quasiquotes/LiftableProps.scala +++ b/test/files/scalacheck/quasiquotes/LiftableProps.scala @@ -76,4 +76,39 @@ object LiftableProps extends QuasiquoteProperties("liftable") { val const = Constant(0) assert(q"$const" ≈ q"0") } + + property("lift list variants") = test { + val lst = List(1, 2) + val immutable = q"$scalapkg.collection.immutable" + assert(q"$lst" ≈ q"$immutable.List(1, 2)") + assert(q"f(..$lst)" ≈ q"f(1, 2)") + val llst = List(List(1), List(2)) + assert(q"f(..$llst)" ≈ q"f($immutable.List(1), $immutable.List(2))") + assert(q"f(...$llst)" ≈ q"f(1)(2)") + } + + property("lift tuple") = test { + assert(q"${Tuple1(1)}" ≈ q"scala.Tuple1(1)") + assert(q"${(1, 2)}" ≈ q"(1, 2)") + assert(q"${(1, 2, 3)}" ≈ q"(1, 2, 3)") + assert(q"${(1, 2, 3, 4)}" ≈ q"(1, 2, 3, 4)") + assert(q"${(1, 2, 3, 4, 5)}" ≈ q"(1, 2, 3, 4, 5)") + assert(q"${(1, 2, 3, 4, 5, 6)}" ≈ q"(1, 2, 3, 4, 5, 6)") + assert(q"${(1, 2, 3, 4, 5, 6, 7)}" ≈ q"(1, 2, 3, 4, 5, 6, 7)") + assert(q"${(1, 2, 3, 4, 5, 6, 7, 8)}" ≈ q"(1, 2, 3, 4, 5, 6, 7, 8)") + assert(q"${(1, 2, 3, 4, 5, 6, 7, 8, 9)}" ≈ q"(1, 2, 3, 4, 5, 6, 7, 8, 9)") + assert(q"${(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)}" ≈ q"(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)") + assert(q"${(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11)}" ≈ q"(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11)") + assert(q"${(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12)}" ≈ q"(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12)") + assert(q"${(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13)}" ≈ q"(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13)") + assert(q"${(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14)}" ≈ q"(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14)") + assert(q"${(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15)}" ≈ q"(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15)") + assert(q"${(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16)}" ≈ q"(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16)") + assert(q"${(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17)}" ≈ q"(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17)") + assert(q"${(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18)}" ≈ q"(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18)") + assert(q"${(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19)}" ≈ q"(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19)") + assert(q"${(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20)}" ≈ q"(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20)") + assert(q"${(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21)}" ≈ q"(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21)") + assert(q"${(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22)}" ≈ q"(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22)") + } }
\ No newline at end of file diff --git a/test/files/scalacheck/quasiquotes/QuasiquoteProperties.scala b/test/files/scalacheck/quasiquotes/QuasiquoteProperties.scala index b331c4b6b6..e4ee5dfcae 100644 --- a/test/files/scalacheck/quasiquotes/QuasiquoteProperties.scala +++ b/test/files/scalacheck/quasiquotes/QuasiquoteProperties.scala @@ -81,7 +81,7 @@ trait Helpers { val compile = toolbox.compile(_) val eval = toolbox.eval(_) - def typecheck(tree: Tree) = toolbox.typeCheck(tree) + def typecheck(tree: Tree) = toolbox.typecheck(tree) def typecheckTyp(tree: Tree) = { val q"type $_ = $res" = typecheck(q"type T = $tree") @@ -120,4 +120,6 @@ trait Helpers { def annot(name: TypeName): Tree = annot(name, Nil) def annot(name: String, args: List[Tree]): Tree = annot(TypeName(name), args) def annot(name: TypeName, args: List[Tree]): Tree = q"new $name(..$args)" -}
\ No newline at end of file + + val scalapkg = build.setSymbol(Ident(TermName("scala")), definitions.ScalaPackage) +} diff --git a/test/files/scalacheck/quasiquotes/RuntimeErrorProps.scala b/test/files/scalacheck/quasiquotes/RuntimeErrorProps.scala new file mode 100644 index 0000000000..a3b6137f68 --- /dev/null +++ b/test/files/scalacheck/quasiquotes/RuntimeErrorProps.scala @@ -0,0 +1,75 @@ +import org.scalacheck._, Prop._, Gen._, Arbitrary._ +import scala.reflect.runtime.universe._, Flag._ + +object RuntimeErrorProps extends QuasiquoteProperties("errors") { + def testFails[T](block: =>T) = test { + assertThrows[IllegalArgumentException] { + block + } + } + + property("default param anon function") = testFails { + val param = q"val x: Int = 1" + q"{ $param => x + 1 }" + } + + property("non-casedef case") = testFails { + val x = q"x" + q"foo match { case $x }" + } + + property("non-new annotation") = testFails { + val annot = q"foo" + q"@$annot def foo" + } + + property("non-valdef param") = testFails { + val param = q"foo" + q"def foo($param)" + } + + property("non-valdef class param") = testFails { + val param = q"foo" + q"class Foo($param)" + } + + property("non-typedef type param") = testFails { + val tparam = tq"T" + q"class C[$tparam]" + } + + property("non-definition refine stat") = testFails { + val stat = q"foo" + tq"Foo { $stat }" + } + + property("non-definition early def") = testFails { + val stat = q"foo" + q"class Foo extends { $stat } with Bar" + } + + property("type apply for definition") = testFails { + val defn = q"def foo" + q"$defn[foo]" + } + + property("non-val selftype") = testFails { + val foo = q"foo" + q"class Foo { $foo => }" + } + + property("for empty enums") = testFails { + val enums = List.empty[Tree] + q"for(..$enums) 0" + } + + property("for starts with non-from enum") = testFails { + val enums = fq"foo = bar" :: Nil + q"for(..$enums) 0" + } + + property("for inlalid enum") = testFails { + val enums = q"foo" :: Nil + q"for(..$enums) 0" + } +} diff --git a/test/files/scalacheck/quasiquotes/TermConstructionProps.scala b/test/files/scalacheck/quasiquotes/TermConstructionProps.scala index cdd96205de..6fb05ff9a4 100644 --- a/test/files/scalacheck/quasiquotes/TermConstructionProps.scala +++ b/test/files/scalacheck/quasiquotes/TermConstructionProps.scala @@ -203,4 +203,25 @@ object TermConstructionProps extends QuasiquoteProperties("term construction") { assert(q"f(..${l1 ++ l2}, $baz)" ≈ q"f(foo, bar, baz)") assert(q"f(${if (true) q"a" else q"b"})" ≈ q"f(a)") } + + property("splice iterable of non-parametric type") = test { + object O extends Iterable[Tree] { def iterator = List(q"foo").iterator } + q"f(..$O)" + } + + property("SI-8016") = test { + val xs = q"1" :: q"2" :: Nil + assertEqAst(q"..$xs", "{1; 2}") + assertEqAst(q"{..$xs}", "{1; 2}") + } + + property("SI-6842") = test { + val cases: List[Tree] = cq"a => b" :: cq"_ => c" :: Nil + assertEqAst(q"1 match { case ..$cases }", "1 match { case a => b case _ => c }") + assertEqAst(q"try 1 catch { case ..$cases }", "try 1 catch { case a => b case _ => c }") + } + + property("SI-8009") = test { + q"`foo`".asInstanceOf[reflect.internal.SymbolTable#Ident].isBackquoted + } } diff --git a/test/files/scalacheck/quasiquotes/TermDeconstructionProps.scala b/test/files/scalacheck/quasiquotes/TermDeconstructionProps.scala index bd81afa125..8d1ada342a 100644 --- a/test/files/scalacheck/quasiquotes/TermDeconstructionProps.scala +++ b/test/files/scalacheck/quasiquotes/TermDeconstructionProps.scala @@ -3,8 +3,10 @@ import scala.reflect.runtime.universe._, Flag._ object TermDeconstructionProps extends QuasiquoteProperties("term deconstruction") { property("f(..x) = f") = test { - val q"f(..$args)" = q"f" - assert(args ≈ Nil) + // see SI-8008 + assertThrows[MatchError] { + val q"f(..$args)" = q"f" + } } property("f(x)") = forAll { (x: Tree) => diff --git a/test/files/scalacheck/quasiquotes/Test.scala b/test/files/scalacheck/quasiquotes/Test.scala index 8b1e779ab2..7a26fa4923 100644 --- a/test/files/scalacheck/quasiquotes/Test.scala +++ b/test/files/scalacheck/quasiquotes/Test.scala @@ -8,7 +8,9 @@ object Test extends Properties("quasiquotes") { include(PatternConstructionProps) include(PatternDeconstructionProps) include(LiftableProps) + include(UnliftableProps) include(ErrorProps) + include(RuntimeErrorProps) include(DefinitionConstructionProps) include(DefinitionDeconstructionProps) include(DeprecationProps) diff --git a/test/files/scalacheck/quasiquotes/TypecheckedProps.scala b/test/files/scalacheck/quasiquotes/TypecheckedProps.scala index f443330e0b..2f501435e3 100644 --- a/test/files/scalacheck/quasiquotes/TypecheckedProps.scala +++ b/test/files/scalacheck/quasiquotes/TypecheckedProps.scala @@ -50,4 +50,29 @@ object TypecheckedProps extends QuasiquoteProperties("typechecked") { assert(enums1 ≈ enums) assert(body1 ≈ body) } + + property("extract UnApply (1)") = test { + val q"object $_ { $_; $_; $m }" = typecheck(q""" + object Test { + class Cell(val x: Int) + object Cell { def unapply(c: Cell) = Some(c.x) } + new Cell(0) match { case Cell(v) => v } + } + """) + val q"$_ match { case $f(..$args) => $_ }" = m + assert(f ≈ pq"Test.this.Cell") + assert(args ≈ List(pq"v")) + } + + property("extract UnApply (2)") = test { + val q"object $_ { $_; $_; $m }" = typecheck(q""" + object Test { + case class Cell(val x: Int) + new Cell(0) match { case Cell(v) => v } + } + """) + val q"$_ match { case ${f: TypeTree}(..$args) => $_ }" = m + assert(f.original ≈ pq"Test.this.Cell") + assert(args ≈ List(pq"v")) + } }
\ No newline at end of file diff --git a/test/files/scalacheck/quasiquotes/UnliftableProps.scala b/test/files/scalacheck/quasiquotes/UnliftableProps.scala new file mode 100644 index 0000000000..8b827c98ff --- /dev/null +++ b/test/files/scalacheck/quasiquotes/UnliftableProps.scala @@ -0,0 +1,160 @@ +import org.scalacheck._, Prop._, Gen._, Arbitrary._ +import scala.reflect.runtime.universe._, Flag._ + +object UnliftableProps extends QuasiquoteProperties("unliftable") { + property("unlift name") = test { + val termname0 = TermName("foo") + val typename0 = TypeName("foo") + val q"${termname1: TermName}" = Ident(termname0) + assert(termname1 == termname0) + val q"${typename1: TypeName}" = Ident(typename0) + assert(typename1 == typename0) + val q"${name1: Name}" = Ident(termname0) + assert(name1 == termname0) + val q"${name2: Name}" = Ident(typename0) + assert(name2 == typename0) + } + + property("unlift type") = test { + val q"${tpe: Type}" = TypeTree(typeOf[Int]) + assert(tpe =:= typeOf[Int]) + } + + property("unlift constant") = test { + val q"${const: Constant}" = Literal(Constant("foo")) + assert(const == Constant("foo")) + } + + property("unlift char") = test { + val q"${c: Char}" = Literal(Constant('0')) + assert(c.isInstanceOf[Char] && c == '0') + } + + property("unlift byte") = test { + val q"${b: Byte}" = Literal(Constant(0: Byte)) + assert(b.isInstanceOf[Byte] && b == 0) + } + + property("unlift short") = test { + val q"${s: Short}" = Literal(Constant(0: Short)) + assert(s.isInstanceOf[Short] && s == 0) + } + + property("unlift int") = test { + val q"${i: Int}" = Literal(Constant(0: Int)) + assert(i.isInstanceOf[Int] && i == 0) + } + + property("unlift long") = test { + val q"${l: Long}" = Literal(Constant(0L: Long)) + assert(l.isInstanceOf[Long] && l == 0L) + } + + property("unlift float") = test { + val q"${f: Float}" = Literal(Constant(0.0f: Float)) + assert(f.isInstanceOf[Float] && f == 0.0f) + } + + property("unlift double") = test { + val q"${d: Double}" = Literal(Constant(0.0: Double)) + assert(d.isInstanceOf[Double] && d == 0.0) + } + + property("unlift bool") = test { + val q"${b: Boolean}" = q"true" + assert(b.isInstanceOf[Boolean] && b == true) + } + + property("unlift string") = test { + val q"${s: String}" = q""" "foo" """ + assert(s.isInstanceOf[String] && s == "foo") + } + + property("unlift scala.symbol") = test { + val q"${s: scala.Symbol}" = q"'foo" + assert(s.isInstanceOf[scala.Symbol] && s == 'foo) + } + + implicit def unliftList[T: Unliftable]: Unliftable[List[T]] = Unliftable { + case q"scala.collection.immutable.List(..$args)" if args.forall { implicitly[Unliftable[T]].unapply(_).nonEmpty } => + val ut = implicitly[Unliftable[T]] + args.flatMap { ut.unapply(_) } + } + + property("unlift list (1)") = test { + val orig = List(1, 2) + val q"${l1: List[Int]}" = q"$orig" // q"List(1, 2)" + assert(l1 == orig) + val q"f(..${l2: List[Int]})" = q"f(..$orig)" // q"f(1, 2) + assert(l2 == orig) + } + + property("unlift list (2)") = test { + val orig2 = List(List(1, 2), List(3)) + val q"f(${l3: List[List[Int]]})" = q"f($orig2)" // q"f(List(List(1, 2), List(3))) + assert(l3 == orig2) + val q"f(..${l4: List[List[Int]]})" = q"f(..$orig2)" // q"f(List(1, 2), List(3))" + assert(l4 == orig2) + val q"f(...${l5: List[List[Int]]})" = q"f(...$orig2)" // q"f(1, 2)(3) + assert(l5 == orig2) + } + + property("don't unlift non-tree splicee (1)") = test { + val q"${a: TermName}.${b: TermName}" = q"a.b" + assert(a == TermName("a")) + assert(b == TermName("b")) + } + + property("don't unlift non-tree splicee (2)") = test { + val q"${mods: Modifiers} def foo" = q"def foo" + assert(mods == Modifiers(DEFERRED)) + } + + property("unlift tuple") = test { + // fails due to SI-8045 + // val q"${t1: Tuple1[Int]}" = q"_root_.scala.Tuple1(1)" + val q"${t2: (Int, Int)}" = q"(1, 2)" + val q"${t3: (Int, Int, Int)}" = q"(1, 2, 3)" + val q"${t4: (Int, Int, Int, Int)}" = q"(1, 2, 3, 4)" + val q"${t5: (Int, Int, Int, Int, Int)}" = q"(1, 2, 3, 4, 5)" + val q"${t6: (Int, Int, Int, Int, Int, Int)}" = q"(1, 2, 3, 4, 5, 6)" + val q"${t7: (Int, Int, Int, Int, Int, Int, Int)}" = q"(1, 2, 3, 4, 5, 6, 7)" + val q"${t8: (Int, Int, Int, Int, Int, Int, Int, Int)}" = q"(1, 2, 3, 4, 5, 6, 7, 8)" + val q"${t9: (Int, Int, Int, Int, Int, Int, Int, Int, Int)}" = q"(1, 2, 3, 4, 5, 6, 7, 8, 9)" + val q"${t10: (Int, Int, Int, Int, Int, Int, Int, Int, Int, Int)}" = q"(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)" + val q"${t11: (Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int)}" = q"(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11)" + val q"${t12: (Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int)}" = q"(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12)" + val q"${t13: (Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int)}" = q"(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13)" + val q"${t14: (Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int)}" = q"(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14)" + val q"${t15: (Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int)}" = q"(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15)" + val q"${t16: (Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int)}" = q"(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16)" + val q"${t17: (Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int)}" = q"(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17)" + val q"${t18: (Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int)}" = q"(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18)" + val q"${t19: (Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int)}" = q"(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19)" + val q"${t20: (Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int)}" = q"(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20)" + val q"${t21: (Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int)}" = q"(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21)" + val q"${t22: (Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int)}" = q"(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22)" + // assert(t1 == Tuple1(1)) + assert(t2 == (1, 2)) + assert(t3 == (1, 2, 3)) + assert(t4 == (1, 2, 3, 4)) + assert(t5 == (1, 2, 3, 4, 5)) + assert(t6 == (1, 2, 3, 4, 5, 6)) + assert(t7 == (1, 2, 3, 4, 5, 6, 7)) + assert(t8 == (1, 2, 3, 4, 5, 6, 7, 8)) + assert(t9 == (1, 2, 3, 4, 5, 6, 7, 8, 9)) + assert(t10 == (1, 2, 3, 4, 5, 6, 7, 8, 9, 10)) + assert(t11 == (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11)) + assert(t12 == (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12)) + assert(t13 == (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13)) + assert(t14 == (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14)) + assert(t15 == (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15)) + assert(t16 == (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16)) + assert(t17 == (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17)) + assert(t18 == (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18)) + assert(t19 == (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19)) + assert(t20 == (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20)) + assert(t21 == (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21)) + assert(t22 == (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22)) + } +} |