summaryrefslogtreecommitdiff
path: root/test/files/pos
diff options
context:
space:
mode:
Diffstat (limited to 'test/files/pos')
-rw-r--r--test/files/pos/bug267.scala26
-rw-r--r--test/files/pos/bug361.scala8
-rw-r--r--test/files/pos/bug767.scala24
-rw-r--r--test/files/pos/bug927.scala4
-rw-r--r--test/files/pos/code.scala2
-rw-r--r--test/files/pos/constfold.scala2
-rw-r--r--test/files/pos/gosh.scala62
-rw-r--r--test/files/pos/mixins.scala14
-rw-r--r--test/files/pos/traits.scala16
-rw-r--r--test/files/pos/unapply.scala10
10 files changed, 84 insertions, 84 deletions
diff --git a/test/files/pos/bug267.scala b/test/files/pos/bug267.scala
index 92282f77a2..d7eae9b8d6 100644
--- a/test/files/pos/bug267.scala
+++ b/test/files/pos/bug267.scala
@@ -1,4 +1,4 @@
-package expAbstractData;
+package expAbstractData
/** A base class consisting of
* - a root trait (i.e. abstract class) `Exp' with an `eval' function
@@ -6,29 +6,29 @@ package expAbstractData;
* - a concrete instance class `Num' of `Exp' for numeric literals
*/
trait Base {
- type exp <: Exp;
+ type exp <: Exp
trait Exp {
- def eval: int
+ def eval: Int
}
- class Num(v: int) extends Exp { self: exp =>
- val value = v;
+ class Num(v: Int) extends Exp { self: exp =>
+ val value = v
def eval = value
}
}
object testBase extends Application with Base {
- type exp = Exp;
+ type exp = Exp
val term = new Num(2);
- Console.println(term.eval);
+ Console.println(term.eval)
}
/** Data extension: An extension of `Base' with `Plus' expressions
*/
trait BasePlus extends Base {
class Plus(l: exp, r: exp) extends Exp { self: exp =>
- val left = l;
- val right = r;
+ val left = l
+ val right = r
def eval = left.eval + right.eval
}
}
@@ -36,13 +36,13 @@ trait BasePlus extends Base {
/** Operation extension: An extension of `Base' with 'show' methods.
*/
trait Show extends Base {
- type exp <: Exp1;
+ type exp <: Exp1
trait Exp1 extends Exp {
- def show: String;
+ def show: String
}
- class Num1(v: int) extends Num(v) with Exp1 { self: exp with Num1 =>
- def show = value.toString();
+ class Num1(v: Int) extends Num(v) with Exp1 { self: exp with Num1 =>
+ def show = value.toString()
}
}
diff --git a/test/files/pos/bug361.scala b/test/files/pos/bug361.scala
index 1e490c3812..f44fb32d47 100644
--- a/test/files/pos/bug361.scala
+++ b/test/files/pos/bug361.scala
@@ -1,18 +1,18 @@
// $Id$
-class Bug361Global extends Bug361Trees;
+class Bug361Global extends Bug361Trees
abstract class Bug361Trees { self: Bug361Global =>
abstract class Tree {
- var pos: int = 0;
+ var pos: Int = 0
}
object posAssigner {
- def atPos[T <: Tree](pos: int, tree: T): T = {
+ def atPos[T <: Tree](pos: Int, tree: T): T = {
tree.pos = pos; tree
}
}
- def atPos[T <: Tree](pos: int)(tree: T): T = posAssigner.atPos(pos, tree);
+ def atPos[T <: Tree](pos: Int)(tree: T): T = posAssigner.atPos(pos, tree)
}
diff --git a/test/files/pos/bug767.scala b/test/files/pos/bug767.scala
index 05dd97f556..0c4067f022 100644
--- a/test/files/pos/bug767.scala
+++ b/test/files/pos/bug767.scala
@@ -1,18 +1,18 @@
abstract class AbsCell {
- type T = Node
- val init: T
- private var value: T = init
- def get: T = value
- def set (x: T): unit = { value = x }
+ type T = Node
+ val init: T
+ private var value: T = init
+ def get: T = value
+ def set (x: T) { value = x }
- class Node {
- val foo = 1
- }
+ class Node {
+ val foo = 1
+ }
}
object inner {
- def main(args: Array[String]): Unit = {
- val cell = new AbsCell { val init = new Node() }
- cell.set(new cell.type#T()) // nullpointer exception
- }
+ def main(args: Array[String]) {
+ val cell = new AbsCell { val init = new Node() }
+ cell.set(new cell.type#T()) // nullpointer exception
+ }
}
diff --git a/test/files/pos/bug927.scala b/test/files/pos/bug927.scala
index 6ab932e23b..1a906cd9bc 100644
--- a/test/files/pos/bug927.scala
+++ b/test/files/pos/bug927.scala
@@ -1,11 +1,11 @@
object Test {
- def sum(stream: Stream[int]): int =
+ def sum(stream: Stream[Int]): Int =
stream match {
case Stream.empty => 0
case Stream.cons(hd, tl) => hd + sum(tl)
}
- val str: Stream[int] = Stream.fromIterator(List(1,2,3).elements)
+ val str: Stream[Int] = Stream.fromIterator(List(1,2,3).elements)
assert(sum(str) == 6)
}
diff --git a/test/files/pos/code.scala b/test/files/pos/code.scala
index 421b0fb5bf..110e01c619 100644
--- a/test/files/pos/code.scala
+++ b/test/files/pos/code.scala
@@ -1,3 +1,3 @@
class Test {
- val fun: reflect.Code[int => int] = x => x + 1;
+ val fun: reflect.Code[Int => Int] = x => x + 1;
}
diff --git a/test/files/pos/constfold.scala b/test/files/pos/constfold.scala
index 0082b8cd5f..d42ada76d3 100644
--- a/test/files/pos/constfold.scala
+++ b/test/files/pos/constfold.scala
@@ -1,6 +1,6 @@
object A {
val x = 2;
- val y = x.asInstanceOf[byte];
+ val y = x.asInstanceOf[Byte];
val z = 1.0 / 2;
val s = "z is " + z;
}
diff --git a/test/files/pos/gosh.scala b/test/files/pos/gosh.scala
index c4cd3df80b..183ce9df1d 100644
--- a/test/files/pos/gosh.scala
+++ b/test/files/pos/gosh.scala
@@ -1,44 +1,44 @@
object ShapeTest extends Application {
- class Point(x : int, y : int) {
- override def toString() = "[" + x + "," + y + "]"
- }
+ class Point(x: Int, y: Int) {
+ override def toString() = "[" + x + "," + y + "]"
+ }
- abstract class Shape {
- def draw() : unit
- }
+ abstract class Shape {
+ def draw(): Unit
+ }
- class Line(s : Point, e : Point) extends Shape {
- def draw() : unit = { Console.println("draw line " + s + "," + e) }
- }
+ class Line(s: Point, e: Point) extends Shape {
+ def draw() { Console.println("draw line " + s + "," + e) }
+ }
- abstract class Foo {
- type T <: Object
+ abstract class Foo {
+ type T <: Object
- def show(o : T) : unit
- def print() : unit = {Console.println("in Foo")}
- }
+ def show(o: T): Unit
+ def print() { Console.println("in Foo") }
+ }
- abstract class ShapeFoo extends Foo {
- type T <: Shape
- def show(o : T) : unit = { o.draw() }
- override def print() : unit = {Console.println("in ShapeFoo")}
- }
+ abstract class ShapeFoo extends Foo {
+ type T <: Shape
+ def show(o: T) { o.draw() }
+ override def print() { Console.println("in ShapeFoo") }
+ }
- class LineFoo extends ShapeFoo {
- type T = Line
- override def print() : unit = {Console.println("in LineFoo")}
- }
+ class LineFoo extends ShapeFoo {
+ type T = Line
+ override def print() { Console.println("in LineFoo") }
+ }
- val p1 = new Point(1,4)
- val p2 = new Point(12, 28)
+ val p1 = new Point(1,4)
+ val p2 = new Point(12, 28)
- val l1 = new Line(p1, p2)
+ val l1 = new Line(p1, p2)
- val l = new ShapeFoo{ // ** //
- type T = Line // ** //
- override def print() : unit = {Console.println("in LineFoo")} // ** //
- }
- l.show(l1) // ** //
+ val l = new ShapeFoo { // ** //
+ type T = Line // ** //
+ override def print() { Console.println("in LineFoo") } // ** //
+ }
+ l.show(l1) // ** //
}
diff --git a/test/files/pos/mixins.scala b/test/files/pos/mixins.scala
index 2b403a25e8..846d6a41bc 100644
--- a/test/files/pos/mixins.scala
+++ b/test/files/pos/mixins.scala
@@ -1,21 +1,21 @@
-package mixins;
+package mixins
abstract class Super {
- def foo: int;
+ def foo: Int
}
trait Mixin extends Super {
- abstract override def foo = super.foo;
+ abstract override def foo = super.foo
}
trait MixinSub extends Super with Mixin {
- abstract override def foo: int = super.foo;
+ abstract override def foo: Int = super.foo
}
trait MixinSubSub extends MixinSub {
- abstract override def foo = super.foo;
+ abstract override def foo = super.foo
}
class Sub extends Super {
- def foo: int = 1
+ def foo: Int = 1
}
class Base extends Sub with MixinSubSub {
- override def foo = super.foo;
+ override def foo = super.foo
}
trait Mixin1 extends Sub with MixinSubSub {}
class Base1 extends Mixin1 {}
diff --git a/test/files/pos/traits.scala b/test/files/pos/traits.scala
index 1418757442..8dcd9c0b5f 100644
--- a/test/files/pos/traits.scala
+++ b/test/files/pos/traits.scala
@@ -1,17 +1,17 @@
object Test {
- type Color = int;
+ type Color = Int
trait Shape {
override def equals(other: Any) = true
}
trait Bordered extends Shape {
- val thickness: int;
+ val thickness: Int
override def equals(other: Any) = other match {
case that: Bordered => this.thickness == that.thickness
case _ => false
}
}
trait Colored extends Shape {
- val color: Color;
+ val color: Color
override def equals(other: Any) = other match {
case that: Colored => this.color == that.color
case _ => false
@@ -28,13 +28,13 @@ object Test {
}
val bcs1 = new BorderedColoredShape {
- val thickness = 1;
- val color = 0;
+ val thickness = 1
+ val color = 0
}
val bcs2 = new BorderedColoredShape {
- val thickness = 2;
- val color = 0;
+ val thickness = 2
+ val color = 0
}
- Console.println(bcs1 == bcs1);
+ Console.println(bcs1 == bcs1)
Console.println(bcs1 == bcs2)
}
diff --git a/test/files/pos/unapply.scala b/test/files/pos/unapply.scala
index 49f7181350..6651e64362 100644
--- a/test/files/pos/unapply.scala
+++ b/test/files/pos/unapply.scala
@@ -1,6 +1,6 @@
object Test {
val xs = List(1)
- val f: int = {
+ val f: Int = {
xs match {
case List(x) => x
}
@@ -9,16 +9,16 @@ object Test {
// the following comes from ticket #230
trait Foo {
- def name : String
- def unapply(x : String) : Option[Unit] = {
- if(x == name) Some(()) else None
+ def name: String
+ def unapply(x: String): Option[Unit] = {
+ if (x == name) Some(()) else None
}
}
object Bar extends Foo { def name = "bar" }
object Baz extends Foo { def name = "baz" }
object Test_ {
- def matcher(s : String) = s match {
+ def matcher(s: String) = s match {
case Bar(x) => println("bar")
case Baz(x) => println("baz")
// ^