summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormichelou <michelou@epfl.ch>2008-05-20 13:29:39 +0000
committermichelou <michelou@epfl.ch>2008-05-20 13:29:39 +0000
commitc1f07338ed21e551446a5c98d262d738a9b7b0ce (patch)
tree8143f69f0b97ff8bb02600991476b104afa652dc
parent7d71e4cf09074f3d1cf7539d28bba64a976524d6 (diff)
downloadscala-c1f07338ed21e551446a5c98d262d738a9b7b0ce.tar.gz
scala-c1f07338ed21e551446a5c98d262d738a9b7b0ce.tar.bz2
scala-c1f07338ed21e551446a5c98d262d738a9b7b0ce.zip
int -> Int, etc..
-rw-r--r--test/files/pos/caseaccs.scala2
-rw-r--r--test/files/pos/channels.scala8
-rw-r--r--test/files/pos/patterns1213.scala4
-rw-r--r--test/files/pos/tcpoly_higherorder_bound_method.scala4
-rw-r--r--test/files/pos/tcpoly_seq.scala48
-rw-r--r--test/files/pos/tcpoly_seq_typealias.scala54
-rw-r--r--test/files/pos/testcast.scala17
-rw-r--r--test/files/pos/typealiases.scala8
-rw-r--r--test/files/pos/viewtest2.scala34
9 files changed, 90 insertions, 89 deletions
diff --git a/test/files/pos/caseaccs.scala b/test/files/pos/caseaccs.scala
index 2668127fc9..7f2c9ef2a6 100644
--- a/test/files/pos/caseaccs.scala
+++ b/test/files/pos/caseaccs.scala
@@ -1,5 +1,5 @@
class Test {
- case class Foo(x: int, private var y: int)
+ case class Foo(x: Int, private var y: Int)
}
object Test {
diff --git a/test/files/pos/channels.scala b/test/files/pos/channels.scala
index 6513f3a5f0..4c7be2cc82 100644
--- a/test/files/pos/channels.scala
+++ b/test/files/pos/channels.scala
@@ -12,8 +12,8 @@ object Bang {
*/
object Test extends Application {
- object IC extends Channel[int]
- def f[b](x: ![b]): int = x match {
+ object IC extends Channel[Int]
+ def f[b](x: ![b]): Int = x match {
case send: ![c] =>
send.chan match {
case IC => send.data
@@ -22,8 +22,8 @@ object Test extends Application {
}
object Test2 extends Application {
- object IC extends Channel[Set[int]]
- def f[b](s: ![b]): Set[int] = s match {
+ object IC extends Channel[Set[Int]]
+ def f[b](s: ![b]): Set[Int] = s match {
case IC ! x => x
}
}
diff --git a/test/files/pos/patterns1213.scala b/test/files/pos/patterns1213.scala
index 7b8a8c8fc0..7e8af17188 100644
--- a/test/files/pos/patterns1213.scala
+++ b/test/files/pos/patterns1213.scala
@@ -1,6 +1,6 @@
-abstract class MapLocation(ID:int) {
+abstract class MapLocation(ID: Int) {
abstract class Message
- case class ReceivePlayer(id: int) extends Message
+ case class ReceivePlayer(id: Int) extends Message
def foo(p: Message) {
p match {
diff --git a/test/files/pos/tcpoly_higherorder_bound_method.scala b/test/files/pos/tcpoly_higherorder_bound_method.scala
index 1e5cbf8092..3905b3b96d 100644
--- a/test/files/pos/tcpoly_higherorder_bound_method.scala
+++ b/test/files/pos/tcpoly_higherorder_bound_method.scala
@@ -1,3 +1,3 @@
trait SkolemisationOfHigherOrderBoundInMethod {
- def method[A, N[X <: A], M[X <: N[A]]]: unit
-} \ No newline at end of file
+ def method[A, N[X <: A], M[X <: N[A]]]: Unit
+}
diff --git a/test/files/pos/tcpoly_seq.scala b/test/files/pos/tcpoly_seq.scala
index 85563488fd..e05a2322e4 100644
--- a/test/files/pos/tcpoly_seq.scala
+++ b/test/files/pos/tcpoly_seq.scala
@@ -54,13 +54,13 @@ trait HOSeq {
final class ListBuffer[A] {
private var start: List[A] = Nil
private var last: ::[A] = _
- private var exported: boolean = false
+ private var exported: Boolean = false
/** Appends a single element to this buffer.
*
* @param x the element to append.
*/
- def += (x: A): unit = {
+ def += (x: A) {
if (exported) copy
if (start.isEmpty) {
last = new HOSeq.this.:: (x, Nil)
@@ -81,13 +81,13 @@ trait HOSeq {
/** Clears the buffer contents.
*/
- def clear: unit = {
+ def clear {
start = Nil
exported = false
}
/** Copy contents of this buffer */
- private def copy = {
+ private def copy {
var cursor = start
val limit = last.tail
clear
@@ -99,34 +99,34 @@ trait HOSeq {
}
implicit def listAccumulator[elT]: Accumulator[List, elT] = new Accumulator[List, elT] {
- private[this] val buff = new ListBuffer[elT]
- def += (el: elT): Unit = buff += el
- def result: List[elT] = buff.toList
+ private[this] val buff = new ListBuffer[elT]
+ def += (el: elT): Unit = buff += el
+ def result: List[elT] = buff.toList
}
trait List[+t] extends Iterable[List, t] {
- def head: t
- def tail: List[t]
- def isEmpty: Boolean
- def elements: Iterator[t] = new Iterator[t] {
- var these = List.this
- def hasNext: Boolean = !these.isEmpty
- def next: t =
- if (!hasNext)
- throw new NoSuchElementException("next on empty Iterator")
- else {
- val result = these.head; these = these.tail; result
- }
- }
- // construct an empty accumulator that will produce the same structure as this iterable, with elements of type t
- def accumulator[t]: Accumulator[List, t] = listAccumulator[t]
+ def head: t
+ def tail: List[t]
+ def isEmpty: Boolean
+ def elements: Iterator[t] = new Iterator[t] {
+ var these = List.this
+ def hasNext: Boolean = !these.isEmpty
+ def next: t =
+ if (!hasNext)
+ throw new NoSuchElementException("next on empty Iterator")
+ else {
+ val result = these.head; these = these.tail; result
+ }
+ }
+ // construct an empty accumulator that will produce the same structure as this iterable, with elements of type t
+ def accumulator[t]: Accumulator[List, t] = listAccumulator[t]
}
// TODO: the var tl approach does not seem to work because subtyping isn't fully working yet
final case class ::[+b](hd: b, private val tl: List[b]) extends List[b] {
def head = hd
def tail = if(tl==null) this else tl // hack
- override def isEmpty: boolean = false
+ override def isEmpty: Boolean = false
}
case object Nil extends List[Nothing] {
@@ -172,4 +172,4 @@ trait HOSeq {
// @pre hasNext
// @post hasAdvanced
def advance: Unit
-}*/ \ No newline at end of file
+}*/
diff --git a/test/files/pos/tcpoly_seq_typealias.scala b/test/files/pos/tcpoly_seq_typealias.scala
index 0498c3b2f6..7a9312a60a 100644
--- a/test/files/pos/tcpoly_seq_typealias.scala
+++ b/test/files/pos/tcpoly_seq_typealias.scala
@@ -1,4 +1,4 @@
-package examples.tcpoly.collection;
+package examples.tcpoly.collection
trait HOSeq {
// an internal interface that encapsulates the accumulation of elements (of type elT) to produce
@@ -56,13 +56,13 @@ trait HOSeq {
final class ListBuffer[A] {
private var start: List[A] = Nil
private var last: ::[A] = _
- private var exported: boolean = false
+ private var exported: Boolean = false
/** Appends a single element to this buffer.
*
* @param x the element to append.
*/
- def += (x: A): unit = {
+ def += (x: A) {
if (exported) copy
if (start.isEmpty) {
last = new HOSeq.this.:: (x, Nil)
@@ -83,13 +83,13 @@ trait HOSeq {
/** Clears the buffer contents.
*/
- def clear: unit = {
+ def clear {
start = Nil
exported = false
}
/** Copy contents of this buffer */
- private def copy = {
+ private def copy {
var cursor = start
val limit = last.tail
clear
@@ -101,36 +101,36 @@ trait HOSeq {
}
implicit def listAccumulator[elT]: Accumulator[List, elT] = new Accumulator[List, elT] {
- private[this] val buff = new ListBuffer[elT]
- def += (el: elT): Unit = buff += el
- def result: List[elT] = buff.toList
+ private[this] val buff = new ListBuffer[elT]
+ def += (el: elT): Unit = buff += el
+ def result: List[elT] = buff.toList
}
trait List[+t] extends Iterable[t] {
- type m[+x] = List[x]
-
- def head: t
- def tail: List[t]
- def isEmpty: Boolean
- def elements: Iterator[t] = new Iterator[t] {
- var these = List.this
- def hasNext: Boolean = !these.isEmpty
- def next: t =
- if (!hasNext)
- throw new NoSuchElementException("next on empty Iterator")
- else {
- val result = these.head; these = these.tail; result
- }
- }
- // construct an empty accumulator that will produce the same structure as this iterable, with elements of type t
- def accumulator[t]: Accumulator[List, t] = listAccumulator[t]
+ type m[+x] = List[x]
+
+ def head: t
+ def tail: List[t]
+ def isEmpty: Boolean
+ def elements: Iterator[t] = new Iterator[t] {
+ var these = List.this
+ def hasNext: Boolean = !these.isEmpty
+ def next: t =
+ if (!hasNext)
+ throw new NoSuchElementException("next on empty Iterator")
+ else {
+ val result = these.head; these = these.tail; result
+ }
+ }
+ // construct an empty accumulator that will produce the same structure as this iterable, with elements of type t
+ def accumulator[t]: Accumulator[List, t] = listAccumulator[t]
}
// TODO: the var tl approach does not seem to work because subtyping isn't fully working yet
final case class ::[+b](hd: b, private val tl: List[b]) extends List[b] {
def head = hd
def tail = if(tl==null) this else tl // hack
- override def isEmpty: boolean = false
+ override def isEmpty: Boolean = false
}
case object Nil extends List[Nothing] {
@@ -140,4 +140,4 @@ trait HOSeq {
def tail: List[Nothing] =
throw new NoSuchElementException("tail of empty list")
}
-} \ No newline at end of file
+}
diff --git a/test/files/pos/testcast.scala b/test/files/pos/testcast.scala
index 2a78b5f2a2..d4184e4f0b 100644
--- a/test/files/pos/testcast.scala
+++ b/test/files/pos/testcast.scala
@@ -1,26 +1,27 @@
-package test;
+package test
class A;
class B extends A {
- def foo: int = 1;
+ def foo: Int = 1
}
object B {
- def view(x: B): B1 = null;
+ def view(x: B): B1 = null
}
class B1 {
- def bar: int = 1
+ def bar: Int = 1
}
object C {
- implicit def view(x: A): B1 = null;
+ implicit def view(x: A): B1 = null
}
+
object Test {
- import C.view;
+ import C.view
- val b: B = null;
+ val b: B = null
- Console.println(b.bar);
+ println(b.bar)
}
diff --git a/test/files/pos/typealiases.scala b/test/files/pos/typealiases.scala
index c32a3e3a78..d03b521f77 100644
--- a/test/files/pos/typealiases.scala
+++ b/test/files/pos/typealiases.scala
@@ -2,9 +2,9 @@ package foo
trait Test[T] {
type Check[T] = Array[T] => Unit;
- type MyPair[S] = Pair[T, S]
+ type MyPair[S] = (T, S)
- val pair1: Pair[T, Int]
+ val pair1: (T, Int)
val pair: MyPair[Int] = pair1
def check(xs: Array[T], c: Check[T]) = c(xs)
@@ -16,5 +16,5 @@ object main extends Test[Int] {
implicit def topair(x: Int): Pair[Int, Int] = (x,x)
val pair2: MyPair[Int] = 1
- val x: short = 1
-} \ No newline at end of file
+ val x: Short = 1
+}
diff --git a/test/files/pos/viewtest2.scala b/test/files/pos/viewtest2.scala
index 321f5d7712..5c8678099d 100644
--- a/test/files/pos/viewtest2.scala
+++ b/test/files/pos/viewtest2.scala
@@ -10,40 +10,40 @@ trait Ordered[+a] {
* x == 0 iff this == that
* x > 0 iff this > that
*/
- def compareTo [b >: a <% Ordered[b]](that: b): int
+ def compareTo [b >: a <% Ordered[b]](that: b): Int
- def < [b >: a <% Ordered[b]](that: b): boolean = (this compareTo that) < 0
+ def < [b >: a <% Ordered[b]](that: b): Boolean = (this compareTo that) < 0
- def > [b >: a <% Ordered[b]](that: b): boolean = (this compareTo that) > 0
+ def > [b >: a <% Ordered[b]](that: b): Boolean = (this compareTo that) > 0
- def <= [b >: a <% Ordered[b]](that: b): boolean = (this compareTo that) <= 0
+ def <= [b >: a <% Ordered[b]](that: b): Boolean = (this compareTo that) <= 0
- def >= [b >: a <% Ordered[b]](that: b): boolean = (this compareTo that) >= 0
+ def >= [b >: a <% Ordered[b]](that: b): Boolean = (this compareTo that) >= 0
}
object O {
implicit def view1(x: String): Ordered[String] = new Ordered[String] {
- def compareTo [b >: String <% Ordered[b]](y: b): int = y match {
+ def compareTo [b >: String <% Ordered[b]](y: b): Int = y match {
case y1: String => x compareTo y1
case _ => -(y compareTo x)
}
}
- implicit def view2(x: char): Ordered[char] = new Ordered[char] {
- def compareTo [b >: char <% Ordered[b]](y: b): int = y match {
- case y1: char => x - y1
+ implicit def view2(x: Char): Ordered[Char] = new Ordered[Char] {
+ def compareTo [b >: Char <% Ordered[b]](y: b): Int = y match {
+ case y1: Char => x - y1
case _ => -(y compareTo x)
}
}
implicit def view3[a <% Ordered[a]](x: List[a]): Ordered[List[a]] =
new Ordered[List[a]] {
- def compareTo [b >: List[a] <% Ordered[b]](y: b): int = y match {
+ def compareTo [b >: List[a] <% Ordered[b]](y: b): Int = y match {
case y1: List[a1] => compareLists(x, y1.asInstanceOf[List[a]])
case _ => -(y compareTo x)
}
- private def compareLists(xs: List[a], ys: List[a]): int = {
+ private def compareLists(xs: List[a], ys: List[a]): Int = {
if (xs.isEmpty && ys.isEmpty) 0
else if (xs.isEmpty) -1
else if (ys.isEmpty) 1
@@ -76,7 +76,7 @@ class Node[a <% Ordered[a]](elem: a, l: Tree[a], r: Tree[a]) extends Tree[a] {
}
case class Str(elem: String) extends Ordered[Str] {
- def compareTo[b >: Str <% Ordered[b]](that: b): int = that match {
+ def compareTo[b >: Str <% Ordered[b]](that: b): Int = that match {
case that1: Str => this.elem compareTo that1.elem
case _ => -(that compareTo this)
}
@@ -89,24 +89,24 @@ object Test {
if (s.length() == 0) List()
else s.charAt(0) :: toCharList(s.substring(1))
- def main(args: Array[String]) = {
+ def main(args: Array[String]) {
{
var t: Tree[String] = Empty
- for (val s <- args) {
+ for (s <- args) {
t = t insert s
}
Console.println(t.elements)
}
{
var t: Tree[Str] = Empty
- for (val s <- args) {
+ for (s <- args) {
t = t insert Str(s)
}
Console.println(t.elements)
}
{
- var t: Tree[List[char]] = Empty
- for (val s <- args) {
+ var t: Tree[List[Char]] = Empty
+ for (s <- args) {
t = t insert toCharList(s)
}
Console.println(t.elements)