summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2005-12-08 15:15:56 +0000
committerMartin Odersky <odersky@gmail.com>2005-12-08 15:15:56 +0000
commit2d91f011f2ba54bb3ac733f3dcf4a518ea56d50e (patch)
tree956f4cf7f0745cf6916ad67354fcb7c42659969d
parente0d7aeaa9d32afce117d366b179e7a8205586f2e (diff)
downloadscala-2d91f011f2ba54bb3ac733f3dcf4a518ea56d50e.tar.gz
scala-2d91f011f2ba54bb3ac733f3dcf4a518ea56d50e.tar.bz2
scala-2d91f011f2ba54bb3ac733f3dcf4a518ea56d50e.zip
*** empty log message ***
-rw-r--r--sources/scala/CaseClass.scala1
-rw-r--r--sources/scala/Symbol.scala11
-rw-r--r--sources/scala/collection/BitSet.scala7
-rw-r--r--sources/scala/collection/Map.scala13
-rw-r--r--sources/scala/collection/Set.scala5
-rw-r--r--sources/scala/collection/immutable/BitSet.scala5
-rw-r--r--sources/scala/collection/immutable/Queue.scala12
-rw-r--r--sources/scala/collection/mutable/HashMap.scala2
-rw-r--r--sources/scala/collection/mutable/LinkedList.scala5
-rw-r--r--sources/scala/collection/mutable/PriorityQueue.scala5
-rw-r--r--sources/scala/collection/mutable/Queue.scala5
-rw-r--r--sources/scala/collection/mutable/Stack.scala5
-rw-r--r--sources/scala/dbc/statement/Select.scala9
-rw-r--r--sources/scala/io/Position.scala10
-rwxr-xr-xsources/scala/runtime/BoxedAnyArray.scala5
-rwxr-xr-xsources/scala/runtime/BoxedBooleanArray.scala5
-rwxr-xr-xsources/scala/runtime/BoxedByteArray.scala5
-rwxr-xr-xsources/scala/runtime/BoxedCharArray.scala5
-rwxr-xr-xsources/scala/runtime/BoxedDoubleArray.scala5
-rwxr-xr-xsources/scala/runtime/BoxedFloatArray.scala5
-rwxr-xr-xsources/scala/runtime/BoxedIntArray.scala5
-rwxr-xr-xsources/scala/runtime/BoxedLongArray.scala5
-rwxr-xr-xsources/scala/runtime/BoxedObjectArray.scala5
-rwxr-xr-xsources/scala/runtime/BoxedShortArray.scala5
-rw-r--r--sources/scala/tools/nsc/ast/TreeInfo.scala8
-rwxr-xr-xsources/scala/tools/nsc/ast/parser/Parsers.scala287
-rwxr-xr-xsources/scala/tools/nsc/ast/parser/Scanners.scala62
-rw-r--r--sources/scala/tools/nsc/backend/icode/BasicBlocks.scala5
-rw-r--r--sources/scala/tools/nsc/backend/icode/GenICode.scala3
-rw-r--r--sources/scala/tools/nsc/backend/icode/Members.scala10
-rw-r--r--sources/scala/tools/nsc/backend/icode/Opcodes.scala12
-rw-r--r--sources/scala/tools/nsc/backend/icode/TypeStacks.scala5
-rw-r--r--sources/scala/tools/nsc/backend/jvm/GenJVM.scala2
-rw-r--r--sources/scala/tools/nsc/matching/MatcherLabels.scala5
-rw-r--r--sources/scala/tools/nsc/matching/PatternMatchers.scala2
-rw-r--r--sources/scala/tools/nsc/matching/PatternNodes.scala10
-rw-r--r--sources/scala/tools/nsc/matching/RightTracers.scala4
-rwxr-xr-xsources/scala/tools/nsc/symtab/Definitions.scala4
-rw-r--r--sources/scala/tools/nsc/symtab/Flags.scala4
-rwxr-xr-xsources/scala/tools/nsc/symtab/Names.scala12
-rwxr-xr-xsources/scala/tools/nsc/symtab/Symbols.scala34
-rwxr-xr-xsources/scala/tools/nsc/symtab/Types.scala138
-rwxr-xr-xsources/scala/tools/nsc/symtab/classfile/ClassfileParser.scala8
-rwxr-xr-xsources/scala/tools/nsc/symtab/classfile/Pickler.scala5
-rwxr-xr-xsources/scala/tools/nsc/transform/AddInterfaces.scala19
-rwxr-xr-xsources/scala/tools/nsc/transform/Constructors.scala9
-rwxr-xr-xsources/scala/tools/nsc/transform/Erasure.scala19
-rwxr-xr-xsources/scala/tools/nsc/transform/LambdaLift.scala6
-rwxr-xr-xsources/scala/tools/nsc/transform/Mixin.scala22
-rwxr-xr-xsources/scala/tools/nsc/transform/UnCurry.scala11
-rwxr-xr-xsources/scala/tools/nsc/typechecker/Contexts.scala26
-rwxr-xr-xsources/scala/tools/nsc/typechecker/Infer.scala28
-rwxr-xr-xsources/scala/tools/nsc/typechecker/Namers.scala8
-rwxr-xr-xsources/scala/tools/nsc/typechecker/RefChecks.scala13
-rwxr-xr-xsources/scala/tools/nsc/typechecker/SuperAccessors.scala4
-rwxr-xr-xsources/scala/tools/nsc/typechecker/Typers.scala37
-rw-r--r--sources/scala/tools/nsc/util/CharArrayReader.scala6
-rwxr-xr-xsources/scala/tools/nsc/util/Position.scala3
-rw-r--r--sources/scala/xml/Node.scala10
-rw-r--r--sources/scala/xml/PrefixedAttribute.scala6
-rw-r--r--sources/scala/xml/dtd/Scanner.scala4
-rw-r--r--sources/scala/xml/factory/NodeFactory.scala4
-rw-r--r--sources/scala/xml/parsing/TokenTests.scala4
-rw-r--r--test-nsc/scalanstest3
64 files changed, 553 insertions, 454 deletions
diff --git a/sources/scala/CaseClass.scala b/sources/scala/CaseClass.scala
index 1b8e7f62a7..0180efe267 100644
--- a/sources/scala/CaseClass.scala
+++ b/sources/scala/CaseClass.scala
@@ -29,4 +29,5 @@ trait CaseClass extends AnyRef {
def caseArity: Int ;
def caseName: String = ""; // for now
+
}
diff --git a/sources/scala/Symbol.scala b/sources/scala/Symbol.scala
index 832b9721ed..2e1ab3a724 100644
--- a/sources/scala/Symbol.scala
+++ b/sources/scala/Symbol.scala
@@ -21,9 +21,10 @@ package scala;
*/
final case class Symbol(name: String) {
- /** Converts this symbol to a string.
- */
- override def toString(): String = {
- "'" + name
- }
+ /** Converts this symbol to a string.
+ */
+ override def toString(): String = {
+ "'" + name
+ }
+
}
diff --git a/sources/scala/collection/BitSet.scala b/sources/scala/collection/BitSet.scala
index bd047bcc2c..5f7d325208 100644
--- a/sources/scala/collection/BitSet.scala
+++ b/sources/scala/collection/BitSet.scala
@@ -51,12 +51,13 @@ package scala.collection;
*
* @return true, iff both bitsets contain the same sequence of elements.
*/
- override def equals(that: Any): Boolean =
+ override def equals(that: Any): Boolean = (
that.isInstanceOf[BitSet] &&
{ val other = that.asInstanceOf[BitSet];
(size == other.size) &&
- (Iterator.range(0, size) forall { i => apply(i) == other.apply(i)});
- };
+ (Iterator.range(0, size) forall { i => apply(i) == other.apply(i)})
+ }
+ );
/**
* applies f to any index which is set to true.
diff --git a/sources/scala/collection/Map.scala b/sources/scala/collection/Map.scala
index 65ee3a6c3b..91ec361083 100644
--- a/sources/scala/collection/Map.scala
+++ b/sources/scala/collection/Map.scala
@@ -53,7 +53,7 @@ trait Map[A, +B] extends AnyRef with PartialFunction[A, B] with Iterable[Pair[A,
* @return the value associated with the given key.
*/
def apply(key: A): B = get(key) match {
- case None => error("key not found")
+ case None => default
case Some(value) => value
}
@@ -136,7 +136,7 @@ trait Map[A, +B] extends AnyRef with PartialFunction[A, B] with Iterable[Pair[A,
*
* @return true, iff both maps contain exactly the same mappings.
*/
- override def equals(that: Any): Boolean =
+ override def equals(that: Any): Boolean = (
that.isInstanceOf[Map[A, B]] &&
{ val other = that.asInstanceOf[Map[A, B]];
this.size == other.size &&
@@ -145,7 +145,8 @@ trait Map[A, +B] extends AnyRef with PartialFunction[A, B] with Iterable[Pair[A,
case None => false;
case Some(otherval) => value == otherval;
}
- }};
+ }}
+ );
/** Returns the mappings of this map as a list.
*
@@ -170,5 +171,11 @@ trait Map[A, +B] extends AnyRef with PartialFunction[A, B] with Iterable[Pair[A,
res;
} + "}";
+ /** The default value for the map, returned when a key is not found
+ * The method implemented here yields an error,
+ * but it might be overridden in subclasses.
+ */
+ def default: B =
+ error("key not found")
}
diff --git a/sources/scala/collection/Set.scala b/sources/scala/collection/Set.scala
index a4cf078543..b222b81648 100644
--- a/sources/scala/collection/Set.scala
+++ b/sources/scala/collection/Set.scala
@@ -67,11 +67,12 @@ trait Set[A] extends AnyRef with Function1[A, Boolean] with Iterable[A] {
* @return true, iff this set and the other set contain the same
* elements.
*/
- override def equals(that: Any): Boolean =
+ override def equals(that: Any): Boolean = (
that.isInstanceOf[Set[A]] &&
{ val other = that.asInstanceOf[Set[A]];
this.size == other.size &&
- this.elements.forall(other.contains) };
+ this.elements.forall(other.contains) }
+ );
/** Returns the elements of this set as a list.
*
diff --git a/sources/scala/collection/immutable/BitSet.scala b/sources/scala/collection/immutable/BitSet.scala
index 8835fde146..61299bf069 100644
--- a/sources/scala/collection/immutable/BitSet.scala
+++ b/sources/scala/collection/immutable/BitSet.scala
@@ -70,7 +70,7 @@ class BitSet(n:Int, ba: Array[Int], copy: Boolean) extends collection.BitSet wit
*
* @return true, iff both bitsets contain the same sequence of elements.
*/
- override def equals(that: Any): Boolean =
+ override def equals(that: Any): Boolean = (
that.isInstanceOf[BitSet] &&
{ val other = that.asInstanceOf[BitSet];
(size == other.size) && ( size == 0 || {
@@ -83,7 +83,8 @@ class BitSet(n:Int, ba: Array[Int], copy: Boolean) extends collection.BitSet wit
}
res
})
- } || super.equals(that);
+ } || super.equals(that)
+ );
def this(rbs: mutable.BitSet) = {
this(rbs.size, rbs.toArray, false);
diff --git a/sources/scala/collection/immutable/Queue.scala b/sources/scala/collection/immutable/Queue.scala
index 74b9a45cd2..cb005d3b5e 100644
--- a/sources/scala/collection/immutable/Queue.scala
+++ b/sources/scala/collection/immutable/Queue.scala
@@ -148,18 +148,18 @@ class Queue[+A](elem: A*) extends Seq[A] {
the same position in this (queue).
If they are equal the next element is
compared. */
- def eqe(index: Int): Boolean = {
+ def eqe(index: Int): Boolean = (
/* If all elements are compared
the queues are equal. */
index >= this.length ||
/* Otherwise: compare the elements */
(q.apply(index) == this.apply(index) &&
/* if they are equal compare the rest. */
- eqe(index + 1))
- }
- /* If the length of the ques are the same,
- compare each element, starting at index 0. */
- (q.length == this.length) && eqe(0);
+ eqe(index + 1))
+ );
+ /* If the length of the ques are the same,
+ compare each element, starting at index 0. */
+ (q.length == this.length) && eqe(0);
case _ => false; /* o is not a queue: not equal to this. */
}
diff --git a/sources/scala/collection/mutable/HashMap.scala b/sources/scala/collection/mutable/HashMap.scala
index 6388b78f25..dcdde2e40c 100644
--- a/sources/scala/collection/mutable/HashMap.scala
+++ b/sources/scala/collection/mutable/HashMap.scala
@@ -28,7 +28,7 @@ class HashMap[A, B] extends scala.collection.mutable.Map[A, B]
tableSize = 0;
}
- override def clone(): HashMap[A, B] = {
+ override def clone(): Map[A, B] = {
val res = new HashMap[A, B];
res ++= this;
res
diff --git a/sources/scala/collection/mutable/LinkedList.scala b/sources/scala/collection/mutable/LinkedList.scala
index a8970da2ae..03f6093cc9 100644
--- a/sources/scala/collection/mutable/LinkedList.scala
+++ b/sources/scala/collection/mutable/LinkedList.scala
@@ -22,9 +22,10 @@ class LinkedList[A](head: A, tail: LinkedList[A])
elem = head;
next = tail;
- override def equals(obj: Any): Boolean =
+ override def equals(obj: Any): Boolean = (
obj.isInstanceOf[LinkedList[A]]
- && toList.equals((obj.asInstanceOf[LinkedList[A]]).toList);
+ && toList.equals((obj.asInstanceOf[LinkedList[A]]).toList)
+ );
override protected def stringPrefix: String = "LinkedList";
}
diff --git a/sources/scala/collection/mutable/PriorityQueue.scala b/sources/scala/collection/mutable/PriorityQueue.scala
index 82d76ec957..83552417cc 100644
--- a/sources/scala/collection/mutable/PriorityQueue.scala
+++ b/sources/scala/collection/mutable/PriorityQueue.scala
@@ -135,12 +135,13 @@ class PriorityQueue[A <% Ordered[A]] extends ResizableArray[A] with java.io.Seri
*
* @return true, iff both queues contain the same sequence of elements.
*/
- override def equals(that: Any): Boolean =
+ override def equals(that: Any): Boolean = (
that.isInstanceOf[PriorityQueue[A]] &&
{ val other = that.asInstanceOf[PriorityQueue[A]];
elements.zip(other.elements).forall {
case Pair(thiselem, thatelem) => thiselem == thatelem;
- }};
+ }}
+ );
/** The hashCode method always yields an error, since it is not
* safe to use mutable queues as keys in hash tables.
diff --git a/sources/scala/collection/mutable/Queue.scala b/sources/scala/collection/mutable/Queue.scala
index 2f22411ede..0d297f5e0d 100644
--- a/sources/scala/collection/mutable/Queue.scala
+++ b/sources/scala/collection/mutable/Queue.scala
@@ -161,12 +161,13 @@ class Queue[A] extends MutableList[A] {
*
* @return true, iff both queues contain the same sequence of elements.
*/
- override def equals(that: Any): Boolean =
+ override def equals(that: Any): Boolean = (
that.isInstanceOf[Queue[A]] &&
{ val other = that.asInstanceOf[Queue[A]];
elements.zip(other.elements).forall {
case Pair(thiselem, thatelem) => thiselem == thatelem;
- }};
+ }}
+ );
/** The hashCode method always yields an error, since it is not
* safe to use mutable queues as keys in hash tables.
diff --git a/sources/scala/collection/mutable/Stack.scala b/sources/scala/collection/mutable/Stack.scala
index a5ba0f97f2..0cf269dba7 100644
--- a/sources/scala/collection/mutable/Stack.scala
+++ b/sources/scala/collection/mutable/Stack.scala
@@ -99,12 +99,13 @@ class Stack[A] extends MutableList[A] {
*
* @return true, iff both stacks contain the same sequence of elements.
*/
- override def equals(that: Any): Boolean =
+ override def equals(that: Any): Boolean = (
that.isInstanceOf[Stack[A]] &&
{ val other = that.asInstanceOf[Stack[A]];
elements.zip(other.elements).forall {
case Pair(thiselem, thatelem) => thiselem == thatelem;
- }};
+ }}
+ );
/** The hashCode method always yields an error, since it is not
* safe to use mutable stacks as keys in hash tables.
diff --git a/sources/scala/dbc/statement/Select.scala b/sources/scala/dbc/statement/Select.scala
index b39ec8a3e5..48b946f17d 100644
--- a/sources/scala/dbc/statement/Select.scala
+++ b/sources/scala/dbc/statement/Select.scala
@@ -48,7 +48,7 @@ abstract class Select extends Relation {
/* def windowClause: Option[_]; */
/** A SQL-99 compliant string representation of the select statement. */
- def sqlString: String = {
+ def sqlString: String = (
"SELECT" +
(setQuantifier match {
case None => ""
@@ -72,15 +72,16 @@ abstract class Select extends Relation {
case None => ""
case Some(gbl) => gbl match {
case Nil => error("Empty group by clause is not allowed")
- case _ => " GROUP BY " + gbl.tail.foldLeft(gbl.head.sqlInnerString)
- ((name:String, gb) => name + ", " + gb.sqlInnerString)
+ case _ => " GROUP BY " +
+ (gbl.tail.foldLeft(gbl.head.sqlInnerString)
+ ((name:String, gb) => name + ", " + gb.sqlInnerString))
}
}) +
(havingClause match {
case None => ""
case Some(expr) => " HAVING " + expr.sqlString
})
- }
+ );
/** A SQL-99 compliant string representation of the relation sub-
* statement. This only has a meaning inside a query. */
diff --git a/sources/scala/io/Position.scala b/sources/scala/io/Position.scala
index 46e36dcdc1..ef61e01317 100644
--- a/sources/scala/io/Position.scala
+++ b/sources/scala/io/Position.scala
@@ -58,17 +58,17 @@ object Position {
if( column < 0 )
error(line+","+column+" not allowed");
- if (line >= LINE_MASK) {
+ {if (line >= LINE_MASK) {
line1 = LINE_MASK;
- column1 = 0; }
- else {
+ column1 = 0;
+ } else {
line1 = line;
if (column > COLUMN_MASK)
column1 = COLUMN_MASK;
else
column1 = column
- }
- (line1 << COLUMN_BITS) | column1;
+ }}
+ {(line1 << COLUMN_BITS) | column1;}
}
/** Returns the line number of the encoded position. */
diff --git a/sources/scala/runtime/BoxedAnyArray.scala b/sources/scala/runtime/BoxedAnyArray.scala
index 07b2313ce9..b2bafa00b1 100755
--- a/sources/scala/runtime/BoxedAnyArray.scala
+++ b/sources/scala/runtime/BoxedAnyArray.scala
@@ -143,9 +143,10 @@ final class BoxedAnyArray(val length: Int) extends BoxedArray {
unboxed
}
- override def equals(other: Any): Boolean =
+ override def equals(other: Any): Boolean = (
other.isInstanceOf[BoxedAnyArray] && (this eq (other.asInstanceOf[BoxedAnyArray])) ||
- (if (unboxed == null) boxed == other else unboxed == other);
+ (if (unboxed == null) boxed == other else unboxed == other)
+ );
override def hashCode(): Int = hash;
}
diff --git a/sources/scala/runtime/BoxedBooleanArray.scala b/sources/scala/runtime/BoxedBooleanArray.scala
index f87f46b828..037ad3b9f2 100755
--- a/sources/scala/runtime/BoxedBooleanArray.scala
+++ b/sources/scala/runtime/BoxedBooleanArray.scala
@@ -22,9 +22,10 @@ final class BoxedBooleanArray(val value: Array[Boolean]) extends BoxedArray {
def unbox(elemTag: String): Object = value;
- override def equals(other: Any) =
+ override def equals(other: Any) = (
value == other ||
- other.isInstanceOf[BoxedBooleanArray] && value == other.asInstanceOf[BoxedBooleanArray].value;
+ other.isInstanceOf[BoxedBooleanArray] && value == other.asInstanceOf[BoxedBooleanArray].value
+ );
override def hashCode(): Int = value.hashCode();
}
diff --git a/sources/scala/runtime/BoxedByteArray.scala b/sources/scala/runtime/BoxedByteArray.scala
index bc1f29324e..bdf3005b11 100755
--- a/sources/scala/runtime/BoxedByteArray.scala
+++ b/sources/scala/runtime/BoxedByteArray.scala
@@ -22,9 +22,10 @@ final class BoxedByteArray(val value: Array[Byte]) extends BoxedArray {
def unbox(elemTag: String): Object = value;
- override def equals(other: Any) =
+ override def equals(other: Any) = (
value == other ||
- other.isInstanceOf[BoxedByteArray] && value == other.asInstanceOf[BoxedByteArray].value;
+ other.isInstanceOf[BoxedByteArray] && value == other.asInstanceOf[BoxedByteArray].value
+ );
override def hashCode(): Int = value.hashCode();
}
diff --git a/sources/scala/runtime/BoxedCharArray.scala b/sources/scala/runtime/BoxedCharArray.scala
index fd16baede2..eec5925014 100755
--- a/sources/scala/runtime/BoxedCharArray.scala
+++ b/sources/scala/runtime/BoxedCharArray.scala
@@ -22,9 +22,10 @@ final class BoxedCharArray(val value: Array[Char]) extends BoxedArray {
def unbox(elemTag: String): Object = value;
- override def equals(other: Any) =
+ override def equals(other: Any) = (
value == other ||
- other.isInstanceOf[BoxedCharArray] && value == other.asInstanceOf[BoxedCharArray].value;
+ other.isInstanceOf[BoxedCharArray] && value == other.asInstanceOf[BoxedCharArray].value
+ );
override def hashCode(): Int = value.hashCode();
}
diff --git a/sources/scala/runtime/BoxedDoubleArray.scala b/sources/scala/runtime/BoxedDoubleArray.scala
index cf961ec4a3..12e530987f 100755
--- a/sources/scala/runtime/BoxedDoubleArray.scala
+++ b/sources/scala/runtime/BoxedDoubleArray.scala
@@ -22,9 +22,10 @@ final class BoxedDoubleArray(val value: Array[Double]) extends BoxedArray {
def unbox(elemTag: String): Object = value;
- override def equals(other: Any) =
+ override def equals(other: Any) = (
value == other ||
- other.isInstanceOf[BoxedDoubleArray] && value == other.asInstanceOf[BoxedDoubleArray].value;
+ other.isInstanceOf[BoxedDoubleArray] && value == other.asInstanceOf[BoxedDoubleArray].value
+ );
override def hashCode(): Int = value.hashCode();
}
diff --git a/sources/scala/runtime/BoxedFloatArray.scala b/sources/scala/runtime/BoxedFloatArray.scala
index 3594b851ef..0f438dc402 100755
--- a/sources/scala/runtime/BoxedFloatArray.scala
+++ b/sources/scala/runtime/BoxedFloatArray.scala
@@ -22,9 +22,10 @@ final class BoxedFloatArray(val value: Array[Float]) extends BoxedArray {
def unbox(elemTag: String): Object = value;
- override def equals(other: Any) =
+ override def equals(other: Any) = (
value == other ||
- other.isInstanceOf[BoxedFloatArray] && value == other.asInstanceOf[BoxedFloatArray].value;
+ other.isInstanceOf[BoxedFloatArray] && value == other.asInstanceOf[BoxedFloatArray].value
+ );
override def hashCode(): Int = value.hashCode();
}
diff --git a/sources/scala/runtime/BoxedIntArray.scala b/sources/scala/runtime/BoxedIntArray.scala
index ac9aa517ec..eb16a8068f 100755
--- a/sources/scala/runtime/BoxedIntArray.scala
+++ b/sources/scala/runtime/BoxedIntArray.scala
@@ -22,9 +22,10 @@ final class BoxedIntArray(val value: Array[Int]) extends BoxedArray {
def unbox(elemTag: String): Object = value;
- override def equals(other: Any) =
+ override def equals(other: Any) = (
value == other ||
- other.isInstanceOf[BoxedIntArray] && value == other.asInstanceOf[BoxedIntArray].value;
+ other.isInstanceOf[BoxedIntArray] && value == other.asInstanceOf[BoxedIntArray].value
+ );
override def hashCode(): Int = value.hashCode();
}
diff --git a/sources/scala/runtime/BoxedLongArray.scala b/sources/scala/runtime/BoxedLongArray.scala
index 63a6217b35..05179acc16 100755
--- a/sources/scala/runtime/BoxedLongArray.scala
+++ b/sources/scala/runtime/BoxedLongArray.scala
@@ -22,9 +22,10 @@ final class BoxedLongArray(val value: Array[Long]) extends BoxedArray {
def unbox(elemTag: String): Object = value;
- override def equals(other: Any) =
+ override def equals(other: Any) = (
value == other ||
- other.isInstanceOf[BoxedLongArray] && value == other.asInstanceOf[BoxedLongArray].value;
+ other.isInstanceOf[BoxedLongArray] && value == other.asInstanceOf[BoxedLongArray].value
+ );
override def hashCode(): Int = value.hashCode();
}
diff --git a/sources/scala/runtime/BoxedObjectArray.scala b/sources/scala/runtime/BoxedObjectArray.scala
index e86578a252..12ff59da8c 100755
--- a/sources/scala/runtime/BoxedObjectArray.scala
+++ b/sources/scala/runtime/BoxedObjectArray.scala
@@ -20,9 +20,10 @@ final class BoxedObjectArray(val value: Array[Object]) extends BoxedArray {
def unbox(elemTag: String): Object = value;
- override def equals(other: Any): Boolean =
+ override def equals(other: Any): Boolean = (
value == other ||
- other.isInstanceOf[BoxedObjectArray] && value == other.asInstanceOf[BoxedObjectArray].value;
+ other.isInstanceOf[BoxedObjectArray] && value == other.asInstanceOf[BoxedObjectArray].value
+ );
override def hashCode(): Int = value.hashCode();
}
diff --git a/sources/scala/runtime/BoxedShortArray.scala b/sources/scala/runtime/BoxedShortArray.scala
index f77f0193c8..973f7c067f 100755
--- a/sources/scala/runtime/BoxedShortArray.scala
+++ b/sources/scala/runtime/BoxedShortArray.scala
@@ -22,9 +22,10 @@ final class BoxedShortArray(val value: Array[Short]) extends BoxedArray {
def unbox(elemTag: String): Object = value;
- override def equals(other: Any) =
+ override def equals(other: Any) = (
value == other ||
- other.isInstanceOf[BoxedShortArray] && value == other.asInstanceOf[BoxedShortArray].value;
+ other.isInstanceOf[BoxedShortArray] && value == other.asInstanceOf[BoxedShortArray].value
+ );
override def hashCode(): Int = value.hashCode();
}
diff --git a/sources/scala/tools/nsc/ast/TreeInfo.scala b/sources/scala/tools/nsc/ast/TreeInfo.scala
index 486dc14751..8e082fec1e 100644
--- a/sources/scala/tools/nsc/ast/TreeInfo.scala
+++ b/sources/scala/tools/nsc/ast/TreeInfo.scala
@@ -126,10 +126,10 @@ abstract class TreeInfo {
/** Is name a variable name? */
def isVariableName(name: Name): boolean = {
val first = name(0);
- (('a' <= first && first <= 'z') || first == '_')
- && name != nme.false_
- && name != nme.true_
- && name != nme.null_
+ ((('a' <= first && first <= 'z') || first == '_')
+ && name != nme.false_
+ && name != nme.true_
+ && name != nme.null_)
}
/** Is tree a this node which belongs to `enclClass'? */
diff --git a/sources/scala/tools/nsc/ast/parser/Parsers.scala b/sources/scala/tools/nsc/ast/parser/Parsers.scala
index ae4f271684..6aa4927800 100755
--- a/sources/scala/tools/nsc/ast/parser/Parsers.scala
+++ b/sources/scala/tools/nsc/ast/parser/Parsers.scala
@@ -79,8 +79,6 @@ import Tokens._;
in.token match {
case EOF =>
return;
- case SEMI =>
- if (nparens == 0 && nbraces == 0) return;
case RPAREN =>
nparens = nparens - 1;
case RBRACE =>
@@ -91,6 +89,7 @@ import Tokens._;
case LBRACE =>
nbraces = nbraces + 1;
case _ =>
+ if (in.isStatSep && nparens <= 0 && nbraces == 0) return;
}
in.nextToken();
}
@@ -111,14 +110,17 @@ import Tokens._;
val pos = in.currentPos;
if (in.token != token)
syntaxError(
- if (Position.line(in.currentPos) > Position.line(in.lastpos)) in.lastpos
- else in.currentPos,
+ if (in.afterLineEnd) in.lastPos else in.currentPos,
in.token2string(token) + " expected but " +
in.token2string(in.token) + " found.", true);
if (in.token == token) in.nextToken();
pos;
}
+ def acceptStatSep(): Unit =
+ if (in.token == SEMI) in.nextToken()
+ else if (!in.isStatSep) accept(SEMI);
+
def errorTypeTree = TypeTree().setType(ErrorType).setPos(in.currentPos);
def errorTermTree = Literal(Constant(null)).setPos(in.currentPos);
def errorPatternTree = Ident(nme.WILDCARD).setPos(in.currentPos);
@@ -496,7 +498,7 @@ import Tokens._;
in.nextToken(); ts += simpleType()
}
atPos(pos) {
- if (in.token == LBRACE) CompoundTypeTree(Template(ts.toList, refinement()))
+ if (in.token == LBRACE && !in.isStatSep) CompoundTypeTree(Template(ts.toList, refinement()))
else makeIntersectionTypeTree(ts.toList)
}
}
@@ -573,7 +575,7 @@ import Tokens._;
* | try `{' block `}' [catch `{' caseClauses `}'] [finally Expr]
* | while `(' Expr `)' Expr
* | do Expr [`;'] while `(' Expr `)'
- * | for `(' Enumerators `)' (do | yield) Expr
+ * | for (`(' Enumerators `)' | '{' Enumerators '}') (do | yield) Expr
* | throw Expr
* | return [Expr]
* | [SimpleExpr `.'] Id `=' Expr
@@ -588,109 +590,100 @@ import Tokens._;
def expr(): Tree =
expr(false, false);
- def expr(isArgument: boolean, isInBlock: boolean): Tree = {
- in.token match {
- case IF =>
- //if (in.token == IF) {
- val pos = in.skipToken();
- accept(LPAREN);
- val cond = expr();
- accept(RPAREN);
- val thenp = expr();
- val elsep =
- if (in.token == ELSE) { in.nextToken(); expr() }
- else EmptyTree;
- atPos(pos) { If(cond, thenp, elsep) }
- //} else if (in.token == TRY) {
- case TRY =>
- atPos(in.skipToken()) {
- accept(LBRACE);
- val body = block();
- accept(RBRACE);
- val catches =
- if (in.token == CATCH) {
+ def expr(isArgument: boolean, isInBlock: boolean): Tree = in.token match {
+ case IF =>
+ val pos = in.skipToken();
+ accept(LPAREN);
+ val cond = expr();
+ accept(RPAREN);
+ val thenp = expr();
+ val elsep =
+ if (in.token == ELSE) { in.nextToken(); expr() }
+ else EmptyTree;
+ atPos(pos) { If(cond, thenp, elsep) }
+ case TRY =>
+ atPos(in.skipToken()) {
+ accept(LBRACE);
+ val body = block();
+ accept(RBRACE);
+ val catches =
+ if (in.token == CATCH) {
in.nextToken();
accept(LBRACE);
val cases = caseClauses();
accept(RBRACE);
cases
} else List();
- val finalizer =
- if (in.token == FINALLY) { in.nextToken(); expr() }
- else EmptyTree;
- Try(body, catches, finalizer)
- }
- //} else if (in.token == WHILE) {
- case WHILE =>
- val lname: Name = unit.fresh.newName("label$");
- val pos = in.skipToken();
- accept(LPAREN);
- val cond = expr();
- accept(RPAREN);
- val body = expr();
- atPos(pos) { makeWhile(lname, cond, body) }
- // } else if (in.token == DO) {
- case DO =>
- val lname: Name = unit.fresh.newName("label$");
- val pos = in.skipToken();
- val body = expr();
- if (in.token == SEMI) in.nextToken();
- accept(WHILE);
- accept(LPAREN);
- val cond = expr();
- accept(RPAREN);
- atPos(pos) { makeDoWhile(lname, body, cond) }
- //} else if (in.token == FOR) {
- case FOR =>
- atPos(in.skipToken()) {
- accept(LPAREN);
- val enums = enumerators();
- accept(RPAREN);
- if (in.token == YIELD) {
- in.nextToken(); makeForYield(enums, expr())
- } else makeFor(enums, expr())
- }
- //} else if (in.token == RETURN) {
- case RETURN =>
- atPos(in.skipToken()) {
- Return(if (isExprIntro) expr() else Literal(()))
- }
- //} else if (in.token == THROW) {
- case THROW =>
- atPos(in.skipToken()) {
- Throw(expr())
- }
- //} else if (in.token == DOT) {
- case DOT =>
- atPos(in.skipToken()) {
- if (in.token == IDENTIFIER) makeClosure(simpleExpr())
- else { syntaxError("identifier expected", true); errorTermTree }
- }
- //} else {
- case _ =>
- var t = postfixExpr();
- if (in.token == EQUALS) {
- t match {
- case Ident(_) | Select(_, _) | Apply(_, _) =>
- t = atPos(in.skipToken()) { makeAssign(t, expr()) }
- case _ =>
- }
- } else if (in.token == COLON) {
- val pos = in.skipToken();
- if (isArgument && in.token == USCORE) {
- val pos1 = in.skipToken();
- if (in.token == IDENTIFIER && in.name == nme.STAR) {
- in.nextToken();
- t = atPos(pos) {
- Typed(t, atPos(pos1) { Ident(nme.WILDCARD_STAR.toTypeName) })
- }
- } else {
- syntaxError(in.currentPos, "`*' expected", true);
- }
- } else {
- t = atPos(pos) { Typed(t, type1()) }
- }
- } else if (in.token == MATCH) {
+ val finalizer =
+ if (in.token == FINALLY) { in.nextToken(); expr() }
+ else EmptyTree;
+ Try(body, catches, finalizer)
+ }
+ case WHILE =>
+ val lname: Name = unit.fresh.newName("label$");
+ val pos = in.skipToken();
+ accept(LPAREN);
+ val cond = expr();
+ accept(RPAREN);
+ val body = expr();
+ atPos(pos) { makeWhile(lname, cond, body) }
+ case DO =>
+ val lname: Name = unit.fresh.newName("label$");
+ val pos = in.skipToken();
+ val body = expr();
+ if (in.token == SEMI) in.nextToken();
+ accept(WHILE);
+ accept(LPAREN);
+ val cond = expr();
+ accept(RPAREN);
+ atPos(pos) { makeDoWhile(lname, body, cond) }
+ case FOR =>
+ atPos(in.skipToken()) {
+ val startToken = in.token;
+ accept(if (startToken == LBRACE) LBRACE else LPAREN);
+ val enums = enumerators();
+ accept(if (startToken == LBRACE) RBRACE else RPAREN);
+ if (in.token == YIELD) {
+ in.nextToken(); makeForYield(enums, expr())
+ } else makeFor(enums, expr())
+ }
+ case RETURN =>
+ atPos(in.skipToken()) {
+ Return(if (isExprIntro) expr() else Literal(()))
+ }
+ case THROW =>
+ atPos(in.skipToken()) {
+ Throw(expr())
+ }
+ case DOT =>
+ atPos(in.skipToken()) {
+ if (in.token == IDENTIFIER) makeClosure(simpleExpr())
+ else { syntaxError("identifier expected", true); errorTermTree }
+ }
+ case _ =>
+ var t = postfixExpr();
+ if (in.token == EQUALS) {
+ t match {
+ case Ident(_) | Select(_, _) | Apply(_, _) =>
+ t = atPos(in.skipToken()) { makeAssign(t, expr()) }
+ case _ =>
+ }
+ } else if (in.token == COLON) {
+ val pos = in.skipToken();
+ if (isArgument && in.token == USCORE) {
+ val pos1 = in.skipToken();
+ if (in.token == IDENTIFIER && in.name == nme.STAR) {
+ in.nextToken();
+ t = atPos(pos) {
+ Typed(t, atPos(pos1) { Ident(nme.WILDCARD_STAR.toTypeName) })
+ }
+ } else {
+ syntaxError(in.currentPos, "`*' expected", true);
+ }
+ } else {
+ t = atPos(pos) { Typed(t, type1()) }
+ }
+ } else if (in.token == MATCH) {
t = atPos(in.skipToken()) {
accept(LBRACE);
val cases = caseClauses();
@@ -698,13 +691,12 @@ import Tokens._;
Match(t, cases): Tree
}
}
- if (in.token == ARROW) {
- t = atPos(in.skipToken()) {
- Function(convertToParams(t), if (isInBlock) block() else expr())
- }
- }
- t
- }
+ if (in.token == ARROW) {
+ t = atPos(in.skipToken()) {
+ Function(convertToParams(t), if (isInBlock) block() else expr())
+ }
+ }
+ t
}
/** PostfixExpr ::= [`.'] InfixExpr [Id]
@@ -714,12 +706,13 @@ import Tokens._;
def postfixExpr(): Tree = {
val base = opstack;
var top = prefixExpr();
- while (in.token == IDENTIFIER) {
+ while (in.token == IDENTIFIER && !in.isStatSep) {
+ //System.out.println("operator: " + in.name + " " + in.afterLineEnd + " " + in.lastPos + " " + in.in.lineStartPos + " " + in.currentPos);//DEBUG
top = reduceStack(
true, base, top, precedence(in.name), treeInfo.isLeftAssoc(in.name));
opstack = OpInfo(top, in.name, in.currentPos) :: opstack;
ident();
- if (isExprIntro) {
+ if (isExprIntro && !in.isStatSep) {
top = prefixExpr();
} else {
val topinfo = opstack.head;
@@ -800,14 +793,14 @@ import Tokens._;
t = atPos(in.skipToken()) {
val parents = new ListBuffer[Tree] + simpleType();
val argss = new ListBuffer[List[Tree]];
- if (in.token == LPAREN)
- do { argss += argumentExprs() } while (in.token == LPAREN)
+ if (in.token == LPAREN && !in.isStatSep)
+ do { argss += argumentExprs() } while (in.token == LPAREN && !in.isStatSep)
else argss += List();
while (in.token == WITH) {
in.nextToken();
parents += simpleType()
}
- val stats = if (in.token == LBRACE) templateBody() else List();
+ val stats = if (in.token == LBRACE && !in.isStatSep) templateBody() else List();
makeNew(parents.toList, stats, argss.toList)
}
isNew = true
@@ -819,14 +812,14 @@ import Tokens._;
in.token match {
case DOT =>
t = atPos(in.skipToken()) { Select(t, ident()) }
- case LBRACKET =>
+ case LBRACKET if (!in.isStatSep) =>
t match {
case Ident(_) | Select(_, _) =>
t = atPos(in.currentPos) { TypeApply(t, typeArgs()) }
case _ =>
return t;
}
- case LPAREN | LBRACE if (!isNew) =>
+ case LPAREN | LBRACE if (!isNew && !in.isStatSep) =>
t = atPos(in.currentPos) { Apply(t, argumentExprs()) }
case _ =>
return t
@@ -891,8 +884,8 @@ import Tokens._;
*/
def enumerators(): List[Tree] = {
val enums = new ListBuffer[Tree] + generator();
- while (in.token == SEMI) {
- in.nextToken();
+ while (in.isStatSep) {
+ if (in.token == SEMI) in.nextToken();
enums += (if (in.token == VAL) generator() else expr())
}
enums.toList
@@ -1163,7 +1156,7 @@ import Tokens._;
}
val vds = new ListBuffer[List[ValDef]];
val pos = in.currentPos;
- while (implicitmod == 0 && in.token == LPAREN) {
+ while (implicitmod == 0 && in.token == LPAREN && !in.isStatSep) {
in.nextToken();
vds += paramClause();
accept(RPAREN);
@@ -1288,7 +1281,7 @@ import Tokens._;
if (in.token == USCORE) {
in.nextToken();
Import(t, List(Pair(nme.WILDCARD, null)))
- } else if (in.token == LBRACE) {
+ } else if (in.token == LBRACE && !in.isStatSep) {
Import(t, importSelectors())
} else {
val name = ident();
@@ -1386,8 +1379,7 @@ import Tokens._;
p
else
Typed(p, tp),
- rhs.duplicate)
- map atPos(p.pos);
+ rhs.duplicate) map atPos(p.pos);
if (rhs == EmptyTree) {
trees match {
case List(ValDef(_, _, _, EmptyTree)) =>
@@ -1464,7 +1456,7 @@ import Tokens._;
val statlist = new ListBuffer[Tree];
statlist += selfInvocation();
val stats =
- if (in.token == SEMI) { in.nextToken(); blockStatSeq(statlist) }
+ if (in.isStatSep) { in.nextToken(); blockStatSeq(statlist) }
else statlist.toList;
accept(RBRACE);
makeBlock(stats)
@@ -1482,19 +1474,18 @@ import Tokens._;
def typeDefOrDcl(mods: int): Tree =
atPos(in.currentPos) {
val name = ident().toTypeName;
- in.token match {
- case LBRACKET =>
- val tparams = typeParamClauseOpt(name, null);
- accept(EQUALS);
- AliasTypeDef(mods, name, tparams, typ())
- case EQUALS =>
- in.nextToken();
- AliasTypeDef(mods, name, List(), typ())
- case SUPERTYPE | SUBTYPE | SEMI | COMMA | RBRACE =>
- typeBounds(mods | Flags.DEFERRED, name)
- case _ =>
- syntaxError("`=', `>:', or `<:' expected", true);
- EmptyTree
+ if (in.token == LBRACKET) {
+ val tparams = typeParamClauseOpt(name, null);
+ accept(EQUALS);
+ AliasTypeDef(mods, name, tparams, typ())
+ } else if (in.token == EQUALS) {
+ in.nextToken();
+ AliasTypeDef(mods, name, List(), typ())
+ } else if (in.token == SUPERTYPE || in.token == SUBTYPE || in.token == COMMA || in.token == RBRACE || in.isStatSep) {
+ typeBounds(mods | Flags.DEFERRED, name)
+ } else {
+ syntaxError("`=', `>:', or `<:' expected", true);
+ EmptyTree
}
}
@@ -1553,7 +1544,7 @@ import Tokens._;
val parent = simpleType();
// System.err.println("classTempl: " + parent);
parents += parent;
- if (in.token == LPAREN)
+ if (in.token == LPAREN && !in.isStatSep)
do { argss += argumentExprs() } while (in.token == LPAREN)
else argss += List();
while (in.token == WITH) {
@@ -1569,7 +1560,7 @@ import Tokens._;
if (in.token == LBRACE) {
templateBody()
} else {
- if (!(in.token == SEMI || in.token == COMMA || in.token == RBRACE))
+ if (!(in.token == COMMA || in.token == RBRACE | in.isStatSep))
syntaxError("`extends' or `{' expected", true);
List()
}
@@ -1640,7 +1631,7 @@ import Tokens._;
} else if (in.token != SEMI) {
syntaxError("illegal start of class or object definition", true);
}
- if (in.token != RBRACE && in.token != EOF) accept(SEMI);
+ if (in.token != RBRACE && in.token != EOF) acceptStatSep();
}
stats.toList
}
@@ -1666,7 +1657,7 @@ import Tokens._;
} else if (in.token != SEMI) {
syntaxError("illegal start of definition", true);
}
- if (in.token != RBRACE) accept(SEMI);
+ if (in.token != RBRACE) acceptStatSep();
}
stats.toList
}
@@ -1726,7 +1717,7 @@ import Tokens._;
} else if (in.token != SEMI) {
syntaxError("illegal start of declaration", true);
}
- if (in.token != RBRACE) accept(SEMI);
+ if (in.token != RBRACE) acceptStatSep();
}
stats.toList
}
@@ -1742,19 +1733,19 @@ import Tokens._;
while ((in.token != RBRACE) && (in.token != EOF) && (in.token != CASE)) {
if (in.token == IMPORT) {
stats ++= importClause();
- accept(SEMI);
+ acceptStatSep();
} else if (isExprIntro) {
stats += expr(false, true);
- if (in.token != RBRACE && in.token != CASE) accept(SEMI);
+ if (in.token != RBRACE && in.token != CASE) acceptStatSep();
} else if (isDefIntro) {
stats ++= defOrDcl(0);
- accept(SEMI);
+ acceptStatSep();
if (in.token == RBRACE || in.token == CASE) {
stats += Literal(()).setPos(in.currentPos)
}
} else if (isLocalModifier) {
stats += tmplDef(localClassModifiers());
- accept(SEMI);
+ acceptStatSep();
if (in.token == RBRACE || in.token == CASE) {
stats += Literal(()).setPos(in.currentPos)
}
@@ -1776,8 +1767,8 @@ import Tokens._;
if (in.token == PACKAGE) {
in.nextToken();
val pkg = qualId();
- if (in.token == SEMI) {
- in.nextToken();
+ if (in.isStatSep) {
+ if (in.token == SEMI) in.nextToken();
makePackaging(pkg, topStatSeq())
} else {
accept(LBRACE);
diff --git a/sources/scala/tools/nsc/ast/parser/Scanners.scala b/sources/scala/tools/nsc/ast/parser/Scanners.scala
index 57f491cab5..b2ba581051 100755
--- a/sources/scala/tools/nsc/ast/parser/Scanners.scala
+++ b/sources/scala/tools/nsc/ast/parser/Scanners.scala
@@ -23,6 +23,9 @@ import scala.tools.nsc.util.CharArrayReader;
/** the token's position */
protected var pos: int = 0;
+ /** the first character position after the previous token */
+ var lastPos: int = 0;
+
def currentPos = pos - 1;
@@ -35,6 +38,7 @@ import scala.tools.nsc.util.CharArrayReader;
def copyFrom(td: TokenData) = {
this.token = td.token;
this.pos = td.pos;
+ this.lastPos = td.lastPos;
this.name = td.name;
this.base = td.base;
}
@@ -82,25 +86,26 @@ import scala.tools.nsc.util.CharArrayReader;
val next = new TokenData();
val prev = new TokenData();
- /** the first character position after the previous token
- */
- var lastpos = 0;
-
/** the last error position
*/
var errpos = -1;
+ /** a stack which indicates whether line-ends can be statement separators
+ */
+ var statSepModes: List[boolean] = List();
+
// Get next token ------------------------------------------------------------
/** read next token and return last position
*/
def skipToken(): int = {
val p = pos; nextToken();
- // XXX: account for off by one error
+ // XXX: account for off by one error //???
p - 1
}
def nextToken(): unit = {
+/*
if (token == RBRACE) {
val prevpos = pos;
fetchToken();
@@ -117,6 +122,16 @@ import scala.tools.nsc.util.CharArrayReader;
}
}
} else {
+*/
+ if (token == LPAREN || token == LBRACKET)
+ statSepModes = false :: statSepModes
+ else if (token == LBRACE)
+ statSepModes = true :: statSepModes
+ else if ((token == RPAREN || token == RBRACKET) && !statSepModes.isEmpty && !statSepModes.head)
+ statSepModes = statSepModes.tail
+ else if (token == RBRACE && !statSepModes.isEmpty && statSepModes.head)
+ statSepModes = statSepModes.tail;
+
if (next.token == EMPTY) {
fetchToken();
} else {
@@ -128,8 +143,10 @@ import scala.tools.nsc.util.CharArrayReader;
fetchToken();
if (token == CLASS) {
token = CASECLASS;
+ lastPos = prev.lastPos;
} else if (token == OBJECT) {
token = CASEOBJECT;
+ lastPos = prev.lastPos;
} else {
next.copyFrom(this);
this.copyFrom(prev);
@@ -143,14 +160,14 @@ import scala.tools.nsc.util.CharArrayReader;
}
}
// Console.println("<" + this + ">");//DEBUG
- }
+// }
}
/** read next token
*/
private def fetchToken(): unit = {
if (token == EOF) return;
- lastpos = in.cpos; // Position.encode(in.cline, in.ccol);
+ lastPos = in.cpos - 1; // Position.encode(in.cline, in.ccol);
//var index = bp;
while (true) {
in.ch match {
@@ -367,18 +384,41 @@ import scala.tools.nsc.util.CharArrayReader;
false
}
+ def isStatSep: boolean = (
+ (token == SEMI) ||
+ afterLineEnd && (statSepModes.isEmpty || statSepModes.head) && inFirstStat(token)
+ );
+
+ def afterLineEnd: boolean = (
+ lastPos < in.lineStartPos &&
+ (in.lineStartPos <= pos ||
+ lastPos < in.lastLineStartPos && in.lastLineStartPos <= pos)
+ );
+
+ def inFirstStat(token: int) = token match {
+ case ELSE | EXTENDS | WITH | YIELD | CATCH | FINALLY |
+ COMMA | SEMI | DOT | COLON | EQUALS | ARROW |
+ LARROW | SUBTYPE | VIEWBOUND | SUPERTYPE | HASH | AT |
+ RPAREN | RBRACKET | RBRACE =>
+ false
+ case _ =>
+ true
+ }
+
// Identifiers ---------------------------------------------------------------
- def isIdentStart(c: char): boolean =
+ def isIdentStart(c: char): boolean = (
('A' <= c && c <= 'Z') ||
('a' <= c && c <= 'a') ||
(c == '_') || (c == '$') ||
- Character.isUnicodeIdentifierStart(c);
+ Character.isUnicodeIdentifierStart(c)
+ );
- def isIdentPart(c: char) =
+ def isIdentPart(c: char) = (
isIdentStart(c) ||
('0' <= c && c <= '9') ||
- Character.isUnicodeIdentifierPart(c);
+ Character.isUnicodeIdentifierPart(c)
+ );
def isSpecial(c: char) = {
val chtp = Character.getType(c);
diff --git a/sources/scala/tools/nsc/backend/icode/BasicBlocks.scala b/sources/scala/tools/nsc/backend/icode/BasicBlocks.scala
index 77877c1dc0..858341a635 100644
--- a/sources/scala/tools/nsc/backend/icode/BasicBlocks.scala
+++ b/sources/scala/tools/nsc/backend/icode/BasicBlocks.scala
@@ -237,10 +237,11 @@ trait BasicBlocks: ICodes {
preds
}
- override def equals(other: Any): Boolean =
+ override def equals(other: Any): Boolean = (
other.isInstanceOf[BasicBlock] &&
other.asInstanceOf[BasicBlock].label == label &&
- other.asInstanceOf[BasicBlock].code == code;
+ other.asInstanceOf[BasicBlock].code == code
+ );
// Instead of it, rather use a printer
def print() : unit = print(System.out);
diff --git a/sources/scala/tools/nsc/backend/icode/GenICode.scala b/sources/scala/tools/nsc/backend/icode/GenICode.scala
index 15be2ae816..6f3047a9c1 100644
--- a/sources/scala/tools/nsc/backend/icode/GenICode.scala
+++ b/sources/scala/tools/nsc/backend/icode/GenICode.scala
@@ -1369,10 +1369,11 @@ abstract class GenICode extends SubComponent {
* It is considered to be so if all value parameters of the label are the
* same as the value parameters of the current method.
*/
- def isTailCallLabel(tree: LabelDef, ctx: Context) =
+ def isTailCallLabel(tree: LabelDef, ctx: Context) = (
tree.params.length == ctx.defdef.vparamss.head &&
List.forall2(tree.params, ctx.defdef.vparamss.head)
{ (x, y) => x.symbol == y.symbol }
+ );
/////////////////////// Context ////////////////////////////////
diff --git a/sources/scala/tools/nsc/backend/icode/Members.scala b/sources/scala/tools/nsc/backend/icode/Members.scala
index 35fe48bcbe..f12c4ef62c 100644
--- a/sources/scala/tools/nsc/backend/icode/Members.scala
+++ b/sources/scala/tools/nsc/backend/icode/Members.scala
@@ -218,9 +218,10 @@ trait Members: ICodes {
exh = e :: exh;
/** Is this method deferred ('abstract' in Java sense) */
- def isDeferred =
+ def isDeferred = (
symbol.hasFlag(Flags.DEFERRED) ||
- symbol.owner.hasFlag(Flags.INTERFACE);
+ symbol.owner.hasFlag(Flags.INTERFACE)
+ );
override def toString() = symbol.fullNameString;
}
@@ -229,9 +230,10 @@ trait Members: ICodes {
class Local(val sym: Symbol, val kind: TypeKind) {
var index: Int = -1;
- override def equals(other: Any): Boolean =
+ override def equals(other: Any): Boolean = (
other.isInstanceOf[Local] &&
- other.asInstanceOf[Local].sym == this.sym;
+ other.asInstanceOf[Local].sym == this.sym
+ );
override def toString(): String = sym.toString();
}
diff --git a/sources/scala/tools/nsc/backend/icode/Opcodes.scala b/sources/scala/tools/nsc/backend/icode/Opcodes.scala
index c7f2a8d709..24eb1132f6 100644
--- a/sources/scala/tools/nsc/backend/icode/Opcodes.scala
+++ b/sources/scala/tools/nsc/backend/icode/Opcodes.scala
@@ -323,8 +323,10 @@ import scala.tools.nsc.util.Position;
{
/** Returns a string representation of this instruction */
- override def toString(): String ="CJUMP (" + kind + ")" +
- cond.toString()+" ? "+successBlock.label+" : "+failureBlock.label;
+ override def toString(): String = (
+ "CJUMP (" + kind + ")" +
+ cond.toString()+" ? "+successBlock.label+" : "+failureBlock.label
+ );
override def consumed = 2;
override def produced = 0;
@@ -340,8 +342,10 @@ import scala.tools.nsc.util.Position;
cond: TestOp,
kind: TypeKind) extends Instruction {
/** Returns a string representation of this instruction */
- override def toString(): String ="CZJUMP (" + kind + ")" +
- cond.toString()+" ? "+successBlock.label+" : "+failureBlock.label;
+ override def toString(): String = (
+ "CZJUMP (" + kind + ")" +
+ cond.toString()+" ? "+successBlock.label+" : "+failureBlock.label
+ );
override def consumed = 1;
override def produced = 0;
diff --git a/sources/scala/tools/nsc/backend/icode/TypeStacks.scala b/sources/scala/tools/nsc/backend/icode/TypeStacks.scala
index c7acd3b908..3bd23ab480 100644
--- a/sources/scala/tools/nsc/backend/icode/TypeStacks.scala
+++ b/sources/scala/tools/nsc/backend/icode/TypeStacks.scala
@@ -61,9 +61,10 @@ trait TypeStacks: ICodes {
* length and each type kind agrees position-wise. Two
* types agree if they are subtypes of one another.
*/
- def agreesWith(other: TypeStack): Boolean =
+ def agreesWith(other: TypeStack): Boolean = (
(types.length == other.types.length) &&
- List.forall2(types, other.types) ((t1, t2) => t1 <:< t2 || t2 <:< t1);
+ List.forall2(types, other.types) ((t1, t2) => t1 <:< t2 || t2 <:< t1)
+ );
def mergeWith(that: TypeStack): TypeStack = {
def merge(a: TypeStack, b: TypeStack): TypeStack = {
diff --git a/sources/scala/tools/nsc/backend/jvm/GenJVM.scala b/sources/scala/tools/nsc/backend/jvm/GenJVM.scala
index 76746f5698..fe37da3e59 100644
--- a/sources/scala/tools/nsc/backend/jvm/GenJVM.scala
+++ b/sources/scala/tools/nsc/backend/jvm/GenJVM.scala
@@ -347,7 +347,7 @@ abstract class GenJVM extends SubComponent {
this.method.exh foreach ((e) => {
ranges(e).sort({ (p1, p2) => p1._1 < p2._1 })
- foreach ((p) => {
+ .foreach ((p) => {
log("Adding exception handler " + e + "at block: " + e.startBlock + " for " + method +
" from: " + p._1 + " to: " + p._2 + " catching: " + e.cls);
jcode.addExceptionHandler(p._1, p._2,
diff --git a/sources/scala/tools/nsc/matching/MatcherLabels.scala b/sources/scala/tools/nsc/matching/MatcherLabels.scala
index d1b8592e3f..15f6eae9b9 100644
--- a/sources/scala/tools/nsc/matching/MatcherLabels.scala
+++ b/sources/scala/tools/nsc/matching/MatcherLabels.scala
@@ -55,8 +55,9 @@ package scala.tools.nsc.matching ;
case Apply( _, _ ) =>
pat2 match {
case Apply( _, _ ) =>
- return treeInfo.methPart/*methSymbol?*/( pat )
- == treeInfo.methPart/*methSymbol*/( pat2 );
+ return
+ (treeInfo.methPart/*methSymbol?*/( pat )
+ == treeInfo.methPart/*methSymbol*/( pat2 ));
}
case _ => false;
}
diff --git a/sources/scala/tools/nsc/matching/PatternMatchers.scala b/sources/scala/tools/nsc/matching/PatternMatchers.scala
index ab74036c9d..7a33023c11 100644
--- a/sources/scala/tools/nsc/matching/PatternMatchers.scala
+++ b/sources/scala/tools/nsc/matching/PatternMatchers.scala
@@ -811,7 +811,7 @@ trait PatternMatchers: (TransMatcher with PatternNodes) extends AnyRef with Patt
var i = guard.length - 1; while(i >= 0) {
val ts:Seq[Tree] = bound(i).asInstanceOf[Array[Tree]];
val temp = currentOwner.newValue(body(i).pos, cunit.fresh.newName("r$"))
- setFlag Flags.SYNTHETIC setInfo resultType;
+ .setFlag(Flags.SYNTHETIC).setInfo(resultType);
var res0: Tree =
//Block(
// List(Assign(Ident(resultVar), body(i))),
diff --git a/sources/scala/tools/nsc/matching/PatternNodes.scala b/sources/scala/tools/nsc/matching/PatternNodes.scala
index c512c8cb68..126f3e2506 100644
--- a/sources/scala/tools/nsc/matching/PatternNodes.scala
+++ b/sources/scala/tools/nsc/matching/PatternNodes.scala
@@ -235,17 +235,17 @@ trait PatternNodes: TransMatcher {
else
sb
case ConstrPat(casted) =>
- val s = "-- " + patNode.getTpe().symbol.name +
- "(" + patNode.getTpe() + ", " + casted + ") -> ";
+ val s = ("-- " + patNode.getTpe().symbol.name +
+ "(" + patNode.getTpe() + ", " + casted + ") -> ");
val nindent = newIndent(s);
sb.append(nindent + s).append('\n');
patNode.and.print(nindent, sb);
cont;
case SequencePat( casted, plen ) =>
- val s = "-- " + patNode.getTpe().symbol.name + "(" +
- patNode.getTpe() +
- ", " + casted + ", " + plen + ") -> ";
+ val s = ("-- " + patNode.getTpe().symbol.name + "(" +
+ patNode.getTpe() +
+ ", " + casted + ", " + plen + ") -> ");
val nindent = newIndent(s);
sb.append(indent + s).append('\n');
patNode.and.print(nindent, sb);
diff --git a/sources/scala/tools/nsc/matching/RightTracers.scala b/sources/scala/tools/nsc/matching/RightTracers.scala
index 81dd8d6ac3..f0daf20fed 100644
--- a/sources/scala/tools/nsc/matching/RightTracers.scala
+++ b/sources/scala/tools/nsc/matching/RightTracers.scala
@@ -462,7 +462,7 @@ abstract class RightTracerInScala extends Autom2Scala {
var stms: scala.List[Tree] = scala.List();
val loopbody = code_body_NEW();
- stms =
+ stms = (
scala.List(
ValDef( iterSym, trace ),
ValDef( stateSym, Literal( 0 ))
@@ -475,7 +475,7 @@ abstract class RightTracerInScala extends Autom2Scala {
stateSym
),
loopbody )
- );
+ ));
// bind variables handled by this righttracer
var it = seqVars.iterator();
diff --git a/sources/scala/tools/nsc/symtab/Definitions.scala b/sources/scala/tools/nsc/symtab/Definitions.scala
index f387f2245a..8e64230c53 100755
--- a/sources/scala/tools/nsc/symtab/Definitions.scala
+++ b/sources/scala/tools/nsc/symtab/Definitions.scala
@@ -306,10 +306,10 @@ import Flags._;
AnyRefClass = newAlias(ScalaPackageClass, "AnyRef", ObjectClass.typeConstructor);
AllRefClass = newClass(ScalaPackageClass, "AllRef", List(AnyRefClass.typeConstructor))
- setFlag (ABSTRACT | TRAIT | FINAL);
+ .setFlag(ABSTRACT | TRAIT | FINAL);
AllClass = newClass(ScalaPackageClass, "All", List(AnyClass.typeConstructor))
- setFlag (ABSTRACT | TRAIT | FINAL);
+ .setFlag(ABSTRACT | TRAIT | FINAL);
StringClass = getClass("java.lang.String");
ThrowableClass = getClass("java.lang.Throwable");
diff --git a/sources/scala/tools/nsc/symtab/Flags.scala b/sources/scala/tools/nsc/symtab/Flags.scala
index c21dacda72..36e4fe72f2 100644
--- a/sources/scala/tools/nsc/symtab/Flags.scala
+++ b/sources/scala/tools/nsc/symtab/Flags.scala
@@ -103,8 +103,8 @@ object Flags {
PRIVATE | PROTECTED | ABSTRACT | FINAL | SEALED | OVERRIDE | CASE | IMPLICIT | ABSOVERRIDE;
final val PrintableFlags = // these modifiers appear in TreePrinter output.
- ExplicitFlags | LOCAL | SYNTHETIC | STABLE | CASEACCESSOR | ACCESSOR |
- SUPERACCESSOR | PARAMACCESSOR | BRIDGE | STATIC;
+ (ExplicitFlags | LOCAL | SYNTHETIC | STABLE | CASEACCESSOR | ACCESSOR |
+ SUPERACCESSOR | PARAMACCESSOR | BRIDGE | STATIC);
final val FieldFlags = MUTABLE | CASEACCESSOR | PARAMACCESSOR | STATIC | FINAL;
diff --git a/sources/scala/tools/nsc/symtab/Names.scala b/sources/scala/tools/nsc/symtab/Names.scala
index 5e82e1178e..8ee2272aa7 100755
--- a/sources/scala/tools/nsc/symtab/Names.scala
+++ b/sources/scala/tools/nsc/symtab/Names.scala
@@ -35,10 +35,10 @@ class Names {
*/
private def hashValue(cs: Array[char], offset: int, len: int): int =
if (len > 0)
- len * (41 * 41 * 41) +
- cs(offset) * (41 * 41) +
- cs(offset + len - 1) * 41 +
- cs(offset + (len >> 1));
+ (len * (41 * 41 * 41) +
+ cs(offset) * (41 * 41) +
+ cs(offset + len - 1) * 41 +
+ cs(offset + (len >> 1)))
else 0;
/** is (the ascii representation of) name at given index equal to
@@ -284,9 +284,9 @@ class Names {
}
/** Replace $op_name by corresponding operator symbol */
- def decode: String =
+ def decode: String = (
NameTransformer.decode(toString()) +
- (if (nameDebug && isTypeName) "!" else "");//debug
+ (if (nameDebug && isTypeName) "!" else ""));//debug
}
private class TermName(index: int, len: int, hash: int) extends Name(index, len) {
diff --git a/sources/scala/tools/nsc/symtab/Symbols.scala b/sources/scala/tools/nsc/symtab/Symbols.scala
index dcaa8519c7..9da395f697 100755
--- a/sources/scala/tools/nsc/symtab/Symbols.scala
+++ b/sources/scala/tools/nsc/symtab/Symbols.scala
@@ -185,11 +185,12 @@ import Flags._;
final def needsImplClass: boolean =
isTrait && (!hasFlag(INTERFACE) || hasFlag(lateINTERFACE)) && !isImplClass;
- final def isImplOnly: boolean =
+ final def isImplOnly: boolean = (
hasFlag(PRIVATE) ||
(owner.isImplClass || owner.isTrait) &&
(hasFlag(notPRIVATE | LIFTED) && !hasFlag(ACCESSOR | SUPERACCESSOR) ||
- isConstructor);
+ isConstructor)
+ );
/** Is this symbol a module variable ? */
final def isModuleVar: boolean = isVariable && nme.isModuleVarName(name);
@@ -203,10 +204,11 @@ import Flags._;
isPackageClass || isModuleClass && isStatic;
/** Is this symbol final?*/
- final def isFinal: boolean =
+ final def isFinal: boolean = (
hasFlag(FINAL) ||
isTerm && (
- hasFlag(PRIVATE) || isLocal || owner.isClass && owner.hasFlag(FINAL | MODULE));
+ hasFlag(PRIVATE) || isLocal || owner.isClass && owner.hasFlag(FINAL | MODULE))
+ );
/** Is this symbol a sealed class?*/
final def isSealed: boolean =
@@ -218,10 +220,10 @@ import Flags._;
/** Is this symbol a constant? */
final def isConstant: boolean =
isStable && (tpe match {
- case ConstantType(_) => true
- case PolyType(_, ConstantType(_)) => true
- case MethodType(_, ConstantType(_)) => true
- case _ => false
+ case ConstantType(_) => true
+ case PolyType(_, ConstantType(_)) => true
+ case MethodType(_, ConstantType(_)) => true
+ case _ => false
});
/** Is this class nested in another class or module (not a package)? */
@@ -244,12 +246,13 @@ import Flags._;
/** A a member of class `base' is incomplete if (1) it is declared deferred or
* (2) it is abstract override and its super symbol in `base' is nonexistent or inclomplete.
*/
- final def isIncompleteIn(base: Symbol): boolean =
+ final def isIncompleteIn(base: Symbol): boolean = (
(this hasFlag DEFERRED) ||
(this hasFlag ABSOVERRIDE) && {
val supersym = superSymbol(base);
supersym == NoSymbol || supersym.isIncompleteIn(base)
}
+ );
final def isInitialized: boolean =
validForRun == currentRun;
@@ -435,9 +438,9 @@ import Flags._;
if (sym.isAbstractType) 1 + sym.info.bounds.hi.closure.length
else sym.info.closure.length;
if (this.isType)
- that.isType &&
- {val diff = closureLength(this) - closureLength(that);
- diff > 0 || diff == 0 && this.id < that.id}
+ (that.isType &&
+ { val diff = closureLength(this) - closureLength(that);
+ diff > 0 || diff == 0 && this.id < that.id })
else
that.isType || this.id < that.id;
}
@@ -450,13 +453,14 @@ import Flags._;
owner == that || owner != NoSymbol && (owner isNestedIn that);
/** Is this class symbol a subclass of that symbol? */
- final def isSubClass(that: Symbol): boolean =
+ final def isSubClass(that: Symbol): boolean = (
this == that || this.isError || that.isError ||
info.closurePos(that) >= 0 ||
this == AllClass ||
this == AllRefClass &&
- (that == AnyClass ||
- that != AllClass && (that isSubClass AnyRefClass));
+ (that == AnyClass ||
+ that != AllClass && (that isSubClass AnyRefClass))
+ );
// Overloaded Alternatives ---------------------------------------------------------
diff --git a/sources/scala/tools/nsc/symtab/Types.scala b/sources/scala/tools/nsc/symtab/Types.scala
index dc48b51cd9..f4db96025a 100755
--- a/sources/scala/tools/nsc/symtab/Types.scala
+++ b/sources/scala/tools/nsc/symtab/Types.scala
@@ -215,16 +215,17 @@ import Flags._;
if (util.Statistics.enabled) subtypeCount = subtypeCount + 1;
val startTime = if (util.Statistics.enabled) System.currentTimeMillis() else 0l;
val result =
- (this eq that) ||
- (if (explainSwitch) explain("<", isSubType, this, that) else isSubType(this, that));
+ ((this eq that) ||
+ (if (explainSwitch) explain("<", isSubType, this, that) else isSubType(this, that)));
if (util.Statistics.enabled) subtypeMillis = subtypeMillis + System.currentTimeMillis() - startTime;
result
}
/** Is this type equivalent to that type? */
- def =:=(that: Type): boolean =
+ def =:=(that: Type): boolean = (
(this eq that) ||
- (if (explainSwitch) explain("=", isSameType, this, that) else isSameType(this, that));
+ (if (explainSwitch) explain("=", isSameType, this, that) else isSameType(this, that))
+ );
/** Does this type implement symbol `sym' with same or stronger type? */
def specializes(sym: Symbol): boolean =
@@ -643,12 +644,13 @@ import Flags._;
var mixins = parents.tail;
val sbcs = superclazz.baseClasses;
var bcs = sbcs;
- def isNew(clazz: Symbol): boolean =
+ def isNew(clazz: Symbol): boolean = (
superclazz.closurePos(clazz) < 0 &&
{ var p = bcs;
while ((p ne sbcs) && (p.head != clazz)) p = p.tail;
p eq sbcs
}
+ );
while (!mixins.isEmpty) {
def addMixinBaseClasses(mbcs: List[Symbol]): List[Symbol] =
if (mbcs.isEmpty) bcs
@@ -679,10 +681,11 @@ import Flags._;
override def narrow: Type = symbol.thisType;
- override def toString(): String =
+ override def toString(): String = (
parents.mkString("", " with ", "") +
(if (settings.debug.value || parents.isEmpty || decls.elems != null)
decls.mkString("{", "; ", "}") else "")
+ );
}
/** A class representing intersection types with refinements of the form
@@ -1153,8 +1156,8 @@ import Flags._;
if (infos1 eq infos) syms
else {
val syms1 = syms map (.cloneSymbol);
- List.map2(syms1, infos1)
- ((sym1, info1) => sym1.setInfo(info1.substSym(syms, syms1)))
+ (List.map2(syms1, infos1)
+ ((sym1, info1) => sym1.setInfo(info1.substSym(syms, syms1))))
}
}
}
@@ -1391,9 +1394,10 @@ import Flags._;
}
final def isValidForBaseClasses(p: Phase): boolean = {
- def noChangeInBaseClasses(it: InfoTransformer, limit: Phase#Id): boolean =
+ def noChangeInBaseClasses(it: InfoTransformer, limit: Phase#Id): boolean = (
it.pid >= limit ||
- !it.changesBaseClasses && noChangeInBaseClasses(it.next, limit);
+ !it.changesBaseClasses && noChangeInBaseClasses(it.next, limit)
+ );
p != null && phaseWithId(p.id) == p && {
if (phase.id > p.id) noChangeInBaseClasses(infoTransformers.nextFrom(p.id), phase.id)
else noChangeInBaseClasses(infoTransformers.nextFrom(phase.id), p.id)
@@ -1445,10 +1449,10 @@ import Flags._;
res1 =:= res2 &&
tp1.isInstanceOf[ImplicitMethodType] == tp2.isInstanceOf[ImplicitMethodType]
case Pair(PolyType(tparams1, res1), PolyType(tparams2, res2)) =>
- tparams1.length == tparams2.length &&
- List.forall2(tparams1, tparams2)
- ((p1, p2) => p1.info =:= p2.info.substSym(tparams2, tparams1)) &&
- res1 =:= res2.substSym(tparams2, tparams1)
+ (tparams1.length == tparams2.length &&
+ List.forall2(tparams1, tparams2)
+ ((p1, p2) => p1.info =:= p2.info.substSym(tparams2, tparams1)) &&
+ res1 =:= res2.substSym(tparams2, tparams1))
case Pair(TypeBounds(lo1, hi1), TypeBounds(lo2, hi2)) =>
lo1 =:= lo2 && hi1 =:= hi2
case Pair(TypeVar(_, constr1), _) =>
@@ -1469,9 +1473,10 @@ import Flags._;
}
/** Are tps1 and tps2 lists of pairwise equivalent types? */
- def isSameTypes(tps1: List[Type], tps2: List[Type]): boolean =
+ def isSameTypes(tps1: List[Type], tps2: List[Type]): boolean = (
tps1.length == tps2.length &&
- List.forall2(tps1, tps2)((tp1, tp2) => tp1 =:= tp2);
+ List.forall2(tps1, tps2)((tp1, tp2) => tp1 =:= tp2)
+ );
var subtypecount = 0;
def isSubType(tp1: Type, tp2: Type): boolean = {
@@ -1504,37 +1509,36 @@ import Flags._;
case Pair(TypeRef(pre1, sym1, args1), TypeRef(pre2, sym2, args2)) =>
//System.out.println("isSubType " + tp1 + " " + tp2);//DEBUG
def isSubArgs(tps1: List[Type], tps2: List[Type],
- tparams: List[Symbol]): boolean = {
+ tparams: List[Symbol]): boolean = (
tps1.isEmpty && tps2.isEmpty
||
!tps1.isEmpty && !tps2.isEmpty &&
(tparams.head.hasFlag(COVARIANT) || (tps2.head <:< tps1.head)) &&
(tparams.head.hasFlag(CONTRAVARIANT) || tps1.head <:< tps2.head) &&
isSubArgs(tps1.tail, tps2.tail, tparams.tail)
- }
- sym1 == sym2 && (pre1 <:< pre2) &&
- isSubArgs(args1, args2, sym1.typeParams)
- ||
- sym1.isAbstractType && !(tp1 =:= tp1.bounds.hi) && (tp1.bounds.hi <:< tp2)
- ||
- sym2.isAbstractType && !(tp2 =:= tp2.bounds.lo) && (tp1 <:< tp2.bounds.lo)
- ||
- sym2.isClass &&
- ({ val base = tp1 baseType sym2; !(base eq tp1) && (base <:< tp2) })
- ||
- sym1 == AllClass
- ||
- sym1 == AllRefClass && sym2 != AllClass && tp2 <:< AnyRefClass.tpe
+ );
+ (sym1 == sym2 && (pre1 <:< pre2) && isSubArgs(args1, args2, sym1.typeParams)
+ ||
+ sym1.isAbstractType && !(tp1 =:= tp1.bounds.hi) && (tp1.bounds.hi <:< tp2)
+ ||
+ sym2.isAbstractType && !(tp2 =:= tp2.bounds.lo) && (tp1 <:< tp2.bounds.lo)
+ ||
+ sym2.isClass &&
+ ({ val base = tp1 baseType sym2; !(base eq tp1) && (base <:< tp2) })
+ ||
+ sym1 == AllClass
+ ||
+ sym1 == AllRefClass && sym2 != AllClass && tp2 <:< AnyRefClass.tpe)
case Pair(MethodType(pts1, res1), MethodType(pts2, res2)) =>
- pts1.length == pts2.length &&
- matchingParams(pts1, pts2, tp2.isInstanceOf[JavaMethodType]) &&
- (res1 <:< res2) &&
- tp1.isInstanceOf[ImplicitMethodType] == tp2.isInstanceOf[ImplicitMethodType]
+ (pts1.length == pts2.length &&
+ matchingParams(pts1, pts2, tp2.isInstanceOf[JavaMethodType]) &&
+ (res1 <:< res2) &&
+ tp1.isInstanceOf[ImplicitMethodType] == tp2.isInstanceOf[ImplicitMethodType])
case Pair(PolyType(tparams1, res1), PolyType(tparams2, res2)) =>
- tparams1.length == tparams2.length &&
- List.forall2(tparams1, tparams2)
- ((p1, p2) => p2.info.substSym(tparams2, tparams1) <:< p1.info) &&
- res1 <:< res2.substSym(tparams2, tparams1)
+ (tparams1.length == tparams2.length &&
+ List.forall2(tparams1, tparams2)
+ ((p1, p2) => p2.info.substSym(tparams2, tparams1) <:< p1.info) &&
+ res1 <:< res2.substSym(tparams2, tparams1))
case Pair(TypeBounds(lo1, hi1), TypeBounds(lo2, hi2)) =>
lo2 <:< lo1 && hi1 <:< hi2
case Pair(_, TypeVar(_, constr2)) =>
@@ -1557,9 +1561,9 @@ import Flags._;
case Pair(ConstantType(_), _) => tp1.singleDeref <:< tp2
case Pair(TypeRef(pre1, sym1, args1), _) =>
- sym1 == AllClass && tp2 <:< AnyClass.tpe
- ||
- sym1 == AllRefClass && tp2.symbol != AllClass && tp2 <:< AnyRefClass.tpe
+ (sym1 == AllClass && tp2 <:< AnyClass.tpe
+ ||
+ sym1 == AllRefClass && tp2.symbol != AllClass && tp2 <:< AnyRefClass.tpe)
case _ =>
false
}
@@ -1567,39 +1571,41 @@ import Flags._;
/** Are tps1 and tps2 lists of equal length such that all elements
* of tps1 conform to corresponding elements of tps2? */
- def isSubTypes(tps1: List[Type], tps2: List[Type]): boolean =
+ def isSubTypes(tps1: List[Type], tps2: List[Type]): boolean = (
tps1.length == tps2.length &&
- List.forall2(tps1, tps2)((tp1, tp2) => tp1 <:< tp2);
+ List.forall2(tps1, tps2)((tp1, tp2) => tp1 <:< tp2)
+ );
/** Does type `tp' implement symbol `sym' with same or stronger type?
* Exact only if `sym' is a member of some refinement type, otherwise
* we might return false negatives */
- def specializesSym(tp: Type, sym: Symbol): boolean =
+ def specializesSym(tp: Type, sym: Symbol): boolean = (
tp.symbol == AllClass ||
tp.symbol == AllRefClass && (sym.owner isSubClass ObjectClass) ||
(tp.nonPrivateMember(sym.name).alternatives exists
- (alt => sym == alt || specializesSym(tp.narrow, alt, sym.owner.thisType, sym)));
+ (alt => sym == alt || specializesSym(tp.narrow, alt, sym.owner.thisType, sym)))
+ );
/** Does member `sym1' of `tp1' have a stronger type than member `sym2' of `tp2'? */
private def specializesSym(tp1: Type, sym1: Symbol, tp2: Type, sym2: Symbol): boolean = {
val info1 = tp1.memberInfo(sym1);
val info2 = tp2.memberInfo(sym2).substThis(tp2.symbol, tp1);
- sym2.isTerm &&
- info1 <:< info2 ||
- sym2.isAbstractType &&
- (info2.bounds containsType info1) ||
- sym2.isAliasType &&
- tp2.memberType(sym2) =:= tp1.memberType(sym1)
+ (sym2.isTerm &&
+ info1 <:< info2 ||
+ sym2.isAbstractType &&
+ (info2.bounds containsType info1) ||
+ sym2.isAliasType &&
+ tp2.memberType(sym2) =:= tp1.memberType(sym1))
}
/** A function implementing tp1 matches tp2 */
private def matchesType(tp1: Type, tp2: Type): boolean = Pair(tp1, tp2) match {
case Pair(MethodType(pts1, res1), MethodType(pts2, res2)) =>
- matchingParams(pts1, pts2, tp2.isInstanceOf[JavaMethodType]) && (res1 matches res2) &&
- tp1.isInstanceOf[ImplicitMethodType] == tp2.isInstanceOf[ImplicitMethodType]
+ (matchingParams(pts1, pts2, tp2.isInstanceOf[JavaMethodType]) && (res1 matches res2) &&
+ tp1.isInstanceOf[ImplicitMethodType] == tp2.isInstanceOf[ImplicitMethodType])
case Pair(PolyType(tparams1, res1), PolyType(tparams2, res2)) =>
- tparams1.length == tparams2.length &&
- (res1 matches res2.substSym(tparams2, tparams1))
+ (tparams1.length == tparams2.length &&
+ (res1 matches res2.substSym(tparams2, tparams1)))
case Pair(PolyType(List(), rtp1), _) => matchesType(rtp1, tp2)
case Pair(_, PolyType(List(), rtp2)) => matchesType(tp1, rtp2)
case Pair(MethodType(_, _), _) => false
@@ -1611,10 +1617,11 @@ import Flags._;
}
/** Are tps1 and tps2 lists of pairwise equivalent types? */
- private def matchingParams(tps1: List[Type], tps2: List[Type], tps2isJava: boolean): boolean =
+ private def matchingParams(tps1: List[Type], tps2: List[Type], tps2isJava: boolean): boolean = (
tps1.length == tps2.length &&
List.forall2(tps1, tps2)((tp1, tp2) =>
- (tp1 =:= tp2) || tps2isJava & tp1.symbol == ObjectClass && tp2.symbol == AnyClass);
+ (tp1 =:= tp2) || tps2isJava & tp1.symbol == ObjectClass && tp2.symbol == AnyClass)
+ );
/** Prepend type `tp' to closure `cl' */
private def addClosure(tp: Type, cl: Array[Type]): Array[Type] = {
@@ -1789,8 +1796,9 @@ import Flags._;
sym.tpe matches prototp.substThis(lubThisType.symbol, t)));
if (syms contains NoSymbol) NoSymbol
else {
- val symtypes = List.map2(narrowts, syms)
- ((t, sym) => t.memberInfo(sym).substThis(t.symbol, lubThisType));
+ val symtypes =
+ (List.map2(narrowts, syms)
+ ((t, sym) => t.memberInfo(sym).substThis(t.symbol, lubThisType)));
if (settings.debug.value) log("common symbols: " + syms + ":" + symtypes);//debug
if (proto.isTerm)
proto.cloneSymbol.setInfo(lub(symtypes))
@@ -1939,11 +1947,11 @@ import Flags._;
val pre = if (variance == 1) lub(pres) else glb(pres);
val argss = tps map (.typeArgs);
val args =
- List.map2(sym.typeParams, List.transpose(argss))
- ((tparam, as) =>
- if (tparam.variance == variance) lub(as)
- else if (tparam.variance == -variance) glb(as)
- else NoType);
+ (List.map2(sym.typeParams, List.transpose(argss))
+ ((tparam, as) =>
+ if (tparam.variance == variance) lub(as)
+ else if (tparam.variance == -variance) glb(as)
+ else NoType));
try {
if (args contains NoType) None
else Some(typeRef(pre, sym, args))
diff --git a/sources/scala/tools/nsc/symtab/classfile/ClassfileParser.scala b/sources/scala/tools/nsc/symtab/classfile/ClassfileParser.scala
index f64627428c..e7585e933e 100755
--- a/sources/scala/tools/nsc/symtab/classfile/ClassfileParser.scala
+++ b/sources/scala/tools/nsc/symtab/classfile/ClassfileParser.scala
@@ -235,9 +235,9 @@ abstract class ClassfileParser {
throw new IOException("class file '" + in.file + "' contains wrong " + clazz);
val superType = pool.getSuperClass(in.nextChar()).tpe;
val ifaceCount = in.nextChar();
- val parents = superType ::
+ val parents = (superType ::
(for (val i <- List.range(0, ifaceCount))
- yield pool.getSuperClass(in.nextChar()).tpe);
+ yield pool.getSuperClass(in.nextChar()).tpe));
instanceDefs = new Scope();
staticDefs = new Scope();
val classInfo = ClassInfoType(parents, instanceDefs, clazz);
@@ -263,9 +263,9 @@ abstract class ClassfileParser {
for (val i <- Iterator.range(0, methodCount)) parseMethod();
if (instanceDefs.lookup(nme.CONSTRUCTOR) == NoSymbol && (sflags & INTERFACE) == 0) {
//System.out.println("adding constructor to " + clazz);//DEBUG
- instanceDefs enter
+ instanceDefs.enter(
clazz.newConstructor(Position.NOPOS)
- .setFlag(clazz.flags & ConstrFlags).setInfo(MethodType(List(), clazz.tpe));
+ .setFlag(clazz.flags & ConstrFlags).setInfo(MethodType(List(), clazz.tpe)));
}
}
}
diff --git a/sources/scala/tools/nsc/symtab/classfile/Pickler.scala b/sources/scala/tools/nsc/symtab/classfile/Pickler.scala
index 6eb2196d53..5ecd30fcd1 100755
--- a/sources/scala/tools/nsc/symtab/classfile/Pickler.scala
+++ b/sources/scala/tools/nsc/symtab/classfile/Pickler.scala
@@ -54,10 +54,11 @@ abstract class Pickler extends SubComponent {
private val index = new HashMap[AnyRef, int];
/** Is root in symbol.owner*? */
- private def isLocal(sym: Symbol): boolean =
+ private def isLocal(sym: Symbol): boolean = (
sym.isRefinementClass ||
sym.name.toTermName == rootName && sym.owner == rootOwner ||
- sym != NoSymbol && isLocal(sym.owner);
+ sym != NoSymbol && isLocal(sym.owner)
+ );
// Phase 1 methods: Populate entries/index ------------------------------------
diff --git a/sources/scala/tools/nsc/transform/AddInterfaces.scala b/sources/scala/tools/nsc/transform/AddInterfaces.scala
index 5f8fd1b91c..0ddcd4d33d 100755
--- a/sources/scala/tools/nsc/transform/AddInterfaces.scala
+++ b/sources/scala/tools/nsc/transform/AddInterfaces.scala
@@ -30,15 +30,16 @@ abstract class AddInterfaces extends InfoTransform {
super.newPhase(prev)
}
- private def needsImplMethod(sym: Symbol): boolean =
+ private def needsImplMethod(sym: Symbol): boolean = (
sym.isMethod && isInterfaceMember(sym) &&
- (!(sym hasFlag (DEFERRED | SUPERACCESSOR)) || (sym hasFlag lateDEFERRED));
+ (!(sym hasFlag (DEFERRED | SUPERACCESSOR)) || (sym hasFlag lateDEFERRED))
+ );
private def isInterfaceMember(sym: Symbol): boolean = {
sym.info; // to set lateMETHOD flag if necessary
- sym.isType ||
- sym.isMethod && !(sym hasFlag (PRIVATE | BRIDGE | LABEL)) &&
- !sym.isConstructor && !sym.isImplOnly
+ (sym.isType ||
+ sym.isMethod && !(sym hasFlag (PRIVATE | BRIDGE | LABEL)) &&
+ !sym.isConstructor && !sym.isImplOnly)
}
def implClass(iface: Symbol): Symbol = implClassMap.get(iface) match {
@@ -165,8 +166,8 @@ abstract class AddInterfaces extends InfoTransform {
private def implTemplate(clazz: Symbol, templ: Template): Template = atPos(templ.pos){
val templ1 = Template(templ.parents, templ.body map implMemberDef)
- setPos templ.pos
- setSymbol clazz.newLocalDummy(templ.pos);
+ .setPos(templ.pos)
+ .setSymbol(clazz.newLocalDummy(templ.pos));
new ChangeOwnerTraverser(templ.symbol.owner, clazz)(
new ChangeOwnerTraverser(templ.symbol, templ1.symbol)(templ1))
}
@@ -188,8 +189,8 @@ abstract class AddInterfaces extends InfoTransform {
protected val traitTransformer = new Transformer {
override def transformStats(stats: List[Tree], exprOwner: Symbol): List[Tree] =
- super.transformStats(stats, exprOwner) :::
- super.transformStats(implClassDefs(stats), exprOwner);
+ (super.transformStats(stats, exprOwner) :::
+ super.transformStats(implClassDefs(stats), exprOwner));
override def transform(tree: Tree): Tree = {
val tree1 = tree match {
case ClassDef(mods, name, tparams, tpt, impl) =>
diff --git a/sources/scala/tools/nsc/transform/Constructors.scala b/sources/scala/tools/nsc/transform/Constructors.scala
index 6f20df4b08..3d8e36939d 100755
--- a/sources/scala/tools/nsc/transform/Constructors.scala
+++ b/sources/scala/tools/nsc/transform/Constructors.scala
@@ -107,8 +107,8 @@ abstract class Constructors extends Transform {
else {
if (rhs != EmptyTree) {
val rhs1 = intoConstructor(stat.symbol, rhs);
- (if (canBeMoved(stat)) constrPrefixBuf else constrStatBuf)
- += mkAssign(stat.symbol, rhs1)
+ (if (canBeMoved(stat)) constrPrefixBuf else constrStatBuf) += mkAssign(
+ stat.symbol, rhs1)
}
defBuf += copy.ValDef(stat, mods, name, tpt, EmptyTree)
}
@@ -120,11 +120,12 @@ abstract class Constructors extends Transform {
val accessed = new TreeSet[Symbol]((x, y) => x isLess y);
- def isAccessed(sym: Symbol) =
+ def isAccessed(sym: Symbol) = (
sym.owner != clazz ||
!(sym hasFlag PARAMACCESSOR) ||
!(sym hasFlag LOCAL) ||
- (accessed contains sym);
+ (accessed contains sym)
+ );
val accessTraverser = new Traverser {
override def traverse(tree: Tree) = {
diff --git a/sources/scala/tools/nsc/transform/Erasure.scala b/sources/scala/tools/nsc/transform/Erasure.scala
index b20aede4d3..b015b5646c 100755
--- a/sources/scala/tools/nsc/transform/Erasure.scala
+++ b/sources/scala/tools/nsc/transform/Erasure.scala
@@ -136,7 +136,7 @@ abstract class Erasure extends AddInterfaces with typechecker.Analyzer {
within(() => expr);
} else {
val temp = context.owner.newValue(expr.pos, context.unit.fresh.newName())
- setFlag SYNTHETIC setInfo expr.tpe;
+ .setFlag(SYNTHETIC).setInfo(expr.tpe);
Block(List(ValDef(temp, expr)), within(() => Ident(temp) setType expr.tpe))
}
@@ -215,9 +215,10 @@ abstract class Erasure extends AddInterfaces with typechecker.Analyzer {
else gen.cast(tree, pt);
/** Is symbol a member of unboxed arrays (which will be expanded directly later)? */
- private def isUnboxedArrayMember(sym: Symbol) =
+ private def isUnboxedArrayMember(sym: Symbol) = (
sym.name == nme.apply || sym.name == nme.length || sym.name == nme.update ||
- sym.owner == ObjectClass;
+ sym.owner == ObjectClass
+ );
/** Is symbol a member of a boxed value class (which will not be expanded later)? */
def isBoxedValueMember(sym: Symbol) =
@@ -453,10 +454,10 @@ abstract class Erasure extends AddInterfaces with typechecker.Analyzer {
}
if (bridgeNeeded) {
val bridge = other.cloneSymbolImpl(owner)
- setPos(owner.pos)
- setFlag (member.flags | BRIDGE)
- resetFlag (ACCESSOR | DEFERRED | lateDEFERRED)
- setInfo otpe;
+ .setPos(owner.pos)
+ .setFlag(member.flags | BRIDGE)
+ .resetFlag(ACCESSOR | DEFERRED | lateDEFERRED)
+ .setInfo(otpe);
bridgeTarget(bridge) = member;
owner.info.decls.enter(bridge);
bridgesScope enter bridge;
@@ -468,8 +469,8 @@ abstract class Erasure extends AddInterfaces with typechecker.Analyzer {
member.tpe match {
case MethodType(List(), ConstantType(c)) => Literal(c)
case _ =>
- ((Select(This(owner), member): Tree) /: vparamss)
- ((fun, vparams) => Apply(fun, vparams map Ident))
+ (((Select(This(owner), member): Tree) /: vparamss)
+ ((fun, vparams) => Apply(fun, vparams map Ident)))
});
if (settings.debug.value)
log("generating bridge from " + other + "(" + Flags.flagsToString(bridge.flags) + ")" + ":" + otpe + other.locationString + " to " + member + ":" + erasure(member.tpe) + member.locationString + " =\n " + bridgeDef);
diff --git a/sources/scala/tools/nsc/transform/LambdaLift.scala b/sources/scala/tools/nsc/transform/LambdaLift.scala
index 9acf89d9c2..753fc65b48 100755
--- a/sources/scala/tools/nsc/transform/LambdaLift.scala
+++ b/sources/scala/tools/nsc/transform/LambdaLift.scala
@@ -185,9 +185,9 @@ abstract class LambdaLift extends InfoTransform {
proxies(owner) =
for (val fv <- free(owner).elements.toList) yield {
val proxy = owner.newValue(owner.pos, fv.name)
- setFlag (if (owner.isClass) PARAMACCESSOR | PRIVATE | LOCAL else PARAM)
- setFlag SYNTHETIC
- setInfo fv.info;
+ .setFlag(if (owner.isClass) PARAMACCESSOR | PRIVATE | LOCAL else PARAM)
+ .setFlag(SYNTHETIC)
+ .setInfo(fv.info);
if (owner.isClass) owner.info.decls enter proxy;
proxy
}
diff --git a/sources/scala/tools/nsc/transform/Mixin.scala b/sources/scala/tools/nsc/transform/Mixin.scala
index f31e1ec8ba..32c325a61f 100755
--- a/sources/scala/tools/nsc/transform/Mixin.scala
+++ b/sources/scala/tools/nsc/transform/Mixin.scala
@@ -20,9 +20,10 @@ abstract class Mixin extends InfoTransform {
override def phaseNewFlags: long = lateMODULE | notABSTRACT;
- private def isForwarded(sym: Symbol) =
+ private def isForwarded(sym: Symbol) = (
sym.owner.isImplClass && sym.isMethod &&
- !sym.isModule && !(sym hasFlag (ACCESSOR | SUPERACCESSOR));
+ !sym.isModule && !(sym hasFlag (ACCESSOR | SUPERACCESSOR))
+ );
private def isStatic(sym: Symbol) = isForwarded(sym) && sym.isImplOnly;
@@ -68,12 +69,12 @@ abstract class Mixin extends InfoTransform {
clazz setFlag MIXEDIN;
def newGetter(field: Symbol): Symbol =
clazz.newMethod(field.pos, nme.getterName(field.name))
- setFlag (field.flags & ~(PRIVATE | LOCAL) | ACCESSOR | DEFERRED | SYNTHETIC)
- setInfo MethodType(List(), field.info);
+ .setFlag(field.flags & ~(PRIVATE | LOCAL) | ACCESSOR | DEFERRED | SYNTHETIC)
+ .setInfo(MethodType(List(), field.info));
def newSetter(field: Symbol): Symbol =
clazz.newMethod(field.pos, nme.getterToSetter(nme.getterName(field.name)))
- setFlag (field.flags & ~(PRIVATE | LOCAL) | ACCESSOR | DEFERRED | SYNTHETIC)
- setInfo MethodType(List(field.info), UnitClass.tpe);
+ .setFlag(field.flags & ~(PRIVATE | LOCAL) | ACCESSOR | DEFERRED | SYNTHETIC)
+ .setInfo(MethodType(List(field.info), UnitClass.tpe));
clazz.info;
val impl = implClass(clazz);
assert(impl != NoSymbol);
@@ -148,8 +149,9 @@ abstract class Mixin extends InfoTransform {
val alias1 = rebindSuper(clazz, member.alias, mixin);
member1.asInstanceOf[TermSymbol] setAlias alias1;
} else if (member.isMethod && member.isModule && !(member hasFlag (LIFTED | BRIDGE))) {
- addMember(clazz, member.cloneSymbol(clazz)) setPos clazz.pos
- resetFlag (DEFERRED | lateDEFERRED)
+ addMember(clazz, member.cloneSymbol(clazz))
+ .setPos(clazz.pos)
+ .resetFlag(DEFERRED | lateDEFERRED)
}
}
}
@@ -221,8 +223,8 @@ abstract class Mixin extends InfoTransform {
if (isForwarded(sym)) {
sym setFlag notOVERRIDE;
self = sym.newValue(sym.pos, nme.SELF)
- setFlag (PARAM | SYNTHETIC)
- setInfo toInterface(currentOwner.typeOfThis);
+ .setFlag(PARAM | SYNTHETIC)
+ .setInfo(toInterface(currentOwner.typeOfThis));
enclInterface = currentOwner.toInterface;
val selfdef = ValDef(self) setType NoType;
copy.DefDef(tree, mods, name, tparams, List(selfdef :: vparams), tpt, rhs)
diff --git a/sources/scala/tools/nsc/transform/UnCurry.scala b/sources/scala/tools/nsc/transform/UnCurry.scala
index 7bd12fb359..941b5df414 100755
--- a/sources/scala/tools/nsc/transform/UnCurry.scala
+++ b/sources/scala/tools/nsc/transform/UnCurry.scala
@@ -81,9 +81,10 @@ abstract class UnCurry extends InfoTransform {
* x.apply()? Note that this is not the case if `x' is used as an argument to another
* call by name parameter.
*/
- def isByNameRef(tree: Tree): boolean =
+ def isByNameRef(tree: Tree): boolean = (
tree.isTerm && tree.hasSymbol &&
- tree.symbol.tpe.symbol == ByNameParamClass && tree.tpe == tree.symbol.tpe.typeArgs.head;
+ tree.symbol.tpe.symbol == ByNameParamClass && tree.tpe == tree.symbol.tpe.typeArgs.head
+ );
/** Uncurry a type of a tree node.
* This function is sensitive to whether or not we are in a pattern -- when in a pattern
@@ -124,13 +125,13 @@ abstract class UnCurry extends InfoTransform {
*/
def transformFunction(fun: Function): Tree = {
val anonClass = fun.symbol.owner.newAnonymousFunctionClass(fun.pos)
- setFlag (FINAL | SYNTHETIC | inConstructorFlag);
+ .setFlag(FINAL | SYNTHETIC | inConstructorFlag);
val formals = fun.tpe.typeArgs.init;
val restpe = fun.tpe.typeArgs.last;
anonClass setInfo ClassInfoType(
List(ObjectClass.tpe, fun.tpe, ScalaObjectClass.tpe), new Scope(), anonClass);
val applyMethod = anonClass.newMethod(fun.pos, nme.apply)
- setFlag FINAL setInfo MethodType(formals, restpe);
+ .setFlag(FINAL).setInfo(MethodType(formals, restpe));
anonClass.info.decls enter applyMethod;
for (val vparam <- fun.vparams) vparam.symbol.owner = applyMethod;
new ChangeOwnerTraverser(fun.symbol, applyMethod).traverse(fun.body);
@@ -139,7 +140,7 @@ abstract class UnCurry extends InfoTransform {
setSymbol applyMethod);
if (fun.tpe.symbol == PartialFunctionClass) {
val isDefinedAtMethod = anonClass.newMethod(fun.pos, nme.isDefinedAt)
- setFlag FINAL setInfo MethodType(formals, BooleanClass.tpe);
+ .setFlag(FINAL).setInfo(MethodType(formals, BooleanClass.tpe));
anonClass.info.decls enter isDefinedAtMethod;
def idbody(idparam: Symbol) = fun.body match {
case Match(_, cases) =>
diff --git a/sources/scala/tools/nsc/typechecker/Contexts.scala b/sources/scala/tools/nsc/typechecker/Contexts.scala
index 3130252f74..021e810a43 100755
--- a/sources/scala/tools/nsc/typechecker/Contexts.scala
+++ b/sources/scala/tools/nsc/typechecker/Contexts.scala
@@ -170,10 +170,10 @@ import scala.tools.nsc.util.Position;
def ambiguousError(pos: int, pre: Type, sym1: Symbol, sym2: Symbol, rest: String): unit = {
val msg =
- "ambiguous reference to overloaded definition,\n" +
- "both " + sym1 + sym1.locationString + " of type " + pre.memberType(sym1) +
- "\nand " + sym2 + sym2.locationString + " of type " + pre.memberType(sym2) +
- "\nmatch " + rest;
+ ("ambiguous reference to overloaded definition,\n" +
+ "both " + sym1 + sym1.locationString + " of type " + pre.memberType(sym1) +
+ "\nand " + sym2 + sym2.locationString + " of type " + pre.memberType(sym2) +
+ "\nmatch " + rest);
if (reportAmbiguousErrors) unit.error(pos, msg)
else throw new TypeError(msg);
}
@@ -221,15 +221,15 @@ import scala.tools.nsc.util.Position;
c != NoContext;
}
- pre == NoPrefix
- ||
- (!sym.hasFlag(PRIVATE | PROTECTED))
- ||
- accessWithin(sym.owner) && (!sym.hasFlag(LOCAL) || pre =:= sym.owner.thisType)
- ||
- (!sym.hasFlag(PRIVATE) &&
- (superAccess ||
- (pre.widen.symbol.isSubClass(sym.owner) && isSubClassOfEnclosing(pre.widen.symbol))))
+ (pre == NoPrefix
+ ||
+ (!sym.hasFlag(PRIVATE | PROTECTED))
+ ||
+ accessWithin(sym.owner) && (!sym.hasFlag(LOCAL) || pre =:= sym.owner.thisType)
+ ||
+ (!sym.hasFlag(PRIVATE) &&
+ (superAccess ||
+ (pre.widen.symbol.isSubClass(sym.owner) && isSubClassOfEnclosing(pre.widen.symbol)))))
}
def pushTypeBounds(sym: Symbol): unit = {
diff --git a/sources/scala/tools/nsc/typechecker/Infer.scala b/sources/scala/tools/nsc/typechecker/Infer.scala
index 43283b4d12..66fec1ec56 100755
--- a/sources/scala/tools/nsc/typechecker/Infer.scala
+++ b/sources/scala/tools/nsc/typechecker/Infer.scala
@@ -173,14 +173,16 @@ package scala.tools.nsc.typechecker;
"expression of type " + tree.tpe
else if (tree.symbol.hasFlag(OVERLOADED))
"overloaded method " + tree.symbol + " with alternatives " + tree.tpe
- else
+ else (
tree.symbol.toString() +
- (if (tree.tpe.paramSectionCount > 0) "" else " of type ") +
- tree.tpe;
+ (if (tree.tpe.paramSectionCount > 0) ": " else " of type ") +
+ tree.tpe
+ );
- def applyErrorMsg(tree: Tree, msg: String, argtpes: List[Type], pt: Type) =
+ def applyErrorMsg(tree: Tree, msg: String, argtpes: List[Type], pt: Type) = (
treeSymTypeMsg(tree) + msg + argtpes.mkString("(", ",", ")") +
- (if (pt == WildcardType) "" else " with expected result type " + pt);
+ (if (pt == WildcardType) "" else " with expected result type " + pt)
+ );
def foundReqMsg(found: Type, req: Type): String =
";\n found : " + found.toLongString + "\n required: " + req;
@@ -372,9 +374,10 @@ package scala.tools.nsc.typechecker;
try {
val uninstantiated = new ListBuffer[Symbol];
val targs = methTypeArgs(undetparams, formals, restpe, argtpes, pt, uninstantiated);
- val result =
+ val result = (
exprTypeArgs(uninstantiated.toList, restpe.subst(undetparams, targs), pt) != null &&
- isWithinBounds(undetparams, targs);
+ isWithinBounds(undetparams, targs)
+ );
result
} catch {
case ex: NoInstance => false
@@ -541,15 +544,16 @@ package scala.tools.nsc.typechecker;
case OverloadedType(pre, alts) => tryTwice {
var alts1 = alts filter (alt => isCompatible(pre.memberType(alt), pt));
if (alts1.isEmpty) alts1 = alts;
- def improves(sym1: Symbol, sym2: Symbol): boolean =
+ def improves(sym1: Symbol, sym2: Symbol): boolean = (
sym2 == NoSymbol ||
((sym1.owner isSubClass sym2.owner) &&
{val tp1 = pre.memberType(sym1);
val tp2 = pre.memberType(sym2);
- tp2 == ErrorType ||
- !global.typer.infer.isCompatible(tp2, pt) && global.typer.infer.isCompatible(tp1, pt) ||
- (tp2.paramSectionCount > 0) && (tp1.paramSectionCount == 0 || specializes(tp1, tp2))
- });
+ (tp2 == ErrorType ||
+ !global.typer.infer.isCompatible(tp2, pt) && global.typer.infer.isCompatible(tp1, pt) ||
+ (tp2.paramSectionCount > 0) && (tp1.paramSectionCount == 0 || specializes(tp1, tp2))
+ )})
+ );
val best = ((NoSymbol: Symbol) /: alts1) ((best, alt) =>
if (improves(alt, best)) alt else best);
val competing = alts1 dropWhile (alt => best == alt || improves(best, alt));
diff --git a/sources/scala/tools/nsc/typechecker/Namers.scala b/sources/scala/tools/nsc/typechecker/Namers.scala
index 6ce7d43e0c..39b2f3b20c 100755
--- a/sources/scala/tools/nsc/typechecker/Namers.scala
+++ b/sources/scala/tools/nsc/typechecker/Namers.scala
@@ -187,7 +187,7 @@ trait Namers: Analyzer {
if ((mods & (CASE | ABSTRACT)) == CASE) { // enter case factory method.
tree.symbol = enterCaseFactorySymbol(
tree.pos, mods & AccessFlags | METHOD | CASE, name.toTermName)
- setInfo innerNamer.caseFactoryCompleter(tree)
+ .setInfo(innerNamer.caseFactoryCompleter(tree))
}
val mods1: int = if (impl.body forall treeInfo.isInterfaceMember) mods | INTERFACE else mods;
tree.symbol = enterClassSymbol(tree.pos, mods1, name);
@@ -199,8 +199,8 @@ trait Namers: Analyzer {
case ValDef(mods, name, tp, rhs) =>
if (context.owner.isClass & (mods & LOCAL) == 0) {
val accmods =
- (if ((mods & MUTABLE) != 0) mods & ~MUTABLE else mods | STABLE) |
- (if ((mods & DEFERRED) == 0) ACCESSOR else 0);
+ ((if ((mods & MUTABLE) != 0) mods & ~MUTABLE else mods | STABLE) |
+ (if ((mods & DEFERRED) == 0) ACCESSOR else 0));
val getter = owner.newMethod(tree.pos, name)
.setFlag(accmods).setInfo(innerNamer.getterTypeCompleter(tree));
enterInScope(getter);
@@ -464,7 +464,7 @@ trait Namers: Analyzer {
}
} catch {
case ex: TypeError =>
- System.out.println("caught " + ex + " in typeSig");//debug
+ //System.out.println("caught " + ex + " in typeSig");//DEBUG
typer.reportTypeError(tree.pos, ex);
ErrorType
}
diff --git a/sources/scala/tools/nsc/typechecker/RefChecks.scala b/sources/scala/tools/nsc/typechecker/RefChecks.scala
index b27804d646..8fc0c0c7cf 100755
--- a/sources/scala/tools/nsc/typechecker/RefChecks.scala
+++ b/sources/scala/tools/nsc/typechecker/RefChecks.scala
@@ -50,7 +50,7 @@ abstract class RefChecks extends InfoTransform {
// var m$: T = null; or, if class member: local var m$: T = _;
def newModuleVarDef(accessor: Symbol) = {
val mvar = accessor.owner.newVariable(accessor.pos, nme.moduleVarName(accessor.name))
- setInfo accessor.tpe.finalResultType;
+ .setInfo(accessor.tpe.finalResultType);
if (mvar.owner.isClass) {
mvar setFlag (PRIVATE | LOCAL | SYNTHETIC);
mvar.owner.info.decls.enter(mvar);
@@ -105,14 +105,15 @@ abstract class RefChecks extends InfoTransform {
val self = clazz.thisType;
- def infoString(sym: Symbol) =
+ def infoString(sym: Symbol) = (
sym.toString() +
(if (sym.owner == clazz) ""
else (sym.locationString +
(if (sym.isAliasType) ", which equals " + self.memberInfo(sym)
else if (sym.isAbstractType) " with bounds " + self.memberInfo(sym)
else if (sym.isTerm) " of type " + self.memberInfo(sym)
- else "")));
+ else "")))
+ );
/* Check that all conditions for overriding `other' by `member' are met. */
def checkOverride(clazz: Symbol, member: Symbol, other: Symbol): unit = {
@@ -434,9 +435,9 @@ abstract class RefChecks extends InfoTransform {
case ModuleDef(mods, name, impl) =>
val sym = tree.symbol;
val cdef = ClassDef(mods | MODULE, name, List(), EmptyTree, impl)
- setPos tree.pos
- setSymbol sym.moduleClass
- setType NoType;
+ .setPos(tree.pos)
+ .setSymbol(sym.moduleClass)
+ .setType(NoType);
if (sym.isStatic) List(transform(cdef))
else {
val vdef =
diff --git a/sources/scala/tools/nsc/typechecker/SuperAccessors.scala b/sources/scala/tools/nsc/typechecker/SuperAccessors.scala
index e5c0194ca0..50749deb5e 100755
--- a/sources/scala/tools/nsc/typechecker/SuperAccessors.scala
+++ b/sources/scala/tools/nsc/typechecker/SuperAccessors.scala
@@ -30,8 +30,8 @@ abstract class SuperAccessors extends transform.Transform {
private def transformArgs(args: List[Tree], formals: List[Type]) = {
if (!formals.isEmpty && formals.last.symbol == definitions.ByNameParamClass)
- (args take (formals.length - 1) map transform) :::
- withInvalidOwner { args drop (formals.length - 1) map transform }
+ ((args take (formals.length - 1) map transform) :::
+ withInvalidOwner { args drop (formals.length - 1) map transform })
else
args map transform
}
diff --git a/sources/scala/tools/nsc/typechecker/Typers.scala b/sources/scala/tools/nsc/typechecker/Typers.scala
index 5824e9306a..3f096609eb 100755
--- a/sources/scala/tools/nsc/typechecker/Typers.scala
+++ b/sources/scala/tools/nsc/typechecker/Typers.scala
@@ -39,10 +39,11 @@ import collection.mutable.HashMap;
import context0.unit;
val infer = new Inferencer(context0) {
- override def isCoercible(tp: Type, pt: Type): boolean =
+ override def isCoercible(tp: Type, pt: Type): boolean = (
tp.isError || pt.isError ||
context0.reportGeneralErrors && // this condition prevents chains of views
inferView(Position.NOPOS, tp, pt, false) != EmptyTree
+ )
}
private def inferView(pos: int, from: Type, to: Type, reportAmbiguous: boolean): Tree = {
@@ -368,7 +369,7 @@ import collection.mutable.HashMap;
((mode & TAPPmode) == 0 || tree.tpe.typeParams.isEmpty) &&
adaptToName(tree, nme.apply).tpe.nonLocalMember(nme.apply)
.filter(m => m.tpe.paramSectionCount > 0) != NoSymbol) { // (8)
- typed(Select(adaptToName(tree, nme.apply), nme.apply) setPos tree.pos, mode, pt)
+ typed(atPos(tree.pos)(Select(adaptToName(tree, nme.apply), nme.apply)), mode, pt)
} else if (!context.undetparams.isEmpty & (mode & POLYmode) == 0) { // (9)
val tparams = context.undetparams;
context.undetparams = List();
@@ -413,15 +414,15 @@ import collection.mutable.HashMap;
!phase.erasedTypes && !qual.tpe.widen.isError &&
qual.tpe.nonLocalMember(name) == NoSymbol) {
val coercion = inferView(qual.pos, qual.tpe, name, true);
- if (coercion != EmptyTree) Apply(coercion, List(qual)) setPos qual.pos
+ if (coercion != EmptyTree) typedQualifier(atPos(qual.pos)(Apply(coercion, List(qual))))
else qual
} else qual;
private def completeSuperType(supertpt: Tree, tparams: List[Symbol], enclTparams: List[Symbol], vparamss: List[List[ValDef]], superargs: List[Tree]): Type = {
enclTparams foreach context.scope.enter;
namer.enterValueParams(context.owner, vparamss);
- val newTree = New(supertpt) setType
- PolyType(tparams, appliedType(supertpt.tpe, tparams map (.tpe)));
+ val newTree = New(supertpt)
+ .setType(PolyType(tparams, appliedType(supertpt.tpe, tparams map (.tpe))));
val tree = typed(atPos(supertpt.pos)(Apply(Select(newTree, nme.CONSTRUCTOR), superargs)));
if (settings.debug.value) log("superconstr " + tree + " co = " + context.owner);//debug
tree.tpe
@@ -524,7 +525,7 @@ import collection.mutable.HashMap;
.typedTemplate(cdef.impl, parentTypes(cdef.impl));
val impl2 = addSyntheticMethods(impl1, clazz);
val ret = copy.ClassDef(cdef, cdef.mods, cdef.name, tparams1, tpt1, impl2)
- setType NoType;
+ .setType(NoType);
ret;
}
@@ -548,7 +549,7 @@ import collection.mutable.HashMap;
val result = atPos(vdef.pos)(
DefDef(getter, vparamss =>
if ((mods & DEFERRED) != 0) EmptyTree
- else typed(Select(This(value.owner), value), EXPRmode, value.tpe)));
+ else typed(atPos(vdef.pos)(Select(This(value.owner), value)), EXPRmode, value.tpe)));
checkNoEscaping.privates(getter, result.tpt);
result
}
@@ -736,7 +737,7 @@ import collection.mutable.HashMap;
val stats1 = typedStats(block.stats, context.owner);
val expr1 = typed(block.expr, mode & ~(FUNmode | QUALmode), pt);
val block1 = copy.Block(block, stats1, expr1)
- setType (if (treeInfo.isPureExpr(block)) expr1.tpe else expr1.tpe.deconst);
+ .setType(if (treeInfo.isPureExpr(block)) expr1.tpe else expr1.tpe.deconst);
if (isFullyDefined(pt)) block1
else {
if (block1.tpe.symbol.isAnonymousClass)
@@ -798,7 +799,7 @@ import collection.mutable.HashMap;
val restpe = body.tpe.deconst;
val funtpe = typeRef(clazz.tpe.prefix, clazz, formals ::: List(restpe));
val fun1 = copy.Function(fun, vparams, checkNoEscaping.locals(context.scope, restpe, body))
- setType funtpe;
+ .setType(funtpe);
if (pt.symbol == TypedCodeClass) typed(atPos(fun.pos)(codify(fun1)))
else fun1
}
@@ -955,7 +956,8 @@ import collection.mutable.HashMap;
if (!qual.tpe.widen.isError)
error(tree.pos,
decode(name) + " is not a member of " + qual.tpe.widen +
- (if (Position.line(tree.pos) > Position.line(qual.pos))
+ (if (Position.line(context.unit.source, qual.pos) <
+ Position.line(context.unit.source, tree.pos))
"\npossible cause: maybe a semicolon is missing before `" + name + "'?" else ""));
setError(tree)
} else {
@@ -1135,7 +1137,7 @@ import collection.mutable.HashMap;
val elemtpt1 = typedType(elemtpt);
val elems1 = List.mapConserve(elems)(elem => typed(elem, mode, elemtpt1.tpe));
copy.ArrayValue(tree, elemtpt1, elems1)
- setType (if (isFullyDefined(pt) && !phase.erasedTypes) pt
+ .setType(if (isFullyDefined(pt) && !phase.erasedTypes) pt
else appliedType(ArrayClass.typeConstructor, List(elemtpt1.tpe)))
case fun @ Function(_, _) =>
@@ -1202,7 +1204,7 @@ import collection.mutable.HashMap;
val finalizer1 = if (finalizer.isEmpty) finalizer
else typed(finalizer, UnitClass.tpe);
copy.Try(tree, block1, catches1, finalizer1)
- setType ptOrLub(block1.tpe :: (catches1 map (.tpe)))
+ .setType(ptOrLub(block1.tpe :: (catches1 map (.tpe))))
case Throw(expr) =>
val expr1 = typed(expr, ThrowableClass.tpe);
@@ -1213,8 +1215,8 @@ import collection.mutable.HashMap;
if (tpt1.hasSymbol && !tpt1.symbol.typeParams.isEmpty) {
context.undetparams = cloneSymbols(tpt1.symbol.unsafeTypeParams);
tpt1 = TypeTree()
- setPos tpt1.pos
- setType appliedType(tpt1.tpe, context.undetparams map (.tpe));
+ .setPos(tpt1.pos)
+ .setType(appliedType(tpt1.tpe, context.undetparams map (.tpe)));
}
if (tpt1.tpe.symbol.isTrait) error(tree.pos, "traits cannot be instantiated");
copy.New(tree, tpt1).setType(tpt1.tpe)
@@ -1380,7 +1382,7 @@ import collection.mutable.HashMap;
result
} catch {
case ex: TypeError =>
- System.out.println("caught " + ex + " in typed");//debug
+ //System.out.println("caught " + ex + " in typed");//DEBUG
reportTypeError(tree.pos, ex);
setError(tree)
case ex: Throwable =>
@@ -1528,9 +1530,10 @@ import collection.mutable.HashMap;
tp1.baseClasses map implicitsOfClass;
}
- def implicitsOfClass(clazz: Symbol): List[ImplicitInfo] =
+ def implicitsOfClass(clazz: Symbol): List[ImplicitInfo] = (
clazz.initialize.linkedModule.moduleClass.info.decls.toList.filter(.hasFlag(IMPLICIT)) map
- (sym => ImplicitInfo(sym.name, clazz.linkedModule.tpe.memberType(sym), sym));
+ (sym => ImplicitInfo(sym.name, clazz.linkedModule.tpe.memberType(sym), sym))
+ );
var tree = searchImplicit(context.implicitss, true);
if (tree == EmptyTree) tree = searchImplicit(implicitsOfType(pt.widen), false);
diff --git a/sources/scala/tools/nsc/util/CharArrayReader.scala b/sources/scala/tools/nsc/util/CharArrayReader.scala
index 0ebfd2bd3e..182a730694 100644
--- a/sources/scala/tools/nsc/util/CharArrayReader.scala
+++ b/sources/scala/tools/nsc/util/CharArrayReader.scala
@@ -25,6 +25,8 @@ class CharArrayReader(buf: Array[char], start: int, /* startline: int, startcol:
//private var ccol: int = _;
def cpos = bp;
var isUnicode: boolean = _;
+ var lastLineStartPos: int = 0;
+ var lineStartPos: int = 0;
//private var nextline = startline;
//private var nextcol = startcol;
@@ -48,7 +50,11 @@ class CharArrayReader(buf: Array[char], start: int, /* startline: int, startcol:
ch = LF;
bp = bp + 1
}
+ lastLineStartPos = lineStartPos;
+ lineStartPos = bp;
case LF | FF =>
+ lastLineStartPos = lineStartPos;
+ lineStartPos = bp;
//nextline = nextline + 1;
//nextcol = 1
case '\\' =>
diff --git a/sources/scala/tools/nsc/util/Position.scala b/sources/scala/tools/nsc/util/Position.scala
index f6bd6b2788..9a16f5390a 100755
--- a/sources/scala/tools/nsc/util/Position.scala
+++ b/sources/scala/tools/nsc/util/Position.scala
@@ -18,9 +18,6 @@ object Position {
val NOLINE = 0;
val FIRSTLINE = 1;
-
- def line(offset : Int) = offset;
-
def line(source : SourceFile, offset : Int) = (new Position(source, offset)).line;
}
diff --git a/sources/scala/xml/Node.scala b/sources/scala/xml/Node.scala
index 0bb28e1af1..2daf643d7a 100644
--- a/sources/scala/xml/Node.scala
+++ b/sources/scala/xml/Node.scala
@@ -91,11 +91,11 @@ abstract class Node extends NodeSeq {
/** structural equality */
override def equals(x: Any): Boolean = x match {
case that: Node =>
- (that.prefix == this.prefix )
- &&(that.label == this.label )
- &&(that.attributes == this.attributes)
- && that.child.sameElements(this.child) // sameElements
- case _ => false
+ ((that.prefix == this.prefix )
+ &&(that.label == this.label )
+ &&(that.attributes == this.attributes)
+ && that.child.sameElements(this.child)) // sameElements
+ case _ => false
}
/** returns a hashcode */
override def hashCode(): Int;
diff --git a/sources/scala/xml/PrefixedAttribute.scala b/sources/scala/xml/PrefixedAttribute.scala
index 38fb907a24..4eb947e2c1 100644
--- a/sources/scala/xml/PrefixedAttribute.scala
+++ b/sources/scala/xml/PrefixedAttribute.scala
@@ -44,9 +44,9 @@ class PrefixedAttribute(val pre: String,
*/
def equals1(m: MetaData) =
- m.isPrefixed &&
- (m.asInstanceOf[PrefixedAttribute].pre == pre) &&
- (m.key == key) && (m.value == value);
+ (m.isPrefixed &&
+ (m.asInstanceOf[PrefixedAttribute].pre == pre) &&
+ (m.key == key) && (m.value == value));
def getNamespace(owner: Node) =
owner.getNamespace(pre);
diff --git a/sources/scala/xml/dtd/Scanner.scala b/sources/scala/xml/dtd/Scanner.scala
index 4d531cc001..c51ac7cbec 100644
--- a/sources/scala/xml/dtd/Scanner.scala
+++ b/sources/scala/xml/dtd/Scanner.scala
@@ -35,8 +35,8 @@ class Scanner extends Tokens with parsing.TokenTests {
// zzz scanner methods zzz
// todo: see XML specification... probably isLetter,isDigit is fine
- final def isIdentChar = { ('a' <= c && c <= 'z')
- || ('A' <= c && c <= 'Z')};
+ final def isIdentChar = ( ('a' <= c && c <= 'z')
+ || ('A' <= c && c <= 'Z'));
final def next = if( it.hasNext ) c = it.next else c = ENDCH;
diff --git a/sources/scala/xml/factory/NodeFactory.scala b/sources/scala/xml/factory/NodeFactory.scala
index 6a28ec825a..7564659c1a 100644
--- a/sources/scala/xml/factory/NodeFactory.scala
+++ b/sources/scala/xml/factory/NodeFactory.scala
@@ -41,12 +41,12 @@ import scala.collection.mutable ;
}
}
- def nodeEquals(n: Node, pre: String, name: String, attrSeq:MetaData, scope: NamespaceBinding, children:Seq[Node]) =
+ def nodeEquals(n: Node, pre: String, name: String, attrSeq:MetaData, scope: NamespaceBinding, children:Seq[Node]) = (
(n.prefix == pre)
&&(n.label == name)
&&(n.attributes == attrSeq)
// scope??
- &&(eqElements(n.child,children));
+ &&(eqElements(n.child,children)));
def makeNode(pre: String, name: String, attrSeq:MetaData, scpe: NamespaceBinding, children:Seq[Node]): A = {
//Console.println("NodeFactory::makeNode("+pre+","+name+","+attrSeq+","+scpe+","+children+")");
diff --git a/sources/scala/xml/parsing/TokenTests.scala b/sources/scala/xml/parsing/TokenTests.scala
index c9eb2235c3..86560fc12f 100644
--- a/sources/scala/xml/parsing/TokenTests.scala
+++ b/sources/scala/xml/parsing/TokenTests.scala
@@ -83,8 +83,8 @@ trait TokenTests {
ch match {
case '\u0020' | '\u000D' | '\u000A' => true;
case _ if
- ('0' <= ch && ch <= '9') || ('a' <= ch && ch <= 'z') ||
- ('A' <= ch && ch <= 'Z') => true;
+ (('0' <= ch && ch <= '9') || ('a' <= ch && ch <= 'z') ||
+ ('A' <= ch && ch <= 'Z')) => true;
case '-' | '\''| '(' | ')' | '+' | ',' | '.' |
'/' | ':' | '=' | '?' | ';' | '!' | '*' |
'#' | '@' | '$' | '_' | '%' => true
diff --git a/test-nsc/scalanstest b/test-nsc/scalanstest
index 37de528c8e..473510f830 100644
--- a/test-nsc/scalanstest
+++ b/test-nsc/scalanstest
@@ -454,7 +454,8 @@ FILES_NEG="";
FILES_MSIL="";
SCALA="$PREFIX/distribs/unix/latest/bin/ns";
-SOCOS="$PREFIX/distribs/unix/latest/bin/nsc";
+# SOCOS="$PREFIX/distribs/unix/latest/bin/nsc -verbose";
+SOCOS="$PREFIX/distribs/unix/latest/bin/nsc -classpath /tmp/newclasses:$HOME/scala/build/nslib.jar:$HOME/scala/sources:$HOME/scala/newsources:/home/linuxsoft/apps/fjbg/jars/fjbg.jar:/home/linuxsoft/apps/msil/msil.jar"
SCALAP="$PREFIX/distribs/unix/latest/bin/nsp";
DIFF="diff";