summaryrefslogtreecommitdiff
path: root/sources/scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2005-12-12 16:24:23 +0000
committerMartin Odersky <odersky@gmail.com>2005-12-12 16:24:23 +0000
commit2bf04d01dbd6aef10f596e0662349907f82701d5 (patch)
tree238c32dc2096bf806ad35a3bae61b486fbc73a9b /sources/scala
parentcb13c4597b2ab1f82ff9a7b18eb360804998965e (diff)
downloadscala-2bf04d01dbd6aef10f596e0662349907f82701d5.tar.gz
scala-2bf04d01dbd6aef10f596e0662349907f82701d5.tar.bz2
scala-2bf04d01dbd6aef10f596e0662349907f82701d5.zip
*** empty log message ***
Diffstat (limited to 'sources/scala')
-rw-r--r--sources/scala/Iterator.scala6
-rw-r--r--sources/scala/collection/BitSet.scala5
-rw-r--r--sources/scala/collection/Map.scala15
-rw-r--r--sources/scala/collection/Set.scala4
-rw-r--r--sources/scala/dbc/datatype/ApproximateNumeric.scala16
-rw-r--r--sources/scala/dbc/datatype/ExactNumeric.scala20
-rw-r--r--sources/scala/dbc/statement/DerivedColumn.scala4
-rw-r--r--sources/scala/dbc/statement/Insert.scala6
-rw-r--r--sources/scala/dbc/statement/InsertionData.scala6
-rw-r--r--sources/scala/dbc/statement/Jointure.scala4
-rw-r--r--sources/scala/dbc/statement/Relation.scala4
-rw-r--r--sources/scala/dbc/statement/Select.scala7
-rw-r--r--sources/scala/dbc/statement/Table.scala6
-rw-r--r--sources/scala/dbc/statement/Transaction.scala6
-rw-r--r--sources/scala/dbc/statement/Update.scala6
-rw-r--r--sources/scala/dbc/statement/expression/Aggregate.scala4
-rw-r--r--sources/scala/dbc/statement/expression/Field.scala4
-rw-r--r--sources/scala/dbc/statement/expression/SetFunction.scala4
-rw-r--r--sources/scala/reflect/Print.scala62
-rw-r--r--sources/scala/runtime/matching/Rule.scala16
-rw-r--r--sources/scala/tools/nsc/MainTokenMetric.scala1
-rwxr-xr-xsources/scala/tools/nsc/ast/parser/Parsers.scala36
-rw-r--r--sources/scala/tools/nsc/backend/icode/TypeKinds.scala4
-rw-r--r--sources/scala/tools/nsc/backend/icode/TypeStacks.scala7
-rw-r--r--sources/scala/tools/nsc/matching/PatternNodes.scala8
-rwxr-xr-xsources/scala/tools/nsc/symtab/Definitions.scala12
-rwxr-xr-xsources/scala/tools/nsc/symtab/Symbols.scala4
-rwxr-xr-xsources/scala/tools/nsc/symtab/Types.scala14
-rwxr-xr-xsources/scala/tools/nsc/symtab/classfile/UnPickler.scala4
-rwxr-xr-xsources/scala/tools/nsc/transform/Erasure.scala8
-rwxr-xr-xsources/scala/tools/nsc/transform/OverridingPairs.scala4
-rw-r--r--sources/scala/tools/nsc/transform/TailCalls.scala6
-rwxr-xr-xsources/scala/tools/nsc/typechecker/Infer.scala10
-rwxr-xr-xsources/scala/tools/nsc/typechecker/RefChecks.scala2
-rwxr-xr-xsources/scala/tools/nsc/typechecker/SyntheticMethods.scala6
-rwxr-xr-xsources/scala/tools/nsc/typechecker/Typers.scala17
-rw-r--r--sources/scala/tools/scalac/typechecker/Analyzer.scala5
-rw-r--r--sources/scala/xml/MetaData.scala9
-rw-r--r--sources/scala/xml/NodeSeq.scala2
-rw-r--r--sources/scala/xml/PrefixedAttribute.scala14
-rw-r--r--sources/scala/xml/UnprefixedAttribute.scala12
-rw-r--r--sources/scala/xml/Utility.scala21
42 files changed, 187 insertions, 224 deletions
diff --git a/sources/scala/Iterator.scala b/sources/scala/Iterator.scala
index 54f9ac8ca7..5a60a198ca 100644
--- a/sources/scala/Iterator.scala
+++ b/sources/scala/Iterator.scala
@@ -372,10 +372,10 @@ trait Iterator[+A] {
var ahead: Iterator[A] = null;
class Partner extends Iterator[A] {
var ys: List[A] = Nil;
- def hasNext: Boolean = Iterator.this.synchronized {
+ def hasNext: Boolean = Iterator.this.synchronized (
((this == ahead) && Iterator.this.hasNext) ||
- ((this != ahead) && (!xs.isEmpty || !ys.isEmpty || Iterator.this.hasNext));
- }
+ ((this != ahead) && (!xs.isEmpty || !ys.isEmpty || Iterator.this.hasNext))
+ );
def next: A = Iterator.this.synchronized {
if (this == ahead) {
val e = Iterator.this.next;
diff --git a/sources/scala/collection/BitSet.scala b/sources/scala/collection/BitSet.scala
index 5f7d325208..bd5855c1de 100644
--- a/sources/scala/collection/BitSet.scala
+++ b/sources/scala/collection/BitSet.scala
@@ -54,8 +54,9 @@ package scala.collection;
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)})
+ ( size == other.size) && (
+ Iterator.range(0, size) forall { i => apply(i) == other.apply(i)}
+ )
}
);
diff --git a/sources/scala/collection/Map.scala b/sources/scala/collection/Map.scala
index 91ec361083..1ee5869224 100644
--- a/sources/scala/collection/Map.scala
+++ b/sources/scala/collection/Map.scala
@@ -139,13 +139,14 @@ trait Map[A, +B] extends AnyRef with PartialFunction[A, B] with Iterable[Pair[A,
override def equals(that: Any): Boolean = (
that.isInstanceOf[Map[A, B]] &&
{ val other = that.asInstanceOf[Map[A, B]];
- this.size == other.size &&
- this.elements.forall {
- case Pair(key, value) => other.get(key) match {
- case None => false;
- case Some(otherval) => value == otherval;
- }
- }}
+ (this.size == other.size &&
+ this.elements.forall {
+ case Pair(key, value) => other.get(key) match {
+ case None => false;
+ case Some(otherval) => value == otherval;
+ }
+ })
+ }
);
/** Returns the mappings of this map as a list.
diff --git a/sources/scala/collection/Set.scala b/sources/scala/collection/Set.scala
index b222b81648..4251d2fa0f 100644
--- a/sources/scala/collection/Set.scala
+++ b/sources/scala/collection/Set.scala
@@ -70,8 +70,8 @@ trait Set[A] extends AnyRef with Function1[A, Boolean] with Iterable[A] {
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.size == other.size &&
+ this.elements.forall(other.contains)) }
);
/** Returns the elements of this set as a list.
diff --git a/sources/scala/dbc/datatype/ApproximateNumeric.scala b/sources/scala/dbc/datatype/ApproximateNumeric.scala
index cef65a6ab8..5dd35842ec 100644
--- a/sources/scala/dbc/datatype/ApproximateNumeric.scala
+++ b/sources/scala/dbc/datatype/ApproximateNumeric.scala
@@ -17,20 +17,20 @@ abstract class ApproximateNumeric[Type] (
def isEquivalent(datatype: DataType) = datatype match {
case dt: ApproximateNumeric[Type] =>
- nativeTypeId == dt.nativeTypeId &&
- precisionRadix == dt.precisionRadix &&
- precision == dt.precision &&
- signed == dt.signed
+ (nativeTypeId == dt.nativeTypeId &&
+ precisionRadix == dt.precisionRadix &&
+ precision == dt.precision &&
+ signed == dt.signed)
case _ =>
false
}
def isSubtypeOf (datatype:DataType) = datatype match {
case dt:ApproximateNumeric[Type] =>
- nativeTypeId == dt.nativeTypeId &&
- precisionRadix == dt.precisionRadix &&
- precision <= dt.precision &&
- signed == dt.signed
+ (nativeTypeId == dt.nativeTypeId &&
+ precisionRadix == dt.precisionRadix &&
+ precision <= dt.precision &&
+ signed == dt.signed)
case _ =>
false
}
diff --git a/sources/scala/dbc/datatype/ExactNumeric.scala b/sources/scala/dbc/datatype/ExactNumeric.scala
index 00cada5fec..9152a7e928 100644
--- a/sources/scala/dbc/datatype/ExactNumeric.scala
+++ b/sources/scala/dbc/datatype/ExactNumeric.scala
@@ -17,22 +17,22 @@ abstract class ExactNumeric[Type](
def isEquivalent(datatype: DataType) = datatype match {
case dt: ExactNumeric[Type] =>
- nativeTypeId == dt.nativeTypeId &&
- precisionRadix == dt.precisionRadix &&
- precision == dt.precision &&
- scale == dt.scale &&
- signed == dt.signed
+ (nativeTypeId == dt.nativeTypeId &&
+ precisionRadix == dt.precisionRadix &&
+ precision == dt.precision &&
+ scale == dt.scale &&
+ signed == dt.signed)
case _ =>
false
}
def isSubtypeOf(datatype: DataType) = datatype match {
case dt: ExactNumeric[Type] =>
- nativeTypeId == dt.nativeTypeId &&
- precisionRadix == dt.precisionRadix &&
- precision <= dt.precision &&
- scale <= dt.scale &&
- signed == dt.signed
+ (nativeTypeId == dt.nativeTypeId &&
+ precisionRadix == dt.precisionRadix &&
+ precision <= dt.precision &&
+ scale <= dt.scale &&
+ signed == dt.signed)
case _ =>
false
}
diff --git a/sources/scala/dbc/statement/DerivedColumn.scala b/sources/scala/dbc/statement/DerivedColumn.scala
index 3948807885..020304f979 100644
--- a/sources/scala/dbc/statement/DerivedColumn.scala
+++ b/sources/scala/dbc/statement/DerivedColumn.scala
@@ -21,12 +21,12 @@ abstract class DerivedColumn {
/** A SQL-99 compliant string representation of the derived column
* sub-statement. This only has a meaning inside a select statement. */
- def sqlString: String = {
+ def sqlString: String = (
valueExpression.sqlInnerString +
(asClause match {
case None => ""
case Some(ac) => " AS " + ac
})
- }
+ );
}
diff --git a/sources/scala/dbc/statement/Insert.scala b/sources/scala/dbc/statement/Insert.scala
index b4302b9c19..23f93ec4a0 100644
--- a/sources/scala/dbc/statement/Insert.scala
+++ b/sources/scala/dbc/statement/Insert.scala
@@ -17,11 +17,11 @@ case class Insert (
) extends Status {
/** A SQL-99 compliant string representation of the select statement. */
- def sqlString: String = {
+ def sqlString: String = (
"INSERT INTO " +
insertionTarget +
" " + insertionData.sqlString
- }
+ );
/** The name of the table where the data should be added. */
//def insertionTarget: String;
@@ -29,4 +29,4 @@ case class Insert (
/** The data that will be added tot he table. */
//def insertionData: InsertionData;
-} \ No newline at end of file
+}
diff --git a/sources/scala/dbc/statement/InsertionData.scala b/sources/scala/dbc/statement/InsertionData.scala
index c814793387..2d6f370319 100644
--- a/sources/scala/dbc/statement/InsertionData.scala
+++ b/sources/scala/dbc/statement/InsertionData.scala
@@ -25,13 +25,13 @@ object InsertionData {
columnNames:Option[List[String]],
columnValues:List[Expression]
) extends InsertionData {
- def sqlString = {
+ def sqlString = (
(columnNames match {
case None => ""
case Some(cn) => cn.mkString(" (",", ",")")
}) +
" VALUES" +
columnValues.map(e=>e.sqlInnerString).mkString(" (",", ",")")
- }
+ )
}
-} \ No newline at end of file
+}
diff --git a/sources/scala/dbc/statement/Jointure.scala b/sources/scala/dbc/statement/Jointure.scala
index 85961a857f..b2ea55d5c9 100644
--- a/sources/scala/dbc/statement/Jointure.scala
+++ b/sources/scala/dbc/statement/Jointure.scala
@@ -30,7 +30,7 @@ abstract class Jointure extends Relation {
/** A SQL-99 compliant string representation of the relation sub-
* statement. This only has a meaning inside a query. */
- def sqlInnerString: String = {
+ def sqlInnerString: String = (
leftRelation.sqlInnerString + " " +
joinType.sqlString + " " +
rightRelation.sqlInnerString +
@@ -38,6 +38,6 @@ abstract class Jointure extends Relation {
case Some(jc) => jc.sqlString
case None => ""
})
- }
+ )
}
diff --git a/sources/scala/dbc/statement/Relation.scala b/sources/scala/dbc/statement/Relation.scala
index 1e8aaee8be..5e9c24025f 100644
--- a/sources/scala/dbc/statement/Relation.scala
+++ b/sources/scala/dbc/statement/Relation.scala
@@ -16,11 +16,11 @@ abstract class Relation extends Statement {
def typeCheck (relation: result.Relation): Unit = {
if (typeCheck != Nil) {
- val sameType: Boolean = {
+ val sameType: Boolean = (
relation.metadata.length == fieldTypes.length &&
(relation.metadata.zip(fieldTypes).forall({case Pair(field,expectedType) =>
isCompatibleType(field.datatype, expectedType)}))
- }
+ );
if (!sameType)
throw new exception.IncompatibleSchema(fieldTypes,relation.metadata.map(field=>field.datatype));
}
diff --git a/sources/scala/dbc/statement/Select.scala b/sources/scala/dbc/statement/Select.scala
index 48b946f17d..cadf82a02d 100644
--- a/sources/scala/dbc/statement/Select.scala
+++ b/sources/scala/dbc/statement/Select.scala
@@ -72,9 +72,10 @@ 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 {
diff --git a/sources/scala/dbc/statement/Table.scala b/sources/scala/dbc/statement/Table.scala
index d8e0d02289..18a065e221 100644
--- a/sources/scala/dbc/statement/Table.scala
+++ b/sources/scala/dbc/statement/Table.scala
@@ -26,11 +26,11 @@ abstract class Table extends Relation {
/** A SQL-99 compliant string representation of the relation sub-
* statement. This only has a meaning inside a query. */
- def sqlInnerString: String = {
+ def sqlInnerString: String = (
tableName +
(tableRename match {
case None => ""
case Some(rename) => " AS " + rename
})
- }
-} \ No newline at end of file
+ )
+}
diff --git a/sources/scala/dbc/statement/Transaction.scala b/sources/scala/dbc/statement/Transaction.scala
index b294cf71a0..b87c0ccc35 100644
--- a/sources/scala/dbc/statement/Transaction.scala
+++ b/sources/scala/dbc/statement/Transaction.scala
@@ -16,7 +16,7 @@ case class Transaction [ResultType] (
) extends Statement {
/** A SQL-99 compliant string representation of the statement. */
- def sqlStartString: String = {
+ def sqlStartString: String = (
"START TRANSACTION" +
(Pair(accessMode,isolationLevel) match {
case Pair(None,None) => ""
@@ -24,7 +24,7 @@ case class Transaction [ResultType] (
case Pair(None,Some(il)) => " " + il.sqlString
case Pair(Some(am),Some(il)) => " " + am.sqlString + ", " + il.sqlString
})
- }
+ );
def sqlCommitString: String = {
"COMMIT"
@@ -48,4 +48,4 @@ case class Transaction [ResultType] (
database.executeStatement(this,debug);
}
-} \ No newline at end of file
+}
diff --git a/sources/scala/dbc/statement/Update.scala b/sources/scala/dbc/statement/Update.scala
index cb32d89f60..bc541200c4 100644
--- a/sources/scala/dbc/statement/Update.scala
+++ b/sources/scala/dbc/statement/Update.scala
@@ -19,7 +19,7 @@ case class Update (
/** A SQL-99 compliant string representation of the select statement. */
- def sqlString: String = {
+ def sqlString: String = (
"UPDATE " +
updateTarget +
" SET " + setClauses.map(sc=>sc.sqlString).mkString("",", ","") +
@@ -27,7 +27,7 @@ case class Update (
case None => ""
case Some(expr) => " WHERE " + expr.sqlString
})
- }
+ );
/** The name of the table that should be updated. */
//def updateTarget: String;
@@ -40,4 +40,4 @@ case class Update (
* value. */
//def whereClause: Option[scala.dbc.statement.expression.Expression];
-} \ No newline at end of file
+}
diff --git a/sources/scala/dbc/statement/expression/Aggregate.scala b/sources/scala/dbc/statement/expression/Aggregate.scala
index c4847ade1c..d0dfd6a133 100644
--- a/sources/scala/dbc/statement/expression/Aggregate.scala
+++ b/sources/scala/dbc/statement/expression/Aggregate.scala
@@ -18,13 +18,13 @@ abstract class Aggregate extends Expression {
/** A SQL-99 compliant string representation of the relation sub-
* statement. This only has a meaning inside another statement. */
- def sqlInnerString: String = {
+ def sqlInnerString: String = (
aggregateName +
"(" + setFunction.sqlString + ")" +
(filterClause match {
case None => ""
case Some(fc) => " FILTER (WHERE " + fc.sqlString + ")"
})
- }
+ )
}
diff --git a/sources/scala/dbc/statement/expression/Field.scala b/sources/scala/dbc/statement/expression/Field.scala
index bcf5d9f29d..55b7c96053 100644
--- a/sources/scala/dbc/statement/expression/Field.scala
+++ b/sources/scala/dbc/statement/expression/Field.scala
@@ -21,7 +21,7 @@ abstract class Field extends Expression {
/** A SQL-99 compliant string representation of the relation sub-
* statement. This only has a meaning inside another statement. */
- def sqlInnerString: String = {
+ def sqlInnerString: String = (
(schemaName match {
case None => ""
case Some(sn) => sn + "."
@@ -30,6 +30,6 @@ abstract class Field extends Expression {
case None => ""
case Some(tn) => tn + "."
}) + fieldName
- }
+ )
}
diff --git a/sources/scala/dbc/statement/expression/SetFunction.scala b/sources/scala/dbc/statement/expression/SetFunction.scala
index 3779dac581..6a3ba37d2d 100644
--- a/sources/scala/dbc/statement/expression/SetFunction.scala
+++ b/sources/scala/dbc/statement/expression/SetFunction.scala
@@ -20,14 +20,14 @@ object SetFunction {
abstract class General extends SetFunction {
def setQuantifier: Option[SetQuantifier];
def valueExpression: Expression;
- def sqlString = {
+ def sqlString = (
"(" +
(setQuantifier match {
case None => ""
case Some(sq) => sq.sqlString + " "
}) +
valueExpression.sqlString + ")"
- }
+ );
}
abstract class Binary extends SetFunction {
def sqlString = error("Binary set function is not supported yet.");
diff --git a/sources/scala/reflect/Print.scala b/sources/scala/reflect/Print.scala
index 489cb90fec..decfe933cc 100644
--- a/sources/scala/reflect/Print.scala
+++ b/sources/scala/reflect/Print.scala
@@ -35,23 +35,23 @@ object Print extends Function1[Any, String] {
case reflect.Literal(value) =>
"Literal (" + value + ")"
case reflect.Apply(fun, args) =>
- "Apply (" + Print(fun) + " on " +
- ((args match {
- case Nil => "nothing "
- case _ :: _ => args.map(Print).mkString("", ", ", "")
- }):String) + ")"
+ ("Apply (" + Print(fun) + " on " +
+ ((args match {
+ case Nil => "nothing "
+ case _ :: _ => args.map(Print).mkString("", ", ", "")
+ }):String) + ")")
case reflect.TypeApply(fun, args) =>
- "TypeApply (" + Print(fun) + " on " +
- ((args match {
- case Nil => "nothing"
- case _ :: _ => args.map(Print).mkString("", ", ", "")
- }):String) + ")"
+ ("TypeApply (" + Print(fun) + " on " +
+ ((args match {
+ case Nil => "nothing"
+ case _ :: _ => args.map(Print).mkString("", ", ", "")
+ }):String) + ")")
case reflect.Function(params, body) =>
- "Function (" +
- ((params match {
- case Nil => "nothing"
- case _ :: _ => params.map(Print).mkString("", ", ", "")
- }):String) + " is " + Print(body) + ")"
+ ("Function (" +
+ ((params match {
+ case Nil => "nothing"
+ case _ :: _ => params.map(Print).mkString("", ", ", "")
+ }):String) + " is " + Print(body) + ")")
case reflect.This(sym) =>
"This (" + Print(sym) + ")"
case _ => "UnknownCode"
@@ -67,11 +67,11 @@ object Print extends Function1[Any, String] {
case reflect.TypeField(name, datatype) =>
"TypeField (" + name + " of " + Print(datatype) + ")"
case reflect.LocalValue(owner, name, datatype) =>
- "LocalValue (" + name + " owned by " + Print(owner) +
- " of " + Print(datatype) + ")"
+ ("LocalValue (" + name + " owned by " + Print(owner) +
+ " of " + Print(datatype) + ")")
case reflect.LocalMethod(owner, name, datatype) =>
- "LocalMethod (" + name + " owned by " + Print(owner) +
- " of " + Print(datatype) + ")"
+ ("LocalMethod (" + name + " owned by " + Print(owner) +
+ " of " + Print(datatype) + ")")
case reflect.NoSymbol => "NoSymbol"
case reflect.RootSymbol => "RootSymbol"
case _ => "UnknownSymbol"
@@ -89,24 +89,24 @@ object Print extends Function1[Any, String] {
case reflect.ThisType(clazz) =>
"ThisType (" + Print(clazz) + ")"
case reflect.AppliedType(datatype, args) =>
- "AppliedType (" + Print(datatype) + " on " +
- ((args match {
- case Nil => "nothing"
- case _ :: _ => args.map(Print).mkString("", ", ", "")
- }):String) + ")"
+ ("AppliedType (" + Print(datatype) + " on " +
+ ((args match {
+ case Nil => "nothing"
+ case _ :: _ => args.map(Print).mkString("", ", ", "")
+ }):String) + ")")
case reflect.TypeBounds(lo, hi) =>
"TypeBounds (" + Print(lo) + " to " + Print(hi) + ")"
case reflect.MethodType(formals, resultType) =>
- "MethodType (" +
- ((formals match {
- case Nil => "nothing"
- case _ :: _ => formals.map(Print).mkString("", ", ", "")
- }):String) + " is " + Print(resultType) + ")"
+ ("MethodType (" +
+ ((formals match {
+ case Nil => "nothing"
+ case _ :: _ => formals.map(Print).mkString("", ", ", "")
+ }):String) + " is " + Print(resultType) + ")")
case reflect.PolyType(typeParams, typeBounds, resultType) =>
- "PolyType (" + (typeParams zip typeBounds).map{
+ ("PolyType (" + (typeParams zip typeBounds).map{
case Pair(typeParam, Pair(lo, hi)) =>
Print(lo) + " < " + Print(typeParam) + " < " + Print(hi)
- }.mkString("", ", ", "") + " to " + Print(resultType) + ")"
+ }.mkString("", ", ", "") + " to " + Print(resultType) + ")")
case _ => "UnknownType"
}
diff --git a/sources/scala/runtime/matching/Rule.scala b/sources/scala/runtime/matching/Rule.scala
index 6f5b867fcd..7bd6d40fd1 100644
--- a/sources/scala/runtime/matching/Rule.scala
+++ b/sources/scala/runtime/matching/Rule.scala
@@ -60,23 +60,21 @@ abstract class Rule extends Ordered[Rule] {
n.toString()+" ::= "+m.toString();
case TreeRule( n, label, n2 ) =>
- n.toString()+{ if( !n.vset.isEmpty ) n.vset.toString() else "" }+
- " ::= "+label+"( "+n2.toString()+{if( n2.nullable ) "~" else ""}+" )";
+ (n.toString()+{ if( !n.vset.isEmpty ) n.vset.toString() else "" }+
+ " ::= "+label+"( "+n2.toString()+{if( n2.nullable ) "~" else ""}+" )")
case AnyTreeRule( n ) =>
- n.toString()+{ if( !n.vset.isEmpty ) n.vset.toString() else "" }+
- " ::= _ ";
+ n.toString()+{ if( !n.vset.isEmpty ) n.vset.toString() else "" }+" ::= _ ";
case AnyNodeRule( n, h ) =>
- n.toString()+{ if( !n.vset.isEmpty ) n.vset.toString() else "" }+
- " ::= _ ( "+h.toString()+" )";
+ n.toString()+{ if( !n.vset.isEmpty ) n.vset.toString() else "" }+" ::= _ ( "+h.toString()+" )";
case HedgeRule( n, t, h ) =>
- n.toString()+{
+ n.toString()+(
if( n.nullable ) "~" else " "
- }+" ::= "+{
+ )+" ::= "+(
if( t == ANYTREE ) "_" else t.toString()
- }+" "+h.toString();
+ )+" "+h.toString();
}
}
diff --git a/sources/scala/tools/nsc/MainTokenMetric.scala b/sources/scala/tools/nsc/MainTokenMetric.scala
index 55a7759494..df05b627e0 100644
--- a/sources/scala/tools/nsc/MainTokenMetric.scala
+++ b/sources/scala/tools/nsc/MainTokenMetric.scala
@@ -22,7 +22,6 @@ object MainTokenMetric {
var totale = 0;
for (val source <- fnames) {
val s = new Scanner(new CompilationUnit(compiler.getSourceFile(source)));
- s.nextToken;
var i = 0;
while(s.token != EOF) {
i = i + 1;
diff --git a/sources/scala/tools/nsc/ast/parser/Parsers.scala b/sources/scala/tools/nsc/ast/parser/Parsers.scala
index 74183c83f8..e5308d35d4 100755
--- a/sources/scala/tools/nsc/ast/parser/Parsers.scala
+++ b/sources/scala/tools/nsc/ast/parser/Parsers.scala
@@ -324,14 +324,14 @@ import Tokens._;
if (in.token == THIS) {
t = atPos(in.skipToken()) { This(nme.EMPTY.toTypeName) }
if (!thisOK || in.token == DOT)
- t = { selectors(t, typeOK, accept(DOT)) }
+ t = atPos(accept(DOT)) { selectors(t, typeOK) }
} else if (in.token == SUPER) {
t = atPos(in.skipToken()) {
Super(nme.EMPTY.toTypeName, mixinQualifierOpt())
}
t = atPos(accept(DOT)) { Select(t, ident()) }
if (in.token == DOT)
- t = { selectors(t, typeOK, in.skipToken()) }
+ t = atPos(in.skipToken()) { selectors(t, typeOK) }
} else {
val i = atPos(in.currentPos) { Ident(ident()) }
t = i;
@@ -341,35 +341,29 @@ import Tokens._;
in.nextToken();
t = atPos(i.pos) { This(i.name.toTypeName) }
if (!thisOK || in.token == DOT)
- t = { selectors(t, typeOK, accept(DOT)) }
+ t = atPos(accept(DOT)) { selectors(t, typeOK) }
} else if (in.token == SUPER) {
in.nextToken();
t = atPos(i.pos) { Super(i.name.toTypeName, mixinQualifierOpt()) }
t = atPos(accept(DOT)) { Select(t, ident())}
if (in.token == DOT)
- t = { selectors(t, typeOK, in.skipToken()) }
+ t = atPos(in.skipToken()) { selectors(t, typeOK) }
} else {
- t = { selectors(t, typeOK, pos) }
+ t = atPos(pos) { selectors(t, typeOK) }
}
}
}
t
}
- def selectors(t: Tree, typeOK: boolean, pos: Int): Tree =
+ def selectors(t: Tree, typeOK: boolean): Tree =
if (typeOK && in.token == TYPE) {
in.nextToken();
- atPos(pos) { SingletonTypeTree(t) }
+ SingletonTypeTree(t)
} else {
- val ident0 : Name = ident();
- //System.err.println("IDENT: " + ident0);
- val t1 = atPos(pos) { Select(t, ident0); }
- if (in.token == DOT) {
- val skipPos = in.skipToken();
- //System.err.println("SKIP: " + skipPos);
- //Thread.dumpStack();
- selectors(t1, typeOK, skipPos);
- } else t1;
+ val t1 = Select(t, ident());
+ if (in.token == DOT) atPos(in.skipToken()) { selectors(t1, typeOK) }
+ else t1
}
/** MixinQualifier ::= `[' Id `]'
@@ -395,7 +389,7 @@ import Tokens._;
*/
def qualId(): Tree = {
val id = atPos(in.currentPos) { Ident(ident()) }
- if (in.token == DOT) { selectors(id, false, in.skipToken()) }
+ if (in.token == DOT) atPos(in.skipToken()) { selectors(id, false) }
else id
}
@@ -1643,8 +1637,8 @@ import Tokens._;
in.token == LBRACKET ||
isModifier) {
val attrs = attributeClauses();
- stats ++
- joinAttributes(attrs, joinComment(List(tmplDef(modifiers() | traitAttribute(attrs)))))
+ (stats ++
+ joinAttributes(attrs, joinComment(List(tmplDef(modifiers() | traitAttribute(attrs))))))
} else if (in.token != SEMI && in.token != NEWLINE) {
syntaxError("illegal start of class or object definition", true);
}
@@ -1669,8 +1663,8 @@ import Tokens._;
stats += expr()
} else if (isDefIntro || isModifier || in.token == LBRACKET) {
val attrs = attributeClauses();
- stats ++
- joinAttributes(attrs, joinComment(defOrDcl(modifiers() | traitAttribute(attrs))))
+ (stats ++
+ joinAttributes(attrs, joinComment(defOrDcl(modifiers() | traitAttribute(attrs)))))
} else if (in.token != SEMI && in.token != NEWLINE) {
syntaxError("illegal start of definition", true);
}
diff --git a/sources/scala/tools/nsc/backend/icode/TypeKinds.scala b/sources/scala/tools/nsc/backend/icode/TypeKinds.scala
index e4cf469538..c1f0c204c6 100644
--- a/sources/scala/tools/nsc/backend/icode/TypeKinds.scala
+++ b/sources/scala/tools/nsc/backend/icode/TypeKinds.scala
@@ -278,8 +278,8 @@ import scala.collection.mutable.{Map, HashMap};
case ARRAY(elem2) =>
elem <:< elem2;
case REFERENCE(sym) =>
- sym == definitions.AnyRefClass ||
- sym == definitions.ObjectClass; // TODO: platform dependent!
+ (sym == definitions.AnyRefClass ||
+ sym == definitions.ObjectClass) // TODO: platform dependent!
case _ => false;
}
diff --git a/sources/scala/tools/nsc/backend/icode/TypeStacks.scala b/sources/scala/tools/nsc/backend/icode/TypeStacks.scala
index 3bd23ab480..1f0f8b887c 100644
--- a/sources/scala/tools/nsc/backend/icode/TypeStacks.scala
+++ b/sources/scala/tools/nsc/backend/icode/TypeStacks.scala
@@ -87,11 +87,10 @@ trait TypeStacks: ICodes {
(types.foldLeft(new StringBuffer("")) ((buf, k) => buf.append(" ").append(k))).toString();
}
- override def equals(other: Any): Boolean = {
+ override def equals(other: Any): Boolean = (
other.isInstanceOf[TypeStack] &&
- List.forall2(other.asInstanceOf[TypeStack].types,
- types) ((a, b) => a == b);
- }
+ List.forall2(other.asInstanceOf[TypeStack].types, types)((a, b) => a == b)
+ );
}
}
diff --git a/sources/scala/tools/nsc/matching/PatternNodes.scala b/sources/scala/tools/nsc/matching/PatternNodes.scala
index 126f3e2506..551d964c39 100644
--- a/sources/scala/tools/nsc/matching/PatternNodes.scala
+++ b/sources/scala/tools/nsc/matching/PatternNodes.scala
@@ -165,10 +165,10 @@ trait PatternNodes: TransMatcher {
case VariablePat(tree) =>
q match {
case VariablePat(other) =>
- (tree.symbol != null) &&
- (tree.symbol != NoSymbol) &&
- (!tree.symbol.isError) &&
- (tree.symbol == other.symbol);
+ ((tree.symbol != null) &&
+ (tree.symbol != NoSymbol) &&
+ (!tree.symbol.isError) &&
+ (tree.symbol == other.symbol))
case _ =>
false;
}
diff --git a/sources/scala/tools/nsc/symtab/Definitions.scala b/sources/scala/tools/nsc/symtab/Definitions.scala
index a5de7158f4..04606ce168 100755
--- a/sources/scala/tools/nsc/symtab/Definitions.scala
+++ b/sources/scala/tools/nsc/symtab/Definitions.scala
@@ -112,8 +112,8 @@ import Flags._;
def isFunctionType(tp: Type): boolean = tp match {
case TypeRef(_, sym, args) =>
- (args.length > 0) && (args.length - 1 <= MaxFunctionArity) &&
- (sym == FunctionClass(args.length - 1))
+ ((args.length > 0) && (args.length - 1 <= MaxFunctionArity) &&
+ (sym == FunctionClass(args.length - 1)))
case _ =>
false
}
@@ -191,12 +191,8 @@ import Flags._;
val result =
if (module) sym.info.nonPrivateMember(fullname.subName(i, j)).suchThat(.hasFlag(MODULE));
else sym.info.nonPrivateMember(fullname.subName(i, j).toTypeName);
- if (result == NoSymbol) {
- val msg = (if (module) "object " else "class ") + fullname + " not found.";
- System.err.println("MSG: " + msg);
- Thread.dumpStack();
- throw new FatalError(msg);
- }
+ if (result == NoSymbol)
+ throw new FatalError((if (module) "object " else "class ") + fullname + " not found.");
result
}
diff --git a/sources/scala/tools/nsc/symtab/Symbols.scala b/sources/scala/tools/nsc/symtab/Symbols.scala
index 9da395f697..80b7bf3a6d 100755
--- a/sources/scala/tools/nsc/symtab/Symbols.scala
+++ b/sources/scala/tools/nsc/symtab/Symbols.scala
@@ -761,8 +761,8 @@ import Flags._;
else if (isAbstractType)
tp match {
case TypeBounds(lo, hi) =>
- (if (lo.symbol == AllClass) "" else " >: " + lo) +
- (if (hi.symbol == AnyClass) "" else " <: " + hi)
+ ((if (lo.symbol == AllClass) "" else " >: " + lo) +
+ (if (hi.symbol == AnyClass) "" else " <: " + hi))
case _ =>
"<: " + tp;
}
diff --git a/sources/scala/tools/nsc/symtab/Types.scala b/sources/scala/tools/nsc/symtab/Types.scala
index 355eca2e82..583ca6503c 100755
--- a/sources/scala/tools/nsc/symtab/Types.scala
+++ b/sources/scala/tools/nsc/symtab/Types.scala
@@ -807,8 +807,8 @@ import Flags._;
if (isFunctionType(this))
return args.init.mkString("(", ", ", ")") + " => " + args.last;
}
- pre.prefixString + sym.nameString +
- (if (args.isEmpty) "" else args.mkString("[", ",", "]"))
+ (pre.prefixString + sym.nameString +
+ (if (args.isEmpty) "" else args.mkString("[", ",", "]")))
}
override def prefixString =
@@ -1444,10 +1444,10 @@ import Flags._;
}
isSameTypes(parents1, parents2) && isSubScope(ref1, ref2) && isSubScope(ref2, ref1)
case Pair(MethodType(pts1, res1), MethodType(pts2, res2)) =>
- pts1.length == pts2.length &&
- isSameTypes(pts1, pts2) &&
- res1 =:= res2 &&
- tp1.isInstanceOf[ImplicitMethodType] == tp2.isInstanceOf[ImplicitMethodType]
+ (pts1.length == pts2.length &&
+ isSameTypes(pts1, pts2) &&
+ res1 =:= res2 &&
+ tp1.isInstanceOf[ImplicitMethodType] == tp2.isInstanceOf[ImplicitMethodType])
case Pair(PolyType(tparams1, res1), PolyType(tparams2, res2)) =>
(tparams1.length == tparams2.length &&
List.forall2(tparams1, tparams2)
@@ -2026,8 +2026,6 @@ import Flags._;
/** An exception signalling a malformed type */
class MalformedType(msg: String) extends TypeError(msg) {
def this(pre: Type, tp: String) = this("malformed type: " + pre + "#" + tp);
- // System.err.println("MALFORMED_TYPE: " + msg);
- // Thread.dumpStack();
}
/** An exception signalling a malformed closure */
diff --git a/sources/scala/tools/nsc/symtab/classfile/UnPickler.scala b/sources/scala/tools/nsc/symtab/classfile/UnPickler.scala
index 89adee33ef..40ed7cc255 100755
--- a/sources/scala/tools/nsc/symtab/classfile/UnPickler.scala
+++ b/sources/scala/tools/nsc/symtab/classfile/UnPickler.scala
@@ -57,8 +57,8 @@ abstract class UnPickler {
/** Does entry represent an (internal) symbol */
private def isSymbolEntry(i: int): boolean = {
val tag = bytes(index(i));
- firstSymTag <= tag && tag <= lastSymTag &&
- (tag != CLASSsym || !isRefinementSymbolEntry(i))
+ (firstSymTag <= tag && tag <= lastSymTag &&
+ (tag != CLASSsym || !isRefinementSymbolEntry(i)))
}
/** Does entry represent a refinement symbol?
diff --git a/sources/scala/tools/nsc/transform/Erasure.scala b/sources/scala/tools/nsc/transform/Erasure.scala
index b015b5646c..c726d2255d 100755
--- a/sources/scala/tools/nsc/transform/Erasure.scala
+++ b/sources/scala/tools/nsc/transform/Erasure.scala
@@ -163,8 +163,8 @@ abstract class Erasure extends AddInterfaces with typechecker.Analyzer {
/** The method-name xxxValue, where Xxx is a numeric value class name */
def unboxOp(tp: Type) = {
val clazzName = tp.symbol.name.toString();
- String.valueOf((clazzName.charAt(0) + ('a' - 'A')).asInstanceOf[char]) +
- clazzName.substring(1) + "Value"
+ (String.valueOf((clazzName.charAt(0) + ('a' - 'A')).asInstanceOf[char]) +
+ clazzName.substring(1) + "Value")
}
/** Unbox `tree' of boxed type to expected type `pt' */
@@ -444,14 +444,14 @@ abstract class Erasure extends AddInterfaces with typechecker.Analyzer {
//System.out.println("bridge? " + member + ":" + member.tpe + member.locationString + " to " + other + ":" + other.tpe + other.locationString);//DEBUG
if (!atPhase(phase.prev)(member hasFlag DEFERRED)) {
val otpe = erasure(other.tpe);
- val bridgeNeeded = atPhase(phase.next) {
+ val bridgeNeeded = atPhase(phase.next) (
!(other.tpe =:= member.tpe) &&
{ var e = bridgesScope.lookupEntry(member.name);
while (e != null && !((e.sym.tpe =:= otpe) && (bridgeTarget(e.sym) == member)))
e = bridgesScope.lookupNextEntry(e);
e == null
}
- }
+ );
if (bridgeNeeded) {
val bridge = other.cloneSymbolImpl(owner)
.setPos(owner.pos)
diff --git a/sources/scala/tools/nsc/transform/OverridingPairs.scala b/sources/scala/tools/nsc/transform/OverridingPairs.scala
index 2830fed9f5..2f80216dbe 100755
--- a/sources/scala/tools/nsc/transform/OverridingPairs.scala
+++ b/sources/scala/tools/nsc/transform/OverridingPairs.scala
@@ -38,8 +38,8 @@ abstract class OverridingPairs {
private def intersectionContainsElementLeq(bs1: BitSet, bs2: BitSet, n: int): boolean = {
val nshifted = n >> 5;
val nmask = 1 << (n & 31);
- (List.range(0, nshifted) exists (i => (bs1(i) & bs2(i)) != 0)) ||
- ((bs1(nshifted) & bs2(nshifted) & (nmask | nmask - 1)) != 0)
+ ((List.range(0, nshifted) exists (i => (bs1(i) & bs2(i)) != 0)) ||
+ ((bs1(nshifted) & bs2(nshifted) & (nmask | nmask - 1)) != 0))
}
private val decls = new Scope;
diff --git a/sources/scala/tools/nsc/transform/TailCalls.scala b/sources/scala/tools/nsc/transform/TailCalls.scala
index 3a1e38b9b7..c6fa574228 100644
--- a/sources/scala/tools/nsc/transform/TailCalls.scala
+++ b/sources/scala/tools/nsc/transform/TailCalls.scala
@@ -94,10 +94,10 @@ abstract class TailCalls extends Transform
accessed = false;
}
- override def toString(): String = {
+ override def toString(): String = (
"" + currentMethod.name + " tparams: " + tparams + " tailPos: " + tailPos +
- " accessed: " + accessed + "\nLabel: " + label + "\nLabel type: " + label.info;
- }
+ " accessed: " + accessed + "\nLabel: " + label + "\nLabel type: " + label.info
+ );
}
private def mkContext(that: Context) = new Context(that);
diff --git a/sources/scala/tools/nsc/typechecker/Infer.scala b/sources/scala/tools/nsc/typechecker/Infer.scala
index 66fec1ec56..fb03509627 100755
--- a/sources/scala/tools/nsc/typechecker/Infer.scala
+++ b/sources/scala/tools/nsc/typechecker/Infer.scala
@@ -367,9 +367,9 @@ package scala.tools.nsc.typechecker;
case MethodType(formals0, restpe) =>
val formals = formalTypes(formals0, argtpes.length);
if (undetparams.isEmpty) {
- formals.length == argtpes.length &&
- isCompatible(argtpes, formals) &&
- isCompatible(restpe, pt)
+ (formals.length == argtpes.length &&
+ isCompatible(argtpes, formals) &&
+ isCompatible(restpe, pt))
} else {
try {
val uninstantiated = new ListBuffer[Symbol];
@@ -587,11 +587,11 @@ package scala.tools.nsc.typechecker;
case OverloadedType(pre, alts) => tryTwice {
if (settings.debug.value) log("infer method alt " + tree.symbol + " with alternatives " + (alts map pre.memberType) + ", argtpes = " + argtpes + ", pt = " + pt);//debug
val alts1 = alts filter (alt => isApplicable(undetparams, pre.memberType(alt), argtpes, pt));
- def improves(sym1: Symbol, sym2: Symbol) = {
+ def improves(sym1: Symbol, sym2: Symbol) = (
sym2 == NoSymbol || sym2.isError ||
((sym1.owner isSubClass sym2.owner) &&
specializes(pre.memberType(sym1), pre.memberType(sym2)))
- }
+ );
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/RefChecks.scala b/sources/scala/tools/nsc/typechecker/RefChecks.scala
index 8fc0c0c7cf..f60ffae9b5 100755
--- a/sources/scala/tools/nsc/typechecker/RefChecks.scala
+++ b/sources/scala/tools/nsc/typechecker/RefChecks.scala
@@ -228,7 +228,7 @@ abstract class RefChecks extends InfoTransform {
if ((member hasFlag DEFERRED) && !(clazz hasFlag ABSTRACT)) {
abstractClassError(false,
infoString(member) + " is not defined" +
- (if (member.isVariable)
+ (if (member.isVariable || member.hasFlag(ACCESSOR))
"\n(Note that variables need to be initialized to be defined)" else ""))
} else if ((member hasFlag ABSOVERRIDE) && member.isIncompleteIn(clazz)) {
val other = member.superSymbol(clazz);
diff --git a/sources/scala/tools/nsc/typechecker/SyntheticMethods.scala b/sources/scala/tools/nsc/typechecker/SyntheticMethods.scala
index 38c680b4f6..3fef013f18 100755
--- a/sources/scala/tools/nsc/typechecker/SyntheticMethods.scala
+++ b/sources/scala/tools/nsc/typechecker/SyntheticMethods.scala
@@ -26,9 +26,9 @@ import util.ListBuffer;
def hasImplementation(name: Name): boolean = {
val sym = clazz.info.nonPrivateMember(name);
- sym.isTerm &&
- (sym.owner == clazz ||
- !(ObjectClass isSubClass sym.owner) && !(sym hasFlag DEFERRED));
+ (sym.isTerm &&
+ (sym.owner == clazz ||
+ !(ObjectClass isSubClass sym.owner) && !(sym hasFlag DEFERRED)))
}
def syntheticMethod(name: Name, flags: int, tpe: Type) = {
diff --git a/sources/scala/tools/nsc/typechecker/Typers.scala b/sources/scala/tools/nsc/typechecker/Typers.scala
index 3f096609eb..a7e363ecb1 100755
--- a/sources/scala/tools/nsc/typechecker/Typers.scala
+++ b/sources/scala/tools/nsc/typechecker/Typers.scala
@@ -97,6 +97,8 @@ import collection.mutable.HashMap;
val SUPERCONSTRmode = 0x100; // Set for the `super' in a superclass constructor call
// super.<init>
+ val STATmode = 0x200; // Set if we are type-checking a statement.
+
private val stickyModes: int = EXPRmode | PATTERNmode | TYPEmode;
/** Report a type error.
@@ -324,8 +326,10 @@ import collection.mutable.HashMap;
typed(applyImplicitArgs(tree1), mode, pt)
case mt: MethodType if ((mode & (EXPRmode | FUNmode)) == EXPRmode &&
isCompatible(tree.tpe, pt)) => // (4.2)
- if (tree.symbol.isConstructor) errorTree(tree, "missing arguments for " + tree.symbol)
- else {
+ if (tree.symbol.isConstructor || (mode & STATmode) != 0) {
+ errorTree(tree, "missing arguments for " + tree.symbol)
+ } else {
+ if (settings.debug.value) log("eta-expanding " + tree + ":" + tree.tpe + " to " + pt);//debug
typed(etaExpand(tree), mode, pt)
}
case _ =>
@@ -821,7 +825,8 @@ import collection.mutable.HashMap;
EmptyTree
case _ =>
(if (exprOwner != context.owner && (!stat.isDef || stat.isInstanceOf[LabelDef]))
- newTyper(context.make(stat, exprOwner)) else this).typed(stat)
+ newTyper(context.make(stat, exprOwner)) else this)
+ .typed(stat, EXPRmode | STATmode, WildcardType)
}
}
@@ -1482,10 +1487,10 @@ import collection.mutable.HashMap;
if (util.Statistics.enabled) implcnt = implcnt + 1;
val startTime = if (util.Statistics.enabled) System.currentTimeMillis() else 0l;
- def isBetter(sym1: Symbol, tpe1: Type, sym2: Symbol, tpe2: Type): boolean = {
+ def isBetter(sym1: Symbol, tpe1: Type, sym2: Symbol, tpe2: Type): boolean = (
sym2.isError ||
- (sym1.owner != sym2.owner) && (sym1.owner isSubClass sym2.owner) && (tpe1 matches tpe2);
- }
+ (sym1.owner != sym2.owner) && (sym1.owner isSubClass sym2.owner) && (tpe1 matches tpe2)
+ );
val tc = newTyper(context.makeImplicit(reportAmbiguous));
def searchImplicit(implicitInfoss: List[List[ImplicitInfo]], local: boolean): Tree = {
diff --git a/sources/scala/tools/scalac/typechecker/Analyzer.scala b/sources/scala/tools/scalac/typechecker/Analyzer.scala
index c0694878a7..e39316a7b4 100644
--- a/sources/scala/tools/scalac/typechecker/Analyzer.scala
+++ b/sources/scala/tools/scalac/typechecker/Analyzer.scala
@@ -1517,8 +1517,7 @@ class Analyzer(global: scalac_Global, descr: AnalyzerPhase) extends Transformer(
case Type$MethodType(_, _) =>
// convert unapplied methods to functions.
if ((mode & (EXPRmode | FUNmode)) == EXPRmode &&
- (infer.isCompatible(tree.getType(), pt) ||
- pt.symbol() == definitions.UNIT_CLASS)) {
+ (infer.isCompatible(tree.getType(), pt))) {
checkEtaExpandable(tree.pos, tree.getType());
if (TreeInfo.methPart(tree).symbol() == definitions.ANY_MATCH) {
error(tree.pos, "`match' needs to be applied fully");
@@ -1649,7 +1648,7 @@ class Analyzer(global: scalac_Global, descr: AnalyzerPhase) extends Transformer(
case _ =>
}
if ((mode & EXPRmode) != 0) {
- if (pt.symbol() == definitions.UNIT_CLASS) {
+ if (pt.isInstanceOf[Type$TypeRef] && pt.symbol() == definitions.UNIT_CLASS && tree.getType().isSubType(definitions.ANY_TYPE())) {
return gen.mkUnitBlock(tree);
} else if (infer.isCompatible(tree.getType(), pt)) {
tree match {
diff --git a/sources/scala/xml/MetaData.scala b/sources/scala/xml/MetaData.scala
index 74b8e2d850..285e3eb850 100644
--- a/sources/scala/xml/MetaData.scala
+++ b/sources/scala/xml/MetaData.scala
@@ -114,7 +114,7 @@ abstract class MetaData extends Iterable[MetaData] {
def key: String;
/** returns key of this MetaData item */
- def value: Any;
+ def value: String;
/** maps this sequence of meta data */
def map(f: MetaData => Text): List[Text] = f(this)::(next map f);
@@ -123,15 +123,14 @@ abstract class MetaData extends Iterable[MetaData] {
def next: MetaData;
/** gets value of unqualified (unprefixed) attribute with given key */
- def getValue(key: String): Any;
+ def getValue(key: String): String;
/** gets value of qualified (prefixed) attribute with given key */
- def getValue(namespace: String, owner: Node, key: String): Any =
+ def getValue(namespace: String, owner: Node, key: String): String =
getValue(namespace, owner.scope, key);
/** gets value of qualified (prefixed) attribute with given key */
- def getValue(namespace: String, scope: NamespaceBinding, key: String): Any;
-
+ def getValue(namespace: String, scope: NamespaceBinding, key: String): String;
override def hashCode(): Int;
def toString1(): String = {
diff --git a/sources/scala/xml/NodeSeq.scala b/sources/scala/xml/NodeSeq.scala
index 105c2e70b4..84d37d5790 100644
--- a/sources/scala/xml/NodeSeq.scala
+++ b/sources/scala/xml/NodeSeq.scala
@@ -50,7 +50,7 @@ abstract class NodeSeq extends Seq[Node] {
val y = this(0);
val v = y.attribute(k);
if( v != null ) {
- res = NodeSeq.fromSeq(Seq.single(new Atom(v)));
+ res = NodeSeq.fromSeq(Seq.single(Text(v)));
}
case _ =>
diff --git a/sources/scala/xml/PrefixedAttribute.scala b/sources/scala/xml/PrefixedAttribute.scala
index 4afb7c6c3a..4eb947e2c1 100644
--- a/sources/scala/xml/PrefixedAttribute.scala
+++ b/sources/scala/xml/PrefixedAttribute.scala
@@ -14,18 +14,14 @@ package scala.xml;
*/
class PrefixedAttribute(val pre: String,
val key: String,
- val value: Any,
+ val value: String,
val next: MetaData) extends MetaData {
-/*
-
// verify that value is a proper attribute value (references, no &lt;)
- // update: this should happen before the attribute is constructed.
- Utility.checkAttributeValue(value.toString()) match {
+ Utility.checkAttributeValue(value) match {
case null => ;
case msg => throw new MalformedAttributeException(msg);
}
-*/
/** Returns a copy of this unprefixed attribute with the given
* next field.
@@ -56,11 +52,11 @@ class PrefixedAttribute(val pre: String,
owner.getNamespace(pre);
/** forwards the call to next */
- def getValue(key: String): Any = next.getValue(key);
+ def getValue(key: String): String = next.getValue(key);
/** gets attribute value of qualified (prefixed) attribute with given key
*/
- def getValue(namespace: String, scope: NamespaceBinding, key: String): Any = {
+ def getValue(namespace: String, scope: NamespaceBinding, key: String): String = {
if (key == this.key && scope.getURI(pre) == namespace)
value
else
@@ -79,7 +75,7 @@ class PrefixedAttribute(val pre: String,
sb.append(':');
sb.append(key);
sb.append('=');
- Utility.appendAttributeValue(value.toString(), sb);
+ Utility.appendQuoted(value, sb);
}
def wellformed(scope: NamespaceBinding): Boolean = {
diff --git a/sources/scala/xml/UnprefixedAttribute.scala b/sources/scala/xml/UnprefixedAttribute.scala
index a705c81ab5..82d30ac804 100644
--- a/sources/scala/xml/UnprefixedAttribute.scala
+++ b/sources/scala/xml/UnprefixedAttribute.scala
@@ -12,16 +12,14 @@ package scala.xml;
/** unprefixed attributes have the null namespace
*/
-class UnprefixedAttribute(val key: String, val value: Any, val next: MetaData) extends MetaData {
+class UnprefixedAttribute(val key: String, val value: String, val next: MetaData) extends MetaData {
- /*
// verify that value is a proper attribute value (references, no &lt;)
- // this should happen before the attribute is constructed.
Utility.checkAttributeValue(value) match {
case null => ;
case msg => throw new MalformedAttributeException(msg);
}
-*/
+
/** returns a copy of this unprefixed attribute with the given next field*/
def copy(next: MetaData) =
new UnprefixedAttribute(key, value, next);
@@ -39,7 +37,7 @@ class UnprefixedAttribute(val key: String, val value: Any, val next: MetaData) e
* @param key
* @return ..
*/
- def getValue(key: String): Any =
+ def getValue(key: String): String =
if (key == this.key) value else next.getValue(key);
/**
@@ -50,7 +48,7 @@ class UnprefixedAttribute(val key: String, val value: Any, val next: MetaData) e
* @param key
* @return ..
*/
- def getValue(namespace: String, scope: NamespaceBinding, key: String): Any =
+ def getValue(namespace: String, scope: NamespaceBinding, key: String): String =
next.getValue(namespace, scope, key);
override def hashCode() =
@@ -62,7 +60,7 @@ class UnprefixedAttribute(val key: String, val value: Any, val next: MetaData) e
def toString1(sb:StringBuffer): Unit = {
sb.append(key);
sb.append('=');
- Utility.appendAttributeValue(value.toString(), sb);
+ Utility.appendQuoted(value, sb);
}
def wellformed(scope: NamespaceBinding): Boolean =
diff --git a/sources/scala/xml/Utility.scala b/sources/scala/xml/Utility.scala
index 29314774e4..2737e75d58 100644
--- a/sources/scala/xml/Utility.scala
+++ b/sources/scala/xml/Utility.scala
@@ -190,27 +190,6 @@ object Utility extends AnyRef with parsing.TokenTests {
sb.append(ch).append(s).append(ch)
}
-
- /**
- * Appends &quot;s&quot; if s does not contain &quot;, &apos;s&apos;
- * otherwise, and replaces &lt; and &amp;
- *
- * @param s
- * @param sb
- */
- def appendAttributeValue(s: String, sb: StringBuffer) = {
- val ch = if (s.indexOf('"') == -1) '"' else '\'';
- sb.append(ch);
- val ss: Seq[Char] = s;
- val it = ss.elements;
- while(it.hasNext) it.next match {
- case '<' => sb.append("&lt;");
- case '&' => sb.append("&amp;");
- case x => sb.append(x);
- }
- sb.append(ch)
- }
-
/**
* Appends &quot;s&quot; and escapes and &quot; i s with \&quot;
*