summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormichelou <michelou@epfl.ch>2008-06-10 10:27:45 +0000
committermichelou <michelou@epfl.ch>2008-06-10 10:27:45 +0000
commit0dabdc7b17a02f1d36a99cd21acfdc0b2498f951 (patch)
tree05e7999dc39a0faf11ca743d7314b178a9823026
parent943f6dda3b32057a3d9e91c68baac8971d94e567 (diff)
downloadscala-0dabdc7b17a02f1d36a99cd21acfdc0b2498f951.tar.gz
scala-0dabdc7b17a02f1d36a99cd21acfdc0b2498f951.tar.bz2
scala-0dabdc7b17a02f1d36a99cd21acfdc0b2498f951.zip
int -> Int, etc..
-rw-r--r--test/files/pos/MailBox.scala6
-rw-r--r--test/files/pos/bug0030.scala8
-rw-r--r--test/files/pos/bug430.scala6
-rw-r--r--test/files/pos/bug602.scala7
-rw-r--r--test/files/pos/bug611.scala4
-rw-r--r--test/files/pos/bug796.scala6
-rw-r--r--test/files/pos/gadts2.scala37
-rw-r--r--test/files/pos/gui.scala64
-rw-r--r--test/files/pos/scoping1.scala14
-rw-r--r--test/files/pos/t0786.scala38
-rw-r--r--test/files/pos/thistype.scala7
-rw-r--r--test/files/run/Course-2002-13.scala2
-rwxr-xr-xtest/files/run/bug1220.scala9
-rw-r--r--test/files/run/colltest.scala12
14 files changed, 111 insertions, 109 deletions
diff --git a/test/files/pos/MailBox.scala b/test/files/pos/MailBox.scala
index b1ea818f60..67b923ea3e 100644
--- a/test/files/pos/MailBox.scala
+++ b/test/files/pos/MailBox.scala
@@ -16,7 +16,7 @@ class MailBox {
}
private abstract class Receiver {
- def isDefined(msg: Any): boolean;
+ def isDefined(msg: Any): Boolean;
var msg: Any = null;
}
@@ -25,7 +25,7 @@ class MailBox {
private val receivers = new LinkedList[Receiver];
private var lastReceiver = receivers;
- def send(msg: Any): unit = synchronized {
+ def send(msg: Any): Unit = synchronized {
var r = receivers;
var r1 = r.next;
while (r1 != null && !r1.elem.isDefined(msg)) {
@@ -59,7 +59,7 @@ class MailBox {
f(msg)
}
- def receiveWithin[a](msec: long)(f: PartialFunction[Any, a]): a = {
+ def receiveWithin[a](msec: Long)(f: PartialFunction[Any, a]): a = {
val msg: Any = synchronized {
var s = sent;
var s1 = s.next;
diff --git a/test/files/pos/bug0030.scala b/test/files/pos/bug0030.scala
index 6d28e18c0d..2f23be14d9 100644
--- a/test/files/pos/bug0030.scala
+++ b/test/files/pos/bug0030.scala
@@ -1,9 +1,9 @@
trait A {
- def f(x: int): unit;
- def f(x: String): unit;
+ def f(x: Int): Unit;
+ def f(x: String): Unit;
}
class B extends A {
- def f(x: int): unit = ();
- def f(x: String): unit = ();
+ def f(x: Int): Unit = ();
+ def f(x: String): Unit = ();
}
diff --git a/test/files/pos/bug430.scala b/test/files/pos/bug430.scala
index 7e3e7eaaec..1f7d86b1c8 100644
--- a/test/files/pos/bug430.scala
+++ b/test/files/pos/bug430.scala
@@ -1,5 +1,5 @@
object Test extends Application {
- def foo[T <% Ordered[T]](x: T): Unit = System.out.println(""+(x < x)+" "+(x <= x))
+ def foo[T <% Ordered[T]](x: T){ Console.println(""+(x < x)+" "+(x <= x)) }
def bar(x: Unit ): Unit = foo(x);
def bar(x: Boolean): Unit = foo(x);
def bar(x: Byte ): Unit = foo(x);
@@ -10,8 +10,8 @@ object Test extends Application {
def bar(x: Double ): Unit = foo(x);
bar(())
bar(true)
- bar(1: byte)
- bar(1: short)
+ bar(1: Byte)
+ bar(1: Short)
bar('a')
bar(1)
bar(1l)
diff --git a/test/files/pos/bug602.scala b/test/files/pos/bug602.scala
index 5877d08ddc..18dd405645 100644
--- a/test/files/pos/bug602.scala
+++ b/test/files/pos/bug602.scala
@@ -1,15 +1,14 @@
-package com.mosol.sl;
+package com.mosol.sl
-case class Span[K <: Ordered[K]](low: Option[K], high: Option[K]) extends Function1[K, boolean] {
+case class Span[K <: Ordered[K]](low: Option[K], high: Option[K]) extends Function1[K, Boolean] {
override def equals(x$1: Any): Boolean = x$1 match {
case Span((low$0 @ _), (high$0 @ _)) if low$0.equals(low).$amp$amp(high$0.equals(high)) => true
case _ => false
}
- def apply(k: K): boolean = this match {
+ def apply(k: K): Boolean = this match {
case Span(Some(low), Some(high)) => (k >= low && k <= high)
case Span(Some(low), None) => (k >= low)
case Span(None, Some(high)) => (k <= high)
case _ => false
}
}
-
diff --git a/test/files/pos/bug611.scala b/test/files/pos/bug611.scala
index eb1a5c19c2..5ef01e4ca1 100644
--- a/test/files/pos/bug611.scala
+++ b/test/files/pos/bug611.scala
@@ -6,8 +6,8 @@ abstract class Field {
var internalValue: FieldType;
}
-case class IntField(value: int) extends Field {
- type FieldType = int;
+case class IntField(value: Int) extends Field {
+ type FieldType = Int;
var internalValue: FieldType = value;
}
diff --git a/test/files/pos/bug796.scala b/test/files/pos/bug796.scala
index 756c103e7c..dfd312ec67 100644
--- a/test/files/pos/bug796.scala
+++ b/test/files/pos/bug796.scala
@@ -9,13 +9,13 @@
object Test extends Application {
object Twice {
- def apply(x: int) = x * 2
- def unapply(x: int): Option[Tuple1[int]] =
+ def apply(x: Int) = x * 2
+ def unapply(x: Int): Option[Tuple1[int]] =
if (x % 2 == 0) Some(Tuple1(x / 2))
else None
}
- def test(x: int) = x match {
+ def test(x: Int) = x match {
case Twice(y) => "x is two times "+y
case _ => "x is odd"
}
diff --git a/test/files/pos/gadts2.scala b/test/files/pos/gadts2.scala
index ca905c572a..fc2a7e4333 100644
--- a/test/files/pos/gadts2.scala
+++ b/test/files/pos/gadts2.scala
@@ -1,26 +1,25 @@
-object Test{
+object Test {
-abstract class Number
-case class Int(n: int) extends Number
-case class Double(d: double) extends Number
+ abstract class Number
+ case class MyInt(n: Int) extends Number
+ case class MyDouble(d: Double) extends Number
-trait Term[+a]
-case class Cell[a](var x: a) extends Term[a]
-final case class NumTerm(val n: Number) extends Term[Number]
+ trait Term[+a]
+ case class Cell[a](var x: a) extends Term[a]
+ final case class NumTerm(val n: Number) extends Term[Number]
-
-def f[a](t:Term[a], c:Cell[a]): unit =
- t match {
- case NumTerm(n) => c.x = Double(1.0)
+ def f[a](t: Term[a], c: Cell[a]) {
+ t match {
+ case NumTerm(n) => c.x = MyDouble(1.0)
+ }
}
+ val x: Term[Number] = NumTerm(MyInt(5))
-val x:Term[Number] = NumTerm(Int(5))
-
-def main(args: Array[String]): unit = {
- val cell = Cell[Number](Int(6))
- Console.println(cell)
- f[Number](new NumTerm(Int(5)), cell)
- Console.println(cell)
-}
+ def main(args: Array[String]) {
+ val cell = Cell[Number](MyInt(6))
+ Console.println(cell)
+ f[Number](new NumTerm(MyInt(5)), cell)
+ Console.println(cell)
+ }
}
diff --git a/test/files/pos/gui.scala b/test/files/pos/gui.scala
index 54ecbfa719..9d87d1b869 100644
--- a/test/files/pos/gui.scala
+++ b/test/files/pos/gui.scala
@@ -1,29 +1,31 @@
object Geom {
- trait Shape;
- case class Point(x: int, y: int) extends Shape;
+ trait Shape
+ case class Point(x: Int, y: Int) extends Shape
case class Rectangle(ll: Point, ur: Point) extends Shape {
- def inset(delta: int) =
+ def inset(delta: Int) =
Rectangle(Point(ll.x - delta, ll.y - delta), Point(ur.x + delta, ur.y + delta));
}
}
object Color {
- type Color = int;
- val black = 0x000000;
- val grey = 0x808080;
+ type Color = Int
+ val black = 0x000000
+ val grey = 0x808080
}
trait Screen {
- type Color = int;
- def drawRect(r: Geom.Rectangle, c: Color): unit;
- def fillRect(r: Geom.Rectangle, c: Color): unit;
+ type Color = Int
+ def drawRect(r: Geom.Rectangle, c: Color): Unit
+ def fillRect(r: Geom.Rectangle, c: Color): Unit
}
object DummyScreen extends Screen {
- def drawRect(r: Geom.Rectangle, c: Color): unit =
- Console.println("draw " + r + " with " + c);
- def fillRect(r: Geom.Rectangle, c: Color): unit =
- Console.println("fill " + r + " with " + c);
+ def drawRect(r: Geom.Rectangle, c: Color) {
+ Console.println("draw " + r + " with " + c)
+ }
+ def fillRect(r: Geom.Rectangle, c: Color) {
+ Console.println("fill " + r + " with " + c)
+ }
}
object GUI {
@@ -33,33 +35,33 @@ object GUI {
}
trait Glyph {
- def getRect: Geom.Rectangle;
- def setLoc(p: Geom.Point): unit;
- def draw() = Console.println("draw " + this);
+ def getRect: Geom.Rectangle
+ def setLoc(p: Geom.Point): Unit
+ def draw() { Console.println("draw " + this) }
}
class Label(scr: Screen, p: Geom.Point, name: String) extends Glyph {
- private var origin = p;
+ private var origin = p
def getRect = Geom.Rectangle(origin, origin).inset(10);
def setLoc(p: Geom.Point) = { origin = p }
}
trait Ctl {
- def getGlyph: Glyph;
- def enable(b: Boolean): this.type;
+ def getGlyph: Glyph
+ def enable(b: Boolean): this.type
}
trait MouseCtl extends Ctl {
- def mouseDown(p: Geom.Point): unit;
+ def mouseDown(p: Geom.Point): Unit
}
abstract class Button(scr: Screen, p: Geom.Point, name: String)
extends Glyph with MouseCtl {
- var enabled: boolean = false;
- val label = new Label(scr, p, name);
+ var enabled: Boolean = false
+ val label = new Label(scr, p, name)
/* Glyph methods */
- override def draw(): unit = {
+ override def draw() {
if (enabled) scr.drawRect(getRect, Color.black)
else scr.fillRect(getRect, Color.grey);
label.draw();
@@ -68,28 +70,28 @@ object GUI {
def getRect = label.getRect.inset(-2);
/* Ctl methods */
- def enable(b: boolean): this.type = { enabled = b; draw(); this }
- def getGlyph = label;
- final def mouseDown(p: Geom.Point): unit =
+ def enable(b: Boolean): this.type = { enabled = b; draw(); this }
+ def getGlyph = label
+ final def mouseDown(p: Geom.Point) {
if (enabled) doit() else Console.println("button is disabled");
-
+ }
/* deferred method to be specified by client */
- def doit(): unit;
+ def doit(): Unit
}
}
object GUIClient {
class Application {
- def quit() = Console.println("application exited");
+ def quit() { Console.println("application exited") }
}
class QuitButton (scr: Screen, p: Geom.Point, name: String, a: Application)
extends GUI.Button(scr, p, name) {
- def doit(): unit = a.quit();
+ def doit() { a.quit() }
}
- def main(args: Array[String]) = {
+ def main(args: Array[String]) {
val b = new QuitButton(
DummyScreen, Geom.Point(1, 1), "quit", new Application);
b.draw();
diff --git a/test/files/pos/scoping1.scala b/test/files/pos/scoping1.scala
index c72df7fa8b..c9c0489e69 100644
--- a/test/files/pos/scoping1.scala
+++ b/test/files/pos/scoping1.scala
@@ -1,12 +1,12 @@
object This extends Application {
- trait A {
- def foo(): unit;
- }
- class C { self: A =>
- def bar() = this.foo();
- }
+ trait A {
+ def foo(): Unit
+ }
+ class C { self: A =>
+ def bar() = this.foo()
+ }
class D extends C with A {
def foo() = ()
}
- val c: C = new D;
+ val c: C = new D
}
diff --git a/test/files/pos/t0786.scala b/test/files/pos/t0786.scala
index d23cdb741b..f40cf7d2e1 100644
--- a/test/files/pos/t0786.scala
+++ b/test/files/pos/t0786.scala
@@ -1,29 +1,29 @@
object ImplicitProblem {
- class M[T]
+ class M[T]
- def nullval[T] = null.asInstanceOf[T];
+ def nullval[T] = null.asInstanceOf[T];
- trait Rep[T] {
- def eval: int
- }
+ trait Rep[T] {
+ def eval: Int
+ }
- implicit def toRep0(n: int) = new Rep[int] {
- def eval = 0
- }
+ implicit def toRep0(n: Int) = new Rep[Int] {
+ def eval = 0
+ }
- implicit def toRepN[T](n: M[T])(implicit f: T => Rep[T]) = new Rep[M[T]] {
- def eval = f(nullval[T]).eval + 1
- }
+ implicit def toRepN[T](n: M[T])(implicit f: T => Rep[T]) = new Rep[M[T]] {
+ def eval = f(nullval[T]).eval + 1
+ }
- def depth[T <% Rep[T]](n: T) = n.eval
+ def depth[T <% Rep[T]](n: T) = n.eval
- def main(args: Array[String]) {
- println(depth(nullval[M[int]])) // (1) this works
- println(nullval[M[int]].eval) // (2) this works
+ def main(args: Array[String]) {
+ println(depth(nullval[M[Int]])) // (1) this works
+ println(nullval[M[Int]].eval) // (2) this works
- type m = M[int]
- println(depth(nullval[m])) // (3) this doesn't compile on 2.7.RC1
- println(nullval[m].eval) // (4) this works
- }
+ type m = M[Int]
+ println(depth(nullval[m])) // (3) this doesn't compile on 2.7.RC1
+ println(nullval[m].eval) // (4) this works
+ }
}
diff --git a/test/files/pos/thistype.scala b/test/files/pos/thistype.scala
index c8f7ec9678..ac315f3323 100644
--- a/test/files/pos/thistype.scala
+++ b/test/files/pos/thistype.scala
@@ -5,10 +5,11 @@ object Test {
}
class MouseCtl extends Ctl {
- def mouseDown(x: int, y: int): unit = { Console.println("mouse down"); }
+ def mouseDown(x: Int, y: Int) { Console.println("mouse down") }
}
- def main(args: Array[String]) =
- new MouseCtl().enable.mouseDown(1, 2);
+ def main(args: Array[String]) {
+ new MouseCtl().enable.mouseDown(1, 2)
+ }
}
diff --git a/test/files/run/Course-2002-13.scala b/test/files/run/Course-2002-13.scala
index e98d8944a8..5b426be984 100644
--- a/test/files/run/Course-2002-13.scala
+++ b/test/files/run/Course-2002-13.scala
@@ -13,7 +13,7 @@ class Tokenizer(s: String, delimiters: String) extends Iterator[String] {
i < delimiters.length()
}
- def hasNext: boolean = {
+ def hasNext: Boolean = {
while (i < s.length() && s.charAt(i) <= ' ') { i = i + 1 }
i < s.length()
}
diff --git a/test/files/run/bug1220.scala b/test/files/run/bug1220.scala
index a992e5f2a5..88baa980f5 100755
--- a/test/files/run/bug1220.scala
+++ b/test/files/run/bug1220.scala
@@ -1,11 +1,12 @@
object Test extends Application {
- class QSRichIterable[A](self:Iterable[A]) {
- def filterMap[R](f: PartialFunction[A,R]) =
- self filter (f.isDefinedAt) map f
+
+ class QSRichIterable[A](self: Iterable[A]) {
+ def filterMap[R](f: PartialFunction[A,R]) =
+ self filter (f.isDefinedAt) map f
}
object Un {
- def unapply(i:int): Option[int] = Some(i)
+ def unapply(i: Int): Option[Int] = Some(i)
}
val richIter = new QSRichIterable(List(0, 1, 2, 3, 4))
diff --git a/test/files/run/colltest.scala b/test/files/run/colltest.scala
index 864753aca1..65c3676297 100644
--- a/test/files/run/colltest.scala
+++ b/test/files/run/colltest.scala
@@ -1,11 +1,11 @@
import collection.mutable._
-class TestSet(s0: Set[int], s1: Set[int]) {
+class TestSet(s0: Set[Int], s1: Set[Int]) {
val Iterations = 10
val Range = 100000
val testEachStep = false
val Threshold = 20000
val r = new java.util.Random(12345)
- def test(s: Set[int], n: int): Any = {
+ def test(s: Set[Int], n: Int): Any = {
val v = n >> 3
n & 7 match {
case 0 | 1 | 2 => s contains v
@@ -16,7 +16,7 @@ class TestSet(s0: Set[int], s1: Set[int]) {
case 7 => s.size
}
}
- def explain(n: int, s: Set[int]): String = n & 7 match {
+ def explain(n: Int, s: Set[Int]): String = n & 7 match {
case 0 | 1 | 2 => "contains"
case 3 => "add"
case 4 => "remove"
@@ -24,13 +24,13 @@ class TestSet(s0: Set[int], s1: Set[int]) {
case 6 => "add"
case 7 => "size"
}
- def checkSubSet(pre: String, s0: Set[int], s1: Set[int]) {
- for (val e <- s0.elements)
+ def checkSubSet(pre: String, s0: Set[Int], s1: Set[Int]) {
+ for (e <- s0.elements)
if (!(s1 contains e)) {
assert(false, pre+" element: "+e+"\n S0 = "+s0+"\n S1 = "+s1)
}
}
- for (val i <- 0 until Iterations) {
+ for (i <- 0 until Iterations) {
val n = r.nextInt(Range)
val res0 = test(s0, n)
val res1 = test(s1, n)