diff options
author | Antonio Cunei <antonio.cunei@epfl.ch> | 2010-04-14 08:25:58 +0000 |
---|---|---|
committer | Antonio Cunei <antonio.cunei@epfl.ch> | 2010-04-14 08:25:58 +0000 |
commit | 433ed7ef4fd7d6ed8067c10cebe1e7ec3f72b40f (patch) | |
tree | 270b56354e7dde32bb3fc7953d08baf92ba49326 /test/disabled/run | |
parent | d61d2c93d788fdf01ad2497b9c6bb69ab9d6a397 (diff) | |
download | scala-433ed7ef4fd7d6ed8067c10cebe1e7ec3f72b40f.tar.gz scala-433ed7ef4fd7d6ed8067c10cebe1e7ec3f72b40f.tar.bz2 scala-433ed7ef4fd7d6ed8067c10cebe1e7ec3f72b40f.zip |
Merged revisions 21492-21512,21516-21518,21520-...
Merged revisions
21492-21512,21516-21518,21520-21525,21527,21529,21531,21535-21537,21539-
21543,21545-21548,21550,21552,21554-21560 via svnmerge from
https://lampsvn.epfl.ch/svn-repos/scala/scala/trunk
........
r21492 | dubochet | 2010-04-12 19:04:31 +0200 (Mon, 12 Apr 2010) | 1 line
[scaladoc] Lazy vals are printed as such, no longer as vars. No
review. ........ r21493 | dubochet | 2010-04-12 19:04:47 +0200 (Mon, 12
Apr 2010) | 1 line
[scaladoc] Signature kind (def, val) needs more space to accommodate
lazy vals and implicit defs. ........ r21494 | dubochet | 2010-04-12
19:05:04 +0200 (Mon, 12 Apr 2010) | 1 line
[scaladoc] Comment summary (first sentence) is extracted by comment
parser, which is a lot more robust and correct. No review. ........
r21495 | dragos | 2010-04-12 19:19:29 +0200 (Mon, 12 Apr 2010) | 4 lines
Auto-generate scala.runtime.AbstractFunctionN classes. Moved zipped*
methods in Tuple1/2 in genprod, so that regenerating tuples does not
lose these methods. Added @specialized annotations into genprod for the
same reason. ........ r21496 | dragos | 2010-04-12 19:19:38 +0200 (Mon,
12 Apr 2010) | 5 lines
Regenerated tuples, products and (Abstract)Functions. We needed to
have separate files for AbstractFunctionN because the compiler may need
their symbol even before their sourcefile is parsed. In such cases it
relies on finding a source file with the right name. ........ r21497 |
dragos | 2010-04-12 19:19:51 +0200 (Mon, 12 Apr 2010) | 1 line
Don't generate forwarders for specialized methods. no review. ........
r21498 | dragos | 2010-04-12 19:19:59 +0200 (Mon, 12 Apr 2010) | 3 lines
Companion objects of case classes extend AbstractFunctionN instead
of FunctionN. This saves quite some space, since FunctionN methods are
not re-mixed in for each object. ........ r21499 | dragos | 2010-04-12
19:20:07 +0200 (Mon, 12 Apr 2010) | 5 lines
Fixed various position issues in specialized members. Removed an
instance where the tree transformer was run twice on the same tree,
resulting in double definition errors. Fixed re-typing of super calls
in constructor arguments for specialized members. No review. ........
r21500 | phaller | 2010-04-12 19:27:14 +0200 (Mon, 12 Apr 2010) | 1 line
Restored partest behavior to write log files with normalized paths.
For new tests the check file can be copied from the log file. This makes
the behavior of --show-diff exactly the same as diffing the log and
check file. Review by extempore. ........ r21501 | dubochet | 2010-04-12
19:30:24 +0200 (Mon, 12 Apr 2010) | 1 line
[scaladoc] Inner objects, which according to the compiler are actually
methods, are now printed as objects by Scaladoc. No review. ........
r21502 | phaller | 2010-04-12 21:18:31 +0200 (Mon, 12 Apr 2010) | 1 line
Reverted r21500 until all test categories work again. ........ r21503
| dubochet | 2010-04-12 21:51:53 +0200 (Mon, 12 Apr 2010) | 1 line
[scaladoc] Use case symbols have correct owner; inherited filter
works as expected with use cases. Review by odersky. ........ r21504 |
extempore | 2010-04-12 21:57:56 +0200 (Mon, 12 Apr 2010) | 5 lines
Correct oversight where neg tests didn't demand a checkfile. More
trying to get timeout/interrupted logic so we know when things die
but also don't impede interrupts. Folded precondition logic into test
sequence logic, it's plenty general to cover it. Closes #3282, review by
phaller. ........ r21505 | malayeri | 2010-04-12 21:59:21 +0200 (Mon, 12
Apr 2010) | 7 lines
[scaladoc] Cosmetic changes:
- changed link color to underlined and dark purple
- increased padding in gray lines of method definitions
- lightened gray lines of method definitions
- changed dashed and solid lines from black to gray
- increased size of top template declaration; changed alignment
Review by dubochet.
........
r21506 | phaller | 2010-04-12 22:17:13 +0200 (Mon, 12 Apr 2010) | 1 line
Disabled test that hangs when actors package is compiled with
specialization. Review by dragos. ........ r21507 | phaller | 2010-04-12
22:41:46 +0200 (Mon, 12 Apr 2010) | 1 line
Another attempt at avoiding partest hang ups when the compiler
crashes. Review by extempore. ........ r21508 | dubochet | 2010-04-12
22:48:42 +0200 (Mon, 12 Apr 2010) | 1 line
[scaladoc] Members inherited from sourceless files are correctly
printed in documentation. No review. ........ r21509 | malayeri |
2010-04-12 22:53:02 +0200 (Mon, 12 Apr 2010) | 1 line
Changed the colors for types, value members, and tooltips. Feel free
to revert. Review by dubochet. ........ r21510 | extempore | 2010-04-12
23:36:33 +0200 (Mon, 12 Apr 2010) | 9 lines
Still working on partest. Added ant targets which can be temporary if
considered clutter.
ant test.partest
ant test.partest-opt
They run some recently troublesome partest tests with a low timeout.
Logged some more exceptions where the compiler has been dying. Review by
phaller. ........ r21511 | extempore | 2010-04-12 23:45:17 +0200 (Mon,
12 Apr 2010) | 10 lines
Disabling what I think are the last two failing tests, one each of the
two leading bugs among those we've seen here today on testing theater:
"could not find toMap: (x$1: scala.collection.TraversableOnce,x$2:
Predef$<:<)"
and
"scala.tools.nsc.symtab.Types$TypeError: method react cannot be
accessed in java.lang.Object with scala.actors.Reactor[Any]
No review but hey lets' see if we can re-enable these tests soonish.
........ r21512 | prokopec | 2010-04-12 23:53:30 +0200 (Mon, 12 Apr
2010) | 1 line
Documentation for mutable collections. No review. ........ r21516 |
extempore | 2010-04-13 01:20:03 +0200 (Tue, 13 Apr 2010) | 5 lines
Noticed that Settings post-set hooks were not being set in the place
where they ought to be, so multiple setting settings (such as -optimise)
were not flipping all the right bits when set programmatically instead
of via command line options. This may be a factor in inlining issues,
though by itself it does not appear to solve anything. No review.
........ r21517 | malayeri | 2010-04-13 06:25:09 +0200 (Tue, 13 Apr
2010) | 1 line
[scaladoc] Changed comment code and pre tages to not have "font-size:
small" attribute. Review by dubochet. ........ r21518 | plocinic |
2010-04-13 10:12:05 +0200 (Tue, 13 Apr 2010) | 1 line
Some clean-ups. Removed old syntax, code duplication etc. No review.
........ r21520 | prokopec | 2010-04-13 12:29:58 +0200 (Tue, 13 Apr
2010) | 1 line
docs for immutable.A-L*. no review
........
r21521 | rytz | 2010-04-13 12:31:39 +0200 (Tue, 13 Apr 2010) | 1 line
fixed most of stability, reviewed by iuli, so no review.
continuations.jar is still failing stability, i'll look at that.
........ r21522 | rompf | 2010-04-13 13:08:12 +0200 (Tue, 13 Apr 2010) |
1 line
closes #3241 and improves serialization of hash tries. review by
community. ........ r21523 | phaller | 2010-04-13 13:37:42 +0200 (Tue,
13 Apr 2010) | 1 line
Improved handling of uncaught exceptions in actors. See #711. Review
by community. ........ r21524 | prokopec | 2010-04-13 13:41:54 +0200
(Tue, 13 Apr 2010) | 1 line
A brace got hurt while documenting. no review.
........
r21525 | rytz | 2010-04-13 13:53:50 +0200 (Tue, 13 Apr 2010) | 1 line
fix stability. jar is not stable. no review.
........
r21527 | dubochet | 2010-04-13 14:08:47 +0200 (Tue, 13 Apr 2010) | 1 line
[scaladoc] Fixed CSS so that styles from wiki markup are correctly
displayed in comments. No Review. ........ r21529 | prokopec |
2010-04-13 14:15:40 +0200 (Tue, 13 Apr 2010) | 1 line
Immutable up to Queue docs. no review
........
r21531 | imaier | 2010-04-13 14:53:21 +0200 (Tue, 13 Apr 2010) | 1 line
Fixed #3258
........
r21535 | phaller | 2010-04-13 16:41:02 +0200 (Tue, 13 Apr 2010) | 1 line
Hardened actor tests. No review.
........
r21536 | phaller | 2010-04-13 16:59:29 +0200 (Tue, 13 Apr 2010) | 1 line
Removed obsolete AbstractReactor trait. No review. ........ r21537 |
prokopec | 2010-04-13 17:50:39 +0200 (Tue, 13 Apr 2010) | 1 line
Docs. no review
........
r21539 | prokopec | 2010-04-13 18:32:09 +0200 (Tue, 13 Apr 2010) | 1 line
Documented immutable.*. no review
........
r21540 | odersky | 2010-04-13 19:36:21 +0200 (Tue, 13 Apr 2010) | 1 line
more documentation
........
r21541 | odersky | 2010-04-13 19:36:54 +0200 (Tue, 13 Apr 2010) | 1 line
fix for usecase in doccomments.
........
r21542 | odersky | 2010-04-13 19:37:24 +0200 (Tue, 13 Apr 2010) | 1 line
attempted fix for the TypeSkolem problem under specialize. ........
r21543 | odersky | 2010-04-13 19:42:35 +0200 (Tue, 13 Apr 2010) | 1 line
Fix for specialized fix.
........
r21545 | malayeri | 2010-04-13 20:13:53 +0200 (Tue, 13 Apr 2010) | 1 line
[scaladoc] More cosmetic changes. Objects are a different shade of
blue and classes are green. ........ r21546 | extempore | 2010-04-13
20:24:05 +0200 (Tue, 13 Apr 2010) | 1 line
A redblack tree scalacheck test contributed by dcsobral. No review.
........ r21547 | extempore | 2010-04-13 20:24:27 +0200 (Tue, 13 Apr
2010) | 2 lines
A safety improvement for random path generation, and a small change
to Random for a more general interface. Review by community. ........
r21548 | extempore | 2010-04-13 20:24:48 +0200 (Tue, 13 Apr 2010) | 3
lines
Some mopping up in equality. Found a stack overflow in the way equals
was being handled, and hammered it out. New ==/## tests which covers
all types and values. Review by odersky. ........ r21550 | odersky |
2010-04-13 21:46:21 +0200 (Tue, 13 Apr 2010) | 2 lines
Removed trace output after having verified that skolems are correctly
identified now. Now review. ........ r21552 | malayeri | 2010-04-13
22:48:50 +0200 (Tue, 13 Apr 2010) | 1 line
[scaladoc] Tweak so that left pane has a little bit of left padding.
Review by dubochet. ........ r21554 | dchenbecker | 2010-04-13 22:51:44
+0200 (Tue, 13 Apr 2010) | 4 lines
Fix for #3284. This code should probably be refactored, but in the
interest of not breaking backwards compatibility, the JSON.parse
method has been marked deprecated for now. ........ r21555 | phaller |
2010-04-13 23:48:21 +0200 (Tue, 13 Apr 2010) | 1 line
Reverted r21523. No review.
........
r21556 | dragos | 2010-04-14 00:50:37 +0200 (Wed, 14 Apr 2010) | 4 lines
Fixed deadlocking behavior in actors. This bug deserves a few more
lines. Specialization removed a 'private' modifier on Actor.resumeActor.
Mixin did not mix this method in actor implementations, believing it was
private. At runtime, an AbstractMethodError was thrown, but swallowed by
forkjoin (probably), resulting in an apparent deadlock. It would have
been much faster to find and fix if the stacktrace was printed, as it is
in Java 1.5. No review. ........ r21557 | dragos | 2010-04-14 00:50:52
+0200 (Wed, 14 Apr 2010) | 1 line
Don't decode symbols in .toString.
........
r21558 | dragos | 2010-04-14 00:51:04 +0200 (Wed, 14 Apr 2010) | 4 lines
Made the icode reader more resilient to errors. A non-resolved symbol
does not cause any crashes, but the method using an unknown symbol will
not be used for inlining. Resurrected tests, removed spec-matrix for the
moment. No review. ........ r21559 | dragos | 2010-04-14 00:52:56 +0200
(Wed, 14 Apr 2010) | 2 lines
Revert "Fix for #3284. This code should probably be refactored,". It
breaks test test/files/run/json.scala, and we need at least one good
nightly before the RC. ........ r21560 | odersky | 2010-04-14 00:54:25
+0200 (Wed, 14 Apr 2010) | 2 lines
Disabled failing json test.
........
Diffstat (limited to 'test/disabled/run')
-rw-r--r-- | test/disabled/run/Course-2002-10-msil.check | 46 | ||||
-rw-r--r-- | test/disabled/run/Course-2002-10.check | 46 | ||||
-rw-r--r-- | test/disabled/run/Course-2002-10.scala | 135 | ||||
-rw-r--r-- | test/disabled/run/Course-2002-13.check | 14 | ||||
-rw-r--r-- | test/disabled/run/Course-2002-13.scala | 323 | ||||
-rw-r--r-- | test/disabled/run/spec-matrix.check | 1 | ||||
-rw-r--r-- | test/disabled/run/spec-matrix.scala | 70 | ||||
-rw-r--r-- | test/disabled/run/streamWithFilter.check | 5 | ||||
-rw-r--r-- | test/disabled/run/streamWithFilter.scala | 11 |
9 files changed, 71 insertions, 580 deletions
diff --git a/test/disabled/run/Course-2002-10-msil.check b/test/disabled/run/Course-2002-10-msil.check deleted file mode 100644 index bbd9414370..0000000000 --- a/test/disabled/run/Course-2002-10-msil.check +++ /dev/null @@ -1,46 +0,0 @@ -fib(0) = 0 -fib(1) = 1 -fib(2) = 1 -fib(3) = 2 -fib(4) = 3 -fib(5) = 5 -fib(6) = 8 -fib(7) = 13 -fib(8) = 21 -fib(9) = 34 -fib(10) = 55 -fib(11) = 89 -fib(12) = 144 -fib(13) = 233 -fib(14) = 377 -fib(15) = 610 -fib(16) = 987 -fib(17) = 1597 -fib(18) = 2584 -fib(19) = 4181 - -pi(0) = 4 , 3.16666666666667 , 4 -pi(1) = 2.66666666666667 , 3.13333333333333 , 3.16666666666667 -pi(2) = 3.46666666666667 , 3.1452380952381 , 3.1421052631579 -pi(3) = 2.8952380952381 , 3.13968253968254 , 3.141599357319 -pi(4) = 3.33968253968254 , 3.14271284271284 , 3.14159271403378 -pi(5) = 2.97604617604618 , 3.14088134088134 , 3.14159265397529 -pi(6) = 3.28373848373848 , 3.14207181707182 , 3.14159265359118 -pi(7) = 3.01707181707182 , 3.14125482360776 , 3.14159265358978 -pi(8) = 3.25236593471888 , 3.1418396189294 , 3.14159265358979 -pi(9) = 3.0418396189294 , 3.1414067184965 , 3.14159265358979 -pi = 3.14159265358979 , 3.14159265358979 , 3.14159265358979 - -ln(0) = 1 , 0.7 , 1 -ln(1) = 0.5 , 0.69047619047619 , 0.7 -ln(2) = 0.833333333333333 , 0.694444444444444 , 0.69327731092437 -ln(3) = 0.583333333333333 , 0.692424242424242 , 0.693148869332925 -ln(4) = 0.783333333333333 , 0.693589743589744 , 0.693147196073549 -ln(5) = 0.616666666666667 , 0.692857142857143 , 0.693147180663564 -ln(6) = 0.759523809523809 , 0.693347338935574 , 0.693147180560404 -ln(7) = 0.634523809523809 , 0.693003341687552 , 0.693147180559944 -ln(8) = 0.745634920634921 , 0.693253968253968 , 0.693147180559943 -ln(9) = 0.645634920634921 , 0.693065750674446 , 0.693147180559945 -ln = 0.693147180559945 , 0.693147180559945 , 0.693147180559945 - -prime numbers: 2 3 5 7 11 13 17 19 23 29 31 37 41 43 47 53 59 61 67 71 73 79 83 89 97 101 103 107 109 113 diff --git a/test/disabled/run/Course-2002-10.check b/test/disabled/run/Course-2002-10.check deleted file mode 100644 index 207b671f05..0000000000 --- a/test/disabled/run/Course-2002-10.check +++ /dev/null @@ -1,46 +0,0 @@ -fib(0) = 0 -fib(1) = 1 -fib(2) = 1 -fib(3) = 2 -fib(4) = 3 -fib(5) = 5 -fib(6) = 8 -fib(7) = 13 -fib(8) = 21 -fib(9) = 34 -fib(10) = 55 -fib(11) = 89 -fib(12) = 144 -fib(13) = 233 -fib(14) = 377 -fib(15) = 610 -fib(16) = 987 -fib(17) = 1597 -fib(18) = 2584 -fib(19) = 4181 - -pi(0) = 4.0 , 3.166666666666667 , 4.0 -pi(1) = 2.666666666666667 , 3.1333333333333337, 3.166666666666667 -pi(2) = 3.466666666666667 , 3.1452380952380956, 3.142105263157895 -pi(3) = 2.8952380952380956, 3.1396825396825396, 3.1415993573190044 -pi(4) = 3.33968253968254 , 3.142712842712843 , 3.141592714033778 -pi(5) = 2.976046176046176 , 3.140881340881341 , 3.1415926539752923 -pi(6) = 3.283738483738484 , 3.142071817071817 , 3.141592653591176 -pi(7) = 3.017071817071817 , 3.1412548236077646, 3.141592653589777 -pi(8) = 3.252365934718876 , 3.1418396189294024, 3.141592653589794 -pi(9) = 3.0418396189294024, 3.141406718496502 , 3.1415926535897936 -pi = 3.141592653589793 , 3.141592653589793 , 3.141592653589793 - -ln(0) = 1.0 , 0.7 , 1.0 -ln(1) = 0.5 , 0.6904761904761905, 0.7 -ln(2) = 0.8333333333333333, 0.6944444444444444, 0.6932773109243697 -ln(3) = 0.5833333333333333, 0.6924242424242424, 0.6931488693329254 -ln(4) = 0.7833333333333333, 0.6935897435897436, 0.6931471960735491 -ln(5) = 0.6166666666666667, 0.6928571428571428, 0.6931471806635636 -ln(6) = 0.7595238095238095, 0.6933473389355742, 0.6931471805604038 -ln(7) = 0.6345238095238095, 0.6930033416875522, 0.6931471805599444 -ln(8) = 0.7456349206349207, 0.6932539682539682, 0.6931471805599426 -ln(9) = 0.6456349206349206, 0.6930657506744463, 0.6931471805599453 -ln = 0.6931471805599453, 0.6931471805599453, 0.6931471805599453 - -prime numbers: 2 3 5 7 11 13 17 19 23 29 31 37 41 43 47 53 59 61 67 71 73 79 83 89 97 101 103 107 109 113 diff --git a/test/disabled/run/Course-2002-10.scala b/test/disabled/run/Course-2002-10.scala deleted file mode 100644 index e978bc8258..0000000000 --- a/test/disabled/run/Course-2002-10.scala +++ /dev/null @@ -1,135 +0,0 @@ -//############################################################################ -// Programmation IV - 2002 - Week 10 -//############################################################################ - -import Math.{Pi, log} - -object M0 { - - def addStream (s1: Stream[Int], s2: Stream[Int]): Stream[Int] = - Stream.cons(s1.head + s2.head, addStream(s1.tail, s2.tail)); - - val fib: Stream[Int] = - Stream.cons(0, Stream.cons(1, addStream(this.fib, this.fib.tail))); - - def test = { - var i = 0; - fib.take(20).foreach(n => {Console.println("fib("+i+") = "+n); i=i+1}); - Console.println; - } -} - -//############################################################################ - -object M1 { - - def scale(x: Double, s: Stream[Double]): Stream[Double] = - s map { e: Double => e*x } - - def partialSums(s: Stream[Double]): Stream[Double] = - Stream.cons(s.head, partialSums(s.tail) map (x => x + s.head)); - - def euler(s: Stream[Double]): Stream[Double] = { - val nm1 = s apply 0; - val n = s apply 1; - val np1 = s apply 2; - Stream.cons(np1 - ((np1 - n)*(np1 - n) / (nm1 - 2*n + np1)),euler(s.tail)) - }; - - def better(s: Stream[Double], transform: Stream[Double] => Stream[Double]) - : Stream[Stream[Double]] = - Stream.cons(s, better(transform(s), transform)); - - def veryGood(s: Stream[Double], transform: Stream[Double] => Stream[Double]) - : Stream[Double] = - better(s, transform) map (x => x.head); - - def lnSummands(n: Double): Stream[Double] = - Stream.cons(1.0 / n, lnSummands(n + 1.0) map { x: Double => -x }) - - var ln0 = partialSums(lnSummands(1.0)); - var ln1 = euler(ln0); - var ln2 = veryGood(ln0, euler); - - def piSummands(n: Double): Stream[Double] = - Stream.cons(1.0 / n, piSummands(n + 2.0) map { x: Double => -x }) - - var pi0 = scale(4.0, partialSums(piSummands(1.0))); - var pi1 = euler(pi0); - var pi2 = veryGood(pi0, euler); - - def pad(s: String, n: Int): String = - if (n <= 0) s.substring(0, s.length() + n) - else pad(s + " ", n - 1); - def str(d: Double) = { val s = d.toString(); pad(s, 18 - s.length()) }; - - def test = { - var i = 0; - while (i < 10) { - Console.print("pi("+i+") = "); - Console.print(str(pi0.apply(i)) + ", "); - Console.print(str(pi1.apply(i)) + ", "); - Console.print(str(pi2.apply(i)) + "\n"); - i = i + 1; - } - Console.print("pi = "); - Console.print(str(Pi) + ", "); - Console.print(str(Pi) + ", "); - Console.print(str(Pi) + "\n"); - Console.println; - i = 0; - while (i < 10) { - Console.print("ln("+i+") = "); - Console.print(str(ln0.apply(i)) + ", "); - Console.print(str(ln1.apply(i)) + ", "); - Console.print(str(ln2.apply(i)) + "\n"); - i = i + 1; - } - Console.print("ln = "); - Console.print(str(log(2)) + ", "); - Console.print(str(log(2)) + ", "); - Console.print(str(log(2)) + "\n"); - Console.println; - } -} - -//############################################################################ - -object M2 { - - class IntIterator(start: Int) extends Iterator[Int] { - var current: Int = start; - def hasNext = true; - def next = { current = current + 1; current - 1 }; - } - - class PrimeIterator() extends Iterator[Int] { - var current: Iterator[Int] = new IntIterator(2); - def hasNext = true; - def next = { - val p = current.next; - current = current filter { x => !((x % p) == 0) }; - p - } - } - - def test = { - val i = (new PrimeIterator()).take(30); - Console.print("prime numbers:"); - while (i.hasNext) { Console.print(" " + i.next); } - Console.println; - } -} - -//############################################################################ - -object Test { - def main(args: Array[String]): Unit = { - M0.test; - M1.test; - M2.test; - () - } -} - -//############################################################################ diff --git a/test/disabled/run/Course-2002-13.check b/test/disabled/run/Course-2002-13.check deleted file mode 100644 index 7664f70576..0000000000 --- a/test/disabled/run/Course-2002-13.check +++ /dev/null @@ -1,14 +0,0 @@ -List(S = jean, V = mange, A = le, D = grand, N = table) -List(S = jean, V = mange, A = le, D = grand, N = cheval) - -List(S = jean, V = mange, A = le, D = grand, N = cheval) -List(S = jean, V = mange, A = la, D = belle, N = table) - -List(S = jean, V = mange, A = le, D = nil, N = cheval) -List(S = jean, V = mange, A = le, D = cons(grand,nil), N = cheval) -List(S = jean, V = mange, A = le, D = cons(grand,cons(grand,nil)), N = cheval) -List(S = jean, V = mange, A = la, D = nil, N = table) -yes -yes -no - diff --git a/test/disabled/run/Course-2002-13.scala b/test/disabled/run/Course-2002-13.scala deleted file mode 100644 index c016d41a90..0000000000 --- a/test/disabled/run/Course-2002-13.scala +++ /dev/null @@ -1,323 +0,0 @@ -//############################################################################ -// Programmation IV - 2002 - Week 13 -//############################################################################ - -class Tokenizer(s: String, delimiters: String) extends Iterator[String] { - - private var i = 0; - - def isDelimiter(ch: Char) = { - var i = 0; - while (i < delimiters.length() && delimiters.charAt(i) != ch) { i = i + 1 } - i < delimiters.length() - } - - def hasNext: Boolean = { - while (i < s.length() && s.charAt(i) <= ' ') { i = i + 1 } - i < s.length() - } - - def next: String = - if (hasNext) { - val start = i; - var ch = s.charAt(i); i = i + 1; - if (isDelimiter(ch)) ch.toString() - else { - while (i < s.length() && - s.charAt(i) > ' ' && - !isDelimiter(s.charAt(i))){ i = i + 1 } - s.substring(start, i) - } - } else ""; - -} - -object Terms { - - val debug = false; - - trait Term { - def map(s: Subst): Term; - def tyvars: List[String]; - } - - case class Binding(name: String, term: Term) { - term match { case Var(n) if (name == n) => error("bad binding") case _ => () } - override def toString() = name + " = " + term; - } - - type Subst = List[Binding]; - - def lookup(s: Subst, name: String): Option[Term] = s match { - case List() => None - case b :: s1 => if (name == b.name) Some(b.term) else lookup(s1, name) - } - - case class Var(a: String) extends Term { - override def toString() = a; - def map(s: Subst): Term = lookup(s, a) match { - case Some(b) => b map s - case None => this; - } - def tyvars = List(a); - } - - case class Con(a: String, ts: List[Term]) extends Term { - override def toString() = - a + (if (ts.isEmpty) "" else ts.mkString("(", ",", ")")); - def map(s: Subst): Term = Con(a, ts map (t => t map s)); - def tyvars = (ts flatMap (t => t.tyvars)).distinct; - } - - private var count = 0; - def newVar(prefix: String) = { count = count + 1; Var(prefix + count) } - - val NoTerm = Con("<none>", List()); - - def unify1(x: Term, y: Term, s: Subst): Option[Subst] = Pair(x, y) match { - case Pair(Var(a), Var(b)) if (a == b) => - Some(s) - case Pair(Var(a), _) => lookup(s, a) match { - case Some(x1) => unify(x1, y, s) - case None => if (y.tyvars contains a) None else Some(Binding(a, y) :: s) - } - case Pair(_, Var(b)) => lookup(s, b) match { - case Some(y1) => unify(x, y1, s) - case None => if (x.tyvars contains b) None else Some(Binding(b, x) :: s) - } - case Pair(Con(a, xs), Con(b, ys)) if (a == b) => - unify(xs, ys, s) - case _ => None - } - - def unify(x: Term, y: Term, s: Subst): Option[Subst] = { - val ss = unify1(x, y, s); - if (debug) Console.println("unify " + x + " with " + y + " = " + ss); - ss - } - - def unify(xs: List[Term], ys: List[Term], s: Subst): Option[Subst] = Pair(xs, ys) match { - case Pair(List(), List()) => Some(s) - case Pair(x :: xs1, y :: ys1) => - unify(x, y, s) match { - case Some(s1) => unify(xs1, ys1, s1) - case None => None - } - case _ => None - } -} - -import Terms._; - -object Programs { - - case class Clause(lhs: Term, rhs: List[Term]) { - def tyvars = - (lhs.tyvars ::: (rhs flatMap (t => t.tyvars))).distinct; - def newInstance = { - var s: Subst = List(); - for (val a <- tyvars) { s = Binding(a, newVar(a)) :: s } - Clause(lhs map s, rhs map (t => t map s)) - } - override def toString() = - lhs.toString() + " :- " + rhs.mkString("", ",", "") + "."; - } - - def list2stream[a](xs: List[a]): Stream[a] = xs match { - case List() => Stream.empty - case x :: xs1 => Stream.cons(x, list2stream(xs1)) - } - def option2stream[a](xo: Option[a]): Stream[a] = xo match { - case None => Stream.empty - case Some(x) => Stream.cons(x, Stream.empty) - } - - def solve(query: List[Term], clauses: List[Clause]): Stream[Subst] = { - - def solve2(query: List[Term], s: Subst): Stream[Subst] = query match { - case List() => - Stream.cons(s, Stream.empty) - case Con("not", qs) :: query1 => - if (solve1(qs, s).isEmpty) Stream.cons(s, Stream.empty) - else Stream.empty - case q :: query1 => - for (val clause <- list2stream(clauses); - val s1 <- tryClause(clause.newInstance, q, s); - val s2 <- solve1(query1, s1)) yield s2 - } - - def solve1(query: List[Term], s: Subst): Stream[Subst] = { - val ss = solve2(query, s); - if (debug) Console.println("solved " + query + " = " + ss); - ss - } - - def tryClause(c: Clause, q: Term, s: Subst): Stream[Subst] = { - if (debug) Console.println("trying " + c); - for (val s1 <- option2stream(unify(q, c.lhs, s)); - val s2 <- solve1(c.rhs, s1)) yield s2; - } - - solve1(query, List()) - } -} - -import Programs._; - -class Parser(s: String) { - val it = new Tokenizer(s, "(),.?"); - - var token: String = it.next; - - def syntaxError(msg: String): Unit = error(msg + ", but " + token + " found"); - - def rep[a](p: => a): List[a] = { - val t = p; - if (token == ",") { token = it.next; t :: rep(p) } else List(t) - } - - def constructor: Term = { - val a = token; - token = it.next; - Con(a, - if (token equals "(") { - token = it.next; - val ts: List[Term] = if (token equals ")") List() else rep(term); - if (token equals ")") token = it.next else syntaxError("`)' expected"); - ts - } else List()) - } - - def term: Term = { - val ch = token.charAt(0); - if ('A' <= ch && ch <= 'Z') { val a = token; token = it.next; Var(a) } - else if (it.isDelimiter(ch)) { syntaxError("term expected"); null } - else constructor - } - - def line: Clause = { - val result = - if (token equals "?") { - token = it.next; - Clause(NoTerm, rep(constructor)); - } else { - Clause( - constructor, - if (token equals ":-") { token = it.next; rep(constructor) } else List()) - } - if (token equals ".") token = it.next else syntaxError("`.' expected"); - result - } - - def all: List[Clause] = if (token equals "") List() else line :: all; -} - -object Prolog { - - def processor: String => Unit = { - var program: List[Clause] = List(); - var solutions: Stream[Subst] = Stream.empty; - var tvs: List[String] = List(); - { input => - new Parser(input).all foreach { c => - if (c.lhs == NoTerm) { - c.rhs match { - case List(Con("more", List())) => - solutions = solutions.tail; - case _ => - solutions = solve(c.rhs, program); - tvs = c.tyvars; - } - if (solutions.isEmpty) { - Console.println("no") - } else { - val s: Subst = solutions.head - .filter(b => tvs contains b.name) - .map(b => Binding(b.name, b.term map solutions.head)) - .reverse; - if (s.isEmpty) Console.println("yes") - else Console.println(s); - } - } else { - program = program ::: List(c); - } - } - } - } - - def process(code: String) = processor(code); -} - -//############################################################################ - -object Test { - def main(args: Array[String]): Unit = { - Prolog.process( - "sujet(jean).\n" + - "sujet(marie).\n" + - "verbe(mange).\n" + - "verbe(dort).\n" + - "article(le).\n" + - "article(la).\n" + - "adjectif(grand).\n" + - "adjectif(belle).\n" + - "nom(table).\n" + - "nom(cheval).\n" + - - "complement(A,D,N) :- article(A), adjectif(D), nom(N).\n" + - "phrase(S,V,A,D,N) :- sujet(S), verbe(V), complement(A,D,N).\n" + - - "?phrase(S,V,A,D,N).\n" + "?more.\n" - ); - Console.println; - - Prolog.process( - "sujet(jean).\n" + - "sujet(marie).\n" + - "verbe(mange).\n" + - "verbe(dort).\n" + - "article(le,m).\n" + - "article(la,f).\n" + - "adjectif(grand,m).\n" + - "adjectif(belle,f).\n" + - "nom(table,f).\n" + - "nom(cheval,m).\n" + - - "complement(A,D,N) :- article(A,G), adjectif(D,G), nom(N,G).\n" + - "phrase(S,V,A,D,N) :- sujet(S), verbe(V), complement(A,D,N).\n" + - - "?phrase(S,V,A,D,N).\n" + "?more.\n" - ); - Console.println; - - Prolog.process( - "sujet(jean).\n" + - "sujet(marie).\n" + - "verbe(mange).\n" + - "verbe(dort).\n" + - "article(le,m).\n" + - "article(la,f).\n" + - "adjectif(grand,m).\n" + - "adjectif(belle,f).\n" + - "nom(table,f).\n" + - "nom(cheval,m).\n" + - - "adjectifs(nil,G).\n" + - "adjectifs(cons(A1,nil),G) :- adjectif(A1,G).\n" + - "adjectifs(cons(A1,cons(A2,nil)),G) :- adjectif(A1,G),adjectif(A2,G).\n"+ - "complement(A,D,N) :- article(A,G), adjectifs(D,G), nom(N,G).\n" + - "phrase(S,V,A,D,N) :- sujet(S), verbe(V), complement(A,D,N).\n" + - - "?phrase(S,V,A,D,N).\n" + "?more.\n" + "?more.\n" + "?more.\n" + - - "?phrase(jean,mange,le,nil,cheval).\n" + - "?phrase(jean,mange,le,cons(grand,nil),cheval).\n" + - "?phrase(jean,mange,le,cons(grand,nil),table).\n" - ); - Console.println; - - () - } -} - -//############################################################################ diff --git a/test/disabled/run/spec-matrix.check b/test/disabled/run/spec-matrix.check new file mode 100644 index 0000000000..72e8ffc0db --- /dev/null +++ b/test/disabled/run/spec-matrix.check @@ -0,0 +1 @@ +* diff --git a/test/disabled/run/spec-matrix.scala b/test/disabled/run/spec-matrix.scala new file mode 100644 index 0000000000..81e3eaf212 --- /dev/null +++ b/test/disabled/run/spec-matrix.scala @@ -0,0 +1,70 @@ +/** Test matrix multiplication with specialization. + */ + +class Matrix[@specialized A: ClassManifest](val rows: Int, val cols: Int) { + private val arr: Array[Array[A]] = new Array[Array[A]](rows, cols) + + def apply(i: Int, j: Int): A = { + if (i < 0 || i >= rows || j < 0 || j >= cols) + throw new NoSuchElementException("Indexes out of bounds: " + (i, j)) + + arr(i)(j) + } + + def update(i: Int, j: Int, e: A) { + arr(i)(j) = e + } + + def rowsIterator: Iterator[Array[A]] = new Iterator[Array[A]] { + var idx = 0; + def hasNext = idx < rows + def next = { + idx += 1 + arr(idx - 1) + } + } +} + +object Test { + def main(args: Array[String]) { + val m = randomMatrix(200, 100) + val n = randomMatrix(100, 200) + + mult(m, n) + println("*") + } + + def randomMatrix(n: Int, m: Int) = { + val r = new util.Random(10) + val x = new Matrix[Int](n, m) + for (i <- 0 until n; j <- 0 until m) + x(i, j) = r.nextInt + x + } + + + def multManifest[@specialized(Int) T](m: Matrix[T], n: Matrix[T])(implicit cm: ClassManifest[T], num: Numeric[T]) { + val p = new Matrix[T](m.rows, n.cols) + import num._ + + for (i <- 0 until m.rows) + for (j <- 0 until n.cols) { + var sum = num.zero + for (k <- 0 until n.rows) + sum += m(i, k) * n(k, j) + p(i, j) = sum + } + } + + def mult(m: Matrix[Int], n: Matrix[Int]) { + val p = new Matrix[Int](m.rows, n.cols) + + for (i <- 0 until m.rows) + for (j <- 0 until n.cols) { + var sum = 0 + for (k <- 0 until n.rows) + sum += m(i, k) * n(k, j) + p(i, j) = sum + } + } +} diff --git a/test/disabled/run/streamWithFilter.check b/test/disabled/run/streamWithFilter.check deleted file mode 100644 index 6b0e91a147..0000000000 --- a/test/disabled/run/streamWithFilter.check +++ /dev/null @@ -1,5 +0,0 @@ -15 -30 -45 -60 -75 diff --git a/test/disabled/run/streamWithFilter.scala b/test/disabled/run/streamWithFilter.scala deleted file mode 100644 index cb919d4f55..0000000000 --- a/test/disabled/run/streamWithFilter.scala +++ /dev/null @@ -1,11 +0,0 @@ -object Test { - val nums = Stream.from(1) - def isFizz(x: Int) = x % 3 == 0 - def isBuzz(x: Int) = x % 5 == 0 - // next line will run forever if withFilter isn't doing its thing. - val fizzbuzzes = for (n <- nums ; if isFizz(n) ; if isBuzz(n)) yield n - - def main(args: Array[String]): Unit = { - fizzbuzzes take 5 foreach println - } -} |