summaryrefslogtreecommitdiff
path: root/sources
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2005-09-26 14:40:42 +0000
committerMartin Odersky <odersky@gmail.com>2005-09-26 14:40:42 +0000
commit5b8594a6beef0c0c88d6ef033ecb5314e1ae73a2 (patch)
tree145a9dd485c363e33c22e3e5e8d37fc541b1d411 /sources
parentb18e6b9a5a2d6c08217e83fa7afde2ea495298da (diff)
downloadscala-5b8594a6beef0c0c88d6ef033ecb5314e1ae73a2.tar.gz
scala-5b8594a6beef0c0c88d6ef033ecb5314e1ae73a2.tar.bz2
scala-5b8594a6beef0c0c88d6ef033ecb5314e1ae73a2.zip
*** empty log message ***
Diffstat (limited to 'sources')
-rw-r--r--sources/scala/Iterator.scala19
-rwxr-xr-xsources/scala/test-nsc24
-rwxr-xr-xsources/scala/tools/nsc/Global.scala2
-rwxr-xr-xsources/scala/tools/nsc/Main.scala2
-rw-r--r--sources/scala/tools/nsc/ast/TreePrinters.scala2
-rw-r--r--sources/scala/tools/nsc/symtab/Flags.scala2
-rwxr-xr-xsources/scala/tools/nsc/symtab/SymbolTable.scala7
-rwxr-xr-xsources/scala/tools/nsc/symtab/Symbols.scala49
-rwxr-xr-xsources/scala/tools/nsc/symtab/Types.scala73
-rwxr-xr-xsources/scala/tools/nsc/symtab/classfile/UnPickler.scala7
-rwxr-xr-xsources/scala/tools/nsc/transform/AddInterfaces.scala2
-rwxr-xr-xsources/scala/tools/nsc/transform/Mixin.scala2
-rwxr-xr-xsources/scala/tools/nsc/typechecker/Contexts.scala10
-rwxr-xr-xsources/scala/tools/nsc/typechecker/Namers.scala4
-rwxr-xr-xsources/scala/tools/nsc/typechecker/Typers.scala4
-rw-r--r--sources/scala/xml/transform/BasicTransformer.scala4
16 files changed, 158 insertions, 55 deletions
diff --git a/sources/scala/Iterator.scala b/sources/scala/Iterator.scala
index 73a608b1da..54f9ac8ca7 100644
--- a/sources/scala/Iterator.scala
+++ b/sources/scala/Iterator.scala
@@ -75,16 +75,19 @@ object Iterator {
*
* @param lo the start value of the iterator
* @param end the end value of the iterator
- * @param step the increment value of the iterator
+ * @param step the increment value of the iterator (must be positive or negative)
* @return the iterator with values in range [lo;end).
*/
- def range(lo: Int, end: Int, step: Int): Iterator[Int] = new Iterator[Int] {
- private var i = lo;
- def hasNext: Boolean = i < end;
- def next: Int =
- if (i < end) { val j = i; i = i + step; j } else Predef.error("next on empty iterator");
- def head: Int =
- if (i < end) i else Predef.error("head on empty iterator");
+ def range(lo: Int, end: Int, step: Int): Iterator[Int] = {
+ assert(step != 0);
+ new Iterator[Int] {
+ private var i = lo;
+ def hasNext: Boolean = if (step > 0) i < end else i > end;
+ def next: Int =
+ if (hasNext) { val j = i; i = i + step; j } else Predef.error("next on empty iterator");
+ def head: Int =
+ if (hasNext) i else Predef.error("head on empty iterator");
+ }
}
/** Create an iterator with elements
diff --git a/sources/scala/test-nsc b/sources/scala/test-nsc
new file mode 100755
index 0000000000..f8a42a0688
--- /dev/null
+++ b/sources/scala/test-nsc
@@ -0,0 +1,24 @@
+#! /bin/tcsh
+alias scala java -Xms16m -ea -classpath /home/linuxsoft/apps/java-1.4.2_08/jre/lib/rt.jar:$HOME/scala/objects/main/lib/scala:$HOME/scala/objects/main/lib/tools:/tmp/classes
+alias scala-debug scala -Djava.compiler=NONE
+alias nsc "scala scala.tools.nsc.Main -classpath "/tmp/newclasses:$HOME/picoClasses:$HOME/scala/sources:$HOME/scala/newsources" -d /tmp/newclasses"
+nsc -verbose -prompt -nopredefs Predef.scala runtime/ScalaRunTime.scala -check:geni $*
+nsc -verbose -prompt *.scala -check:geni $*
+nsc -verbose -prompt runtime/*.scala runtime/*/*.scala -check:geni $*
+nsc -verbose -prompt collection/*.scala -check:geni $*
+nsc -verbose -prompt collection/mutable/*.scala -check:geni $*
+nsc -verbose -prompt collection/immutable/*.scala -check:geni $*
+nsc -verbose -prompt concurrent/*.scala -check:geni $*
+nsc -verbose -prompt io/*.scala -check:geni $*
+nsc -verbose -prompt mobile/*.scala -check:geni $*
+nsc -verbose -prompt text/*.scala -check:geni $*
+nsc -verbose -prompt testing/*.scala -check:geni $*
+nsc -verbose -prompt util/*/*.scala -check:geni $*
+nsc -verbose -prompt xml*.scala xml/*/*.scala -check:geni $*
+rm -r /tmp/newclasses/scala/tools/nsc
+nsc -verbose -prompt tools/nsc/*.scala tools/nsc/matching/*.scala -check:geni $*
+nsc -verbose -prompt tools/nsc/Global.scala -check:geni $*
+nsc -verbose -prompt tools/nsc/typechecker/Typers.scala -check:geni $*
+nsc -verbose -prompt tools/nsc/symtab/Types.scala -check:geni $*
+nsc -verbose -prompt tools/nsc/symtab/Symbols.scala -check:geni $*
+
diff --git a/sources/scala/tools/nsc/Global.scala b/sources/scala/tools/nsc/Global.scala
index 8a2715eb01..76eb0887db 100755
--- a/sources/scala/tools/nsc/Global.scala
+++ b/sources/scala/tools/nsc/Global.scala
@@ -360,7 +360,7 @@ class Global(val settings: Settings, val reporter: Reporter) extends SymbolTable
if (reporter.errors() == 0) {
for (val Pair(sym, pickled) <- symData.elements.toList) {
- sym.pos = Position.NOPOS;
+ sym setPos Position.NOPOS;
if (symData contains sym) {
symData -= sym;
symData -= sym.linkedSym;
diff --git a/sources/scala/tools/nsc/Main.scala b/sources/scala/tools/nsc/Main.scala
index b3b314a783..8403dc954d 100755
--- a/sources/scala/tools/nsc/Main.scala
+++ b/sources/scala/tools/nsc/Main.scala
@@ -32,7 +32,7 @@ object Main {
val in = new BufferedReader(new InputStreamReader(System.in));
System.out.print(prompt);
var line = in.readLine();
- while (line.length() > 0) {
+ while (line != null && line.length() > 0) {
val args = List.fromString(line, ' ');
val command = new CompilerCommand(args, error, true);
compiler.compile(command.files);
diff --git a/sources/scala/tools/nsc/ast/TreePrinters.scala b/sources/scala/tools/nsc/ast/TreePrinters.scala
index 79af31e1e2..3c017acb3b 100644
--- a/sources/scala/tools/nsc/ast/TreePrinters.scala
+++ b/sources/scala/tools/nsc/ast/TreePrinters.scala
@@ -259,7 +259,7 @@ abstract class TreePrinters {
def print(tree: Tree): unit =
printRaw(
- if (tree.isDef && tree.symbol != NoSymbol && !tree.symbol.hasFlag(INITIALIZED)) {
+ if (tree.isDef && tree.symbol != NoSymbol && !tree.symbol.isInitialized) {
tree match {
case ClassDef(_, _, _, _, impl) => ClassDef(tree.symbol, impl)
case ModuleDef(_, _, impl) => ModuleDef(tree.symbol, impl)
diff --git a/sources/scala/tools/nsc/symtab/Flags.scala b/sources/scala/tools/nsc/symtab/Flags.scala
index 0cadf154a9..4fc5330461 100644
--- a/sources/scala/tools/nsc/symtab/Flags.scala
+++ b/sources/scala/tools/nsc/symtab/Flags.scala
@@ -64,7 +64,6 @@ object Flags {
final val TRANS_FLAG = 0x2000000000l; // transient flag guaranteed to be reset after each phase.
final val INCONSTRUCTOR = TRANS_FLAG; // transient flag for analyzer
- final val INITIALIZED = 0x4000000000l; // symbol's definition is complete
final val LOCKED = 0x8000000000l; // temporary flag to catch cyclic dependencies
final val InitialFlags = 0x000000FFFFFFFFFFl; // flags that are enabled from phase 1.
@@ -124,7 +123,6 @@ object Flags {
else if (flag == TRANS_FLAG) "<trans-flag>"
else if (flag == MIXEDIN) "<mixedin>"
else if (flag == EXPANDEDNAME) "<expandedname>"
- else if (flag == INITIALIZED) "<initialized>"
else if (flag == LOCKED) "<locked>"
else if (flag == STATICMODULE) "<staticobject>"
else if (flag == STATICMEMBER) "<staticmember>"
diff --git a/sources/scala/tools/nsc/symtab/SymbolTable.scala b/sources/scala/tools/nsc/symtab/SymbolTable.scala
index c928e13096..ebc63b9ab8 100755
--- a/sources/scala/tools/nsc/symtab/SymbolTable.scala
+++ b/sources/scala/tools/nsc/symtab/SymbolTable.scala
@@ -30,10 +30,9 @@ abstract class SymbolTable extends Names
final val NoRun = 0;
- /** The number of the current compiler run. Runs start at 2 and increment by 2's.
- * Odd run numbers in the `validForRun' field of symbols indicate that the type of
- * the symbol is not yet fully defined.
- */
+ /** The number of the current compiler run. Runs start at 1 and increment each time
+ * after Global.compileSources is called.
+ */
var currentRun: int = NoRun;
def atPhase[T](ph: Phase)(op: => T): T = {
diff --git a/sources/scala/tools/nsc/symtab/Symbols.scala b/sources/scala/tools/nsc/symtab/Symbols.scala
index b8bcd3e7fe..ee4a5744ff 100755
--- a/sources/scala/tools/nsc/symtab/Symbols.scala
+++ b/sources/scala/tools/nsc/symtab/Symbols.scala
@@ -26,10 +26,12 @@ abstract class Symbols: SymbolTable {
var rawowner = initOwner;
var rawname = initName;
private var rawflags: long = 0;
- var pos = initPos;
+ private var rawpos = initPos;
val id = { ids = ids + 1; ids }
+ var validForRun: int = NoRun;
- def setPos(pos: int): this.type = { this.pos = pos; this }
+ def pos = rawpos;
+ def setPos(pos: int): this.type = { this.rawpos = pos; this }
// Creators -------------------------------------------------------------------
@@ -194,7 +196,7 @@ abstract class Symbols: SymbolTable {
!owner.isPackageClass && owner.isLocalClass);
/** Symbol was preloaded from package */
- final def isExternal: boolean = pos == Position.NOPOS;
+ final def isExternal: boolean = rawpos == Position.NOPOS;
/** A a member of class `base' is incomplete if (1) it is declared deferred or
* (2) it is abstract override and its super symbol in `base' is nonexistent or inclomplete.
@@ -204,6 +206,9 @@ abstract class Symbols: SymbolTable {
(this hasFlag DEFERRED) ||
(this hasFlag ABSOVERRIDE) && isIncompleteIn(superSymbol(base));
+ final def isInitialized: boolean =
+ validForRun == currentRun;
+
/** The variance of this symbol as an integer */
final def variance: int =
if (hasFlag(COVARIANT)) 1
@@ -247,10 +252,14 @@ abstract class Symbols: SymbolTable {
*/
final def info: Type = {
var cnt = 0;
- while ((rawflags & INITIALIZED) == 0) {
- //if (settings.debug.value) System.out.println("completing " + this + " in " + this.owner);//DEBUG
- assert(infos != null, this.name);
- val tp = infos.info;
+ while (validForRun != currentRun) {
+ var ifs = infos;
+ assert(ifs != null, this.name);
+ while (ifs.prev != null) {
+ ifs = ifs.prev;
+ }
+ val tp = ifs.info;
+ //if (settings.debug.value) System.out.println("completing " + this.rawname + tp.getClass());//debug
if ((rawflags & LOCKED) != 0) {
setInfo(ErrorType);
throw CyclicReference(this, tp);
@@ -258,9 +267,9 @@ abstract class Symbols: SymbolTable {
rawflags = rawflags | LOCKED;
val current = phase;
try {
- phase = infos.start;
+ phase = ifs.start;
tp.complete(this);
- // if (settings.debug.value && (rawflags & INITIALIZED) != 0) System.out.println("completed " + this/* + ":" + info*/);//DEBUG
+ // if (settings.debug.value && (validForRun == currentRun) System.out.println("completed " + this/* + ":" + info*/);//DEBUG
rawflags = rawflags & ~LOCKED
} finally {
phase = current
@@ -276,15 +285,15 @@ abstract class Symbols: SymbolTable {
/** Set initial info. */
def setInfo(info: Type): this.type = {
assert(info != null);
- infos = new TypeHistory(firstPhase, info, null);
+ infos = new TypeHistory(phase, info, null);
limit = phase;
if (info.isComplete) {
rawflags = rawflags & ~LOCKED;
+ validForRun = currentRun
} else {
- rawflags = rawflags | INITIALIZED & ~LOCKED;
+ rawflags = rawflags & ~LOCKED;
+ validForRun = NoRun
}
- rawflags = if (info.isComplete) rawflags | INITIALIZED & ~LOCKED;
- else rawflags & ~INITIALIZED & ~LOCKED;
this
}
@@ -299,7 +308,7 @@ abstract class Symbols: SymbolTable {
/** Return info without checking for initialization or completing */
final def rawInfo: Type = {
if (limit.id < phase.id) {
- if ((rawflags & INITIALIZED) != 0) {
+ if (validForRun == currentRun) {
val current = phase;
var itr = infoTransformers.nextFrom(limit);
infoTransformers = itr; // caching optimization
@@ -319,14 +328,14 @@ abstract class Symbols: SymbolTable {
infos.info
} else {
var infos = this.infos;
- while (phase.id < infos.start.id) infos = infos.prev;
+ while (phase.id < infos.start.id && infos.prev != null) infos = infos.prev;
infos.info
}
}
/** Initialize the symbol */
final def initialize: this.type = {
- if ((rawflags & INITIALIZED) == 0) info;
+ if (!isInitialized) info;
this
}
@@ -355,7 +364,7 @@ abstract class Symbols: SymbolTable {
*/
def reset(completer: Type): unit = {
resetFlags;
- pos = Position.NOPOS;
+ rawpos = Position.NOPOS;
infos = null;
limit = NoPhase;
setInfo(completer)
@@ -794,7 +803,7 @@ abstract class Symbols: SymbolTable {
if (isValid(tpePhase)) {
tpePhase = phase
} else {
- if (hasFlag(INITIALIZED)) tpePhase = phase;
+ if (isInitialized) tpePhase = phase;
tpeCache = NoType;
val targs = if (phase.erasedTypes && this != ArrayClass) List()
else unsafeTypeParams map (.tpe);
@@ -905,8 +914,8 @@ abstract class Symbols: SymbolTable {
/** An object repreesenting a missing symbol */
object NoSymbol extends Symbol(null, Position.NOPOS, nme.NOSYMBOL) {
- super.setInfo(NoType);
- override def setInfo(info: Type): this.type = { assert(info eq NoType); this }
+ setInfo(NoType);
+ override def setInfo(info: Type): this.type = { assert(info eq NoType); super.setInfo(info) }
override def enclClass: Symbol = this;
override def toplevelClass: Symbol = this;
override def enclMethod: Symbol = this;
diff --git a/sources/scala/tools/nsc/symtab/Types.scala b/sources/scala/tools/nsc/symtab/Types.scala
index 23a68176ef..a3106c18ce 100755
--- a/sources/scala/tools/nsc/symtab/Types.scala
+++ b/sources/scala/tools/nsc/symtab/Types.scala
@@ -217,7 +217,7 @@ abstract class Types: SymbolTable {
/** Is this type equivalent to that type? */
def =:=(that: Type): boolean =
(this eq that) ||
- (if (explainSwitch) explain("<", isSameType, this, that) else isSameType(this, that));
+ (if (explainSwitch) explain("=", isSameType, this, that) else isSameType(this, that));
/** Does this type implement symbol `sym' with same or stronger type? */
def specializes(sym: Symbol): boolean =
@@ -294,7 +294,19 @@ abstract class Types: SymbolTable {
def isComplete: boolean = true;
/** If this is a lazy type, assign a new type to `sym'. */
- def complete(sym: Symbol): unit = {}
+ def complete(sym: Symbol): unit = {
+ if (sym == NoSymbol || sym.isPackageClass) sym.validForRun = currentRun
+ else {
+ /*if (sym.owner.isClass) complete(sym.owner);*/
+ val this1 = adaptToNewRunMap(this);
+ System.out.println("adapting " + sym);//debug
+ if (this1 eq this) sym.validForRun = currentRun
+ else {
+ System.out.println("new type of " + sym + "=" + this1);//debug
+ sym.setInfo(this1);
+ }
+ }
+ }
/** If this is a symbol loader type, load and assign a new type to `sym'. */
def load(sym: Symbol): unit = {}
@@ -1016,8 +1028,12 @@ abstract class Types: SymbolTable {
/** Map this function over given type */
def mapOver(tp: Type): Type = tp match {
- case ErrorType | WildcardType | NoType | NoPrefix | ThisType(_) | ConstantType(_) =>
- tp
+ case ErrorType => tp
+ case WildcardType => tp
+ case NoType => tp
+ case NoPrefix => tp
+ case ThisType(_) => tp
+ case ConstantType(_) => tp
case SingleType(pre, sym) =>
if (sym.isPackageClass) tp // short path
else {
@@ -1247,6 +1263,55 @@ abstract class Types: SymbolTable {
}
}
+ object adaptToNewRunMap extends TypeMap {
+ private def adaptToNewRun(pre: Type, sym: Symbol): Symbol = {
+ if (sym.isModuleClass) adaptToNewRun(pre, sym.sourceModule).moduleClass;
+ else if ((pre eq NoPrefix) || (pre eq NoType) || sym.owner.isPackageClass) sym
+ else {
+ val rebind0 = pre.nonPrivateMember(sym.name);
+ val rebind = rebind0.suchThat(sym => sym.isType || sym.isStable);
+ if (rebind == NoSymbol) throw new MalformedType(pre, sym.name.toString());
+ rebind
+ }
+ }
+ def apply(tp: Type): Type = tp match {
+ case SingleType(pre, sym) =>
+ if (sym.isPackage) tp
+ else {
+ val pre1 = this(pre);
+ val sym1 = adaptToNewRun(pre1, sym);
+ if ((pre1 eq pre) && (sym1 eq sym)) tp
+ else singleType(pre1, sym1)
+ }
+ case TypeRef(pre, sym, args) =>
+ if (sym.isPackageClass) tp
+ else {
+ val pre1 = this(pre);
+ val args1 = List.mapConserve(args)(this);
+ val sym1 = adaptToNewRun(pre1, sym);
+ if ((pre1 eq pre) && (sym1 eq sym) && (args1 eq args) && sym.isExternal) tp
+ else typeRef(pre1, sym1, args1)
+ }
+ case PolyType(tparams, restp) =>
+ val restp1 = this(restp);
+ if (restp1 eq restp) tp
+ else PolyType(tparams, restp1)
+ case ClassInfoType(parents, decls, clazz) =>
+ val parents1 = List.mapConserve(parents)(this);
+ if (parents1 eq parents) tp
+ else ClassInfoType(parents1, decls, clazz)
+ case RefinedType(parents, decls) =>
+ val parents1 = List.mapConserve(parents)(this);
+ if (parents1 eq parents) tp
+ else refinedType(parents1, tp.symbol.owner, decls)
+ case SuperType(_, _) => mapOver(tp)
+ case TypeBounds(_, _) => mapOver(tp)
+ case MethodType(_, _) => mapOver(tp)
+ case TypeVar(_, _) => mapOver(tp)
+ case _ => tp
+ }
+ }
+
// Helper Methods -------------------------------------------------------------
final def isValid(p: Phase): boolean =
diff --git a/sources/scala/tools/nsc/symtab/classfile/UnPickler.scala b/sources/scala/tools/nsc/symtab/classfile/UnPickler.scala
index ea459829d4..222fcdacd2 100755
--- a/sources/scala/tools/nsc/symtab/classfile/UnPickler.scala
+++ b/sources/scala/tools/nsc/symtab/classfile/UnPickler.scala
@@ -210,7 +210,12 @@ abstract class UnPickler {
throw new RuntimeException("malformed Scala signature of " + classRoot.name + " at " + readIndex + "; " + msg);
private class LazyTypeRef(i: int) extends LazyType {
- override def complete(sym: Symbol): unit = sym setInfo at(i, readType);
+ private val definedAtRun: int = currentRun;
+ override def complete(sym: Symbol): unit = {
+ val tp = at(i, readType);
+ sym setInfo tp;
+ if (currentRun != definedAtRun) tp.complete(sym)
+ }
override def load(sym: Symbol): unit = complete(sym)
}
diff --git a/sources/scala/tools/nsc/transform/AddInterfaces.scala b/sources/scala/tools/nsc/transform/AddInterfaces.scala
index a266590f51..7b1638cc65 100755
--- a/sources/scala/tools/nsc/transform/AddInterfaces.scala
+++ b/sources/scala/tools/nsc/transform/AddInterfaces.scala
@@ -48,7 +48,7 @@ abstract class AddInterfaces extends InfoTransform {
impl.name = implName;
if (iface.owner.isClass) iface.owner.info.decls enter impl
}
- impl.pos = iface.pos;
+ impl setPos iface.pos;
impl.flags = iface.flags & ~(INTERFACE | lateINTERFACE);
impl setInfo new LazyImplClassType(iface);
implClassMap(iface) = impl;
diff --git a/sources/scala/tools/nsc/transform/Mixin.scala b/sources/scala/tools/nsc/transform/Mixin.scala
index f12ca011f2..7e120adb69 100755
--- a/sources/scala/tools/nsc/transform/Mixin.scala
+++ b/sources/scala/tools/nsc/transform/Mixin.scala
@@ -139,7 +139,7 @@ abstract class Mixin extends InfoTransform {
clazz setFlag lateMODULE;
var sourceModule = clazz.owner.info.decls.lookup(sym.name.toTermName);
if (sourceModule != NoSymbol) {
- sourceModule.pos = sym.pos;
+ sourceModule setPos sym.pos;
sourceModule.flags = MODULE | FINAL;
} else {
sourceModule = clazz.owner.newModule(
diff --git a/sources/scala/tools/nsc/typechecker/Contexts.scala b/sources/scala/tools/nsc/typechecker/Contexts.scala
index d09ce315b9..d164999752 100755
--- a/sources/scala/tools/nsc/typechecker/Contexts.scala
+++ b/sources/scala/tools/nsc/typechecker/Contexts.scala
@@ -43,7 +43,9 @@ abstract class Contexts: Analyzer {
var sc = startContext;
while (sc != NoContext) {
sc.tree match {
- case Import(qual, _) => qual.tpe = singleType(qual.symbol.owner.thisType, qual.symbol)
+ case Import(qual, _) =>
+ qual.tpe = singleType(qual.symbol.owner.thisType, qual.symbol);
+ System.out.println("resetting " + qual + " to " + qual.tpe)
case _ =>
}
sc = sc.outer
@@ -216,7 +218,7 @@ abstract class Contexts: Analyzer {
if (implicitsCache == null) {
val newImplicits: List[ImplicitInfo] =
if (owner != outer.owner && owner.isClass && !owner.isPackageClass) {
- if (!owner.hasFlag(INITIALIZED)) return outer.implicitss;
+ if (!owner.isInitialized) return outer.implicitss;
if (settings.debug.value) log("collect member implicits " + owner + ", implicit members = " + owner.thisType.implicitMembers);//debug
collectImplicits(owner.thisType.implicitMembers, owner.thisType)
} else if (scope != outer.scope && !owner.isPackageClass) {
@@ -267,7 +269,7 @@ abstract class Contexts: Analyzer {
override def toString() = tree.toString();
}
- case class ImportType(expr: Tree) extends Type;
-
case class ImplicitInfo(val name: Name, val tpe: Type, val sym: Symbol);
+
+ case class ImportType(expr: Tree) extends Type;
}
diff --git a/sources/scala/tools/nsc/typechecker/Namers.scala b/sources/scala/tools/nsc/typechecker/Namers.scala
index 06546a6341..2b3a277244 100755
--- a/sources/scala/tools/nsc/typechecker/Namers.scala
+++ b/sources/scala/tools/nsc/typechecker/Namers.scala
@@ -16,7 +16,7 @@ trait Namers: Analyzer {
def updatePosFlags(sym: Symbol, pos: int, mods: int): Symbol = {
if (settings.debug.value) log("overwriting " + sym);
- sym.pos = pos;
+ sym setPos pos;
sym.flags = mods | sym.flags & LOCKED;
if (sym.isModule)
updatePosFlags(sym.moduleClass, pos, (mods & ModuleToClassFlags) | MODULE | FINAL);
@@ -60,7 +60,7 @@ trait Namers: Analyzer {
private def enterPackageSymbol(pos: int, name: Name): Symbol = {
val p: Symbol = context.scope.lookup(name);
if (p.isPackage && context.scope == p.owner.info.decls) {
- p.pos = pos; p.moduleClass.pos = pos; p
+ p
} else {
val pkg = context.owner.newPackage(pos, name);
pkg.moduleClass.setInfo(new PackageClassInfoType(new Scope(), pkg.moduleClass));
diff --git a/sources/scala/tools/nsc/typechecker/Typers.scala b/sources/scala/tools/nsc/typechecker/Typers.scala
index da38fff387..e5d409abe9 100755
--- a/sources/scala/tools/nsc/typechecker/Typers.scala
+++ b/sources/scala/tools/nsc/typechecker/Typers.scala
@@ -880,7 +880,7 @@ abstract class Typers: Analyzer {
case ErrorType =>
setError(tree)
case _ =>
- throw new Error("Matcherror at " + phase);//debug
+ throw new Error("Matcherror at " + phase + " " + fun.tpe);//debug
}
/** The qualifying class of a this or super with prefix `qual' */
@@ -1166,7 +1166,7 @@ abstract class Typers: Analyzer {
val enclFun = if (tree.symbol != NoSymbol) tree.symbol else context.owner.enclMethod;
if (!enclFun.isMethod || enclFun.isConstructor)
errorTree(tree, "return outside method definition")
- else if (!context.owner.hasFlag(INITIALIZED))
+ else if (!context.owner.isInitialized)
errorTree(tree, "method " + context.owner + " has return statement; needs result type")
else {
val expr1: Tree = typed(expr, enclFun.tpe.finalResultType);
diff --git a/sources/scala/xml/transform/BasicTransformer.scala b/sources/scala/xml/transform/BasicTransformer.scala
index a260f82105..56bbc16201 100644
--- a/sources/scala/xml/transform/BasicTransformer.scala
+++ b/sources/scala/xml/transform/BasicTransformer.scala
@@ -61,9 +61,7 @@ trait BasicTransformer extends Function1[Node,Node] {
}
ns
} catch {
- case n: NeedsCopy =>
- // todo: replace with NeedsCopy(n2), once pattern matcher can handle try's
- val n2 = n.result;
+ case NeedsCopy(n2) =>
val nb = buffer(i, ns);
nb ++ n2;
transform(it, nb);