diff options
-rwxr-xr-x | newsources/scala/Array.scala | 12 | ||||
-rw-r--r-- | sources/scala/runtime/ScalaRunTime.scala | 7 | ||||
-rw-r--r-- | sources/scala/tools/nsc/matching/DetWordAutoms.scala | 12 | ||||
-rw-r--r-- | sources/scala/tools/nsc/matching/MatcherLabels.scala | 2 | ||||
-rwxr-xr-x | sources/scala/tools/nsc/symtab/Types.scala | 10 | ||||
-rwxr-xr-x | sources/scala/tools/nsc/typechecker/Typers.scala | 11 |
6 files changed, 28 insertions, 26 deletions
diff --git a/newsources/scala/Array.scala b/newsources/scala/Array.scala index 7e3b0e225e..6172a6f77d 100755 --- a/newsources/scala/Array.scala +++ b/newsources/scala/Array.scala @@ -11,13 +11,7 @@ package scala; final class Array[T](val length: Int) extends Cloneable with java.io.Serializable with Seq[T] { - - def apply(i: Int): T; - def update(i: Int, x: T): Unit; - - def elements = new Iterator[T] { - var index = 0; - def hasNext: Boolean = index < length; - def next: T = { val i = index; index = i + 1; apply(i) } - } + def apply(i: Int): T = throw new Error(); + def update(i: Int, x: T): Unit = throw new Error(); + def elements: Iterator[T] = throw new Error(); } diff --git a/sources/scala/runtime/ScalaRunTime.scala b/sources/scala/runtime/ScalaRunTime.scala index f4ac7a18cb..d18a8c14ff 100644 --- a/sources/scala/runtime/ScalaRunTime.scala +++ b/sources/scala/runtime/ScalaRunTime.scala @@ -10,7 +10,6 @@ package scala.runtime; - object ScalaRunTime { /** Names for primitive typesm, used by array unboxing */ @@ -23,8 +22,6 @@ object ScalaRunTime { val DoubleTag = ".Double"; val BooleanTag = ".Boolean"; - import compat.Platform.getClass; - trait Try[a] { def Catch[b >: a](handler: PartialFunction[Throwable, b]): b; def Finally(handler: Unit): a; @@ -66,7 +63,7 @@ object ScalaRunTime { } def _hashCode(x: CaseClass): Int = { - var code = getClass(x).hashCode(); + var code = x.getClass().hashCode(); val arity = x.caseArity; var i = 0; while (i < arity) { @@ -78,7 +75,7 @@ object ScalaRunTime { def _equals(x: CaseClass, y: Any): Boolean = y match { case y1: CaseClass => - (getClass(x) eq getClass(y1)) && { + (x.getClass() eq y1.getClass()) && { val arity = x.caseArity; var i = 0; while (i < arity && x.caseElement(i) == y1.caseElement(i)) diff --git a/sources/scala/tools/nsc/matching/DetWordAutoms.scala b/sources/scala/tools/nsc/matching/DetWordAutoms.scala index b250877d87..553b5b1e13 100644 --- a/sources/scala/tools/nsc/matching/DetWordAutoms.scala +++ b/sources/scala/tools/nsc/matching/DetWordAutoms.scala @@ -150,7 +150,7 @@ class DetWordAutom { // TEMPORARY VAR used only during determinization and debug printing // Q -> (Label -> Q ) - var deltaMap: HashMap = _; + var delta/*Map*/: HashMap = _; // Q -> Integer; var indexMap: HashMap = _; @@ -183,7 +183,7 @@ class DetWordAutom { this._labels = nfa.labels; ////System.out.println("Labels: "+labels); - this.deltaMap = new HashMap(); + this.delta/*Map*/ = new HashMap(); //this.dead = -1; states = new TreeSet( new StateSetComparator() ); @@ -222,7 +222,7 @@ class DetWordAutom { invIndexMap.put( new Integer( ix ), P1 ); indexMap.put( P1, new Integer( ix )); ix = ix + 1; - deltaMap.put( P1, {trans = new HashMap(); trans}); + delta/*Map*/.put( P1, {trans = new HashMap(); trans}); //Console.println("...beginning 4" ); // labelled transitions @@ -310,7 +310,7 @@ class DetWordAutom { ////System.out.print(state.toString() + " --> " + state_x); //System.out.println(" deftarget " + defTarget + " --> "+defTarget_x); - trans = deltaMap.get( state ).asInstanceOf[HashMap]; + trans = delta/*Map*/.get( state ).asInstanceOf[HashMap]; val newTrans = new HashMap(); val labs = _labels.iterator(); while(labs.hasNext()) { @@ -333,7 +333,7 @@ class DetWordAutom { _deltaq( state_x.intValue() ) = newTrans; _defaultq( state_x.intValue() ) = defTarget_x; - deltaMap.remove( state ); + delta/*Map*/.remove( state ); deftrans.remove( state ); } @@ -866,7 +866,7 @@ class DetWordAutom { while (it.hasNext()) { val state = it.next().asInstanceOf[TreeSet]; Console.print("state:" + state.toString() + " transitions "); - trans = deltaMap.get( state ).asInstanceOf[HashMap]; + trans = delta/*Map*/.get( state ).asInstanceOf[HashMap]; val labs = _labels.iterator(); while(labs.hasNext()) { val label = labs.next(); diff --git a/sources/scala/tools/nsc/matching/MatcherLabels.scala b/sources/scala/tools/nsc/matching/MatcherLabels.scala index 55529e61e2..ebf8dfc2cb 100644 --- a/sources/scala/tools/nsc/matching/MatcherLabels.scala +++ b/sources/scala/tools/nsc/matching/MatcherLabels.scala @@ -1,6 +1,6 @@ package scala.tools.nsc.matching ; -class MatcherLabels: TransMatcher { +abstract class MatcherLabels: TransMatcher { import global._ ; diff --git a/sources/scala/tools/nsc/symtab/Types.scala b/sources/scala/tools/nsc/symtab/Types.scala index 69b49890ef..0533920f9f 100755 --- a/sources/scala/tools/nsc/symtab/Types.scala +++ b/sources/scala/tools/nsc/symtab/Types.scala @@ -81,10 +81,14 @@ abstract class Types: SymbolTable { /** For a typeref, its arguments. The empty list for all other types */ def typeArgs: List[Type] = List(); - /** For a method or poly type, its result type, + /** For a method or poly type, its direct result type, * the type itself for all other types */ def resultType: Type = this; + /** For a curried method or poly type its non-method result type, + * the type itself for all other types */ + def finalResultType: Type = this; + /** For a method or poly type, the number of its value parameter sections, * 0 for all other types */ def paramSectionCount: int = 0; @@ -688,6 +692,8 @@ abstract class Types: SymbolTable { override def paramSectionCount: int = resultType.paramSectionCount + 1; + override def finalResultType: Type = resultType.finalResultType; + override def erasure = { val pts = List.mapConserve(paramTypes)(.erasure); val res = resultType.erasure; @@ -711,6 +717,8 @@ abstract class Types: SymbolTable { override def paramSectionCount: int = resultType.paramSectionCount; override def paramTypes: List[Type] = resultType.paramTypes; + override def finalResultType: Type = resultType.finalResultType; + override def parents: List[Type] = resultType.parents; override def decls: Scope = resultType.decls; override def symbol: Symbol = resultType.symbol; diff --git a/sources/scala/tools/nsc/typechecker/Typers.scala b/sources/scala/tools/nsc/typechecker/Typers.scala index 0034f08679..9875fdac28 100755 --- a/sources/scala/tools/nsc/typechecker/Typers.scala +++ b/sources/scala/tools/nsc/typechecker/Typers.scala @@ -247,7 +247,7 @@ abstract class Typers: Analyzer { * If all this fails, error */ // def adapt(tree: Tree, mode: int, pt: Type): Tree = { - private def adapt(tree: Tree, mode: int, pt: Type): Tree = tree.tpe match { + protected def adapt(tree: Tree, mode: int, pt: Type): Tree = tree.tpe match { case ct @ ConstantType(value) if ((mode & TYPEmode) == 0 && (ct <:< pt)) => // (0) copy.Literal(tree, value) case OverloadedType(pre, alts) if ((mode & FUNmode) == 0) => // (1) @@ -458,8 +458,11 @@ abstract class Typers: Analyzer { val vdef = copy.ValDef(stat, mods | PRIVATE | LOCAL, nme.LOCAL_NAME(name), tpe, rhs); val getter: DefDef = { val sym = vdef.symbol; - val getter = sym.owner.info.decls.lookup(name).suchThat(.hasFlag(ACCESSOR)); - assert(getter != NoSymbol, vdef); + val decls = sym.owner.info.decls; + var getterEntry = decls.lookupEntry(name); + while (!(getterEntry.sym hasFlag ACCESSOR)) + getterEntry = decls.lookupNextEntry(getterEntry); + val getter = getterEntry.sym; val result = atPos(vdef.pos)( DefDef(getter, vparamss => if ((mods & DEFERRED) != 0) EmptyTree else typed(gen.mkRef(sym), EXPRmode, sym.tpe))); @@ -1065,7 +1068,7 @@ abstract class Typers: Analyzer { else if (!context.owner.hasFlag(INITIALIZED)) errorTree(tree, "method " + context.owner + " has return statement; needs result type") else { - val expr1: Tree = typed(expr, enclFun.tpe.resultType); + val expr1: Tree = typed(expr, enclFun.tpe.finalResultType); copy.Return(tree, expr1) setSymbol enclFun setType AllClass.tpe; } |