summaryrefslogtreecommitdiff
path: root/src/dotnet-library
diff options
context:
space:
mode:
authormihaylov <mihaylov@epfl.ch>2007-09-17 11:12:25 +0000
committermihaylov <mihaylov@epfl.ch>2007-09-17 11:12:25 +0000
commit6eb0e65691c012bbb88599892a232f09dc1eaa7b (patch)
tree60b17ed48559776a8474263b3ee0390eab97295d /src/dotnet-library
parent2353ddb22a7ebb2bf228acc5805c3ca998c3ab5d (diff)
downloadscala-6eb0e65691c012bbb88599892a232f09dc1eaa7b.tar.gz
scala-6eb0e65691c012bbb88599892a232f09dc1eaa7b.tar.bz2
scala-6eb0e65691c012bbb88599892a232f09dc1eaa7b.zip
Synced src/dotnet-library with rev 12880 of src...
Synced src/dotnet-library with rev 12880 of src/library
Diffstat (limited to 'src/dotnet-library')
-rw-r--r--src/dotnet-library/README18
-rw-r--r--src/dotnet-library/scala/Predef.scala6
-rw-r--r--src/dotnet-library/scala/runtime/RichString.scala44
3 files changed, 48 insertions, 20 deletions
diff --git a/src/dotnet-library/README b/src/dotnet-library/README
new file mode 100644
index 0000000000..5e5ff2b910
--- /dev/null
+++ b/src/dotnet-library/README
@@ -0,0 +1,18 @@
+The dotnet-library tree has been synchronized with
+revision 12880 of src/library on $Date$.
+
+Never, never, never, ever add/remove/edit files in the dotnet-library
+tree by hand. If you need to change sth use the opportunity to merge
+the changes that have occured since the last merge. Any manual intervention
+makes the merging harder and is to be considerd rude and
+
+koko:~/scala/src/dotnet-library>svn merge \
+https://lampsvn.epfl.ch/svn-repos/scala/scala/trunk/src/library@12365 \
+https://lampsvn.epfl.ch/svn-repos/scala/scala/trunk/src/library@12879 .
+
+You'll get many "Skipped missing target: ..." messages because this tree
+only contains files that are different for MSIL. Hopefully, changes in those
+files do not introduce anything platform-specific because they will be copied
+from the src/library tree. If there are platform-specific changes, the
+offending file has to be added to the dotnet-library tree and modified to
+compile for .NET. \ No newline at end of file
diff --git a/src/dotnet-library/scala/Predef.scala b/src/dotnet-library/scala/Predef.scala
index 493ee84b91..3feb140e3c 100644
--- a/src/dotnet-library/scala/Predef.scala
+++ b/src/dotnet-library/scala/Predef.scala
@@ -94,12 +94,12 @@ object Predef {
def assume(assumption: Boolean) {
if (!assumption)
- throw new Error("assumption failed")
+ throw new IllegalArgumentException("assumption failed")
}
def assume(assumption: Boolean, message: Any) {
if (!assumption)
- throw new Error("assumption failed: " + message)
+ throw new IllegalArgumentException("assumption failed: " + message)
}
// tupling ------------------------------------------------------------
@@ -304,6 +304,8 @@ object Predef {
implicit def float2double(x: Float): Double = x.toDouble
+ implicit def forceArrayProjection[A](x : Array.Projection[A]) : Array[A] = x.force
+
def currentThread = System.Threading.Thread.CurrentThread
}
diff --git a/src/dotnet-library/scala/runtime/RichString.scala b/src/dotnet-library/scala/runtime/RichString.scala
index 2f43f5e7c7..2a71306686 100644
--- a/src/dotnet-library/scala/runtime/RichString.scala
+++ b/src/dotnet-library/scala/runtime/RichString.scala
@@ -19,35 +19,42 @@ final class RichString(val self: String) extends Proxy with RandomAccessSeq[Char
override def length = self.length
override def toString = self
override def mkString = self
- override def slice(from : Int, until : Int) : RichString = {
+
+ override def slice(from: Int, until: Int): RichString = {
val from0 = if (from < 0) 0 else from
val until0 = if (from >= until || from >= self.length) return new RichString("")
else if (until > self.length) self.length else until
new RichString(self.substring(from0, until0))
}
+
//override def ++ [B >: A](that: Iterable[B]): Seq[B] = {
- override def ++[B >: Char](that : Iterable[B]) : RandomAccessSeq[B] = that match {
- case that : RichString => new RichString(self + that.self)
- case that => super.++(that)
+ override def ++[B >: Char](that: Iterable[B]): RandomAccessSeq[B] = that match {
+ case that: RichString => new RichString(self + that.self)
+ case that => super.++(that)
}
- override def take(until : Int) : RichString = slice(0, until)
- override def drop(from : Int) : RichString = slice(from, self.length)
- override def startsWith[B](that : Seq[B]) = that match {
- case that : RichString => self startsWith that.self
- case that => super.startsWith(that)
+ override def take(until: Int): RichString = slice(0, until)
+
+ override def drop(from: Int): RichString = slice(from, self.length)
+
+ override def startsWith[B](that: Seq[B]) = that match {
+ case that: RichString => self startsWith that.self
+ case that => super.startsWith(that)
}
- override def endsWith[B](that : Seq[B]) = that match {
- case that : RichString => self endsWith that.self
- case that => super.endsWith(that)
+
+ override def endsWith[B](that: Seq[B]) = that match {
+ case that: RichString => self endsWith that.self
+ case that => super.endsWith(that)
}
- override def indexOf[B](that : Seq[B]) = that match {
- case that : RichString => self indexOf that.self
- case that => super.indexOf(that)
+
+ override def indexOf[B](that: Seq[B]) = that match {
+ case that: RichString => self indexOf that.self
+ case that => super.indexOf(that)
}
- override def containsSlice[B](that : Seq[B]) = that match {
- case that : RichString => self contains that.self
- case that => super.containsSlice(that)
+
+ override def containsSlice[B](that: Seq[B]) = that match {
+ case that: RichString => self contains that.self
+ case that => super.containsSlice(that)
}
override def compare(other: String) = self compareTo other
@@ -165,4 +172,5 @@ final class RichString(val self: String) extends Proxy with RandomAccessSeq[Char
def toLong: Long = System.Int64.Parse(self)
def toFloat: Float = System.Single.Parse(self)
def toDouble: Double = System.Double.Parse(self)
+
}