summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAntonio Cunei <antonio.cunei@epfl.ch>2010-09-02 09:57:58 +0000
committerAntonio Cunei <antonio.cunei@epfl.ch>2010-09-02 09:57:58 +0000
commitc45a1430699d7438f46d5af6f4db63f3ed587805 (patch)
tree6c4adfd515c62430aef1f8c3cb23969f6bdf42f4 /src
parent512a7a03e0c0a964f067483930f430b05eae744d (diff)
downloadscala-c45a1430699d7438f46d5af6f4db63f3ed587805.tar.gz
scala-c45a1430699d7438f46d5af6f4db63f3ed587805.tar.bz2
scala-c45a1430699d7438f46d5af6f4db63f3ed587805.zip
Merged revisions 22188-22189,22195,22198,22445,...
Merged revisions 22188-22189,22195,22198,22445,22450,22452,22457,22460,22462,22470,22484, 22489-22490,22556,22609,22667-22668,22684,22830 via svnmerge from https://lampsvn.epfl.ch/svn-repos/scala/scala/trunk ........ r22188 | extempore | 2010-06-08 01:43:14 +0200 (Tue, 08 Jun 2010) | 4 lines Most of the iterate implementations were calling the given function one too many times, leading to tragic failure if the function could not handle this (such as repeatedly applying tail.) Closes #3540, review by prokopec. ........ r22189 | extempore | 2010-06-08 04:15:50 +0200 (Tue, 08 Jun 2010) | 4 lines Taking another shot at negative constants as annotation arguments since r22175 didn't quite get there. I call into the constant folder with the unfolded tree at the last point before it's going to fail the compile anyway. Closes #3521, review by odersky. ........ r22195 | extempore | 2010-06-08 16:35:16 +0200 (Tue, 08 Jun 2010) | 2 lines Fixed a regrettable oversight which was leaving temp files stacking up in templand, and a partial fix for #3519. No review. ........ r22198 | extempore | 2010-06-08 21:03:56 +0200 (Tue, 08 Jun 2010) | 3 lines Put in some long overdue soft padding around repl completion so when it pokes around the compiler in a way which surprises something, we don't lose the repl. Closes #3548, no review. ........ r22445 | extempore | 2010-06-30 22:51:18 +0200 (Wed, 30 Jun 2010) | 1 line Added forkjoin to partest's classpath to unbreak the build. No review. ........ r22450 | extempore | 2010-07-01 02:16:32 +0200 (Thu, 01 Jul 2010) | 4 lines Although everything now builds for me, the buildbot still fails on src/dbc for lack of forkjoin.jar. We apparently have invented non-deterministic jar dependencies. Added forkjoin.jar in another spot, no review. ........ r22452 | extempore | 2010-07-01 20:29:09 +0200 (Thu, 01 Jul 2010) | 2 lines Warded off a parser crash on certain invalid programs. Closes #3209, no review. ........ r22457 | extempore | 2010-07-01 22:32:02 +0200 (Thu, 01 Jul 2010) | 2 lines A crasher in the pattern matcher revealed a flaw in how equality comparisons were constructed. Closes #3570, no review. ........ r22460 | extempore | 2010-07-01 22:32:47 +0200 (Thu, 01 Jul 2010) | 2 lines Fixed an infinite loop in the xml parser on invalid input. Also found an off by one bug in Source while fixing it. No review. ........ r22462 | extempore | 2010-07-01 22:43:32 +0200 (Thu, 01 Jul 2010) | 4 lines Since the buildbots won't meet me in the middle, am putting the forkjoin.jar everywhere with the hope/expectation we will see a restoral of order. Someone should definitely figure out how it is we developed this non-deterministic dependency. Review by phaller. ........ r22470 | extempore | 2010-07-02 06:20:28 +0200 (Fri, 02 Jul 2010) | 2 lines Normalized protected type aliases before repl printing, so we don't see things like x.Self. Closes #3193, no review. ........ r22484 | extempore | 2010-07-04 22:26:55 +0200 (Sun, 04 Jul 2010) | 2 lines Tightened how the repl prints types so we don't see OverloadedTypes slip through sometimes. Review by apocalisp. ........ r22489 | extempore | 2010-07-05 18:00:22 +0200 (Mon, 05 Jul 2010) | 3 lines The take/drop methods in IndexedSeqOptimized were overridden to call slice without checking bounds, causing it to fail when the argument is too large. Restored expected behavior. No review. ........ r22490 | extempore | 2010-07-05 18:06:36 +0200 (Mon, 05 Jul 2010) | 1 line A brown bag on the head fix to that last patch. No review. ........ r22556 | extempore | 2010-07-14 10:00:03 +0200 (Wed, 14 Jul 2010) | 2 lines Moved the burden of forgivingness for string slices into StringOps where it belongs. Review by odersky. ........ r22609 | extempore | 2010-07-20 20:14:54 +0200 (Tue, 20 Jul 2010) | 2 lines Fix for stability failure introduced in build.xml change. Review by malayeri (as an FYI.) ........ r22667 | extempore | 2010-08-03 20:01:34 +0200 (Tue, 03 Aug 2010) | 3 lines Parse ordering issue prevented passing properties containing a :. There is a test case included, but note that partest passes it with or without the patch: see ticket #3712. Closes #3495, no review. ........ r22668 | extempore | 2010-08-03 20:01:47 +0200 (Tue, 03 Aug 2010) | 2 lines Reverted my brainless introduction of ## to a java file. Closes #3716, no review. ........ r22684 | extempore | 2010-08-05 17:15:00 +0200 (Thu, 05 Aug 2010) | 2 lines Widened a try block to unregress the error message for file not found. Closes #3729, no review. ........ r22830 | extempore | 2010-08-23 18:57:10 +0200 (Mon, 23 Aug 2010) | 2 lines Fix and test case for broken linked lists, contributed by Lucien Pereira. Closes #3361, no review. ........
Diffstat (limited to 'src')
-rw-r--r--src/compiler/scala/tools/nsc/Global.scala10
-rw-r--r--src/compiler/scala/tools/nsc/Interpreter.scala17
-rw-r--r--src/compiler/scala/tools/nsc/ast/TreeDSL.scala22
-rw-r--r--src/compiler/scala/tools/nsc/ast/parser/Parsers.scala8
-rw-r--r--src/compiler/scala/tools/nsc/interpreter/Completion.scala18
-rw-r--r--src/compiler/scala/tools/nsc/io/File.scala11
-rw-r--r--src/compiler/scala/tools/nsc/matching/ParallelMatching.scala1
-rw-r--r--src/compiler/scala/tools/nsc/settings/MutableSettings.scala4
-rw-r--r--src/compiler/scala/tools/nsc/symtab/Definitions.scala1
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Typers.scala12
-rw-r--r--src/library/scala/Array.scala17
-rw-r--r--src/library/scala/collection/generic/TraversableFactory.scala16
-rw-r--r--src/library/scala/collection/immutable/StringOps.scala12
-rw-r--r--src/library/scala/collection/mutable/DoubleLinkedList.scala16
-rw-r--r--src/library/scala/collection/mutable/LinkedListLike.scala3
-rw-r--r--src/library/scala/io/Source.scala10
-rw-r--r--src/library/scala/xml/parsing/MarkupParser.scala6
-rw-r--r--src/msil/ch/epfl/lamp/compiler/msil/Type.java2
18 files changed, 120 insertions, 66 deletions
diff --git a/src/compiler/scala/tools/nsc/Global.scala b/src/compiler/scala/tools/nsc/Global.scala
index ee1abc32a1..f937ebc5e0 100644
--- a/src/compiler/scala/tools/nsc/Global.scala
+++ b/src/compiler/scala/tools/nsc/Global.scala
@@ -808,11 +808,13 @@ class Global(var settings: Settings, var reporter: Reporter) extends SymbolTable
/** Compile list of files given by their names */
def compile(filenames: List[String]) {
- val sources: List[SourceFile] =
- if (isScriptRun && filenames.size > 1) returning(Nil)(_ => error("can only compile one script at a time"))
- else filenames map getSourceFile
+ try {
+ val sources: List[SourceFile] =
+ if (isScriptRun && filenames.size > 1) returning(Nil)(_ => error("can only compile one script at a time"))
+ else filenames map getSourceFile
- try compileSources(sources)
+ compileSources(sources)
+ }
catch { case ex: IOException => error(ex.getMessage()) }
}
diff --git a/src/compiler/scala/tools/nsc/Interpreter.scala b/src/compiler/scala/tools/nsc/Interpreter.scala
index 128c378e23..5d11973a74 100644
--- a/src/compiler/scala/tools/nsc/Interpreter.scala
+++ b/src/compiler/scala/tools/nsc/Interpreter.scala
@@ -146,7 +146,7 @@ class Interpreter(val settings: Settings, out: PrintWriter) {
else null
}
- import compiler.{ Traverser, CompilationUnit, Symbol, Name, Type }
+ import compiler.{ Traverser, CompilationUnit, Symbol, Name, Type, TypeRef, PolyType }
import compiler.{
Tree, TermTree, ValOrDefDef, ValDef, DefDef, Assign, ClassDef,
ModuleDef, Ident, Select, TypeDef, Import, MemberDef, DocDef,
@@ -946,14 +946,19 @@ class Interpreter(val settings: Settings, out: PrintWriter) {
lazy val typeOf: Map[Name, String] = {
def getTypes(names: List[Name], nameMap: Name => Name): Map[Name, String] = {
names.foldLeft(Map.empty[Name, String]) { (map, name) =>
- val rawType = atNextPhase(resObjSym.info.member(name).tpe)
+ val tp1 = atNextPhase(resObjSym.info.nonPrivateDecl(name).tpe)
// the types are all =>T; remove the =>
- val cleanedType = rawType match {
- case compiler.PolyType(Nil, rt) => rt
- case rawType => rawType
+ val tp2 = tp1 match {
+ case PolyType(Nil, tp) => tp
+ case tp => tp
}
+ // normalize non-public types so we don't see protected aliases like Self
+ val tp3 = compiler.atPhase(objRun.typerPhase)(tp2 match {
+ case TypeRef(_, sym, _) if !sym.isPublic => tp2.normalize.toString
+ case tp => tp.toString
+ })
- map + (name -> atNextPhase(cleanedType.toString))
+ map + (name -> tp3)
}
}
diff --git a/src/compiler/scala/tools/nsc/ast/TreeDSL.scala b/src/compiler/scala/tools/nsc/ast/TreeDSL.scala
index 34d3423401..a24c8c01d3 100644
--- a/src/compiler/scala/tools/nsc/ast/TreeDSL.scala
+++ b/src/compiler/scala/tools/nsc/ast/TreeDSL.scala
@@ -76,20 +76,24 @@ trait TreeDSL {
else gen.mkAnd(target, other)
/** Note - calling ANY_== in the matcher caused primitives to get boxed
- * for the comparison, whereas looking up nme.EQ does not.
+ * for the comparison, whereas looking up nme.EQ does not. See #3570 for
+ * an example of how target.tpe can be non-null, yet it claims not to have
+ * a mmeber called nme.EQ. Not sure if that should happen, but we can be
+ * robust by dragging in Any regardless.
*/
def MEMBER_== (other: Tree) = {
- if (target.tpe == null) ANY_==(other)
- else fn(target, target.tpe member nme.EQ, other)
+ val opSym = if (target.tpe == null) NoSymbol else target.tpe member nme.EQ
+ if (opSym == NoSymbol) ANY_==(other)
+ else fn(target, opSym, other)
}
- def ANY_NE (other: Tree) = fn(target, nme.ne, toAnyRef(other))
def ANY_EQ (other: Tree) = fn(target, nme.eq, toAnyRef(other))
+ def ANY_NE (other: Tree) = fn(target, nme.ne, toAnyRef(other))
def ANY_== (other: Tree) = fn(target, Any_==, other)
- def ANY_>= (other: Tree) = fn(target, nme.GE, other)
- def ANY_<= (other: Tree) = fn(target, nme.LE, other)
- def OBJ_!= (other: Tree) = fn(target, Object_ne, other)
- def OBJ_EQ (other: Tree) = fn(target, nme.eq, other)
- def OBJ_NE (other: Tree) = fn(target, nme.ne, other)
+ def ANY_!= (other: Tree) = fn(target, Any_!=, other)
+ def OBJ_== (other: Tree) = fn(target, Object_==, other)
+ def OBJ_!= (other: Tree) = fn(target, Object_!=, other)
+ def OBJ_EQ (other: Tree) = fn(target, Object_eq, other)
+ def OBJ_NE (other: Tree) = fn(target, Object_ne, other)
def INT_| (other: Tree) = fn(target, getMember(IntClass, nme.OR), other)
def INT_& (other: Tree) = fn(target, getMember(IntClass, nme.AND), other)
diff --git a/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala b/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala
index f3149f7723..aa01b86af6 100644
--- a/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala
+++ b/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala
@@ -2731,10 +2731,10 @@ self =>
topstats() match {
case List(stat @ PackageDef(_, _)) => stat
case stats =>
- val start = stats match {
- case Nil => 0
- case _ => wrappingPos(stats).startOrPoint
- }
+ val start =
+ if (stats forall (_ == EmptyTree)) 0
+ else wrappingPos(stats).startOrPoint
+
makePackaging(start, atPos(start, start, start) { Ident(nme.EMPTY_PACKAGE_NAME) }, stats)
}
}
diff --git a/src/compiler/scala/tools/nsc/interpreter/Completion.scala b/src/compiler/scala/tools/nsc/interpreter/Completion.scala
index 4b959f5fd8..22a95a4bf8 100644
--- a/src/compiler/scala/tools/nsc/interpreter/Completion.scala
+++ b/src/compiler/scala/tools/nsc/interpreter/Completion.scala
@@ -312,7 +312,7 @@ class Completion(val repl: Interpreter) extends CompletionOutput {
override def complete(_buf: String, cursor: Int, candidates: JList[String]): Int = {
val buf = onull(_buf)
verbosity = if (isConsecutiveTabs(buf, cursor)) verbosity + 1 else 0
- DBG("complete(%s, %d) last = (%s, %d), verbosity: %s".format(buf, cursor, lastBuf, lastCursor, verbosity))
+ DBG("\ncomplete(%s, %d) last = (%s, %d), verbosity: %s".format(buf, cursor, lastBuf, lastCursor, verbosity))
// we don't try lower priority completions unless higher ones return no results.
def tryCompletion(p: Parsed, completionFunction: Parsed => List[String]): Option[Int] = {
@@ -346,7 +346,21 @@ class Completion(val repl: Interpreter) extends CompletionOutput {
def regularCompletion = tryCompletion(mkDotted, topLevelFor)
def fileCompletion = tryCompletion(mkUndelimited, FileCompletion completionsFor _.buffer)
- (lastResultCompletion orElse regularCompletion orElse fileCompletion) getOrElse cursor
+ /** This is the kickoff point for all manner of theoretically possible compiler
+ * unhappiness - fault may be here or elsewhere, but we don't want to crash the
+ * repl regardless. Hopefully catching Exception is enough, but because the
+ * compiler still throws some Errors it may not be.
+ */
+ try {
+ (lastResultCompletion orElse regularCompletion orElse fileCompletion) getOrElse cursor
+ }
+ catch {
+ case ex: Exception =>
+ DBG("Error: complete(%s, %s, _) provoked %s".format(_buf, cursor, ex))
+ candidates add " "
+ candidates add "<completion error>"
+ cursor
+ }
}
}
}
diff --git a/src/compiler/scala/tools/nsc/io/File.scala b/src/compiler/scala/tools/nsc/io/File.scala
index d8e1410375..e9741ed5cb 100644
--- a/src/compiler/scala/tools/nsc/io/File.scala
+++ b/src/compiler/scala/tools/nsc/io/File.scala
@@ -33,13 +33,18 @@ object File {
// this is a workaround for http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6503430
// we are using a static initializer to statically initialize a java class so we don't
- // trigger java.lang.InternalErrors later when using it concurrently.
- {
+ // trigger java.lang.InternalErrors later when using it concurrently. We ignore all
+ // the exceptions so as not to cause spurious failures when no write access is available,
+ // e.g. google app engine.
+ try {
val tmp = JFile.createTempFile("bug6503430", null, null)
val in = new FileInputStream(tmp).getChannel()
val out = new FileOutputStream(tmp, true).getChannel()
out.transferFrom(in, 0, 0)
- ()
+ tmp.delete()
+ }
+ catch {
+ case _: IllegalArgumentException | _: IllegalStateException | _: IOException | _: SecurityException => ()
}
}
import File._
diff --git a/src/compiler/scala/tools/nsc/matching/ParallelMatching.scala b/src/compiler/scala/tools/nsc/matching/ParallelMatching.scala
index 77997c4565..f9e7a1bdcf 100644
--- a/src/compiler/scala/tools/nsc/matching/ParallelMatching.scala
+++ b/src/compiler/scala/tools/nsc/matching/ParallelMatching.scala
@@ -886,6 +886,7 @@ trait ParallelMatching extends ast.TreeDSL
}
case _: SingletonType if useEqTest =>
val eqTest = REF(tpe.termSymbol) MEMBER_== scrutTree
+
// See ticket #1503 for the motivation behind checking for a binding.
// The upshot is that it is unsound to assume equality means the right
// type, but if the value doesn't appear on the right hand side of the
diff --git a/src/compiler/scala/tools/nsc/settings/MutableSettings.scala b/src/compiler/scala/tools/nsc/settings/MutableSettings.scala
index e8443d11c1..1e0e00e01d 100644
--- a/src/compiler/scala/tools/nsc/settings/MutableSettings.scala
+++ b/src/compiler/scala/tools/nsc/settings/MutableSettings.scala
@@ -143,11 +143,11 @@ class MutableSettings(val errorFn: String => Unit) extends AbsSettings with Scal
//
// Internally we use Option[List[String]] to discover error,
// but the outside expects our arguments back unchanged on failure
- if (arg contains ":") parseColonArg(arg) match {
+ if (isPropertyArg(arg)) parsePropertyArg(arg) match {
case Some(_) => rest
case None => args
}
- else if (isPropertyArg(arg)) parsePropertyArg(arg) match {
+ else if (arg contains ":") parseColonArg(arg) match {
case Some(_) => rest
case None => args
}
diff --git a/src/compiler/scala/tools/nsc/symtab/Definitions.scala b/src/compiler/scala/tools/nsc/symtab/Definitions.scala
index 92d8b213c1..a474f8d5f2 100644
--- a/src/compiler/scala/tools/nsc/symtab/Definitions.scala
+++ b/src/compiler/scala/tools/nsc/symtab/Definitions.scala
@@ -215,7 +215,6 @@ trait Definitions extends reflect.generic.StandardDefinitions {
def Array_length = getMember(ArrayClass, nme.length)
lazy val Array_clone = getMember(ArrayClass, nme.clone_)
lazy val ArrayModule = getModule("scala.Array")
- def ArrayModule_apply = getMember(ArrayModule, nme.apply)
// reflection / structural types
lazy val SoftReferenceClass = getClass("java.lang.ref.SoftReference")
diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
index 5fdf9267d2..d05754e080 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
@@ -2589,7 +2589,10 @@ trait Typers { self: Analyzer =>
annotationError
}
- def tryConst(tr: Tree, pt: Type) = typed(tr, EXPRmode, pt) match {
+ /** Calling constfold right here is necessary because some trees (negated
+ * floats and literals in particular) are not yet folded.
+ */
+ def tryConst(tr: Tree, pt: Type) = typed(constfold(tr), EXPRmode, pt) match {
// null cannot be used as constant value for classfile annotations
case l @ Literal(c) if !(l.isErroneous || c.value == null) =>
Some(LiteralAnnotArg(c))
@@ -2618,11 +2621,10 @@ trait Typers { self: Analyzer =>
// and Array.apply(x: Int, xs: Int*): Array[Int] (and similar)
case Apply(fun, args) =>
val typedFun = typed(fun, funMode(mode), WildcardType)
- if (typedFun.symbol.owner == ArrayModule.moduleClass &&
- typedFun.symbol.name == nme.apply)
+ if (typedFun.symbol.owner == ArrayModule.moduleClass && typedFun.symbol.name == nme.apply)
pt match {
- case TypeRef(_, sym, argts) if (sym == ArrayClass && !argts.isEmpty) =>
- trees2ConstArg(args, argts.head)
+ case TypeRef(_, ArrayClass, targ :: _) =>
+ trees2ConstArg(args, targ)
case _ =>
// For classfile annotations, pt can only be T:
// BT = Int, .., String, Class[_], JavaAnnotClass
diff --git a/src/library/scala/Array.scala b/src/library/scala/Array.scala
index 8327b93d66..e7ee280cef 100644
--- a/src/library/scala/Array.scala
+++ b/src/library/scala/Array.scala
@@ -391,13 +391,18 @@ object Array extends FallbackArrayBuilding {
*/
def iterate[T: ClassManifest](start: T, len: Int)(f: T => T): Array[T] = {
val b = newBuilder[T]
- b.sizeHint(len)
- var acc = start
- var i = 0
- while (i < len) {
+
+ if (len > 0) {
+ b.sizeHint(len)
+ var acc = start
+ var i = 1
b += acc
- acc = f(acc)
- i += 1
+
+ while (i < len) {
+ acc = f(acc)
+ i += 1
+ b += acc
+ }
}
b.result
}
diff --git a/src/library/scala/collection/generic/TraversableFactory.scala b/src/library/scala/collection/generic/TraversableFactory.scala
index d8541d2714..c6f5ce4dde 100644
--- a/src/library/scala/collection/generic/TraversableFactory.scala
+++ b/src/library/scala/collection/generic/TraversableFactory.scala
@@ -224,13 +224,17 @@ abstract class TraversableFactory[CC[X] <: Traversable[X] with GenericTraversabl
*/
def iterate[A](start: A, len: Int)(f: A => A): CC[A] = {
val b = newBuilder[A]
- b.sizeHint(len)
- var acc = start
- var i = 0
- while (i < len) {
+ if (len > 0) {
+ b.sizeHint(len)
+ var acc = start
+ var i = 1
b += acc
- acc = f(acc)
- i += 1
+
+ while (i < len) {
+ acc = f(acc)
+ i += 1
+ b += acc
+ }
}
b.result
}
diff --git a/src/library/scala/collection/immutable/StringOps.scala b/src/library/scala/collection/immutable/StringOps.scala
index 8a27a4ad4b..0d8f5f6b83 100644
--- a/src/library/scala/collection/immutable/StringOps.scala
+++ b/src/library/scala/collection/immutable/StringOps.scala
@@ -36,8 +36,16 @@ final class StringOps(override val repr: String) extends StringLike[String] {
/** Creates a string builder buffer as builder for this class */
override protected[this] def newBuilder = new StringBuilder
- override def slice(from: Int, until: Int): String =
- repr.substring(from max 0, until min repr.length)
+ override def slice(from: Int, until: Int): String = {
+ /** Slice must be forgiving on all out of bounds indices and
+ * substring is not.
+ */
+ val start = from max 0
+ val end = until min repr.length
+
+ if (start >= end) ""
+ else repr.substring(start, end)
+ }
override def toString = repr
}
diff --git a/src/library/scala/collection/mutable/DoubleLinkedList.scala b/src/library/scala/collection/mutable/DoubleLinkedList.scala
index e702301703..d3c86953c8 100644
--- a/src/library/scala/collection/mutable/DoubleLinkedList.scala
+++ b/src/library/scala/collection/mutable/DoubleLinkedList.scala
@@ -69,15 +69,21 @@ object DoubleLinkedList extends SeqFactory[DoubleLinkedList] {
def newBuilder[A]: Builder[A, DoubleLinkedList[A]] =
new Builder[A, DoubleLinkedList[A]] {
var current: DoubleLinkedList[A] = _
+ val emptyList = new DoubleLinkedList[A]()
+ if(null == current)
+ current = emptyList
+
def +=(elem: A): this.type = {
- val tmp = new DoubleLinkedList(elem, null)
- if (current != null)
- current.insert(tmp)
+ if (current.nonEmpty)
+ current.insert(new DoubleLinkedList(elem, emptyList))
else
- current = tmp
+ current = new DoubleLinkedList(elem, emptyList)
this
}
- def clear() { current = null }
+
+ def clear() {
+ current = emptyList
+ }
def result() = current
}
}
diff --git a/src/library/scala/collection/mutable/LinkedListLike.scala b/src/library/scala/collection/mutable/LinkedListLike.scala
index ca904e0a24..6fb516d566 100644
--- a/src/library/scala/collection/mutable/LinkedListLike.scala
+++ b/src/library/scala/collection/mutable/LinkedListLike.scala
@@ -66,8 +66,7 @@ trait LinkedListLike[A, This <: Seq[A] with LinkedListLike[A, This]] extends Seq
def insert(that: This): Unit = {
require(nonEmpty, "insert into empty list")
if (that.nonEmpty) {
- that.append(next)
- next = that
+ next = next.append(that)
}
}
diff --git a/src/library/scala/io/Source.scala b/src/library/scala/io/Source.scala
index 935fe022be..cb7403e255 100644
--- a/src/library/scala/io/Source.scala
+++ b/src/library/scala/io/Source.scala
@@ -198,7 +198,8 @@ abstract class Source extends Iterator[Char] {
*
*/
@deprecated("Use a collections method such as getLines().toIndexedSeq for random access.")
- def getLine(line: Int): String = getLines() drop (line - 1) next
+ def getLine(line: Int): String = lineNum(line)
+ private def lineNum(line: Int): String = getLines() drop (line - 1) next
class LineIterator() extends Iterator[String] {
private[this] val sb = new StringBuilder
@@ -298,11 +299,10 @@ abstract class Source extends Iterator[Char] {
* @param out PrintStream to use
*/
def report(pos: Int, msg: String, out: PrintStream) {
- val line = Position line pos
- val col = Position column pos
- val str = getLines() toIndexedSeq line
+ val line = Position line pos
+ val col = Position column pos
- out println "%s:%d:%d: %s%s%s^".format(descr, line, col, msg, str, spaces(col - 1))
+ out println "%s:%d:%d: %s%s%s^".format(descr, line, col, msg, lineNum(line), spaces(col - 1))
}
/**
diff --git a/src/library/scala/xml/parsing/MarkupParser.scala b/src/library/scala/xml/parsing/MarkupParser.scala
index 24e0d78c6f..4f6b89c07b 100644
--- a/src/library/scala/xml/parsing/MarkupParser.scala
+++ b/src/library/scala/xml/parsing/MarkupParser.scala
@@ -310,7 +310,7 @@ trait MarkupParser extends MarkupParserCommon with TokenTests
def xEntityValue(): String = {
val endch = ch
nextch
- while (ch != endch) {
+ while (ch != endch && !eof) {
putChar(ch)
nextch
}
@@ -556,7 +556,7 @@ trait MarkupParser extends MarkupParserCommon with TokenTests
if (ch != '\'' && ch != '"')
reportSyntaxError("quote ' or \" expected");
nextch
- while (ch != endch) {
+ while (ch != endch && !eof) {
putChar(ch)
nextch
}
@@ -572,7 +572,7 @@ trait MarkupParser extends MarkupParserCommon with TokenTests
if (ch!='\'' && ch != '"')
reportSyntaxError("quote ' or \" expected");
nextch
- while (ch != endch) {
+ while (ch != endch && !eof) {
putChar(ch)
//Console.println("hello '"+ch+"'"+isPubIDChar(ch));
if (!isPubIDChar(ch))
diff --git a/src/msil/ch/epfl/lamp/compiler/msil/Type.java b/src/msil/ch/epfl/lamp/compiler/msil/Type.java
index dbeaa1184a..f7d44980c4 100644
--- a/src/msil/ch/epfl/lamp/compiler/msil/Type.java
+++ b/src/msil/ch/epfl/lamp/compiler/msil/Type.java
@@ -812,7 +812,7 @@ public abstract class Type extends MemberInfo {
if (k >= 0)
cname = cname.substring(k + 1);
return "[" + t.Assembly().GetName() + "]" + t +
- "(" + cname + "#" + Integer.toHexString(t.##) + ")";
+ "(" + cname + "#" + Integer.toHexString(t.hashCode()) + ")";
}
private static String dumpType(Type t) {
StringBuffer str = new StringBuffer();