From 08a42368c0931dea170b7320cc1bc5389a275548 Mon Sep 17 00:00:00 2001 From: michelou Date: Mon, 23 Jul 2007 12:19:46 +0000 Subject: removed some more type aliases --- src/actors/scala/actors/Actor.scala | 6 +- src/actors/scala/actors/Future.scala | 4 +- src/actors/scala/actors/remote/RemoteActor.scala | 4 +- src/actors/scala/actors/remote/TcpService.scala | 2 +- src/compiler/scala/tools/nsc/ast/Trees.scala | 3 +- .../scala/tools/nsc/ast/parser/Parsers.scala | 2 +- .../tools/nsc/ast/parser/SyntaxAnalyzer.scala | 4 +- src/compiler/scala/tools/nsc/doc/ModelFrames.scala | 4 +- src/compiler/scala/tools/nsc/io/SourceReader.scala | 8 ++- .../scala/tools/nsc/matching/PatternNodes.scala | 55 +++++++++------- .../scala/tools/nsc/symtab/Definitions.scala | 2 +- .../scala/tools/nsc/symtab/InfoTransformers.scala | 4 +- .../scala/tools/nsc/symtab/SymbolLoaders.scala | 10 +-- .../nsc/symtab/classfile/SymblfileParser.scala | 4 +- .../tools/nsc/symtab/classfile/UnPickler.scala | 2 +- .../scala/tools/nsc/transform/Erasure.scala | 18 +++--- .../scala/tools/nsc/transform/ExplicitOuter.scala | 11 ++-- .../scala/tools/nsc/transform/Flatten.scala | 5 +- .../scala/tools/nsc/transform/LambdaLift.scala | 26 ++++---- src/compiler/scala/tools/nsc/transform/Mixin.scala | 19 +++--- .../tools/nsc/transform/OverridingPairs.scala | 5 +- .../scala/tools/nsc/transform/UnCurry.scala | 4 +- .../scala/tools/nsc/typechecker/Contexts.scala | 60 +++++++++--------- .../scala/tools/nsc/typechecker/Infer.scala | 74 +++++++++++----------- .../scala/tools/nsc/typechecker/Namers.scala | 28 ++++---- .../scala/tools/nsc/typechecker/RefChecks.scala | 64 ++++++++++--------- .../tools/nsc/typechecker/SyntheticMethods.scala | 4 +- .../scala/tools/nsc/typechecker/TreeCheckers.scala | 2 +- src/library/scala/concurrent/pilib.scala | 8 +-- 29 files changed, 237 insertions(+), 205 deletions(-) diff --git a/src/actors/scala/actors/Actor.scala b/src/actors/scala/actors/Actor.scala index 314cd2f322..a7e5f123be 100644 --- a/src/actors/scala/actors/Actor.scala +++ b/src/actors/scala/actors/Actor.scala @@ -603,11 +603,11 @@ trait Actor extends OutputChannel[Any] { private def tick(): Unit = Scheduler tick this - private[actors] var kill: () => unit = () => {} + private[actors] var kill: () => Unit = () => {} private def suspendActor() { isWaiting = true - while(isWaiting) { + while (isWaiting) { try { wait() } catch { @@ -623,7 +623,7 @@ trait Actor extends OutputChannel[Any] { var waittime = msec var fromExc = false isWaiting = true - while(isWaiting) { + while (isWaiting) { try { fromExc = false wait(waittime) diff --git a/src/actors/scala/actors/Future.scala b/src/actors/scala/actors/Future.scala index aeb8662d38..1ba81e5c43 100644 --- a/src/actors/scala/actors/Future.scala +++ b/src/actors/scala/actors/Future.scala @@ -91,12 +91,12 @@ object Futures { }) def awaitWith(partFuns: Seq[PartialFunction[Any, Pair[Int, Any]]]) { - val reaction: PartialFunction[Any, unit] = new PartialFunction[Any, unit] { + val reaction: PartialFunction[Any, Unit] = new PartialFunction[Any, Unit] { def isDefinedAt(msg: Any) = msg match { case TIMEOUT => true case _ => partFuns exists (_ isDefinedAt msg) } - def apply(msg: Any): unit = msg match { + def apply(msg: Any): Unit = msg match { case TIMEOUT => // do nothing case _ => { val pfOpt = partFuns find (_ isDefinedAt msg) diff --git a/src/actors/scala/actors/remote/RemoteActor.scala b/src/actors/scala/actors/remote/RemoteActor.scala index 8e4bdfab90..4a69da6911 100644 --- a/src/actors/scala/actors/remote/RemoteActor.scala +++ b/src/actors/scala/actors/remote/RemoteActor.scala @@ -49,7 +49,7 @@ object RemoteActor { * Makes self remotely accessible on TCP port * port. */ - def alive(port: int): unit = synchronized { + def alive(port: int): Unit = synchronized { val serv = new TcpService(port) serv.start() kernels += Actor.self -> serv.kernel @@ -59,7 +59,7 @@ object RemoteActor { * Registers a under name on this * node. */ - def register(name: Symbol, a: Actor): unit = synchronized { + def register(name: Symbol, a: Actor): Unit = synchronized { val kernel = kernels.get(Actor.self) match { case None => val serv = new TcpService(TcpService.generatePort) diff --git a/src/actors/scala/actors/remote/TcpService.scala b/src/actors/scala/actors/remote/TcpService.scala index d0944c3554..e40384749b 100644 --- a/src/actors/scala/actors/remote/TcpService.scala +++ b/src/actors/scala/actors/remote/TcpService.scala @@ -68,7 +68,7 @@ class TcpService(port: Int) extends Thread with Service { * If the node is not yet up, up to TcpService.BufSize * messages are buffered. */ - def send(node: Node, data: Array[byte]): unit = synchronized { + def send(node: Node, data: Array[byte]): Unit = synchronized { def bufferMsg(t: Throwable) = { // buffer message, so that it can be re-sent diff --git a/src/compiler/scala/tools/nsc/ast/Trees.scala b/src/compiler/scala/tools/nsc/ast/Trees.scala index ba95255739..d6d1033916 100644 --- a/src/compiler/scala/tools/nsc/ast/Trees.scala +++ b/src/compiler/scala/tools/nsc/ast/Trees.scala @@ -87,8 +87,9 @@ trait Trees { } def symbol: Symbol = null - def symbol_=(sym: Symbol): unit = + def symbol_=(sym: Symbol) { throw new Error("symbol_= inapplicable for " + this) + } def setSymbol(sym: Symbol): this.type = { symbol = sym; this } def hasSymbol = false diff --git a/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala b/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala index cf1e543370..c0cefd5347 100644 --- a/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala +++ b/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala @@ -789,7 +789,7 @@ trait Parsers { (t /: annots) (makeAnnotated) } - def annotTypeRest(pos: ScanPosition, isPattern: boolean, t: Tree): Tree = + def annotTypeRest(pos: ScanPosition, isPattern: Boolean, t: Tree): Tree = if (inToken == HASH) annotTypeRest(pos, isPattern, atPos(inSkipToken) { SelectFromTypeTree(t, ident().toTypeName) }) else if (inToken == LBRACKET) diff --git a/src/compiler/scala/tools/nsc/ast/parser/SyntaxAnalyzer.scala b/src/compiler/scala/tools/nsc/ast/parser/SyntaxAnalyzer.scala index 7d5c95cb71..7d2e51b240 100644 --- a/src/compiler/scala/tools/nsc/ast/parser/SyntaxAnalyzer.scala +++ b/src/compiler/scala/tools/nsc/ast/parser/SyntaxAnalyzer.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2006 LAMP/EPFL + * Copyright 2005-2007 LAMP/EPFL * @author Martin Odersky */ // $Id$ @@ -15,7 +15,7 @@ abstract class SyntaxAnalyzer extends SubComponent with Parsers with MarkupParse def newPhase(prev: Phase): StdPhase = new ParserPhase(prev) class ParserPhase(prev: scala.tools.nsc.Phase) extends StdPhase(prev) { - def apply(unit: global.CompilationUnit): unit = { + def apply(unit: global.CompilationUnit) { global.informProgress("parsing " + unit) unit.body = new UnitParser(unit).parse() } diff --git a/src/compiler/scala/tools/nsc/doc/ModelFrames.scala b/src/compiler/scala/tools/nsc/doc/ModelFrames.scala index c3f6f8b3a3..d2b86c3bd6 100644 --- a/src/compiler/scala/tools/nsc/doc/ModelFrames.scala +++ b/src/compiler/scala/tools/nsc/doc/ModelFrames.scala @@ -363,7 +363,7 @@ trait ModelFrames extends ModelExtractor { val pos = path lastIndexOf System.getProperty("file.separator", "/") if (pos != -1) path.substring(pos + 1) else path } - def copyResource(name: String, isFile: boolean) = try { + def copyResource(name: String, isFile: Boolean) = try { val (in, outfile) = if (isFile) (new FileInputStream(name), basename(name)) @@ -372,7 +372,7 @@ trait ModelFrames extends ModelExtractor { (loader.getResourceAsStream("scala/tools/nsc/doc/" + name), name) } val out = new FileOutputStream(new File(outdir + File.separator + outfile)) - val buf = new Array[byte](1024) + val buf = new Array[Byte](1024) var len = 0 while (len != -1) { out.write(buf, 0, len) diff --git a/src/compiler/scala/tools/nsc/io/SourceReader.scala b/src/compiler/scala/tools/nsc/io/SourceReader.scala index 2ea7ec4afe..5f549c4a0e 100644 --- a/src/compiler/scala/tools/nsc/io/SourceReader.scala +++ b/src/compiler/scala/tools/nsc/io/SourceReader.scala @@ -58,11 +58,13 @@ class SourceReader(decoder: CharsetDecoder) { */ def read(file: AbstractFile): Array[Char] = { file match { - case p:PlainFile => read(p.file) // bq: (!!!) + case p:PlainFile => + read(p.file) // bq: (!!!) case z:ZipArchive#FileEntry => val c = Channels.newChannel(z.getArchive.getInputStream(z.entry)) read(c) - case _ => throw new IOException(file.toString()+" is neither plain file nor ZipArchive#FileEntry") + case _ => + throw new IOException(file.toString()+" is neither plain file nor ZipArchive#FileEntry") } /* val decoder: CharsetDecoder = this.decoder.reset(); @@ -119,7 +121,7 @@ object SourceReader { * chunk of the input file. */ def decode(decoder: CharsetDecoder, bytes: ByteBuffer, chars: CharBuffer, - endOfInput: boolean): CharBuffer = + endOfInput: Boolean): CharBuffer = { val result: CoderResult = decoder.decode(bytes, chars, endOfInput) if (result.isUnderflow()) { diff --git a/src/compiler/scala/tools/nsc/matching/PatternNodes.scala b/src/compiler/scala/tools/nsc/matching/PatternNodes.scala index cf9ed50be4..56bd401a46 100644 --- a/src/compiler/scala/tools/nsc/matching/PatternNodes.scala +++ b/src/compiler/scala/tools/nsc/matching/PatternNodes.scala @@ -1,14 +1,16 @@ /* NSC -- new Scala compiler - * Copyright 2005-2006 LAMP/EPFL + * Copyright 2005-2007 LAMP/EPFL * @author Burak Emir */ // $Id$ package scala.tools.nsc.matching -import compat.StringBuilder import scala.tools.nsc.util.{Position, NoPosition} +/** + * @author Burak Emir + */ trait PatternNodes { self: transform.ExplicitOuter => import global._ @@ -17,9 +19,11 @@ trait PatternNodes { self: transform.ExplicitOuter => /** returns the child patterns of a pattern */ - protected def patternArgs(tree: Tree): List[Tree] = { //Console.println("patternArgs "+tree.toString()) + protected def patternArgs(tree: Tree): List[Tree] = { + //Console.println("patternArgs "+tree.toString()) /*val res = */ tree match { - case Bind(_, pat) => patternArgs(pat) + case Bind(_, pat) => + patternArgs(pat) case a @ Apply(_, List(av @ ArrayValue(_, ts))) if isSeqApply(a) && isRightIgnoring(av) => ts.reverse.drop(1).reverse @@ -27,16 +31,20 @@ trait PatternNodes { self: transform.ExplicitOuter => case a @ Apply(_, List(av @ ArrayValue(_, ts))) if isSeqApply(a) => ts - case a @ Apply(_, args) => args + case a @ Apply(_, args) => + args - case a @ UnApply(_, args) => args + case a @ UnApply(_, args) => + args case av @ ArrayValue(_, ts) if isRightIgnoring(av) => ts.reverse.drop(1).reverse - case av @ ArrayValue(_, ts) => ts + case av @ ArrayValue(_, ts) => + ts - case _ => List() + case _ => + List() } //Console.println("patternArgs returns "+res.toString()) ; res } @@ -55,7 +63,7 @@ trait PatternNodes { self: transform.ExplicitOuter => def forEachAlternative(f: PatternNode => Unit) { // only for header? var z = this; - while(z ne null) { + while (z ne null) { f(z) z = z.or } @@ -79,7 +87,10 @@ trait PatternNodes { self: transform.ExplicitOuter => null } - def set(p:(Position,Type)): this.type = { /*assert(tpe ne null); */ this.pos = p._1; this.tpe = p._2; this } + def set(p:(Position,Type)): this.type = { + /*assert(tpe ne null); */ + this.pos = p._1; this.tpe = p._2; this + } def dup(): PatternNode = { var res: PatternNode = this match { @@ -128,7 +139,7 @@ trait PatternNodes { self: transform.ExplicitOuter => case _ => null } - def isDefaultPat(): boolean = this match { + def isDefaultPat(): Boolean = this match { case DefaultPat() => true case _ => false } @@ -137,7 +148,7 @@ trait PatternNodes { self: transform.ExplicitOuter => * p and q are equal (constructor | sequence) type tests, or * "q matches" => "p matches" */ - def isSameAs(q: PatternNode): boolean = this match { + def isSameAs(q: PatternNode): Boolean = this match { case ConstrPat(_) => q match { case ConstrPat(_) => @@ -237,7 +248,7 @@ trait PatternNodes { self: transform.ExplicitOuter => sb.setCharAt(indent.length() - 1, ' ') var i = 0; while (i < s.length()) { sb.append(' ') - i = i + 1 + i += 1 } sb.toString() } @@ -333,11 +344,11 @@ trait PatternNodes { self: transform.ExplicitOuter => } def findLastSection: Header = { - var h: Header = this; + var h: Header = this while(h.next != null) { h = h.next } h } - var isSubHeader = false; + var isSubHeader = false /* returns true if this header node has a catch all case @@ -384,7 +395,7 @@ trait PatternNodes { self: transform.ExplicitOuter => var res = true var coveredCases: SymSet = emptySymbolSet var remainingCases = checkExCoverage(selType.typeSymbol) - var cases = 0; + var cases = 0 def traverse(alts:PatternNode) { //Console.println("traverse, alts="+alts) @@ -480,7 +491,7 @@ trait PatternNodes { self: transform.ExplicitOuter => case class ConstantPat(value: Any /*AConstant*/) extends PatternNode case class VariablePat(tree: Tree) extends PatternNode case class AltPat(subheader: Header) extends PatternNode - case class SequencePat(override val casted: Symbol, len: int) extends PatternNode // only used in PatternMatcher + case class SequencePat(override val casted: Symbol, len: Int) extends PatternNode // only used in PatternMatcher case class RightIgnoringSequencePat(override val casted: Symbol, castedRest: Symbol, minlen: int) extends PatternNode //PM @@ -492,17 +503,17 @@ trait PatternNodes { self: transform.ExplicitOuter => private var boundVars: Array[ValDef] = new Array[ValDef](4) private var numVars = 0 - def substitute(oldSym: Symbol, newInit: Tree): Unit = { + def substitute(oldSym: Symbol, newInit: Tree) { var i = 0; while (i < numVars) { if (boundVars(i).rhs.symbol == oldSym) { boundVars(i) = ValDef(boundVars(i).symbol, newInit) return } - i = i + 1 + i += 1 } } - def newBoundVar(sym: Symbol, tpe: Type, init: Tree): Unit = { + def newBoundVar(sym: Symbol, tpe: Type, init: Tree) { //if(sym == Symbol.NoSymbol ) { // scala.Predef.Error("can't add variable with NoSymbol"); //} @@ -515,7 +526,7 @@ trait PatternNodes { self: transform.ExplicitOuter => } sym.setInfo(tpe) this.boundVars(numVars) = ValDef(sym, init.duplicate) - numVars = numVars + 1 + numVars += 1 } def getBoundVars(): Array[ValDef] = { @@ -535,7 +546,7 @@ trait PatternNodes { self: transform.ExplicitOuter => !isSameType(boundVars(i).tpe, env.boundVars(i).tpe) || (boundVars(i).rhs != env.boundVars(i).rhs)) return false - i = i + 1 + i += 1 } true } diff --git a/src/compiler/scala/tools/nsc/symtab/Definitions.scala b/src/compiler/scala/tools/nsc/symtab/Definitions.scala index e1da275a2f..900775c5d3 100644 --- a/src/compiler/scala/tools/nsc/symtab/Definitions.scala +++ b/src/compiler/scala/tools/nsc/symtab/Definitions.scala @@ -302,7 +302,7 @@ trait Definitions { val sym = FunctionClass(formals.length) typeRef(sym.typeConstructor.prefix, sym, formals ::: List(restpe)) } else NoType; - def isFunctionType(tp: Type): boolean = tp.normalize match { + def isFunctionType(tp: Type): Boolean = tp.normalize match { case TypeRef(_, sym, args) => (args.length > 0) && (args.length - 1 <= MaxFunctionArity) && (sym == FunctionClass(args.length - 1)) diff --git a/src/compiler/scala/tools/nsc/symtab/InfoTransformers.scala b/src/compiler/scala/tools/nsc/symtab/InfoTransformers.scala index c6d5c0891a..9756ddd576 100644 --- a/src/compiler/scala/tools/nsc/symtab/InfoTransformers.scala +++ b/src/compiler/scala/tools/nsc/symtab/InfoTransformers.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2006 LAMP/EPFL + * Copyright 2005-2007 LAMP/EPFL * @author Martin Odersky */ // $Id$ @@ -17,7 +17,7 @@ trait InfoTransformers { val changesBaseClasses: Boolean def transform(sym: Symbol, tpe: Type): Type - def insert(that: InfoTransformer): unit = { + def insert(that: InfoTransformer) { assert(this.pid != that.pid) if (that.pid < this.pid) { prev insert that diff --git a/src/compiler/scala/tools/nsc/symtab/SymbolLoaders.scala b/src/compiler/scala/tools/nsc/symtab/SymbolLoaders.scala index 8019cc7840..450695b80e 100644 --- a/src/compiler/scala/tools/nsc/symtab/SymbolLoaders.scala +++ b/src/compiler/scala/tools/nsc/symtab/SymbolLoaders.scala @@ -6,14 +6,16 @@ package scala.tools.nsc.symtab -import compat.Platform.currentTime import java.io.{File, IOException} + +import ch.epfl.lamp.compiler.msil.{Type => MSILType, Attribute => MSILAttribute} + import scala.collection.mutable.{HashMap, HashSet} +import scala.compat.Platform.currentTime import scala.tools.nsc.io.AbstractFile import scala.tools.nsc.util.{Position, NoPosition} import classfile.ClassfileParser import Flags._ -import ch.epfl.lamp.compiler.msil.{Type => MSILType, Attribute => MSILAttribute} /** This class ... * @@ -200,7 +202,7 @@ abstract class SymbolLoaders { override def newPackageLoader(dir: global.classPath0.Context): PackageLoader = new NamespaceLoader(dir) - val types = new HashMap[String,MSILType]() + val types = new HashMap[String, MSILType]() val namespaces = new HashSet[String]() @@ -268,7 +270,7 @@ abstract class SymbolLoaders { } /* class SymblfileLoader(file: AbstractFile) extends SymbolLoader(file) { - protected def doComplete(root: Symbol): unit = symblfileParser.parse(file, root); + protected def doComplete(root: Symbol) { symblfileParser.parse(file, root) } protected def kindString: String = "symbl file"; } */ diff --git a/src/compiler/scala/tools/nsc/symtab/classfile/SymblfileParser.scala b/src/compiler/scala/tools/nsc/symtab/classfile/SymblfileParser.scala index 99d64a3018..485496b283 100644 --- a/src/compiler/scala/tools/nsc/symtab/classfile/SymblfileParser.scala +++ b/src/compiler/scala/tools/nsc/symtab/classfile/SymblfileParser.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2006 LAMP/EPFL + * Copyright 2005-2007 LAMP/EPFL * @author Martin Odersky */ // $Id$ @@ -24,7 +24,7 @@ abstract class SymblfileParser { val global: SymblfileParser.this.global.type = SymblfileParser.this.global } - def parse(file: AbstractFile, root: Symbol): unit = { + def parse(file: AbstractFile, root: Symbol) { assert(current eq null, current) current = file val bytes = new AbstractFileReader(file).buf diff --git a/src/compiler/scala/tools/nsc/symtab/classfile/UnPickler.scala b/src/compiler/scala/tools/nsc/symtab/classfile/UnPickler.scala index d707e89fe1..b140da032c 100644 --- a/src/compiler/scala/tools/nsc/symtab/classfile/UnPickler.scala +++ b/src/compiler/scala/tools/nsc/symtab/classfile/UnPickler.scala @@ -72,7 +72,7 @@ abstract class UnPickler { } /** Does entry represent an (internal) symbol */ - private def isSymbolEntry(i: Int): boolean = { + private def isSymbolEntry(i: Int): Boolean = { val tag = bytes(index(i)) % PosOffset (firstSymTag <= tag && tag <= lastSymTag && (tag != CLASSsym || !isRefinementSymbolEntry(i))) diff --git a/src/compiler/scala/tools/nsc/transform/Erasure.scala b/src/compiler/scala/tools/nsc/transform/Erasure.scala index b1e3f77994..09cfa4a627 100644 --- a/src/compiler/scala/tools/nsc/transform/Erasure.scala +++ b/src/compiler/scala/tools/nsc/transform/Erasure.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2006 LAMP/EPFL + * Copyright 2005-2007 LAMP/EPFL * @author Martin Odersky */ // $Id$ @@ -551,10 +551,10 @@ abstract class Erasure extends AddInterfaces with typechecker.Analyzer { * * */ - private def checkNoDoubleDefs(root: Symbol): unit = { - def doubleDefError(sym1: Symbol, sym2: Symbol): unit = { - val tpe1 = atPhase(currentRun.refchecksPhase.next)(root.thisType.memberType(sym1)); - val tpe2 = atPhase(currentRun.refchecksPhase.next)(root.thisType.memberType(sym2)); + private def checkNoDoubleDefs(root: Symbol) { + def doubleDefError(sym1: Symbol, sym2: Symbol) { + val tpe1 = atPhase(currentRun.refchecksPhase.next)(root.thisType.memberType(sym1)) + val tpe2 = atPhase(currentRun.refchecksPhase.next)(root.thisType.memberType(sym2)) unit.error( if (sym1.owner == root) sym1.pos else root.pos, (if (sym1.owner == sym2.owner) "double definition:\n" @@ -583,9 +583,9 @@ abstract class Erasure extends AddInterfaces with typechecker.Analyzer { } val opc = new overridingPairs.Cursor(root) { - override def exclude(sym: Symbol): boolean = + override def exclude(sym: Symbol): Boolean = !sym.isTerm || (sym hasFlag (PRIVATE | BRIDGE)) || super.exclude(sym) - override def matches(sym1: Symbol, sym2: Symbol): boolean = + override def matches(sym1: Symbol, sym2: Symbol): Boolean = atPhase(phase.next)(sym1.tpe =:= sym2.tpe) } while (opc.hasNext) { @@ -647,7 +647,7 @@ abstract class Erasure extends AddInterfaces with typechecker.Analyzer { val opc = atPhase(currentRun.explicitOuterPhase) { new overridingPairs.Cursor(owner) { override def parents: List[Type] = List(owner.info.parents.head) - override def exclude(sym: Symbol): boolean = + override def exclude(sym: Symbol): Boolean = !sym.isMethod || (sym hasFlag (PRIVATE | BRIDGE)) || super.exclude(sym) } } @@ -764,7 +764,7 @@ abstract class Erasure extends AddInterfaces with typechecker.Analyzer { // leave all other type tests/type casts, remove all other type applications fun case Apply(fn, args) => - def isGenericArray(tpe: Type): boolean = erasure(tpe).typeSymbol == BoxedArrayClass + def isGenericArray(tpe: Type): Boolean = erasure(tpe).typeSymbol == BoxedArrayClass if (fn.hasSymbol && fn.symbol.name == nme.arraycopy && fn.symbol.owner.name == nme.System.toTypeName && diff --git a/src/compiler/scala/tools/nsc/transform/ExplicitOuter.scala b/src/compiler/scala/tools/nsc/transform/ExplicitOuter.scala index 5a247a96ac..d0e2bf1eca 100644 --- a/src/compiler/scala/tools/nsc/transform/ExplicitOuter.scala +++ b/src/compiler/scala/tools/nsc/transform/ExplicitOuter.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2006 LAMP/EPFL + * Copyright 2005-2007 LAMP/EPFL * @author Martin Odersky */ // $Id$ @@ -451,16 +451,15 @@ abstract class ExplicitOuter extends InfoTransform with TransMatcher with Patter null } case _ => - val x = super.transform(tree) + val x = super.transform(tree) - if(x.tpe eq null) x else { - x setType transformInfo(currentOwner, x.tpe) - } + if (x.tpe eq null) x + else x setType transformInfo(currentOwner, x.tpe) } } /** The transformation method for whole compilation units */ - override def transformUnit(unit: CompilationUnit): unit = { + override def transformUnit(unit: CompilationUnit) { cunit = unit atPhase(phase.next) { super.transformUnit(unit) } } diff --git a/src/compiler/scala/tools/nsc/transform/Flatten.scala b/src/compiler/scala/tools/nsc/transform/Flatten.scala index 1c538dcbf6..b66be5d98c 100644 --- a/src/compiler/scala/tools/nsc/transform/Flatten.scala +++ b/src/compiler/scala/tools/nsc/transform/Flatten.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2006 LAMP/EPFL + * Copyright 2005-2007 LAMP/EPFL * @author Martin Odersky */ // $Id$ @@ -18,7 +18,7 @@ abstract class Flatten extends InfoTransform { /** the following two members override abstract members in Transform */ val phaseName: String = "flatten" - private def liftClass(sym: Symbol): unit = + private def liftClass(sym: Symbol) { if (!(sym hasFlag LIFTED)) { sym setFlag LIFTED atPhase(phase.next) { @@ -30,6 +30,7 @@ abstract class Flatten extends InfoTransform { scope enter sym } } + } private val flattened = new TypeMap { def apply(tp: Type): Type = tp match { diff --git a/src/compiler/scala/tools/nsc/transform/LambdaLift.scala b/src/compiler/scala/tools/nsc/transform/LambdaLift.scala index 9a6ae62539..925f1e8e61 100644 --- a/src/compiler/scala/tools/nsc/transform/LambdaLift.scala +++ b/src/compiler/scala/tools/nsc/transform/LambdaLift.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2006 LAMP/EPFL + * Copyright 2005-2007 LAMP/EPFL * @author */ // $Id$ @@ -57,7 +57,7 @@ abstract class LambdaLift extends InfoTransform { private val renamable = newSymSet /** A flag to indicate whether new free variables have been found */ - private var changedFreeVars: boolean = _ + private var changedFreeVars: Boolean = _ /** Buffers for lifted out classes and methods */ private val liftedDefs = new HashMap[Symbol, ListBuffer[Tree]] @@ -138,7 +138,7 @@ abstract class LambdaLift extends InfoTransform { * } * } */ - private def markFree(sym: Symbol, owner: Symbol): boolean = { + private def markFree(sym: Symbol, owner: Symbol): Boolean = { if (settings.debug.value) log("mark " + sym + " of " + sym.owner + " free in " + owner) if (owner == enclMethOrClass(sym.owner)) true @@ -163,7 +163,7 @@ abstract class LambdaLift extends InfoTransform { } } - private def markCalled(sym: Symbol, owner: Symbol): unit = { + private def markCalled(sym: Symbol, owner: Symbol) { if (settings.debug.value) log("mark " + sym + " of " + sym.owner + " called by " + owner); symSet(called, owner) addEntry sym @@ -188,7 +188,7 @@ abstract class LambdaLift extends InfoTransform { /** The traverse function */ private val freeVarTraverser = new Traverser { - override def traverse(tree: Tree): unit = { + override def traverse(tree: Tree) { try { //debug val sym = tree.symbol; tree match { @@ -232,28 +232,28 @@ abstract class LambdaLift extends InfoTransform { * value/variable/let that are free in some function or class, and to * all class/function symbols that are owned by some function. */ - private def computeFreeVars: unit = { + private def computeFreeVars { freeVarTraverser.traverse(unit.body) do { changedFreeVars = false - for (val caller <- called.keys; - val callee <- called(caller).elements; - val fv <- freeVars(callee)) + for (caller <- called.keys; + callee <- called(caller).elements; + fv <- freeVars(callee)) markFree(fv, caller) } while (changedFreeVars); - for (val sym <- renamable.elements) { + for (sym <- renamable.elements) { sym.name = unit.fresh.newName(sym.name.toString() + "$") if (settings.debug.value) log("renamed: " + sym.name) } atPhase(phase.next) { - for (val owner <- free.keys) { + for (owner <- free.keys) { if (settings.debug.value) log("free(" + owner + owner.locationString + ") = " + free(owner).elements.toList); proxies(owner) = - for (val fv <- free(owner).elements.toList) yield { + for (fv <- free(owner).elements.toList) yield { val proxy = owner.newValue(owner.pos, fv.name) .setFlag(if (owner.isClass) PARAMACCESSOR | PRIVATE | LOCAL else PARAM) .setFlag(SYNTHETIC) @@ -411,7 +411,7 @@ abstract class LambdaLift extends InfoTransform { super.transformStats(stats, exprOwner) map addLifted } - override def transformUnit(unit: CompilationUnit): unit = { + override def transformUnit(unit: CompilationUnit) { computeFreeVars atPhase(phase.next)(super.transformUnit(unit)) assert(liftedDefs.size == 0, liftedDefs.keys.toList) diff --git a/src/compiler/scala/tools/nsc/transform/Mixin.scala b/src/compiler/scala/tools/nsc/transform/Mixin.scala index 7e1984e34e..e4cd3c4f43 100644 --- a/src/compiler/scala/tools/nsc/transform/Mixin.scala +++ b/src/compiler/scala/tools/nsc/transform/Mixin.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2006 LAMP/EPFL + * Copyright 2005-2007 LAMP/EPFL * @author Martin Odersky */ // $Id$ @@ -21,7 +21,7 @@ abstract class Mixin extends InfoTransform { val phaseName: String = "mixin" /** The phase might set the fiollowing new flags: */ - override def phaseNewFlags: long = lateMODULE | notABSTRACT + override def phaseNewFlags: Long = lateMODULE | notABSTRACT /** This map contains a binding (class -> info) if * the class with this info at phase mixinPhase has been treated for mixin composition @@ -130,7 +130,7 @@ abstract class Mixin extends InfoTransform { * * @param clazz ... */ - def addLateInterfaceMembers(clazz: Symbol): unit = + def addLateInterfaceMembers(clazz: Symbol) { if ((treatedClassInfos get clazz) != Some(clazz.info)) { treatedClassInfos(clazz) = clazz.info assert(phase == currentRun.mixinPhase) @@ -169,6 +169,7 @@ abstract class Mixin extends InfoTransform { } if (settings.debug.value) log("new defs of " + clazz + " = " + clazz.info.decls); } + } /** Map a lazy, mixedin field accessor to it's trait member accessor */ val initializer = new HashMap[Symbol, Symbol] @@ -184,7 +185,7 @@ abstract class Mixin extends InfoTransform { * - for every super accessor in T, add an implementation of that accessor * - for every module in T, add a module */ - def addMixedinMembers(clazz: Symbol): unit = { + def addMixedinMembers(clazz: Symbol) { if (!(clazz hasFlag JAVA) && (treatedClassInfos get clazz) != Some(clazz.info)) { treatedClassInfos(clazz) = clazz.info @@ -197,7 +198,7 @@ abstract class Mixin extends InfoTransform { //Console.println("adding members of " + clazz.info.baseClasses.tail.takeWhile(superclazz !=) + " to " + clazz);//DEBUG /** Mix in members of implementation class mixinClass into class clazz */ - def mixinImplClassMembers(impl: Symbol, iface: Symbol): unit = { + def mixinImplClassMembers(impl: Symbol, iface: Symbol) { assert (impl.isImplClass) for (val member <- impl.info.decls.toList) { if (isForwarded(member)) { @@ -218,7 +219,7 @@ abstract class Mixin extends InfoTransform { * for each lazy field in mixinClass, add a link from its mixed in member to it's * initializer method inside the implclass. */ - def mixinTraitMembers(mixinClass: Symbol): unit = { + def mixinTraitMembers(mixinClass: Symbol) { // For all members of a trait's interface do: for (val member <- mixinClass.info.decls.toList) { if ((member hasFlag ACCESSOR) && @@ -451,8 +452,9 @@ abstract class Mixin extends InfoTransform { if (sym.pos == NoPosition) clazz.pos else sym.pos /** Add tree at given position as new definition */ - def addDef(pos: Position, tree: Tree): unit = + def addDef(pos: Position, tree: Tree) { newDefs += attributedDef(pos, tree) + } /** Add new method definition. * @@ -460,8 +462,9 @@ abstract class Mixin extends InfoTransform { * @param rhs A function that maps formal parameters to the method's * right-hand side */ - def addDefDef(sym: Symbol, rhs: List[Symbol] => Tree): unit = + def addDefDef(sym: Symbol, rhs: List[Symbol] => Tree) { addDef(position(sym), DefDef(sym, vparamss => rhs(vparamss.head))) + } /** Add `newdefs' to `stats', removing any abstract method definitions * in stats that are matched by some symbol defined in diff --git a/src/compiler/scala/tools/nsc/transform/OverridingPairs.scala b/src/compiler/scala/tools/nsc/transform/OverridingPairs.scala index e5d5e50a39..865d988cae 100644 --- a/src/compiler/scala/tools/nsc/transform/OverridingPairs.scala +++ b/src/compiler/scala/tools/nsc/transform/OverridingPairs.scala @@ -69,7 +69,7 @@ abstract class OverridingPairs { private val size = base.info.baseClasses.length - private val index = new HashMap[Symbol, int] + private val index = new HashMap[Symbol, Int] { var i = 0 for (bc <- base.info.baseClasses) { @@ -108,7 +108,7 @@ abstract class OverridingPairs { //@M: note that next is called once during object initialisation def hasNext: Boolean = curEntry ne null - def next: unit = + def next { if (curEntry ne null) { overriding = curEntry.sym if (nextEntry ne null) { @@ -133,6 +133,7 @@ abstract class OverridingPairs { next } } + } next //@M: ATTN! this method gets called during construction! } diff --git a/src/compiler/scala/tools/nsc/transform/UnCurry.scala b/src/compiler/scala/tools/nsc/transform/UnCurry.scala index 2e6e99bd6c..812896337f 100644 --- a/src/compiler/scala/tools/nsc/transform/UnCurry.scala +++ b/src/compiler/scala/tools/nsc/transform/UnCurry.scala @@ -113,7 +113,7 @@ abstract class UnCurry extends InfoTransform with TypingTransformers { * x.apply()? Note that this is not the case if `x' is used as an argument to another * call by name parameter. */ - def isByNameRef(tree: Tree): boolean = + def isByNameRef(tree: Tree): Boolean = tree.isTerm && tree.hasSymbol && tree.symbol.tpe.typeSymbol == ByNameParamClass && !byNameArgs.contains(tree) @@ -350,7 +350,7 @@ abstract class UnCurry extends InfoTransform with TypingTransformers { t } - def withInConstructorFlag(inConstructorFlag: long)(f: => Tree): Tree = { + def withInConstructorFlag(inConstructorFlag: Long)(f: => Tree): Tree = { val savedInConstructorFlag = this.inConstructorFlag this.inConstructorFlag = inConstructorFlag val t = f diff --git a/src/compiler/scala/tools/nsc/typechecker/Contexts.scala b/src/compiler/scala/tools/nsc/typechecker/Contexts.scala index 6e14d4f871..734c29e2cf 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Contexts.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Contexts.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2006 LAMP/EPFL + * Copyright 2005-2007 LAMP/EPFL * @author Martin Odersky */ // $Id$ @@ -20,7 +20,7 @@ trait Contexts { self: Analyzer => val NoContext = new Context { override def implicitss: List[List[ImplicitInfo]] = List() - outer = this; + outer = this } NoContext.enclClass = NoContext NoContext.enclMethod = NoContext @@ -58,7 +58,7 @@ trait Contexts { self: Analyzer => def rootContext(unit: CompilationUnit, tree: Tree, erasedTypes: boolean): Context = { import definitions._ var sc = startContext - def addImport(pkg: Symbol): unit = { + def addImport(pkg: Symbol) { assert(pkg ne null) val qual = gen.mkAttributedStableRef(pkg) sc = sc.makeNewImport( @@ -76,7 +76,7 @@ trait Contexts { self: Analyzer => c } - def resetContexts: unit = { + def resetContexts { var sc = startContext while (sc != NoContext) { sc.tree match { @@ -95,10 +95,10 @@ trait Contexts { self: Analyzer => var enclClass: Context = _ // The next outer context whose tree is a // template or package definition var enclMethod: Context = _ // The next outer context whose tree is a method - var variance: int = _ // Variance relative to enclosing class + var variance: Int = _ // Variance relative to enclosing class private var _undetparams: List[Symbol] = List() // Undetermined type parameters, // not inherited to child contexts - var depth: int = 0 + var depth: Int = 0 var imports: List[ImportInfo] = List() var prefix: Type = NoPrefix @@ -118,9 +118,9 @@ trait Contexts { self: Analyzer => case NoContext => false case that : Context => val a0 = if (tree eq null) tree == that.tree else tree equalsStructure that.tree; - val a1 = owner == that.owner; - val a2 = scope == that.scope; - val a3 = outer == that.outer; + val a1 = owner == that.owner + val a2 = scope == that.scope + val a3 = outer == that.outer val a4 = { if (enclClass eq this) { that.enclClass eq that; @@ -135,18 +135,18 @@ trait Contexts { self: Analyzer => val a7 = _undetparams == that._undetparams; val a8 = depth == that.depth; val a9 = if (imports.length != that.imports.length) false else - (for (val x <- imports.zip(that.imports)) yield + (for (x <- imports.zip(that.imports)) yield (x._1.tree equalsStructure x._2.tree) && x._1.depth == x._2.depth). foldLeft(true)((x,y) => x && y); - val a10 = prefix == that.prefix; - val a11 = inConstructorSuffix == that.inConstructorSuffix; - val a12 = implicitsEnabled == that.implicitsEnabled; - val a13 = checking == that.checking; - val a14 = retyping == that.retyping; - val a15 = savedTypeBounds == that.savedTypeBounds; + val a10 = prefix == that.prefix + val a11 = inConstructorSuffix == that.inConstructorSuffix + val a12 = implicitsEnabled == that.implicitsEnabled + val a13 = checking == that.checking + val a14 = retyping == that.retyping + val a15 = savedTypeBounds == that.savedTypeBounds a0 && a1 && a2 && a3 && a4 && a5 && a6 && a7 && a8 && a9 && a10 && a11 && a12 && a13 && a14 && a15 - case _ => false; + case _ => false } @@ -224,14 +224,14 @@ trait Contexts { self: Analyzer => def make(tree: Tree): Context = make(tree, owner) - def makeSilent(reportAmbiguousErrors: boolean): Context = { + def makeSilent(reportAmbiguousErrors: Boolean): Context = { val c = make(tree) c.reportGeneralErrors = false c.reportAmbiguousErrors = reportAmbiguousErrors c } - def makeImplicit(reportAmbiguousErrors: boolean) = { + def makeImplicit(reportAmbiguousErrors: Boolean) = { val c = makeSilent(reportAmbiguousErrors) c.implicitsEnabled = false c @@ -295,7 +295,7 @@ trait Contexts { self: Analyzer => * @param rest ... */ def ambiguousError(pos: Position, pre: Type, sym1: Symbol, - sym2: Symbol, rest: String): unit = { + sym2: Symbol, rest: String) { val msg = ("ambiguous reference to overloaded definition,\n" + "both " + sym1 + sym1.locationString + " of type " + pre.memberType(sym1) + @@ -313,14 +313,14 @@ trait Contexts { self: Analyzer => c } - def isLocal(): boolean = tree match { + def isLocal(): Boolean = tree match { case Block(_,_) => true case PackageDef(_, _) => false case EmptyTree => false case _ => outer.isLocal() } - def nextEnclosing(p: Context => boolean): Context = + def nextEnclosing(p: Context => Boolean): Context = if (this == NoContext || p(this)) this else outer.nextEnclosing(p) override def toString(): String = { @@ -361,7 +361,7 @@ trait Contexts { self: Analyzer => def isAccessible(sym: Symbol, pre: Type, superAccess: boolean): boolean = { /** Are we inside definition of `owner'? */ - def accessWithin(owner: Symbol): boolean = { + def accessWithin(owner: Symbol): Boolean = { var c = this while (c != NoContext && c.owner != owner) { if (c.outer eq null) assert(false, "accessWithin(" + owner + ") " + c);//debug @@ -372,10 +372,10 @@ trait Contexts { self: Analyzer => } /** Is `clazz' a subclass of an enclosing class? */ - def isSubClassOfEnclosing(clazz: Symbol): boolean = + def isSubClassOfEnclosing(clazz: Symbol): Boolean = enclosingSuperClassContext(clazz) != NoContext - def isSubThisType(pre: Type, clazz: Symbol): boolean = pre match { + def isSubThisType(pre: Type, clazz: Symbol): Boolean = pre match { case ThisType(pclazz) => pclazz isNonBottomSubClass clazz case _ => false } @@ -399,13 +399,13 @@ trait Contexts { self: Analyzer => } } - def pushTypeBounds(sym: Symbol): unit = { + def pushTypeBounds(sym: Symbol) { savedTypeBounds = (sym, sym.info) :: savedTypeBounds } def restoreTypeBounds(tp: Type): Type = { var current = tp - for (val (sym, info) <- savedTypeBounds) { + for ((sym, info) <- savedTypeBounds) { if (settings.debug.value) log("resetting " + sym + " to " + info); sym.info match { case TypeBounds(lo, hi) if (hi <:< lo && lo <:< hi) => @@ -423,7 +423,7 @@ trait Contexts { self: Analyzer => private var implicitsRunId = NoRunId private def collectImplicits(syms: List[Symbol], pre: Type): List[ImplicitInfo] = - for (val sym <- syms; sym.hasFlag(IMPLICIT) && isAccessible(sym, pre, false)) + for (sym <- syms if sym.hasFlag(IMPLICIT) && isAccessible(sym, pre, false)) yield new ImplicitInfo(sym.name, pre, sym) private def collectImplicitImports(imp: ImportInfo): List[ImplicitInfo] = { @@ -475,7 +475,7 @@ trait Contexts { self: Analyzer => } } - class ImportInfo(val tree: Import, val depth: int) { + class ImportInfo(val tree: Import, val depth: Int) { /** The prefix expression */ def qual: Tree = tree.symbol.info match { @@ -484,7 +484,7 @@ trait Contexts { self: Analyzer => } /** Is name imported explicitly, not via wildcard? */ - def isExplicitImport(name: Name): boolean = + def isExplicitImport(name: Name): Boolean = tree.selectors exists (_._2 == name.toTermName) /** The symbol with name name imported from import clause diff --git a/src/compiler/scala/tools/nsc/typechecker/Infer.scala b/src/compiler/scala/tools/nsc/typechecker/Infer.scala index 248e7a94d2..ad8fb895c4 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Infer.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Infer.scala @@ -40,7 +40,7 @@ trait Infer { * @param formals ... * @param nargs ... */ - def formalTypes(formals: List[Type], nargs: int): List[Type] = { + def formalTypes(formals: List[Type], nargs: Int): List[Type] = { val formals1 = formals map { case TypeRef(_, sym, List(arg)) if (sym == ByNameParamClass) => arg case formal => formal @@ -51,12 +51,12 @@ trait Infer { } else formals1 } - def actualTypes(actuals: List[Type], nformals: int): List[Type] = + def actualTypes(actuals: List[Type], nformals: Int): List[Type] = if (nformals == 1 && actuals.length != 1) List(if (actuals.length == 0) UnitClass.tpe else tupleType(actuals)) else actuals - def actualArgs(pos: Position, actuals: List[Tree], nformals: int): List[Tree] = + def actualArgs(pos: Position, actuals: List[Tree], nformals: Int): List[Tree] = if (nformals == 1 && actuals.length != 1) List(atPos(pos)(gen.mkTuple(actuals))) else actuals /** A fresh type varable with given type parameter as origin. @@ -103,7 +103,7 @@ trait Infer { * @param tp ... * @return ... */ - def isFullyDefined(tp: Type): boolean = tp match { + def isFullyDefined(tp: Type): Boolean = tp match { case WildcardType | NoType => false case NoPrefix | ThisType(_) | ConstantType(_) => @@ -134,7 +134,7 @@ trait Infer { * @throws NoInstance */ private def solvedTypes(tvars: List[TypeVar], tparams: List[Symbol], - variances: List[int], upper: boolean): List[Type] = { + variances: List[Int], upper: Boolean): List[Type] = { solve(tvars, tparams, variances, upper) for (val tvar <- tvars) assert(tvar.constr.inst != tvar, tvar.origin) tvars map instantiate @@ -214,8 +214,9 @@ trait Infer { "\n possible cause: missing arguments for method or constructor" else "") - def error(pos: Position, msg: String): unit = + def error(pos: Position, msg: String) { context.error(pos, msg) + } def errorTree(tree: Tree, msg: String): Tree = { if (!tree.isErroneous) error(tree.pos, msg) @@ -322,7 +323,7 @@ trait Infer { } } - def isPlausiblyCompatible(tp: Type, pt: Type): boolean = tp match { + def isPlausiblyCompatible(tp: Type, pt: Type): Boolean = tp match { case PolyType(_, restpe) => isPlausiblyCompatible(restpe, pt) case MethodType(formals, _) => @@ -342,7 +343,7 @@ trait Infer { true } - def isPlausiblySubType(tp1: Type, tp2: Type): boolean = tp1.normalize match { + def isPlausiblySubType(tp1: Type, tp2: Type): Boolean = tp1.normalize match { case TypeRef(_, sym1, _) => !sym1.isClass || { tp2.normalize match { @@ -354,17 +355,17 @@ trait Infer { true } - def isCompatible(tp: Type, pt: Type): boolean = { + def isCompatible(tp: Type, pt: Type): Boolean = { val tp1 = normalize(tp) (tp1 <:< pt) || isCoercible(tp, pt) } - def isWeaklyCompatible(tp: Type, pt: Type): boolean = + def isWeaklyCompatible(tp: Type, pt: Type): Boolean = pt.typeSymbol == UnitClass || isCompatible(tp, pt) - def isCoercible(tp: Type, pt: Type): boolean = false + def isCoercible(tp: Type, pt: Type): Boolean = false - def isCompatible(tps: List[Type], pts: List[Type]): boolean = + def isCompatible(tps: List[Type], pts: List[Type]): Boolean = List.map2(tps, pts)((tp, pt) => isCompatible(tp, pt)) forall (x => x) /* -- Type instantiation------------------------------------------------ */ @@ -409,7 +410,7 @@ trait Infer { pt: Type): List[Type] = { /** Map type variable to its instance, or, if `variance' is covariant/contravariant, * to its upper/lower bound */ - def instantiateToBound(tvar: TypeVar, variance: int): Type = try { + def instantiateToBound(tvar: TypeVar, variance: Int): Type = try { //Console.println("instantiate "+tvar+tvar.constr+" variance = "+variance);//DEBUG if (tvar.constr.inst != NoType) { instantiate(tvar.constr.inst) @@ -509,7 +510,7 @@ trait Infer { * @return ... */ def isApplicable(undetparams: List[Symbol], ftpe: Type, - argtpes0: List[Type], pt: Type): boolean = + argtpes0: List[Type], pt: Type): Boolean = ftpe match { case MethodType(formals0, _) => val formals = formalTypes(formals0, argtpes0.length) @@ -538,7 +539,7 @@ trait Infer { false } - def isApplicableSafe(undetparams: List[Symbol], ftpe: Type, argtpes0: List[Type], pt: Type): boolean = { + def isApplicableSafe(undetparams: List[Symbol], ftpe: Type, argtpes0: List[Type], pt: Type): Boolean = { val reportAmbiguousErrors = context.reportAmbiguousErrors context.reportAmbiguousErrors = false try { @@ -558,7 +559,7 @@ trait Infer { * @param ftpe2 ... * @return ... */ - def specializes(ftpe1: Type, ftpe2: Type): boolean = ftpe1 match { + def specializes(ftpe1: Type, ftpe2: Type): Boolean = ftpe1 match { case MethodType(formals, _) => isApplicable(List(), ftpe2, formals, WildcardType) case PolyType(tparams, MethodType(formals, _)) => @@ -615,7 +616,7 @@ trait Infer { * * If sym2 is invariant, sym1's variance is irrelevant. Otherwise they must be equal. */ - def variancesMatch(sym1: Symbol, sym2: Symbol): boolean = (sym2.variance==0 || sym1.variance==sym2.variance) + def variancesMatch(sym1: Symbol, sym2: Symbol): Boolean = (sym2.variance==0 || sym1.variance==sym2.variance) /** Check well-kindedness of type application (assumes arities are already checked) -- @M * @@ -647,11 +648,11 @@ trait Infer { val _arityMismatches = new ListBuffer[(Symbol, Symbol)] val _varianceMismatches = new ListBuffer[(Symbol, Symbol)] val _stricterBounds = new ListBuffer[(Symbol, Symbol)] - def varianceMismatch(a: Symbol, p: Symbol): unit = _varianceMismatches += (a, p) - def stricterBound(a: Symbol, p: Symbol): unit = _stricterBounds += (a, p) - def arityMismatches(as: Iterable[(Symbol, Symbol)]): unit = _arityMismatches ++= as - def varianceMismatches(as: Iterable[(Symbol, Symbol)]): unit = _varianceMismatches ++= as - def stricterBounds(as: Iterable[(Symbol, Symbol)]): unit = _stricterBounds ++= as + def varianceMismatch(a: Symbol, p: Symbol) { _varianceMismatches += (a, p) } + def stricterBound(a: Symbol, p: Symbol) { _stricterBounds += (a, p) } + def arityMismatches(as: Iterable[(Symbol, Symbol)]) { _arityMismatches ++= as } + def varianceMismatches(as: Iterable[(Symbol, Symbol)]) { _varianceMismatches ++= as } + def stricterBounds(as: Iterable[(Symbol, Symbol)]) { _stricterBounds ++= as } for ((hkarg, hkparam) <- hkargs zip hkparams) { if (hkparam.typeParams.isEmpty) { // base-case: kind * @@ -723,7 +724,7 @@ trait Infer { * attempts fail, an error is produced. */ def inferArgumentInstance(tree: Tree, undetparams: List[Symbol], - strictPt: Type, lenientPt: Type): unit = { + strictPt: Type, lenientPt: Type) { var targs = exprTypeArgs(undetparams, tree.tpe, strictPt) if (targs eq null) targs = exprTypeArgs(undetparams, tree.tpe, lenientPt) substExpr(tree, undetparams, targs, lenientPt) @@ -736,8 +737,9 @@ trait Infer { * @param undetparams ... * @param pt ... */ - def inferExprInstance(tree: Tree, undetparams: List[Symbol], pt: Type): unit = + def inferExprInstance(tree: Tree, undetparams: List[Symbol], pt: Type) { substExpr(tree, undetparams, exprTypeArgs(undetparams, tree.tpe, pt), pt) + } /** Substitite free type variables `undetparams' of polymorphic argument * expression tree to `targs', Error if `targs' is null @@ -803,8 +805,8 @@ trait Infer { * bt1 and bt2 have the same prefix, and * any correspondiong non-variant type arguments of bt1 and bt2 are the same */ - def isPopulated(tp1: Type, tp2: Type): boolean = { - def isConsistent(tp1: Type, tp2: Type): boolean = (tp1, tp2) match { + def isPopulated(tp1: Type, tp2: Type): Boolean = { + def isConsistent(tp1: Type, tp2: Type): Boolean = (tp1, tp2) match { case (TypeRef(pre1, sym1, args1), TypeRef(pre2, sym2, args2)) => assert(sym1 == sym2) pre1 =:= pre2 && @@ -839,7 +841,7 @@ trait Infer { * @param undetparams ... * @param pt ... */ - def inferConstructorInstance(tree: Tree, undetparams: List[Symbol], pt: Type): unit = { + def inferConstructorInstance(tree: Tree, undetparams: List[Symbol], pt: Type) { var restpe = tree.tpe.finalResultType var tvars = undetparams map freshVar @@ -912,7 +914,7 @@ trait Infer { } } - def checkCheckable(pos: Position, tp: Type): unit = { + def checkCheckable(pos: Position, tp: Type) { def patternWarning(tp: Type, prefix: String) = context.unit.uncheckedWarning(pos, prefix+tp+" in type pattern is unchecked since it is eliminated by erasure") def isLocalBinding(sym: Symbol) = @@ -1015,7 +1017,7 @@ trait Infer { abstract class SymCollector extends TypeTraverser { private var result: List[Symbol] = _ - protected def includeCondition(sym: Symbol): boolean + protected def includeCondition(sym: Symbol): Boolean override def traverse(tp: Type): TypeTraverser = { tp.normalize match { @@ -1049,12 +1051,12 @@ trait Infer { /** A traverser to collect type parameters referred to in a type */ object freeTypeParamsOfTerms extends SymCollector { - protected def includeCondition(sym: Symbol): boolean = + protected def includeCondition(sym: Symbol): Boolean = sym.isAbstractType && sym.owner.isTerm } object typeRefs extends SymCollector { - protected def includeCondition(sym: Symbol): boolean = true + protected def includeCondition(sym: Symbol): Boolean = true } def checkDead(tree: Tree): Tree = { @@ -1081,11 +1083,11 @@ trait Infer { * If several alternatives match `pt', take parameterless one. * If no alternative matches `pt', take the parameterless one anyway. */ - def inferExprAlternative(tree: Tree, pt: Type): unit = tree.tpe match { + def inferExprAlternative(tree: Tree, pt: Type): Unit = tree.tpe match { case OverloadedType(pre, alts) => tryTwice { var alts1 = alts filter (alt => isCompatible(pre.memberType(alt), pt)) if (alts1.isEmpty) alts1 = alts - def improves(sym1: Symbol, sym2: Symbol): boolean = + def improves(sym1: Symbol, sym2: Symbol): Boolean = sym2 == NoSymbol || { val tp1 = pre.memberType(sym1) val tp2 = pre.memberType(sym2) @@ -1130,7 +1132,7 @@ trait Infer { * with pt = WildcardType. * Otherwise, if there is no best alternative, error. */ - def inferMethodAlternative(tree: Tree, undetparams: List[Symbol], argtpes: List[Type], pt: Type): unit = tree.tpe match { + def inferMethodAlternative(tree: Tree, undetparams: List[Symbol], argtpes: List[Type], pt: Type): Unit = tree.tpe match { case OverloadedType(pre, alts) => tryTwice { if (settings.debug.value) log("infer method alt " + tree.symbol + " with alternatives " + (alts map pre.memberType) + ", argtpes = " + argtpes + ", pt = " + pt) @@ -1167,7 +1169,7 @@ trait Infer { * * @param infer ... */ - def tryTwice(infer: => unit): unit = { + def tryTwice(infer: => Unit) { if (context.implicitsEnabled) { val reportGeneralErrors = context.reportGeneralErrors context.reportGeneralErrors = false @@ -1194,7 +1196,7 @@ trait Infer { * @param tree ... * @param nparams ... */ - def inferPolyAlternatives(tree: Tree, argtypes: List[Type]): unit = tree.tpe match { + def inferPolyAlternatives(tree: Tree, argtypes: List[Type]): Unit = tree.tpe match { case OverloadedType(pre, alts) => val sym0 = tree.symbol filter { alt => alt.typeParams.length == argtypes.length } if (sym0 == NoSymbol) { diff --git a/src/compiler/scala/tools/nsc/typechecker/Namers.scala b/src/compiler/scala/tools/nsc/typechecker/Namers.scala index 605263a2a1..8bbc88c390 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Namers.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Namers.scala @@ -52,7 +52,7 @@ trait Namers { self: Analyzer => sym } - def updatePosFlags(sym: Symbol, pos: Position, flags: long): Symbol = { + def updatePosFlags(sym: Symbol, pos: Position, flags: Long): Symbol = { if (settings.debug.value) log("overwriting " + sym) val lockedFlag = sym.flags & LOCKED sym.reset(NoType) @@ -68,7 +68,7 @@ trait Namers { self: Analyzer => sym } - private def isTemplateContext(context: Context): boolean = context.tree match { + private def isTemplateContext(context: Context): Boolean = context.tree match { case Template(_, _, _) => true case Import(_, _) => isTemplateContext(context.outer) case _ => false @@ -101,10 +101,11 @@ trait Namers { self: Analyzer => innerNamer } - private def doubleDefError(pos: Position, sym: Symbol): unit = + private def doubleDefError(pos: Position, sym: Symbol) { context.error(pos, sym.name.toString() + " is already defined as " + (if (sym.hasFlag(CASE)) "case class " + sym.name else sym.toString())) + } def enterInScope[A <: Symbol](sym: A): A = { // allow for overloaded methods @@ -207,8 +208,9 @@ trait Namers { self: Analyzer => def newTypeSkolems(tparams: List[Symbol]): List[Symbol] = { val tskolems = tparams map (_.newTypeSkolem) val ltp = new LazyType { - override def complete(sym: Symbol): unit = + override def complete(sym: Symbol) { sym setInfo sym.deSkolemize.info.substSym(tparams, tskolems) //@M the info of a skolem is the skolemized info of the actual type parameter of the skolem + } } tskolems foreach (_.setInfo(ltp)) tskolems @@ -217,7 +219,7 @@ trait Namers { self: Analyzer => /** Replace type parameters with their TypeSkolems, which can later be deskolemized to the original type param * (a skolem is a representation of a bound variable when viewed outside its scope) */ - def skolemize(tparams: List[TypeDef]): unit = { + def skolemize(tparams: List[TypeDef]) { val tskolems = newTypeSkolems(tparams map (_.symbol)) for ((tparam, tskolem) <- tparams zip tskolems) tparam.symbol = tskolem } @@ -232,7 +234,7 @@ trait Namers { self: Analyzer => */ class LazyPolyType(tparams: List[Tree], restp: Type, owner: Tree, ownerSym: Symbol, ctx: Context) extends LazyType { //@M override val typeParams: List[Symbol]= tparams map (_.symbol) //@M - override def complete(sym: Symbol): unit = { + override def complete(sym: Symbol) { if(ownerSym.isAbstractType) //@M an abstract type's type parameters are entered new Namer(ctx.makeNewScope(owner, ownerSym)).enterSyms(tparams) //@M restp.complete(sym) @@ -710,7 +712,7 @@ trait Namers { self: Analyzer => val expr1 = typer.typedQualifier(expr) val base = expr1.tpe typer.checkStable(expr1) - def checkNotRedundant(pos: Position, from: Name, to: Name): boolean = { + def checkNotRedundant(pos: Position, from: Name, to: Name): Boolean = { if (!tree.symbol.hasFlag(SYNTHETIC) && !((expr1.symbol ne null) && expr1.symbol.isInterpreterWrapper) && base.member(from) != NoSymbol) { @@ -729,7 +731,7 @@ trait Namers { self: Analyzer => } true } - def checkSelectors(selectors: List[(Name, Name)]): unit = selectors match { + def checkSelectors(selectors: List[(Name, Name)]): Unit = selectors match { case (from, to) :: rest => if (from != nme.WILDCARD && base != ErrorType) { if (base.member(from) == NoSymbol && base.member(from.toTypeName) == NoSymbol) @@ -763,15 +765,17 @@ trait Namers { self: Analyzer => * - `def' modifier never for parameters of case classes * - declarations only in mixins or abstract classes (when not @native) */ - def validate(sym: Symbol): unit = { - def checkNoConflict(flag1: int, flag2: int): unit = + def validate(sym: Symbol) { + def checkNoConflict(flag1: Int, flag2: Int) { if (sym.hasFlag(flag1) && sym.hasFlag(flag2)) context.error(sym.pos, if (flag1 == DEFERRED) "abstract member may not have " + Flags.flagsToString(flag2) + " modifier"; else "illegal combination of modifiers: " + - Flags.flagsToString(flag1) + " and " + Flags.flagsToString(flag2) + " for: " + sym + Flags.flagsToString(sym.rawflags)); + Flags.flagsToString(flag1) + " and " + Flags.flagsToString(flag2) + + " for: " + sym + Flags.flagsToString(sym.rawflags)); + } if (sym.hasFlag(IMPLICIT) && !sym.isTerm) context.error(sym.pos, "`implicit' modifier can be used only for values, variables and methods") if (sym.hasFlag(IMPLICIT) && sym.owner.isPackageClass) @@ -871,7 +875,7 @@ trait Namers { self: Analyzer => /** An explanatory note to be added to error messages * when there's a problem with abstract var defs */ - def varNotice(sym: Symbol) = + def varNotice(sym: Symbol): String = if (underlying(sym).isVariable) "\n(Note that variables need to be initialized to be defined)" else "" diff --git a/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala b/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala index 174485c6cb..13f19feb24 100644 --- a/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala +++ b/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala @@ -1,5 +1,5 @@ /* NSC -- new Scala compiler - * Copyright 2005-2006 LAMP/EPFL + * Copyright 2005-2007 LAMP/EPFL * @author Martin Odersky */ // $Id$ @@ -46,7 +46,7 @@ abstract class RefChecks extends InfoTransform { /** the following two members override abstract members in Transform */ val phaseName: String = "refchecks" - override def phaseNewFlags: long = lateMETHOD + override def phaseNewFlags: Long = lateMETHOD def newTransformer(unit: CompilationUnit): RefCheckTransformer = new RefCheckTransformer(unit) @@ -88,7 +88,7 @@ abstract class RefChecks extends InfoTransform { * 4. Check that every member with an `override' modifier * overrides some other member. */ - private def checkAllOverrides(clazz: Symbol): unit = { + private def checkAllOverrides(clazz: Symbol) { val self = clazz.thisType @@ -103,7 +103,7 @@ abstract class RefChecks extends InfoTransform { else ""))) } - def overridesType(tp1: Type, tp2: Type): boolean = (tp1.normalize, tp2.normalize) match { + def overridesType(tp1: Type, tp2: Type): Boolean = (tp1.normalize, tp2.normalize) match { case (MethodType(List(), rtp1), PolyType(List(), rtp2)) => rtp1 <:< rtp2 case (PolyType(List(), rtp1), MethodType(List(), rtp2)) => @@ -117,22 +117,23 @@ abstract class RefChecks extends InfoTransform { /** Check that all conditions for overriding other by * member are met. */ - def checkOverride(clazz: Symbol, member: Symbol, other: Symbol): unit = { + def checkOverride(clazz: Symbol, member: Symbol, other: Symbol) { val pos = if (member.owner == clazz) member.pos else clazz.pos - def overrideError(msg: String): unit = + def overrideError(msg: String) { if (other.tpe != ErrorType && member.tpe != ErrorType) unit.error(pos, "error overriding " + infoString(other) + ";\n " + infoString(member) + " " + msg); + } - def overrideTypeError(): unit = { + def overrideTypeError() { if (other.tpe != ErrorType && member.tpe != ErrorType) { overrideError("has incompatible type "+analyzer.underlying(member).tpe.normalize); explainTypes(member.tpe, other.tpe); } } - def overrideAccessError(): unit = { + def overrideAccessError() { val pwString = if (other.privateWithin == NoSymbol) "" else other.privateWithin.name.toString val otherAccess = flagsToString(other getFlag (PRIVATE | PROTECTED), pwString) @@ -242,7 +243,7 @@ abstract class RefChecks extends InfoTransform { } // 2. Check that only abstract classes have deferred members if (clazz.isClass && !clazz.isTrait) { - def abstractClassError(mustBeMixin: boolean, msg: String): unit = { + def abstractClassError(mustBeMixin: Boolean, msg: String) { unit.error(clazz.pos, (if (clazz.isAnonymousClass || clazz.isModuleClass) "object creation impossible" else if (mustBeMixin) clazz.toString() + " needs to be a mixin" @@ -310,18 +311,18 @@ abstract class RefChecks extends InfoTransform { * * */ - private def validateBaseTypes(clazz: Symbol): unit = { + private def validateBaseTypes(clazz: Symbol) { val seenTypes = new Array[Type](clazz.info.closure.length) var seenCaseClass = if (clazz hasFlag CASE) clazz else NoSymbol - def validateTypes(tps: List[Type], includeSuper: boolean): unit = { + def validateTypes(tps: List[Type], includeSuper: Boolean) { if (!tps.isEmpty) { for (val tp <- tps.tail.reverse) validateType(tp, false); if (includeSuper) validateType(tps.head, true); } } - def validateType(tp: Type, includeSuper: boolean): unit = { + def validateType(tp: Type, includeSuper: Boolean) { val baseClass = tp.typeSymbol if (baseClass.isClass) { val index = clazz.info.closurePos(baseClass) @@ -364,12 +365,12 @@ abstract class RefChecks extends InfoTransform { private def validateVariance(base: Symbol) { - def varianceString(variance: int): String = + def varianceString(variance: Int): String = if (variance == 1) "covariant" else if (variance == -1) "contravariant" else "invariant"; - def relativeVariance(tvar: Symbol): int = { + def relativeVariance(tvar: Symbol): Int = { val clazz = tvar.owner var sym = base var state = CoVariance @@ -388,7 +389,7 @@ abstract class RefChecks extends InfoTransform { state } - def validateVariance(tp: Type, variance: int): unit = tp match { + def validateVariance(tp: Type, variance: Int): Unit = tp match { case ErrorType => ; case WildcardType => ; case NoType => ; @@ -430,18 +431,20 @@ abstract class RefChecks extends InfoTransform { validateVariance(tp, variance) } - def validateVariances(tps: List[Type], variance: int): unit = + def validateVariances(tps: List[Type], variance: Int) { tps foreach (tp => validateVariance(tp, variance)) + } - def validateVarianceArgs(tps: List[Type], variance: int, tparams: List[Symbol]): unit = + def validateVarianceArgs(tps: List[Type], variance: Int, tparams: List[Symbol]) { (tps zip tparams) foreach { case (tp, tparam) => validateVariance(tp, variance * tparam.variance) } + } validateVariance(base.info, CoVariance) } - override def traverse(tree: Tree): Unit = { + override def traverse(tree: Tree) { tree match { case ClassDef(_, _, _, _) | TypeDef(_, _, _, _) => validateVariance(tree.symbol) @@ -463,7 +466,7 @@ abstract class RefChecks extends InfoTransform { class LevelInfo(val outer: LevelInfo) { val scope: Scope = if (outer eq null) newScope else newScope(outer.scope) - var maxindex: int = Math.MIN_INT + var maxindex: Int = Math.MIN_INT var refpos: Position = _ var refsym: Symbol = _ } @@ -471,13 +474,15 @@ abstract class RefChecks extends InfoTransform { private var currentLevel: LevelInfo = null private val symIndex = new HashMap[Symbol, int] - private def pushLevel(): unit = + private def pushLevel() { currentLevel = new LevelInfo(currentLevel) + } - private def popLevel(): unit = + private def popLevel() { currentLevel = currentLevel.outer + } - private def enterSyms(stats: List[Tree]): unit = { + private def enterSyms(stats: List[Tree]) { var index = -1 for (val stat <- stats) { index = index + 1; @@ -493,7 +498,7 @@ abstract class RefChecks extends InfoTransform { } } - private def enterReference(pos: Position, sym: Symbol): unit = + private def enterReference(pos: Position, sym: Symbol) { if (sym.isLocal) { val e = currentLevel.scope.lookupEntry(sym.name) if ((e ne null) && sym == e.sym) { @@ -507,6 +512,7 @@ abstract class RefChecks extends InfoTransform { } } } + } // Comparison checking ------------------------------------------------------- object normalizeAll extends TypeMap { @@ -531,10 +537,10 @@ abstract class RefChecks extends InfoTransform { val formal = underlyingClass(fn.tpe.paramTypes.head) val actual = underlyingClass(args.head.tpe) val receiver = underlyingClass(qual.tpe) - def nonSensibleWarning(what: String, alwaysEqual: boolean) = + def nonSensibleWarning(what: String, alwaysEqual: Boolean) = unit.warning(pos, "comparing "+what+" using `"+name.decode+"' will always yield "+ (alwaysEqual == (name == nme.EQ || name == nme.LE || name == nme.GE))) - def nonSensible(pre: String, alwaysEqual: boolean) = + def nonSensible(pre: String, alwaysEqual: Boolean) = nonSensibleWarning(pre+"values of types "+normalizeAll(qual.tpe.widen)+" and "+normalizeAll(args.head.tpe.widen), alwaysEqual) // @MAT normalize for consistency in error message, otherwise part is normalized due to use of `typeSymbol', but the rest isn't def hasObjectEquals = receiver.info.member(nme.equals_) == Object_equals @@ -578,7 +584,7 @@ abstract class RefChecks extends InfoTransform { pushLevel() enterSyms(stats) var index = -1 - val stats1 = stats flatMap { stat => index = index + 1; transformStat(stat, index) } + val stats1 = stats flatMap { stat => index += 1; transformStat(stat, index) } popLevel() stats1 } @@ -588,7 +594,7 @@ abstract class RefChecks extends InfoTransform { * - for all other lazy values z the accessor is a block of this form: * { z = ; z } where z can be an identifier or a field. */ - def transformStat(tree: Tree, index: int): List[Tree] = tree match { + def transformStat(tree: Tree, index: Int): List[Tree] = tree match { case ModuleDef(mods, name, impl) => val sym = tree.symbol val cdef = ClassDef(mods | MODULE, name, List(), impl) @@ -677,13 +683,13 @@ abstract class RefChecks extends InfoTransform { override def transform(tree: Tree): Tree = try { /* Check whether argument types conform to bounds of type parameters */ - def checkBounds(pre: Type, owner: Symbol, tparams: List[Symbol], argtps: List[Type]): unit = try { + def checkBounds(pre: Type, owner: Symbol, tparams: List[Symbol], argtps: List[Type]): Unit = try { typer.infer.checkBounds(tree.pos, pre, owner, tparams, argtps, ""); } catch { case ex: TypeError => unit.error(tree.pos, ex.getMessage()); } - def isIrrefutable(pat: Tree, seltpe: Type): boolean = { + def isIrrefutable(pat: Tree, seltpe: Type): Boolean = { val result = pat match { case Apply(_, args) => val clazz = pat.tpe.typeSymbol; diff --git a/src/compiler/scala/tools/nsc/typechecker/SyntheticMethods.scala b/src/compiler/scala/tools/nsc/typechecker/SyntheticMethods.scala index 5a63f2ae7f..2c08481680 100644 --- a/src/compiler/scala/tools/nsc/typechecker/SyntheticMethods.scala +++ b/src/compiler/scala/tools/nsc/typechecker/SyntheticMethods.scala @@ -41,12 +41,12 @@ trait SyntheticMethods { self: Analyzer => val localTyper = newTyper(context) - def hasImplementation(name: Name): boolean = { + def hasImplementation(name: Name): Boolean = { val sym = clazz.info.nonPrivateMember(name) sym.isTerm && !(sym hasFlag DEFERRED) } - def hasOverridingImplementation(meth: Symbol): boolean = { + def hasOverridingImplementation(meth: Symbol): Boolean = { val sym = clazz.info.nonPrivateMember(meth.name) sym.alternatives exists { sym => sym != meth && !(sym hasFlag DEFERRED) && diff --git a/src/compiler/scala/tools/nsc/typechecker/TreeCheckers.scala b/src/compiler/scala/tools/nsc/typechecker/TreeCheckers.scala index 615fc2c1c8..aac29e8875 100644 --- a/src/compiler/scala/tools/nsc/typechecker/TreeCheckers.scala +++ b/src/compiler/scala/tools/nsc/typechecker/TreeCheckers.scala @@ -42,7 +42,7 @@ abstract class TreeCheckers extends Analyzer { import infer._ - override def typed(tree: Tree, mode: int, pt: Type): Tree = { + override def typed(tree: Tree, mode: Int, pt: Type): Tree = { tree match { case EmptyTree | TypeTree() => ; diff --git a/src/library/scala/concurrent/pilib.scala b/src/library/scala/concurrent/pilib.scala index 7acfbc2728..93b742efa0 100644 --- a/src/library/scala/concurrent/pilib.scala +++ b/src/library/scala/concurrent/pilib.scala @@ -18,10 +18,10 @@ package scala.concurrent * example, the definition of a two-place buffer using the pilib * library looks like: *

- *  def Buffer[a](put: Chan[a], get: Chan[a]): unit = {
- *    def B0: unit = choice ( put * { x => B1(x) } );
- *    def B1(x: a): unit = choice ( get(x) * B0, put * { y => B2(x, y) } )
- *    def B2(x: a, y: a): unit = choice ( get(x) * B1(y) )
+ *  def Buffer[a](put: Chan[a], get: Chan[a]) {
+ *    def B0 { choice ( put * { x => B1(x) } ) }
+ *    def B1(x: a) { choice ( get(x) * B0, put * { y => B2(x, y) } ) }
+ *    def B2(x: a, y: a) { choice ( get(x) * B1(y) ) }
  *    B0
  *  }
  *  
-- cgit v1.2.3