From c42428d76652cbf3ffda1204b8f2e7bb5654f119 Mon Sep 17 00:00:00 2001 From: Lukas Rytz Date: Thu, 2 Jul 2015 16:11:50 +0200 Subject: Fix superclass for Java interface symbols created in JavaMirrors According to the spec [1] the superclass of an interface is always Object. Restores the tests that were moved to pending in bf951ec1, fixex part of SI-9374. [1] https://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.1 --- test/pending/run/reify_csv.check | 10 --- test/pending/run/reify_csv.scala | 36 ---------- test/pending/run/reify_for1.scala | 10 --- test/pending/run/reify_fors_newpatmat.check | 5 -- test/pending/run/reify_fors_newpatmat.scala | 101 ---------------------------- test/pending/run/reify_fors_oldpatmat.check | 5 -- test/pending/run/reify_fors_oldpatmat.scala | 101 ---------------------------- test/pending/run/reify_newimpl_51.check | 3 - test/pending/run/reify_newimpl_51.scala | 18 ----- test/pending/run/reify_newimpl_52.check | 3 - test/pending/run/reify_newimpl_52.scala | 18 ----- test/pending/run/reify_properties.check | 2 - test/pending/run/reify_properties.scala | 57 ---------------- test/pending/run/reify_sort1.check | 2 - test/pending/run/reify_sort1.scala | 21 ------ 15 files changed, 392 deletions(-) delete mode 100644 test/pending/run/reify_csv.check delete mode 100644 test/pending/run/reify_csv.scala delete mode 100644 test/pending/run/reify_for1.scala delete mode 100644 test/pending/run/reify_fors_newpatmat.check delete mode 100644 test/pending/run/reify_fors_newpatmat.scala delete mode 100644 test/pending/run/reify_fors_oldpatmat.check delete mode 100644 test/pending/run/reify_fors_oldpatmat.scala delete mode 100644 test/pending/run/reify_newimpl_51.check delete mode 100644 test/pending/run/reify_newimpl_51.scala delete mode 100644 test/pending/run/reify_newimpl_52.check delete mode 100644 test/pending/run/reify_newimpl_52.scala delete mode 100644 test/pending/run/reify_properties.check delete mode 100644 test/pending/run/reify_properties.scala delete mode 100644 test/pending/run/reify_sort1.check delete mode 100644 test/pending/run/reify_sort1.scala (limited to 'test/pending/run') diff --git a/test/pending/run/reify_csv.check b/test/pending/run/reify_csv.check deleted file mode 100644 index b56f4bb50b..0000000000 --- a/test/pending/run/reify_csv.check +++ /dev/null @@ -1,10 +0,0 @@ -List(phase name, id, description) -record(parser,1,parse source into ASTs, perform simple desugaring) -record(namer,2,resolve names, attach symbols to named trees) -record(packageobjects,3,load package objects) -record(typer,4,the meat and potatoes: type the trees) -record(superaccessors,5,add super accessors in traits and nested classes) -record(pickler,6,serialize symbol tables) -record(refchecks,7,reference/override checking, translate nested objects) -record(selectiveanf,8,) -record(liftcode,9,reify trees) diff --git a/test/pending/run/reify_csv.scala b/test/pending/run/reify_csv.scala deleted file mode 100644 index c35624469c..0000000000 --- a/test/pending/run/reify_csv.scala +++ /dev/null @@ -1,36 +0,0 @@ -import scala.reflect.runtime.universe._ -import scala.tools.reflect.Eval - -object Test extends App { - val csv = """ - | phase name; id; description - | parser; 1; parse source into ASTs, perform simple desugaring - | namer; 2; resolve names, attach symbols to named trees - |packageobjects; 3; load package objects - | typer; 4; the meat and potatoes: type the trees - |superaccessors; 5; add super accessors in traits and nested classes - | pickler; 6; serialize symbol tables - | refchecks; 7; reference/override checking, translate nested objects - | selectiveanf; 8; - | liftcode; 9; reify trees""".stripMargin.split("\n").map{_.trim()}.drop(1).toList - - val fields = csv.head.split(";").map{_.trim()}.toList - println(fields) - - reify({ - object Csv { - case class record(`phase name`: String, id: String, description: String) - - object record { - def parse(lines: List[String]) = { - lines drop(1) map { line => line.split(";", -1).toList match { - case phase$whitespace$name :: id :: description :: _ => record(phase$whitespace$name.trim(), id.trim(), description.trim()) - case _ => throw new Exception("format error") - }} - } - } - } - - Csv.record.parse(csv) foreach println - }).eval -} diff --git a/test/pending/run/reify_for1.scala b/test/pending/run/reify_for1.scala deleted file mode 100644 index e1f5347572..0000000000 --- a/test/pending/run/reify_for1.scala +++ /dev/null @@ -1,10 +0,0 @@ -import scala.reflect.runtime.universe._ -import scala.tools.reflect.Eval - -object Test extends App { - reify { - val sumOfSquares1 = (for (i <- 1 to 100; if (i % 3 == 0)) yield Math.pow(i, 2)).sum - val sumOfSquares2 = (1 to 100).filter(_ % 3 == 0).map(Math.pow(_, 2)).sum - assert(sumOfSquares1 == sumOfSquares2) - }.eval -} \ No newline at end of file diff --git a/test/pending/run/reify_fors_newpatmat.check b/test/pending/run/reify_fors_newpatmat.check deleted file mode 100644 index eefddedc20..0000000000 --- a/test/pending/run/reify_fors_newpatmat.check +++ /dev/null @@ -1,5 +0,0 @@ -Persons over 20: John Richard -divisors(34) = List(1, 2, 17, 34) -findNums(15) = (4,1) (5,2) (6,1) (7,4) (8,3) (8,5) (9,2) (9,4) (10,1) (10,3) (10,7) (11,2) (11,6) (11,8) (12,1) (12,5) (12,7) (13,4) (13,6) (13,10) (14,3) (14,5) (14,9) -average(List(3.5, 5.0, 4.5)) = 4.333333333333333 -scalProd(List(3.5, 5.0, 4.5), List(2.0, 1.0, 3.0)) = 25.5 diff --git a/test/pending/run/reify_fors_newpatmat.scala b/test/pending/run/reify_fors_newpatmat.scala deleted file mode 100644 index 6bee9538a8..0000000000 --- a/test/pending/run/reify_fors_newpatmat.scala +++ /dev/null @@ -1,101 +0,0 @@ -import scala.reflect.runtime.universe._ -import scala.tools.reflect.Eval - -object Test extends App { - reify { - object Persons { - /** A list of persons. To create a list, we use Predef.List - * which takes a variable number of arguments and constructs - * a list out of them. - */ - val persons = List( - new Person("Bob", 17), - new Person("John", 40), - new Person("Richard", 68) - ) - - /** A Person class. 'val' constructor parameters become - * public members of the class. - */ - class Person(val name: String, val age: Int) - - /** Return an iterator over persons that are older than 20. - */ - def olderThan20(xs: Seq[Person]): Iterator[String] = - olderThan20(xs.iterator) - - /** Return an iterator over persons older than 20, given - * an iterator over persons. - */ - def olderThan20(xs: Iterator[Person]): Iterator[String] = { - - // The first expression is called a 'generator' and makes - // 'p' take values from 'xs'. The second expression is - // called a 'filter' and it is a boolean expression which - // selects only persons older than 20. There can be more than - // one generator and filter. The 'yield' expression is evaluated - // for each 'p' which satisfies the filters and used to assemble - // the resulting iterator - for (p <- xs if p.age > 20) yield p.name - } - } - - /** Some functions over lists of numbers which demonstrate - * the use of for comprehensions. - */ - object Numeric { - - /** Return the divisors of n. */ - def divisors(n: Int): List[Int] = - for (i <- List.range(1, n+1) if n % i == 0) yield i - - /** Is 'n' a prime number? */ - def isPrime(n: Int) = divisors(n).length == 2 - - /** Return pairs of numbers whose sum is prime. */ - def findNums(n: Int): Iterable[(Int, Int)] = { - - // a for comprehension using two generators - for (i <- 1 until n; - j <- 1 until (i-1); - if isPrime(i + j)) yield (i, j) - } - - /** Return the sum of the elements of 'xs'. */ - def sum(xs: List[Double]): Double = - xs.foldLeft(0.0) { (x, y) => x + y } - - /** Return the sum of pairwise product of the two lists. */ - def scalProd(xs: List[Double], ys: List[Double]) = - sum(for((x, y) <- xs zip ys) yield x * y); - - /** Remove duplicate elements in 'xs'. */ - def removeDuplicates[A](xs: List[A]): List[A] = - if (xs.isEmpty) - xs - else - xs.head :: removeDuplicates(for (x <- xs.tail if x != xs.head) yield x) - } - - // import all members of object 'persons' in the current scope - import Persons._ - - print("Persons over 20:") - olderThan20(persons) foreach { x => print(" " + x) } - println - - import Numeric._ - - println("divisors(34) = " + divisors(34)) - - print("findNums(15) =") - findNums(15) foreach { x => print(" " + x) } - println - - val xs = List(3.5, 5.0, 4.5) - println("average(" + xs + ") = " + sum(xs) / xs.length) - - val ys = List(2.0, 1.0, 3.0) - println("scalProd(" + xs + ", " + ys +") = " + scalProd(xs, ys)) - }.eval -} \ No newline at end of file diff --git a/test/pending/run/reify_fors_oldpatmat.check b/test/pending/run/reify_fors_oldpatmat.check deleted file mode 100644 index eefddedc20..0000000000 --- a/test/pending/run/reify_fors_oldpatmat.check +++ /dev/null @@ -1,5 +0,0 @@ -Persons over 20: John Richard -divisors(34) = List(1, 2, 17, 34) -findNums(15) = (4,1) (5,2) (6,1) (7,4) (8,3) (8,5) (9,2) (9,4) (10,1) (10,3) (10,7) (11,2) (11,6) (11,8) (12,1) (12,5) (12,7) (13,4) (13,6) (13,10) (14,3) (14,5) (14,9) -average(List(3.5, 5.0, 4.5)) = 4.333333333333333 -scalProd(List(3.5, 5.0, 4.5), List(2.0, 1.0, 3.0)) = 25.5 diff --git a/test/pending/run/reify_fors_oldpatmat.scala b/test/pending/run/reify_fors_oldpatmat.scala deleted file mode 100644 index 6bee9538a8..0000000000 --- a/test/pending/run/reify_fors_oldpatmat.scala +++ /dev/null @@ -1,101 +0,0 @@ -import scala.reflect.runtime.universe._ -import scala.tools.reflect.Eval - -object Test extends App { - reify { - object Persons { - /** A list of persons. To create a list, we use Predef.List - * which takes a variable number of arguments and constructs - * a list out of them. - */ - val persons = List( - new Person("Bob", 17), - new Person("John", 40), - new Person("Richard", 68) - ) - - /** A Person class. 'val' constructor parameters become - * public members of the class. - */ - class Person(val name: String, val age: Int) - - /** Return an iterator over persons that are older than 20. - */ - def olderThan20(xs: Seq[Person]): Iterator[String] = - olderThan20(xs.iterator) - - /** Return an iterator over persons older than 20, given - * an iterator over persons. - */ - def olderThan20(xs: Iterator[Person]): Iterator[String] = { - - // The first expression is called a 'generator' and makes - // 'p' take values from 'xs'. The second expression is - // called a 'filter' and it is a boolean expression which - // selects only persons older than 20. There can be more than - // one generator and filter. The 'yield' expression is evaluated - // for each 'p' which satisfies the filters and used to assemble - // the resulting iterator - for (p <- xs if p.age > 20) yield p.name - } - } - - /** Some functions over lists of numbers which demonstrate - * the use of for comprehensions. - */ - object Numeric { - - /** Return the divisors of n. */ - def divisors(n: Int): List[Int] = - for (i <- List.range(1, n+1) if n % i == 0) yield i - - /** Is 'n' a prime number? */ - def isPrime(n: Int) = divisors(n).length == 2 - - /** Return pairs of numbers whose sum is prime. */ - def findNums(n: Int): Iterable[(Int, Int)] = { - - // a for comprehension using two generators - for (i <- 1 until n; - j <- 1 until (i-1); - if isPrime(i + j)) yield (i, j) - } - - /** Return the sum of the elements of 'xs'. */ - def sum(xs: List[Double]): Double = - xs.foldLeft(0.0) { (x, y) => x + y } - - /** Return the sum of pairwise product of the two lists. */ - def scalProd(xs: List[Double], ys: List[Double]) = - sum(for((x, y) <- xs zip ys) yield x * y); - - /** Remove duplicate elements in 'xs'. */ - def removeDuplicates[A](xs: List[A]): List[A] = - if (xs.isEmpty) - xs - else - xs.head :: removeDuplicates(for (x <- xs.tail if x != xs.head) yield x) - } - - // import all members of object 'persons' in the current scope - import Persons._ - - print("Persons over 20:") - olderThan20(persons) foreach { x => print(" " + x) } - println - - import Numeric._ - - println("divisors(34) = " + divisors(34)) - - print("findNums(15) =") - findNums(15) foreach { x => print(" " + x) } - println - - val xs = List(3.5, 5.0, 4.5) - println("average(" + xs + ") = " + sum(xs) / xs.length) - - val ys = List(2.0, 1.0, 3.0) - println("scalProd(" + xs + ", " + ys +") = " + scalProd(xs, ys)) - }.eval -} \ No newline at end of file diff --git a/test/pending/run/reify_newimpl_51.check b/test/pending/run/reify_newimpl_51.check deleted file mode 100644 index 9a4ddeacd3..0000000000 --- a/test/pending/run/reify_newimpl_51.check +++ /dev/null @@ -1,3 +0,0 @@ -2 -1 -2 \ No newline at end of file diff --git a/test/pending/run/reify_newimpl_51.scala b/test/pending/run/reify_newimpl_51.scala deleted file mode 100644 index f823bf4033..0000000000 --- a/test/pending/run/reify_newimpl_51.scala +++ /dev/null @@ -1,18 +0,0 @@ -import scala.reflect.runtime.universe._ -import scala.tools.reflect.Eval - -object Test extends App { - { - var counter = 0 - lazy val x = { counter += 1; counter } - lazy val y = { counter += 1; counter } - val code = reify { - def foo = y // ensures that y is the first freevar we find - val bar = reify { println(x * y) } - bar.eval - println(x) - println(y) - } - code.eval - } -} \ No newline at end of file diff --git a/test/pending/run/reify_newimpl_52.check b/test/pending/run/reify_newimpl_52.check deleted file mode 100644 index 9359a2b211..0000000000 --- a/test/pending/run/reify_newimpl_52.check +++ /dev/null @@ -1,3 +0,0 @@ -2 -2 -1 \ No newline at end of file diff --git a/test/pending/run/reify_newimpl_52.scala b/test/pending/run/reify_newimpl_52.scala deleted file mode 100644 index f01199e830..0000000000 --- a/test/pending/run/reify_newimpl_52.scala +++ /dev/null @@ -1,18 +0,0 @@ -import scala.reflect.runtime.universe._ -import scala.tools.reflect.Eval - -object Test extends App { - { - var counter = 0 - lazy val x = { counter += 1; counter } - lazy val y = { counter += 1; counter } - val code = reify { - def foo = y // ensures that y is the first freevar we find - val bar = reify { println(y * x) } - bar.eval - println(x) - println(y) - } - code.eval - } -} \ No newline at end of file diff --git a/test/pending/run/reify_properties.check b/test/pending/run/reify_properties.check deleted file mode 100644 index d769bea4b0..0000000000 --- a/test/pending/run/reify_properties.check +++ /dev/null @@ -1,2 +0,0 @@ -user1: MR. ROBERT -user2: MR. BOB KUZ diff --git a/test/pending/run/reify_properties.scala b/test/pending/run/reify_properties.scala deleted file mode 100644 index 01a9b12a92..0000000000 --- a/test/pending/run/reify_properties.scala +++ /dev/null @@ -1,57 +0,0 @@ -import scala.reflect.runtime.universe._ -import scala.tools.reflect.Eval - -object Test extends App { - reify { - /** A mutable property whose getter and setter may be customized. */ - case class Property[T](init: T) { - private var value: T = init - - /** The getter function, defaults to identity. */ - private var setter: T => T = identity[T] - - /** The setter function, defaults to identity. */ - private var getter: T => T = identity[T] - - /** Retrive the value held in this property. */ - def apply(): T = getter(value) - - /** Update the value held in this property, through the setter. */ - def update(newValue: T) = value = setter(newValue) - - /** Change the getter. */ - def get(newGetter: T => T) = { getter = newGetter; this } - - /** Change the setter */ - def set(newSetter: T => T) = { setter = newSetter; this } - } - - class User { - // Create a property with custom getter and setter - val firstname = Property("") - .get { v => v.toUpperCase() } - .set { v => "Mr. " + v } - val lastname = Property("") - - /** Scala provides syntactic sugar for calling 'apply'. Simply - * adding a list of arguments between parenthesis (in this case, - * an empty list) is translated to a call to 'apply' with those - * arguments. - */ - override def toString() = firstname() + " " + lastname() - } - - val user1 = new User - - // Syntactic sugar for 'update': an assignment is translated to a - // call to method 'update' - user1.firstname() = "Robert" - - val user2 = new User - user2.firstname() = "bob" - user2.lastname() = "KUZ" - - println("user1: " + user1) - println("user2: " + user2) - }.eval -} diff --git a/test/pending/run/reify_sort1.check b/test/pending/run/reify_sort1.check deleted file mode 100644 index 0d30805141..0000000000 --- a/test/pending/run/reify_sort1.check +++ /dev/null @@ -1,2 +0,0 @@ -List(6, 2, 8, 5, 1) -List(1, 2, 5, 6, 8) diff --git a/test/pending/run/reify_sort1.scala b/test/pending/run/reify_sort1.scala deleted file mode 100644 index 6fb3cc5895..0000000000 --- a/test/pending/run/reify_sort1.scala +++ /dev/null @@ -1,21 +0,0 @@ -import scala.reflect.runtime.universe._ -import scala.tools.reflect.Eval - -object Test extends App { - reify { - def sort(a: List[Int]): List[Int] = { - if (a.length < 2) - a - else { - val pivot = a(a.length / 2) - sort(a.filter(_ < pivot)) ::: - a.filter(_ == pivot) ::: - sort(a.filter(_ > pivot)) - } - } - - val xs = List(6, 2, 8, 5, 1) - println(xs) - println(sort(xs)) - }.eval -} \ No newline at end of file -- cgit v1.2.3