summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormihaylov <mihaylov@epfl.ch>2007-05-15 10:46:54 +0000
committermihaylov <mihaylov@epfl.ch>2007-05-15 10:46:54 +0000
commit9450c16f193ecab560f9374f7965a60be3b09c18 (patch)
tree03a4f5327a7f2f941d93c71e4a3ad8ba0d3f17cc
parent8de5ae2b13556c5dea09049b79a40b378e93d008 (diff)
downloadscala-9450c16f193ecab560f9374f7965a60be3b09c18.tar.gz
scala-9450c16f193ecab560f9374f7965a60be3b09c18.tar.bz2
scala-9450c16f193ecab560f9374f7965a60be3b09c18.zip
Synced src/dotnet-library with src/library rev ...
Synced src/dotnet-library with src/library rev 11027
-rwxr-xr-x[-rw-r--r--]lib/scalaruntime.dllbin4608 -> 5120 bytes
-rw-r--r--src/compiler/scala/tools/nsc/backend/icode/GenICode.scala6
-rw-r--r--src/compiler/scala/tools/nsc/backend/msil/GenMSIL.scala31
-rw-r--r--src/compiler/scala/tools/nsc/symtab/Definitions.scala5
-rw-r--r--src/dotnet-library/scala/Application.scala47
-rw-r--r--src/dotnet-library/scala/Math.scala64
-rw-r--r--src/dotnet-library/scala/Symbol.scala18
-rw-r--r--src/dotnet-library/scala/compat/Math.scala5
-rw-r--r--src/dotnet-library/scala/runtime/Comparator.cs40
-rw-r--r--src/dotnet-library/scala/runtime/RichChar.scala12
-rw-r--r--src/dotnet-library/scala/runtime/RichDouble.scala18
-rw-r--r--src/dotnet-library/scala/runtime/RichException.scala4
-rw-r--r--src/dotnet-library/scala/runtime/RichFloat.scala20
-rw-r--r--src/dotnet-library/scala/runtime/RichString.scala2
-rw-r--r--src/library/scala/Array.scala1
-rw-r--r--src/library/scala/util/Properties.scala (renamed from src/library/scala/runtime/Properties.scala)2
16 files changed, 215 insertions, 60 deletions
diff --git a/lib/scalaruntime.dll b/lib/scalaruntime.dll
index 43c0a1cc24..86dff58dc5 100644..100755
--- a/lib/scalaruntime.dll
+++ b/lib/scalaruntime.dll
Binary files differ
diff --git a/src/compiler/scala/tools/nsc/backend/icode/GenICode.scala b/src/compiler/scala/tools/nsc/backend/icode/GenICode.scala
index e10691420d..b668e28c05 100644
--- a/src/compiler/scala/tools/nsc/backend/icode/GenICode.scala
+++ b/src/compiler/scala/tools/nsc/backend/icode/GenICode.scala
@@ -43,7 +43,7 @@ abstract class GenICode extends SubComponent {
val SCALA_ALLREF = REFERENCE(definitions.AllRefClass)
val THROWABLE = REFERENCE(definitions.ThrowableClass)
- val BoxedCharacterClass = definitions.getClass("java.lang.Character")
+ val BoxedCharacterClass = if (forMSIL) null else definitions.getClass("java.lang.Character")
val Comparator_equals = definitions.getMember(definitions.getModule("scala.runtime.Comparator"),
nme.equals_)
@@ -1384,9 +1384,9 @@ abstract class GenICode extends SubComponent {
(lsym == definitions.ObjectClass) ||
(rsym == definitions.ObjectClass) ||
(lsym isNonBottomSubClass definitions.BoxedNumberClass)||
- (lsym isNonBottomSubClass BoxedCharacterClass) ||
+ (!forMSIL && (lsym isNonBottomSubClass BoxedCharacterClass)) ||
(rsym isNonBottomSubClass definitions.BoxedNumberClass) ||
- (rsym isNonBottomSubClass BoxedCharacterClass)
+ (!forMSIL && (rsym isNonBottomSubClass BoxedCharacterClass))
}
if (mustUseAnyComparator) {
diff --git a/src/compiler/scala/tools/nsc/backend/msil/GenMSIL.scala b/src/compiler/scala/tools/nsc/backend/msil/GenMSIL.scala
index e9061af154..6c6835bb6a 100644
--- a/src/compiler/scala/tools/nsc/backend/msil/GenMSIL.scala
+++ b/src/compiler/scala/tools/nsc/backend/msil/GenMSIL.scala
@@ -489,7 +489,11 @@ abstract class GenMSIL extends SubComponent {
}
}
- tBuilder.setPosition((sym.pos).line.get, iclass.cunit.source.file.name)
+ val line = (sym.pos).line match {
+ case Some(l) => l
+ case None => 0
+ }
+ tBuilder.setPosition(line, iclass.cunit.source.file.name)
if (isTopLevelModule(sym)) {
if (settings.debug.value)
@@ -895,27 +899,27 @@ abstract class GenMSIL extends SubComponent {
def replaceOutJumps(blocks: List[BasicBlock], leaving: List[(BasicBlock, List[BasicBlock])], exh: ExceptionHandler): (List[BasicBlock], Option[BasicBlock]) = {
def replaceJump(block: BasicBlock, from: BasicBlock, to: BasicBlock) = block.lastInstruction match {
case JUMP(where) =>
- assert(from == where)
+ //assert(from == where)
block.replaceInstruction(block.lastInstruction, JUMP(to))
case CJUMP(success, failure, cond, kind) =>
if (from == success)
block.replaceInstruction(block.lastInstruction, CJUMP(to, failure, cond, kind))
else
- assert(from == failure)
+ //assert(from == failure)
if (from == failure)
block.replaceInstruction(block.lastInstruction, CJUMP(success, to, cond, kind))
case CZJUMP(success, failure, cond, kind) =>
if (from == success)
block.replaceInstruction(block.lastInstruction, CZJUMP(to, failure, cond, kind))
else
- assert(from == failure)
+ //assert(from == failure)
if (from == failure)
block.replaceInstruction(block.lastInstruction, CZJUMP(success, to, cond, kind))
case SWITCH(tags, labels) => // labels: List[BasicBlock]
val newLabels = labels.map(b => if (b == from) to else b)
assert(newLabels.contains(to))
block.replaceInstruction(block.lastInstruction, SWITCH(tags, newLabels))
- case _ => abort("expected branch at the end of block " + block)
+ case _ => () //abort("expected branch at the end of block " + block)
}
val jumpOutBlock = blocks.last.code.newBlock
@@ -934,20 +938,20 @@ abstract class GenMSIL extends SubComponent {
(blocks, None)
else if (leaving.length == 1) {
val outside = leaving(0)._2
- assert(outside.forall(b => b == outside(0)), "exception-block leaving to multiple targets")
+ //assert(outside.forall(b => b == outside(0)), "exception-block leaving to multiple targets")
if (!firstBlockAfter.isDefinedAt(exh))
firstBlockAfter(exh) = outside(0)
- else
- assert(firstBlockAfter(exh) == outside(0), "try/catch leaving to multiple targets: " + firstBlockAfter(exh) + ", new: " + outside(0))
+ //else ()
+ //assert(firstBlockAfter(exh) == outside(0), "try/catch leaving to multiple targets: " + firstBlockAfter(exh) + ", new: " + outside(0))
val last = leaving(0)._1
(blocks.diff(List(last)) ::: List(last), None)
} else {
val outside = leaving.flatMap(p => p._2)
- assert(outside.forall(b => b == outside(0)), "exception-block leaving to multiple targets")
+ //assert(outside.forall(b => b == outside(0)), "exception-block leaving to multiple targets")
if (!firstBlockAfter.isDefinedAt(exh))
firstBlockAfter(exh) = outside(0)
- else
- assert(firstBlockAfter(exh) == outside(0), "try/catch leaving to multiple targets")
+ //else
+ //assert(firstBlockAfter(exh) == outside(0), "try/catch leaving to multiple targets")
replaceOutJumps(blocks, leaving, exh)
}
}
@@ -1177,8 +1181,9 @@ abstract class GenMSIL extends SubComponent {
needAdditionalRet = false
- var currentLineNr = try { (instr.pos).line.get } catch {
- case _: Error =>
+ val currentLineNr = (instr.pos).line match {
+ case Some(line) => line
+ case None =>
log("Warning: wrong position in: " + method)
lastLineNr
} // if getting line number fails
diff --git a/src/compiler/scala/tools/nsc/symtab/Definitions.scala b/src/compiler/scala/tools/nsc/symtab/Definitions.scala
index c52f2c7c4c..a7f40f84ec 100644
--- a/src/compiler/scala/tools/nsc/symtab/Definitions.scala
+++ b/src/compiler/scala/tools/nsc/symtab/Definitions.scala
@@ -37,7 +37,6 @@ trait Definitions {
var AllClass: Symbol = _
var ClassClass: Symbol = _
- var MethodClass: Symbol = _
var StringClass: Symbol = _
var ThrowableClass: Symbol = _
var NullPointerExceptionClass: Symbol = _
@@ -755,7 +754,6 @@ trait Definitions {
StringClass = getClass(if (forMSIL) "System.String" else "java.lang.String")
ClassClass = getClass(if (forMSIL) "System.Type" else "java.lang.Class")
- MethodClass = getClass("java.lang.reflect.Method")
ThrowableClass = getClass(if (forMSIL) "System.Exception" else "java.lang.Throwable")
NullPointerExceptionClass = getClass(if (forMSIL) "System.NullReferenceException"
else "java.lang.NullPointerException")
@@ -872,7 +870,8 @@ trait Definitions {
PatternWildcard = NoSymbol.newValue(NoPosition, "_").setInfo(AllClass.typeConstructor)
- BoxedNumberClass = if (forMSIL) null else getClass("java.lang.Number")
+ BoxedNumberClass = if (forMSIL) getClass("System.IConvertible")
+ else getClass("java.lang.Number")
BoxedArrayClass = getClass("scala.runtime.BoxedArray")
BoxedAnyArrayClass = getClass("scala.runtime.BoxedAnyArray")
BoxedObjectArrayClass = getClass("scala.runtime.BoxedObjectArray")
diff --git a/src/dotnet-library/scala/Application.scala b/src/dotnet-library/scala/Application.scala
index 7b51de0bfd..4a47186a15 100644
--- a/src/dotnet-library/scala/Application.scala
+++ b/src/dotnet-library/scala/Application.scala
@@ -1,7 +1,7 @@
/* __ *\
** ________ ___ / / ___ Scala API **
-** / __/ __// _ | / / / _ | (c) 2002-2006, LAMP/EPFL **
-** __\ \/ /__/ __ |/ /__/ __ | **
+** / __/ __// _ | / / / _ | (c) 2002-2007, LAMP/EPFL **
+** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
** /____/\___/_/ |_/____/_/ | | **
** |/ **
\* */
@@ -11,26 +11,29 @@
package scala
+//import java.lang.System.getProperty
+//import scala.compat.Platform.currentTime
-//import compat.Platform.currentTime
-
-/** The <code>Application</code> class can be used to quickly turn objects
- * into executable programs. Here is an example:
- * <pre>
+/** <p>
+ * The <code>Application</code> class can be used to quickly turn objects
+ * into executable programs. Here is an example:
+ * </p><pre>
* object Main with Application {
* Console.println("Hello World!");
* }
* </pre>
- * Here, object <code>Main</code> inherits the <code>main</code> method
- * of <code>Application</code>. The body of the <code>Main</code> object
- * defines the main program. This technique does not work if the main
- * program depends on command-line arguments (which are not accessible
- * with the technique presented here).
- *
- * It is possible to time the execution of objects that inherit from
- * class <code>Application</code> by setting the global scala.time property.
- * Here is an example for benchmarking object <code>Main</code>:
- * <pre>
+ * <p>
+ * Here, object <code>Main</code> inherits the <code>main</code> method
+ * of <code>Application</code>. The body of the <code>Main</code> object
+ * defines the main program. This technique does not work if the main
+ * program depends on command-line arguments (which are not accessible
+ * with the technique presented here).
+ * </p>
+ * <p>
+ * It is possible to time the execution of objects that inherit from class
+ * <code>Application</code> by setting the global <code>scala.time</code>
+ * property. Here is an example for benchmarking object <code>Main</code>:
+ * </p><pre>
* java -Dscala.time Main
* </pre>
*
@@ -42,17 +45,17 @@ trait Application {
/** The time when execution of this program started.
*/
-// val executionStart: Long = java.lang.System.currentTimeMillis()
+// val executionStart: Long = currentTime
/** The default main method.
*
* @param args the arguments passed to the main method
*/
def main(args: Array[String]) = {
-// if (java.lang.System.getProperty("scala.time") != null)
-// java.lang.System.out.println("[total " +
-// (java.lang.System.currentTimeMillis()
-// - executionStart) + "ms]");
+// if (getProperty("scala.time") ne null) {
+// val total = currentTime - executionStart
+// Console.println("[total " + total + "ms]")
+// }
}
}
diff --git a/src/dotnet-library/scala/Math.scala b/src/dotnet-library/scala/Math.scala
index 731b4c001d..ace7d54c0a 100644
--- a/src/dotnet-library/scala/Math.scala
+++ b/src/dotnet-library/scala/Math.scala
@@ -16,6 +16,61 @@ import Predef._
object Math {
+ /** The smalles possible value for scala.Byte. */
+ val MIN_BYTE = System.Byte.MinValue
+ /** The greatest possible value for scala.Byte. */
+ val MAX_BYTE = System.Byte.MaxValue
+
+ /** The smalles possible value for scala.Short. */
+ val MIN_SHORT = System.Int16.MinValue
+ /** The greatest possible value for scala.Short. */
+ val MAX_SHORT = System.Int16.MaxValue
+
+ /** The smalles possible value for scala.Char. */
+ val MIN_CHAR = System.Char.MinValue
+ /** The greatest possible value for scala.Char. */
+ val MAX_CHAR = System.Char.MaxValue
+
+ /** The smalles possible value for scala.Int. */
+ val MIN_INT = System.Int32.MinValue
+ /** The greatest possible value for scala.Int. */
+ val MAX_INT = System.Int32.MaxValue
+
+ /** The smalles possible value for scala.Long. */
+ val MIN_LONG = System.Int64.MinValue
+ /** The greatest possible value for scala.Long. */
+ val MAX_LONG = System.Int64.MaxValue
+
+ /** The smalles possible value for scala.Float. */
+ val MIN_FLOAT = System.Single.MinValue
+ /** The smalles difference between two values of scala.Float. */
+ val EPS_FLOAT = System.Single.Epsilon
+ /** The greatest possible value for scala.Float. */
+ val MAX_FLOAT = System.Single.MinValue
+ /** A value of type scala.Float that represents no number. */
+ //val NaN_FLOAT = System.Single.NaN
+ /** Negative infinity of type scala.Float*/
+ //val NEG_INF_FLOAT = System.Double.NegativeInfinity
+ /** Positive infinity of type scala.Float*/
+ //val POS_INF_FLOAT = System.Double.PositiveInfinity
+
+ /** The smalles possible value for scala.Double. */
+ val MIN_DOUBLE = System.Double.MinValue
+ /** The smalles difference between two values of scala.Double. */
+ val EPS_DOUBLE = System.Double.Epsilon
+ /** The greatest possible value for scala.Double. */
+ val MAX_DOUBLE = System.Double.MaxValue
+ /** A value of type scala.Double that represents no number. */
+ //val NaN_DOUBLE = System.Double.NaN
+ /** Negative infinity of type scala.Double*/
+ //val NEG_INF_DOUBLE = System.Double.NegativeInfinity
+ /** Positive infinity of type scala.Double*/
+ //val POS_INF_DOUBLE = System.Double.PositiveInfinity
+
+ /** The <code>double</code> value that is closer than any other to
+ * <code>e</code>, the base of the natural logarithms.
+ */
+
val E = System.Math.E
val Pi = System.Math.PI
@@ -27,19 +82,24 @@ object Math {
def asin(x: Double): Double = System.Math.Asin(x)
def acos(x: Double): Double = System.Math.Acos(x)
def atan(x: Double): Double = System.Math.Atan(x)
- //def toRadians(x: Double): Double = System.Math.toRadians(x)
- //def toDegrees(x: Double): Double = System.Math.toDegrees(x)
+
+ def toRadians(x: Double): Double = x * Pi / 180.0
+ def toDegrees(x: Double): Double = x * 180.0 / Pi
+
def exp(x: Double): Double = System.Math.Exp(x)
def log(x: Double): Double = System.Math.Log(x)
def sqrt(x: Double): Double = System.Math.Sqrt(x)
+
def IEEEremainder(x: Double, y: Double): Double = System.Math.IEEERemainder(x, y)
def ceil(x: Double): Double = System.Math.Ceiling(x)
def floor(x: Double): Double = System.Math.Floor(x)
+
//def rint(x: Double): Double = System.Math.rint(x)
def atan2(x: Double, y: Double): Double = System.Math.Atan2(x, y)
def pow(x: Double, y: Double): Double = System.Math.Pow(x, y)
def round(x: Float): Int = System.Math.Round(x).toInt
def round(x: Double): Long = System.Math.Round(x).toLong
+
def abs(x: Int): Int = System.Math.Abs(x)
def abs(x: Long): Long = System.Math.Abs(x)
def abs(x: Float): Float = System.Math.Abs(x)
diff --git a/src/dotnet-library/scala/Symbol.scala b/src/dotnet-library/scala/Symbol.scala
index 3b023d5e8f..91cdf065e4 100644
--- a/src/dotnet-library/scala/Symbol.scala
+++ b/src/dotnet-library/scala/Symbol.scala
@@ -11,9 +11,9 @@
package scala
-//import collection.jcl.WeakHashMap
+//import scala.collection.jcl
-//private[scala] object internedSymbols extends WeakHashMap[String, Symbol]
+//private[scala] object internedSymbols extends jcl.HashMap[String, ref.WeakReference[Symbol]]
/** <p>
* Instances of <code>Symbol</code> can be created easily with
@@ -48,11 +48,11 @@ final case class Symbol(name: String) {
* @return the unique reference to this symbol.
*/
def intern: Symbol = this
-// def intern: Symbol = internedSymbols get name match {
-// case Some(sym) =>
-// sym
-// case None =>
-// internedSymbols(name) = this
-// this
-// }
+
+// def intern: Symbol = synchronized { internedSymbols get name match {
+// case Some(sym) if sym.isValid => sym.apply
+// case _ =>
+// internedSymbols(name) = new ref.WeakReference(this); this
+// } }
+
}
diff --git a/src/dotnet-library/scala/compat/Math.scala b/src/dotnet-library/scala/compat/Math.scala
index 43bacbb688..ff820bb074 100644
--- a/src/dotnet-library/scala/compat/Math.scala
+++ b/src/dotnet-library/scala/compat/Math.scala
@@ -11,7 +11,10 @@
package scala.compat
-
+/**
+ * This class will be removed soon. Use scala.Math instead
+ */
+@deprecated
object Math {
val MIN_BYTE = System.Byte.MinValue
val MAX_BYTE = System.Byte.MaxValue
diff --git a/src/dotnet-library/scala/runtime/Comparator.cs b/src/dotnet-library/scala/runtime/Comparator.cs
new file mode 100644
index 0000000000..4a1322d49c
--- /dev/null
+++ b/src/dotnet-library/scala/runtime/Comparator.cs
@@ -0,0 +1,40 @@
+/* __ *\
+** ________ ___ / / ___ Scala API **
+** / __/ __// _ | / / / _ | (c) 2002-2007, LAMP/EPFL **
+** __\ \/ /__/ __ |/ /__/ __ | **
+** /____/\___/_/ |_/____/_/ | | **
+** |/ **
+\* */
+
+// $Id$
+
+namespace scala.runtime {
+
+ using System;
+
+ public class Comparator {
+ public static bool equals(object a, object b) {
+ if (a == null)
+ return b == null;
+ if (a.Equals(b))
+ return true;
+ if (a == b)
+ return true;
+ IConvertible aa = a as IConvertible;
+ IConvertible bb = b as IConvertible;
+ if (aa != null && bb != null) {
+ if (a is Decimal || b is Decimal)
+ return aa.ToDecimal(null) == bb.ToDecimal(null);
+ if (a is Double || b is Double)
+ return aa.ToDouble(null) == bb.ToDouble(null);
+ if (a is Single || b is Single)
+ return aa.ToSingle(null) == bb.ToSingle(null);
+ if (a is Int64 || b is Int64)
+ return aa.ToInt64(null) == bb.ToInt64(null);
+ return aa.ToInt32(null) == bb.ToInt32(null);
+ }
+ return false;
+ }
+ }
+
+}
diff --git a/src/dotnet-library/scala/runtime/RichChar.scala b/src/dotnet-library/scala/runtime/RichChar.scala
index 27633065d3..c9cde3f11a 100644
--- a/src/dotnet-library/scala/runtime/RichChar.scala
+++ b/src/dotnet-library/scala/runtime/RichChar.scala
@@ -48,9 +48,9 @@ final class RichChar(x: Char) extends Proxy with Ordered[Char] {
def asDigit: Int = System.Char.GetNumericValue(x).toInt
- def to(y: Char): Iterator[Char] = new BufferedIterator[Char] {
+ private class SequentialCharIterator(limit: Char) extends BufferedIterator[Char] {
private var ch = x
- def hasNext: Boolean = ch < y
+ def hasNext: Boolean = ch < limit
def next(): Char =
if (hasNext) { val j = ch; ch = (ch + 1).toChar; j }
else throw new NoSuchElementException("next on empty iterator")
@@ -59,4 +59,12 @@ final class RichChar(x: Char) extends Proxy with Ordered[Char] {
else throw new NoSuchElementException("head on empty iterator")
}
+ /** Create an Iterator[Char] over the characters from 'x' to 'y' - 1
+ */
+ def until(y: Char): Iterator[Char] = new SequentialCharIterator(y)
+
+ /** Create an Iterator[Char] over the characters from 'x' to 'y'
+ */
+ def to(y: Char): Iterator[Char] = new SequentialCharIterator((y + 1).toChar)
+
}
diff --git a/src/dotnet-library/scala/runtime/RichDouble.scala b/src/dotnet-library/scala/runtime/RichDouble.scala
index 77ae930cd4..dceabc3eb9 100644
--- a/src/dotnet-library/scala/runtime/RichDouble.scala
+++ b/src/dotnet-library/scala/runtime/RichDouble.scala
@@ -25,6 +25,24 @@ final class RichDouble(x: Double) extends Proxy with Ordered[Double] {
def abs: Double = Math.abs(x)
def round: Long = Math.round(x)
+ def ceil: Double = Math.ceil(x)
+ def floor: Double = Math.floor(x)
+
+ /** Converts an angle measured in degrees to an approximately equivalent
+ * angle measured in radians.
+ *
+ * @param x an angle, in degrees
+ * @return the measurement of the angle <code>x</code> in radians.
+ */
+ def toRadians: Double = Math.toRadians(x)
+
+ /** Converts an angle measured in radians to an approximately equivalent
+ * angle measured in degrees.
+ *
+ * @param x angle, in radians
+ * @return the measurement of the angle <code>x</code> in degrees.
+ */
+ def toDegrees: Double = Math.toDegrees(x)
def isNaN: Boolean = System.Double.IsNaN(x)
def isInfinity: Boolean = System.Double.IsInfinity(x)
diff --git a/src/dotnet-library/scala/runtime/RichException.scala b/src/dotnet-library/scala/runtime/RichException.scala
index 04cb0cf65e..ebc7ddd8b9 100644
--- a/src/dotnet-library/scala/runtime/RichException.scala
+++ b/src/dotnet-library/scala/runtime/RichException.scala
@@ -1,7 +1,7 @@
/* __ *\
** ________ ___ / / ___ Scala API **
-** / __/ __// _ | / / / _ | (c) 2002-2006, LAMP/EPFL **
-** __\ \/ /__/ __ |/ /__/ __ | **
+** / __/ __// _ | / / / _ | (c) 2002-2007, LAMP/EPFL **
+** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
** /____/\___/_/ |_/____/_/ | | **
** |/ **
\* */
diff --git a/src/dotnet-library/scala/runtime/RichFloat.scala b/src/dotnet-library/scala/runtime/RichFloat.scala
index a480cc5b9b..5f8849c1a3 100644
--- a/src/dotnet-library/scala/runtime/RichFloat.scala
+++ b/src/dotnet-library/scala/runtime/RichFloat.scala
@@ -12,6 +12,8 @@
package scala.runtime
+import Predef._
+
final class RichFloat(x: Float) extends Proxy with Ordered[Float] {
// Proxy.self
@@ -25,6 +27,24 @@ final class RichFloat(x: Float) extends Proxy with Ordered[Float] {
def abs: Float = Math.abs(x)
def round: Int = Math.round(x)
+ def ceil: Float = Math.ceil(x).toFloat
+ def floor: Float = Math.floor(x).toFloat
+
+ /** Converts an angle measured in degrees to an approximately equivalent
+ * angle measured in radians.
+ *
+ * @param x an angle, in degrees
+ * @return the measurement of the angle <code>x</code> in radians.
+ */
+ def toRadians: Float = Math.toRadians(x).toFloat
+
+ /** Converts an angle measured in radians to an approximately equivalent
+ * angle measured in degrees.
+ *
+ * @param x angle, in radians
+ * @return the measurement of the angle <code>x</code> in degrees.
+ */
+ def toDegrees: Float = Math.toDegrees(x).toFloat
def isNaN: Boolean = System.Single.IsNaN(x)
def isInfinity: Boolean = System.Single.IsInfinity(x)
diff --git a/src/dotnet-library/scala/runtime/RichString.scala b/src/dotnet-library/scala/runtime/RichString.scala
index 1073acfe07..667b972f72 100644
--- a/src/dotnet-library/scala/runtime/RichString.scala
+++ b/src/dotnet-library/scala/runtime/RichString.scala
@@ -20,7 +20,7 @@ final class RichString(val self: String) extends Proxy with Seq[Char] with Order
def compare(other: String) = self compareTo other
// Seq[Char]
- def length = self.length()
+ def length = self.length
def elements = Iterator.fromString(self)
/** Retrieve the n-th character of the string
diff --git a/src/library/scala/Array.scala b/src/library/scala/Array.scala
index 5de6796040..fad177d88c 100644
--- a/src/library/scala/Array.scala
+++ b/src/library/scala/Array.scala
@@ -188,7 +188,6 @@ object Array {
* @version 1.0
*/
final class Array[A](_length: Int) extends Seq[A] {
- import java.lang.Error
/** The length of the array */
def length: Int = throw new Error()
diff --git a/src/library/scala/runtime/Properties.scala b/src/library/scala/util/Properties.scala
index 3e46646f2b..d6e77ffa60 100644
--- a/src/library/scala/runtime/Properties.scala
+++ b/src/library/scala/util/Properties.scala
@@ -8,7 +8,7 @@
// $Id$
-package scala.runtime
+package scala.util
/** A utility to load the library properties from a Java properties file
* included in the jar.