Browse files

Changed Super to fix #4300

  • Loading branch information...
1 parent 1f3c58a commit 13c59adf9fbff0e99ffa9f8e30f5dc05e0c1ee4d @odersky odersky committed Mar 14, 2011
Showing with 132 additions and 103 deletions.
  1. +2 −1 src/compiler/scala/tools/nsc/ast/NodePrinters.scala
  2. +2 −2 src/compiler/scala/tools/nsc/ast/TreeBrowsers.scala
  3. +7 −1 src/compiler/scala/tools/nsc/ast/TreePrinters.scala
  4. +9 −7 src/compiler/scala/tools/nsc/ast/Trees.scala
  5. +3 −3 src/compiler/scala/tools/nsc/ast/parser/Parsers.scala
  6. +2 −1 src/compiler/scala/tools/nsc/interactive/Global.scala
  7. +1 −1 src/compiler/scala/tools/nsc/symtab/classfile/Pickler.scala
  8. +21 −9 src/compiler/scala/tools/nsc/transform/Mixin.scala
  9. +1 −1 src/compiler/scala/tools/nsc/transform/Reifiers.scala
  10. +1 −1 src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala
  11. +2 −2 src/compiler/scala/tools/nsc/typechecker/Duplicators.scala
  12. +1 −1 src/compiler/scala/tools/nsc/typechecker/Namers.scala
  13. +4 −2 src/compiler/scala/tools/nsc/typechecker/SuperAccessors.scala
  14. +38 −35 src/compiler/scala/tools/nsc/typechecker/Typers.scala
  15. +9 −9 src/library/scala/collection/JavaConversions.scala
  16. +2 −2 src/library/scala/collection/MapLike.scala
  17. +3 −3 src/library/scala/collection/generic/Signalling.scala
  18. +2 −2 src/library/scala/collection/immutable/LongMap.scala
  19. +4 −4 src/library/scala/collection/mutable/ArrayStack.scala
  20. +1 −1 src/library/scala/collection/mutable/FlatHashTable.scala
  21. +2 −2 src/library/scala/collection/mutable/HashMap.scala
  22. +2 −2 src/library/scala/collection/mutable/HashTable.scala
  23. +3 −3 src/library/scala/collection/parallel/Tasks.scala
  24. +3 −3 src/library/scala/collection/parallel/mutable/ParFlatHashTable.scala
  25. +5 −3 src/library/scala/reflect/generic/Trees.scala
  26. +1 −1 src/library/scala/reflect/generic/UnPickler.scala
  27. +1 −1 test/files/neg/t0117.check
View
3 src/compiler/scala/tools/nsc/ast/NodePrinters.scala
@@ -196,7 +196,8 @@ abstract class NodePrinters {
traverse(qualifier, level + 1, true)
printcln(" \"" + selector + "\")")
case Super(qual, mix) =>
- printcln("Super(\"" + qual + "\", \"" + mix + "\")" + nodeinfo2(tree))
+ println("Super(\"" + mix + "\")" + nodeinfo(tree))
+ traverse(qual, level + 1, true)
case Template(parents, self, body) =>
println("Template(" + nodeinfo(tree))
println(" " + parents.map(p =>
View
4 src/compiler/scala/tools/nsc/ast/TreeBrowsers.scala
@@ -345,7 +345,7 @@ abstract class TreeBrowsers {
("Apply", EMPTY)
case Super(qualif, mix) =>
- ("Super", qualif.toString() + ", mix: " + mix.toString())
+ ("Super", "mix: " + mix.toString())
case This(qualifier) =>
("This", qualifier)
@@ -486,7 +486,7 @@ abstract class TreeBrowsers {
List(qual) ::: args
case Super(qualif, mix) =>
- Nil
+ List(qualif)
case This(qualif) =>
Nil
View
8 src/compiler/scala/tools/nsc/ast/TreePrinters.scala
@@ -341,12 +341,18 @@ trait TreePrinters { trees: SymbolTable =>
print("<apply-dynamic>("); print(qual); print("#"); print(tree.symbol.nameString)
printRow(vargs, ", (", ", ", "))")
- case Super(qual, mix) =>
+ case Super(This(qual), mix) =>
if (!qual.isEmpty || tree.symbol != NoSymbol) print(symName(tree, qual) + ".")
print("super")
if (!mix.isEmpty)
print("[" + mix + "]")
+ case Super(qual, mix) =>
+ print(qual)
+ print(".super")
+ if (!mix.isEmpty)
+ print("[" + mix + "]")
+
case This(qual) =>
if (!qual.isEmpty) print(symName(tree, qual) + ".")
print("this")
View
16 src/compiler/scala/tools/nsc/ast/Trees.scala
@@ -256,7 +256,7 @@ trait Trees extends reflect.generic.Trees { self: SymbolTable =>
if (vparamss1.isEmpty || !vparamss1.head.isEmpty && vparamss1.head.head.mods.isImplicit)
vparamss1 = List() :: vparamss1;
val superRef: Tree = atPos(superPos) {
- Select(Super(tpnme.EMPTY, tpnme.EMPTY), nme.CONSTRUCTOR)
+ Select(Super(This(tpnme.EMPTY), tpnme.EMPTY), nme.CONSTRUCTOR)
}
val superCall = (superRef /: argss) (Apply)
List(
@@ -289,7 +289,7 @@ trait Trees extends reflect.generic.Trees { self: SymbolTable =>
(superRef /: argss) (Apply)
}
- def Super(sym: Symbol, mix: Name): Tree = Super(sym.name.toTypeName, mix.toTypeName) setSymbol sym
+ def Super(sym: Symbol, mix: TypeName): Tree = Super(This(sym), mix)
def This(sym: Symbol): Tree = This(sym.name.toTypeName) setSymbol sym
@@ -388,7 +388,7 @@ trait Trees extends reflect.generic.Trees { self: SymbolTable =>
def TypeApply(tree: Tree, fun: Tree, args: List[Tree]): TypeApply
def Apply(tree: Tree, fun: Tree, args: List[Tree]): Apply
def ApplyDynamic(tree: Tree, qual: Tree, args: List[Tree]): ApplyDynamic
- def Super(tree: Tree, qual: Name, mix: Name): Super
+ def Super(tree: Tree, qual: Tree, mix: TypeName): Super
def This(tree: Tree, qual: Name): This
def Select(tree: Tree, qualifier: Tree, selector: Name): Select
def Ident(tree: Tree, name: Name): Ident
@@ -470,8 +470,8 @@ trait Trees extends reflect.generic.Trees { self: SymbolTable =>
}).copyAttrs(tree)
def ApplyDynamic(tree: Tree, qual: Tree, args: List[Tree]) =
new ApplyDynamic(qual, args).copyAttrs(tree)
- def Super(tree: Tree, qual: Name, mix: Name) =
- new Super(qual.toTypeName, mix.toTypeName).copyAttrs(tree)
+ def Super(tree: Tree, qual: Tree, mix: TypeName) =
+ new Super(qual, mix).copyAttrs(tree)
def This(tree: Tree, qual: Name) =
new This(qual.toTypeName).copyAttrs(tree)
def Select(tree: Tree, qualifier: Tree, selector: Name) =
@@ -656,7 +656,7 @@ trait Trees extends reflect.generic.Trees { self: SymbolTable =>
if (qual0 == qual) && (args0 == args) => t
case _ => treeCopy.ApplyDynamic(tree, qual, args)
}
- def Super(tree: Tree, qual: Name, mix: Name) = tree match {
+ def Super(tree: Tree, qual: Tree, mix: TypeName) = tree match {
case t @ Super(qual0, mix0)
if (qual0 == qual) && (mix0 == mix) => t
case _ => treeCopy.Super(tree, qual, mix)
@@ -824,7 +824,7 @@ trait Trees extends reflect.generic.Trees { self: SymbolTable =>
case ApplyDynamic(qual, args) =>
treeCopy.ApplyDynamic(tree, transform(qual), transformTrees(args))
case Super(qual, mix) =>
- treeCopy.Super(tree, qual, mix)
+ treeCopy.Super(tree, transform(qual), mix)
case This(qual) =>
treeCopy.This(tree, qual)
case Select(qualifier, selector) =>
@@ -901,6 +901,8 @@ trait Trees extends reflect.generic.Trees { self: SymbolTable =>
traverseTrees(ts)
case TypeTreeWithDeferredRefCheck() => // TODO: should we traverse the wrapped tree?
// (and rewrap the result? how to update the deferred check? would need to store wrapped tree instead of returning it from check)
+ case Super(qual, _) =>
+ traverse(qual) // !!! remove when Super is done
case _ => super.traverse(tree)
}
View
6 src/compiler/scala/tools/nsc/ast/parser/Parsers.scala
@@ -376,7 +376,7 @@ self =>
Nil,
List(Nil),
TypeTree(),
- Block(List(Apply(Select(Super(tpnme.EMPTY, tpnme.EMPTY), nme.CONSTRUCTOR), Nil)), Literal(Constant(())))
+ Block(List(Apply(Select(Super(This(tpnme.EMPTY), tpnme.EMPTY), nme.CONSTRUCTOR), Nil)), Literal(Constant(())))
)
// def main
@@ -995,7 +995,7 @@ self =>
}
} else if (in.token == SUPER) {
in.nextToken()
- t = atPos(start) { Super(tpnme.EMPTY, mixinQualifierOpt()) }
+ t = atPos(start) { Super(This(tpnme.EMPTY), mixinQualifierOpt()) }
accept(DOT)
t = selector(t)
if (in.token == DOT) t = selectors(t, typeOK, in.skipToken())
@@ -1015,7 +1015,7 @@ self =>
t = selectors(t, typeOK, accept(DOT))
} else if (in.token == SUPER) {
in.nextToken()
- t = atPos(start) { Super(name.toTypeName, mixinQualifierOpt()) }
+ t = atPos(start) { Super(This(name.toTypeName), mixinQualifierOpt()) }
accept(DOT)
t = selector(t)
if (in.token == DOT) t = selectors(t, typeOK, in.skipToken())
View
3 src/compiler/scala/tools/nsc/interactive/Global.scala
@@ -629,7 +629,7 @@ class Global(settings: Settings, reporter: Reporter)
val newsym = pre.decl(sym.name) filter { alt =>
sym.isType || {
try {
- val tp1 = pre.memberType(alt) onTypeError NoType
+ val tp1 = adaptToNewRunMap(pre.memberType(alt) onTypeError NoType)
val tp2 = adaptToNewRunMap(sym.tpe)
matchesType(tp1, tp2, false)
} catch {
@@ -645,6 +645,7 @@ class Global(settings: Settings, reporter: Reporter)
debugLog("link not found "+sym+" "+source+" "+pre)
NoPosition
} else if (newsym.isOverloaded) {
+ settings.uniqid.value = true
debugLog("link ambiguous "+sym+" "+source+" "+pre+" "+newsym.alternatives)
NoPosition
} else {
View
2 src/compiler/scala/tools/nsc/symtab/classfile/Pickler.scala
@@ -358,7 +358,7 @@ abstract class Pickler extends SubComponent {
putTrees(args)
case Super(qual, mix) =>
- putEntry(qual:Name)
+ putTree(qual)
putEntry(mix:Name)
case This(qual) =>
View
30 src/compiler/scala/tools/nsc/transform/Mixin.scala
@@ -548,11 +548,25 @@ abstract class Mixin extends InfoTransform with ast.TreeDSL {
/** Replace a super reference by this or the self parameter, depending
* on whether we are in an implementation class or not.
- * Leave all other trees unchanged */
- private def transformSuper(qual: Tree) =
- if (!qual.isInstanceOf[Super]) qual
- else if (currentOwner.enclClass.isImplClass) selfRef(qual.pos)
- else gen.mkAttributedThis(currentOwner.enclClass)
+ * Leave all other trees unchanged.
+ */
+ private def transformSuper(tree: Tree) = tree match {
+ case Super(qual, _) =>
+ transformThis(qual)
+ case _ =>
+ tree
+ }
+
+ /** Replace a this reference to the current implementation class by the self
+ * parameter. Leave all other trees unchanged.
+ */
+ private def transformThis(tree: Tree) = tree match {
+ case This(_) if tree.symbol.isImplClass =>
+ assert(tree.symbol == currentOwner.enclClass)
+ selfRef(tree.pos)
+ case _ =>
+ tree
+ }
/** Create a static reference to given symbol <code>sym</code> of the
* form <code>M.sym</code> where M is the symbol's implementation module.
@@ -1178,10 +1192,8 @@ abstract class Mixin extends InfoTransform with ast.TreeDSL {
tree
}
- case This(_) if tree.symbol.isImplClass =>
- // change `this' in implementation modules to references to the self parameter
- assert(tree.symbol == currentOwner.enclClass)
- selfRef(tree.pos)
+ case This(_) =>
+ transformThis(tree)
case Select(Super(_, _), name) =>
tree
View
2 src/compiler/scala/tools/nsc/transform/Reifiers.scala
@@ -305,7 +305,7 @@ trait Reifiers {
val rrhs = reify(rhs)
reflect.DefDef(rsym, rparss, rret, rrhs)
- case sp @ Super(qual: Name, mix: Name) =>
+ case sp @ Super(qual, mix) =>
val rsym = reify(sp.symbol)
reflect.Super(rsym)
View
2 src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala
@@ -1396,7 +1396,7 @@ abstract class SpecializeTypes extends InfoTransform with TypingTransformers {
if (symbol.isConstructor) {
val t = atOwner(symbol) {
- val superRef: Tree = Select(Super(tpnme.EMPTY, tpnme.EMPTY), nme.CONSTRUCTOR)
+ val superRef: Tree = Select(Super(This(tpnme.EMPTY), tpnme.EMPTY), nme.CONSTRUCTOR)
forwardCtorCall(tree.pos, superRef, vparamss, symbol.owner)
}
if (symbol.isPrimaryConstructor) localTyper typed {
View
4 src/compiler/scala/tools/nsc/typechecker/Duplicators.scala
@@ -276,12 +276,12 @@ abstract class Duplicators extends Analyzer {
val tree1 = super.typed(tree, mode, pt)
// log("plain this typed to: " + tree1)
tree1
-
+/* no longer needed, because Super now contains a This(...)
case Super(qual, mix) if (oldClassOwner ne null) && (tree.symbol == oldClassOwner) =>
val tree1 = Super(qual, mix)
log("changed " + tree + " to " + tree1)
super.typed(atPos(tree.pos)(tree1))
-
+*/
case Match(scrut, cases) =>
val scrut1 = typed(scrut, EXPRmode | BYVALmode, WildcardType)
val scrutTpe = scrut1.tpe.widen
View
2 src/compiler/scala/tools/nsc/typechecker/Namers.scala
@@ -757,7 +757,7 @@ trait Namers { self: Analyzer =>
// add apply and unapply methods to companion objects of case classes,
// unless they exist already; here, "clazz" is the module class
if (clazz.isModuleClass) {
- Namers.this.caseClassOfModuleClass get clazz map { cdefRef =>
+ Namers.this.caseClassOfModuleClass get clazz foreach { cdefRef =>
val cdef = cdefRef()
addApplyUnapply(cdef, templateNamer)
caseClassOfModuleClass -= clazz
View
6 src/compiler/scala/tools/nsc/typechecker/SuperAccessors.scala
@@ -190,10 +190,12 @@ abstract class SuperAccessors extends transform.Transform with transform.TypingT
mayNeedProtectedAccessor(sel, args, false)
case sel @ Select(qual @ This(_), name) =>
+ // direct calls to aliases of param accessors to the superclass in order to avoid
+ // duplicating fields.
if (sym.isParamAccessor && sym.alias != NoSymbol) {
val result = localTyper.typed {
Select(
- Super(qual.symbol, tpnme.EMPTY/*qual.symbol.info.parents.head.symbol.name*/) setPos qual.pos,
+ Super(qual, tpnme.EMPTY/*qual.symbol.info.parents.head.symbol.name*/) setPos qual.pos,
sym.alias) setPos tree.pos
}
if (settings.debug.value)
@@ -202,7 +204,7 @@ abstract class SuperAccessors extends transform.Transform with transform.TypingT
}
else mayNeedProtectedAccessor(sel, List(EmptyTree), false)
- case Select(sup @ Super(_, mix), name) =>
+ case Select(Super(_, mix), name) =>
if (sym.isValue && !sym.isMethod || sym.hasAccessorFlag) {
unit.error(tree.pos, "super may be not be used on "+
(if (sym.hasAccessorFlag) sym.accessed else sym))
View
73 src/compiler/scala/tools/nsc/typechecker/Typers.scala
@@ -3378,41 +3378,44 @@ trait Typers extends Modes {
def qualifyingClassSym(qual: Name): Symbol =
if (tree.symbol != NoSymbol) tree.symbol else qualifyingClass(tree, qual, false)
- def typedSuper(qual: Name, mix: Name) = {
- val clazz = qualifyingClassSym(qual)
- if (clazz == NoSymbol) setError(tree)
- else {
- def findMixinSuper(site: Type): Type = {
- val ps = site.parents filter (_.typeSymbol.name == mix)
- if (ps.isEmpty) {
- if (settings.debug.value)
- Console.println(site.parents map (_.typeSymbol.name))//debug
- if (phase.erasedTypes && context.enclClass.owner.isImplClass) {
- // the reference to super class got lost during erasure
- restrictionError(tree.pos, unit, "traits may not select fields or methods from to super[C] where C is a class")
- } else {
- error(tree.pos, mix+" does not name a parent class of "+clazz)
- }
- ErrorType
- } else if (!ps.tail.isEmpty) {
- error(tree.pos, "ambiguous parent class qualifier")
- ErrorType
+ def typedSuper(qual: Tree, mix: TypeName) = {
+ val qual1 = typed(qual)
+ val clazz = qual1.symbol
+
+ def findMixinSuper(site: Type): Type = {
+ var ps = site.parents filter (_.typeSymbol.name == mix)
+ if (ps.isEmpty)
+ ps = site.parents filter (_.typeSymbol.toInterface.name == mix)
+ if (ps.isEmpty) {
+ if (settings.debug.value)
+ Console.println(site.parents map (_.typeSymbol.name))//debug
+ if (phase.erasedTypes && context.enclClass.owner.isImplClass) {
+ // the reference to super class got lost during erasure
+ restrictionError(tree.pos, unit, "traits may not select fields or methods from super[C] where C is a class")
} else {
- ps.head
+ error(tree.pos, mix+" does not name a parent class of "+clazz)
}
+ ErrorType
+ } else if (!ps.tail.isEmpty) {
+ error(tree.pos, "ambiguous parent class qualifier")
+ ErrorType
+ } else {
+ ps.head
}
- val owntype =
- if (mix.isEmpty) {
- if ((mode & SUPERCONSTRmode) != 0)
- if (clazz.info.parents.isEmpty) AnyRefClass.tpe // can happen due to cyclic references ==> #1036
- else clazz.info.parents.head
- else intersectionType(clazz.info.parents)
- } else {
- findMixinSuper(clazz.info)
- }
- tree setSymbol clazz setType SuperType(clazz.thisType, owntype)
}
- }
+
+ val owntype =
+ if (mix.isEmpty) {
+ if ((mode & SUPERCONSTRmode) != 0)
+ if (clazz.info.parents.isEmpty) AnyRefClass.tpe // can happen due to cyclic references ==> #1036
+ else clazz.info.parents.head
+ else intersectionType(clazz.info.parents)
+ } else {
+ findMixinSuper(clazz.info)
+ }
+
+ treeCopy.Super(tree, qual1, mix) setType SuperType(clazz.thisType, owntype)
+ }
def typedThis(qual: Name) = {
val clazz = qualifyingClassSym(qual)
@@ -3609,11 +3612,11 @@ trait Typers extends Modes {
}
else {
cx = cx.enclClass
- defSym = pre.member(name) filter (
- sym => qualifies(sym) && context.isAccessible(sym, pre, false))
+ val foundSym = pre.member(name) filter qualifies
+ defSym = foundSym filter (context.isAccessible(_, pre, false))
if (defSym == NoSymbol) {
- if (inaccessibleSym eq NoSymbol) {
- inaccessibleSym = pre.member(name) filter qualifies
+ if ((foundSym ne NoSymbol) && (inaccessibleSym eq NoSymbol)) {
+ inaccessibleSym = foundSym
inaccessibleExplanation = analyzer.lastAccessCheckDetails
}
cx = cx.outer
View
18 src/library/scala/collection/JavaConversions.scala
@@ -560,10 +560,10 @@ object JavaConversions {
case class IteratorWrapper[A](underlying : Iterator[A]) extends ju.Iterator[A] with ju.Enumeration[A] {
def hasNext = underlying.hasNext
- def next = underlying.next
+ def next() = underlying.next
def hasMoreElements = underlying.hasNext
- def nextElement = underlying.next
- def remove = throw new UnsupportedOperationException
+ def nextElement() = underlying.next
+ def remove() = throw new UnsupportedOperationException
}
class ToIteratorWrapper[A](underlying : Iterator[A]) {
@@ -572,12 +572,12 @@ object JavaConversions {
case class JIteratorWrapper[A](underlying : ju.Iterator[A]) extends Iterator[A] {
def hasNext = underlying.hasNext
- def next = underlying.next
+ def next() = underlying.next
}
case class JEnumerationWrapper[A](underlying : ju.Enumeration[A]) extends Iterator[A] {
def hasNext = underlying.hasMoreElements
- def next = underlying.nextElement
+ def next() = underlying.nextElement
}
case class IterableWrapper[A](underlying : Iterable[A])
@@ -696,7 +696,7 @@ object JavaConversions {
def hasNext = ui.hasNext
- def next = {
+ def next() = {
val (k, v) = ui.next
prev = Some(k)
new ju.Map.Entry[A, B] {
@@ -711,7 +711,7 @@ object JavaConversions {
}
}
- def remove = prev match {
+ def remove() = prev match {
case Some(k) =>
underlying match {
case mm: mutable.Map[a, _] =>
@@ -781,7 +781,7 @@ object JavaConversions {
def iterator = new Iterator[(A, B)] {
val ui = underlying.entrySet.iterator
def hasNext = ui.hasNext
- def next = { val e = ui.next ; (e.getKey, e.getValue) }
+ def next() = { val e = ui.next ; (e.getKey, e.getValue) }
}
override def clear() = underlying.clear()
@@ -930,7 +930,7 @@ object JavaConversions {
def iterator = new Iterator[(String, String)] {
val ui = underlying.entrySet.iterator
def hasNext = ui.hasNext
- def next = { val e = ui.next ; (e.getKey.asInstanceOf[String], e.getValue.asInstanceOf[String]) }
+ def next() = { val e = ui.next ; (e.getKey.asInstanceOf[String], e.getValue.asInstanceOf[String]) }
}
override def clear() = underlying.clear()
View
4 src/library/scala/collection/MapLike.scala
@@ -174,7 +174,7 @@ self =>
def keysIterator: Iterator[A] = new Iterator[A] {
val iter = self.iterator
def hasNext = iter.hasNext
- def next = iter.next._1
+ def next() = iter.next._1
}
/** Creates an iterator for all keys.
@@ -205,7 +205,7 @@ self =>
def valuesIterator: Iterator[B] = new Iterator[B] {
val iter = self.iterator
def hasNext = iter.hasNext
- def next = iter.next._2
+ def next() = iter.next._2
}
/** Defines the default value computation for the map,
View
6 src/library/scala/collection/generic/Signalling.scala
@@ -44,7 +44,7 @@ trait Signalling {
*
* $abortflag
*/
- def abort: Unit
+ def abort(): Unit
/**
* Returns the value of the index flag.
@@ -113,7 +113,7 @@ object IdleSignalling extends DefaultSignalling
trait VolatileAbort extends Signalling {
@volatile private var abortflag = false
override def isAborted = abortflag
- override def abort = abortflag = true
+ override def abort() = abortflag = true
}
@@ -155,7 +155,7 @@ trait DelegatedSignalling extends Signalling {
var signalDelegate: Signalling
def isAborted = signalDelegate.isAborted
- def abort = signalDelegate.abort
+ def abort() = signalDelegate.abort
def indexFlag = signalDelegate.indexFlag
def setIndexFlag(f: Int) = signalDelegate.setIndexFlag(f)
View
4 src/library/scala/collection/immutable/LongMap.scala
@@ -84,7 +84,7 @@ private[immutable] abstract class LongMapIterator[V, T](it : LongMap[V]) extends
var index = 0;
var buffer = new Array[AnyRef](65);
- def pop = {
+ def pop() = {
index -= 1;
buffer(index).asInstanceOf[LongMap[V]];
}
@@ -102,7 +102,7 @@ private[immutable] abstract class LongMapIterator[V, T](it : LongMap[V]) extends
def hasNext = index != 0;
final def next : T =
- pop match {
+ pop() match {
case LongMap.Bin(_,_, t@LongMap.Tip(_, _), right) => {
push(right);
valueOf(t);
View
8 src/library/scala/collection/mutable/ArrayStack.scala
@@ -113,7 +113,7 @@ extends Seq[T]
*
* @return the element on top of the stack
*/
- def pop: T = {
+ def pop(): T = {
if (index == 0) sys.error("Stack empty")
index -= 1
val x = table(index).asInstanceOf[T]
@@ -140,7 +140,7 @@ extends Seq[T]
* the top equal to the element that was previously at the top.
* If the stack is empty, an exception is thrown.
*/
- def dup = push(top)
+ def dup() = push(top)
/** Empties the stack. */
def clear {
@@ -215,7 +215,7 @@ extends Seq[T]
def iterator: Iterator[T] = new Iterator[T] {
var currentIndex = index
def hasNext = currentIndex > 0
- def next = {
+ def next() = {
currentIndex -= 1
table(currentIndex).asInstanceOf[T]
}
@@ -229,5 +229,5 @@ extends Seq[T]
}
}
- override def clone = new ArrayStack[T](ArrayStack.clone(table), index)
+ override def clone() = new ArrayStack[T](ArrayStack.clone(table), index)
}
View
2 src/library/scala/collection/mutable/FlatHashTable.scala
@@ -270,7 +270,7 @@ trait FlatHashTable[A] extends FlatHashTable.HashUtils[A] {
println(sizemap.toList)
}
- protected def sizeMapDisable = sizemap = null
+ protected def sizeMapDisable() = sizemap = null
protected def isSizeMapDefined = sizemap ne null
View
4 src/library/scala/collection/mutable/HashMap.scala
@@ -106,14 +106,14 @@ extends Map[A, B]
override def keysIterator: Iterator[A] = new Iterator[A] {
val iter = entriesIterator
def hasNext = iter.hasNext
- def next = iter.next.key
+ def next() = iter.next.key
}
/* Override to avoid tuple allocation */
override def valuesIterator: Iterator[B] = new Iterator[B] {
val iter = entriesIterator
def hasNext = iter.hasNext
- def next = iter.next.value
+ def next() = iter.next.value
}
/** Toggles whether a size map is used to track hash map statistics.
View
4 src/library/scala/collection/mutable/HashTable.scala
@@ -160,7 +160,7 @@ trait HashTable[A, Entry >: Null <: HashEntry[A, Entry]] extends HashTable.HashU
var es = iterTable(idx).asInstanceOf[Entry]
scan()
def hasNext = es != null
- def next = {
+ def next() = {
val res = es
es = es.next
scan()
@@ -295,7 +295,7 @@ trait HashTable[A, Entry >: Null <: HashEntry[A, Entry]] extends HashTable.HashU
println(sizemap.toList)
}
- protected def sizeMapDisable = sizemap = null
+ protected def sizeMapDisable() = sizemap = null
protected def isSizeMapDefined = sizemap ne null
View
6 src/library/scala/collection/parallel/Tasks.scala
@@ -164,7 +164,7 @@ trait AdaptiveWorkStealingTasks extends Tasks {
def compute = if (body.shouldSplitFurther) internal else body.tryLeaf(None)
def internal = {
- var last = spawnSubtasks
+ var last = spawnSubtasks()
last.body.tryLeaf(None)
body.result = last.body.result
@@ -187,7 +187,7 @@ trait AdaptiveWorkStealingTasks extends Tasks {
}
}
- def spawnSubtasks = {
+ def spawnSubtasks() = {
var last: TaskImpl[R, Tp] = null
var head: TaskImpl[R, Tp] = this
do {
@@ -203,7 +203,7 @@ trait AdaptiveWorkStealingTasks extends Tasks {
head
}
- def printChain = {
+ def printChain() = {
var curr = this
var chain = "chain: "
while (curr != null) {
View
6 src/library/scala/collection/parallel/mutable/ParFlatHashTable.scala
@@ -43,15 +43,15 @@ trait ParFlatHashTable[T] extends collection.mutable.FlatHashTable[T] {
}
}
- private def checkbounds = if (idx >= itertable.length) {
+ private def checkbounds() = if (idx >= itertable.length) {
throw new IndexOutOfBoundsException(idx.toString)
}
def newIterator(index: Int, until: Int, totalsize: Int): ParIterableIterator[T]
def remaining = totalsize - traversed
def hasNext = traversed < totalsize
- def next = if (hasNext) {
+ def next() = if (hasNext) {
val r = itertable(idx).asInstanceOf[T]
traversed += 1
idx += 1
@@ -108,7 +108,7 @@ trait ParFlatHashTable[T] extends collection.mutable.FlatHashTable[T] {
count
}
- private def check = if (table.slice(idx, until).count(_ != null) != remaining) {
+ private def check() = if (table.slice(idx, until).count(_ != null) != remaining) {
println("Invariant broken: " + debugInformation)
assert(false)
}
View
8 src/library/scala/reflect/generic/Trees.scala
@@ -409,11 +409,13 @@ trait Trees { self: Universe =>
extends TermTree with SymTree
// The symbol of an ApplyDynamic is the function symbol of `qual', or NoSymbol, if there is none.
- /** Super reference */
- case class Super(qual: TypeName, mix: TypeName)
- extends TermTree with SymTree
+ /** Super reference, qual = corresponding this reference */
+ case class Super(qual: Tree, mix: TypeName) extends TermTree {
// The symbol of a Super is the class _from_ which the super reference is made.
// For instance in C.super(...), it would be C.
+ override def symbol: Symbol = qual.symbol
+ override def symbol_=(sym: Symbol) { qual.symbol = sym }
+ }
/** Self reference */
case class This(qual: TypeName)
View
2 src/library/scala/reflect/generic/UnPickler.scala
@@ -674,7 +674,7 @@ abstract class UnPickler {
case SUPERtree =>
setSym()
- val qual = readTypeNameRef()
+ val qual = readTreeRef()
val mix = readTypeNameRef()
Super(qual, mix)
View
2 test/files/neg/t0117.check
@@ -1,4 +1,4 @@
-t0117.scala:2: error: Implementation restriction: traits may not select fields or methods from to super[C] where C is a class
+t0117.scala:2: error: Implementation restriction: traits may not select fields or methods from super[C] where C is a class
trait B extends A { println(super[A].a) }
^
one error found

0 comments on commit 13c59ad

Please sign in to comment.