summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormichelou <michelou@epfl.ch>2008-01-18 19:53:56 +0000
committermichelou <michelou@epfl.ch>2008-01-18 19:53:56 +0000
commit456729b845c3360f8d7b100b774b7432d2e4ed2f (patch)
tree0feb56bdf6de587275edcfa9cb16f7283f962f23
parente56b12033dd2a047b06e943cf6bf0e058d3f4679 (diff)
downloadscala-456729b845c3360f8d7b100b774b7432d2e4ed2f.tar.gz
scala-456729b845c3360f8d7b100b774b7432d2e4ed2f.tar.bz2
scala-456729b845c3360f8d7b100b774b7432d2e4ed2f.zip
removed more warnings
-rw-r--r--src/actors/scala/actors/remote/NetKernel.scala8
-rw-r--r--src/actors/scala/actors/remote/RemoteActor.scala8
-rw-r--r--src/actors/scala/actors/remote/TcpService.scala19
-rw-r--r--src/compiler/scala/tools/nsc/Interpreter.scala12
-rw-r--r--src/compiler/scala/tools/nsc/ast/Trees.scala12
-rw-r--r--src/compiler/scala/tools/nsc/ast/parser/Scanners.scala6
-rw-r--r--src/compiler/scala/tools/nsc/backend/icode/analysis/Liveness.scala20
-rw-r--r--src/compiler/scala/tools/nsc/symtab/Symbols.scala7
-rw-r--r--src/compiler/scala/tools/nsc/transform/TypingTransformers.scala4
-rw-r--r--src/compiler/scala/tools/nsc/util/Position.scala38
-rw-r--r--src/library/scala/collection/mutable/Map.scala6
-rw-r--r--src/library/scala/util/parsing/ast/Binders.scala33
12 files changed, 88 insertions, 85 deletions
diff --git a/src/actors/scala/actors/remote/NetKernel.scala b/src/actors/scala/actors/remote/NetKernel.scala
index f3fa57478c..c2d3723033 100644
--- a/src/actors/scala/actors/remote/NetKernel.scala
+++ b/src/actors/scala/actors/remote/NetKernel.scala
@@ -1,6 +1,6 @@
/* __ *\
** ________ ___ / / ___ Scala API **
-** / __/ __// _ | / / / _ | (c) 2005-2007, LAMP/EPFL **
+** / __/ __// _ | / / / _ | (c) 2005-2008, LAMP/EPFL **
** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
** /____/\___/_/ |_/____/_/ | | **
** |/ **
@@ -54,8 +54,8 @@ class NetKernel(service: Service) {
private val names = new HashMap[Actor, Symbol]
def register(name: Symbol, a: Actor): Unit = synchronized {
- actors += name -> a
- names += a -> name
+ actors += Pair(name, a)
+ names += Pair(a, name)
}
def selfName = names.get(Actor.self) match {
@@ -79,7 +79,7 @@ class NetKernel(service: Service) {
def createProxy(node: Node, sym: Symbol): Actor = {
val p = new Proxy(node, sym, this)
- proxies += Pair(node, sym) -> p
+ proxies += Pair((node, sym), p)
p
}
diff --git a/src/actors/scala/actors/remote/RemoteActor.scala b/src/actors/scala/actors/remote/RemoteActor.scala
index 6126ecbc86..b1a2587aa1 100644
--- a/src/actors/scala/actors/remote/RemoteActor.scala
+++ b/src/actors/scala/actors/remote/RemoteActor.scala
@@ -1,6 +1,6 @@
/* __ *\
** ________ ___ / / ___ Scala API **
-** / __/ __// _ | / / / _ | (c) 2005-2007, LAMP/EPFL **
+** / __/ __// _ | / / / _ | (c) 2005-2008, LAMP/EPFL **
** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
** /____/\___/_/ |_/____/_/ | | **
** |/ **
@@ -53,7 +53,7 @@ object RemoteActor {
val serv = TcpService(port)
val kern = serv.kernel
val s = Actor.self
- kernels += s -> kern
+ kernels += Pair(s, kern)
Scheduler.onTerminate(s) {
Debug.info("alive actor "+s+" terminated")
@@ -75,7 +75,7 @@ object RemoteActor {
case None =>
val serv = new TcpService(TcpService.generatePort)
serv.start()
- kernels += Actor.self -> serv.kernel
+ kernels += Pair(Actor.self, serv.kernel)
serv.kernel
case Some(k) =>
k
@@ -89,7 +89,7 @@ object RemoteActor {
// return path (sender)
val serv = new TcpService(TcpService.generatePort)
serv.start()
- kernels += Actor.self -> serv.kernel
+ kernels += Pair(Actor.self, serv.kernel)
serv.kernel
case Some(k) =>
k
diff --git a/src/actors/scala/actors/remote/TcpService.scala b/src/actors/scala/actors/remote/TcpService.scala
index c678a0c43c..74f03c44d5 100644
--- a/src/actors/scala/actors/remote/TcpService.scala
+++ b/src/actors/scala/actors/remote/TcpService.scala
@@ -1,6 +1,6 @@
/* __ *\
** ________ ___ / / ___ Scala API **
-** / __/ __// _ | / / / _ | (c) 2005-2007, LAMP/EPFL **
+** / __/ __// _ | / / / _ | (c) 2005-2008, LAMP/EPFL **
** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
** /____/\___/_/ |_/____/_/ | | **
** |/ **
@@ -12,8 +12,8 @@
package scala.actors.remote
-import java.lang.{Thread, SecurityException}
import java.io.{DataInputStream, DataOutputStream, IOException}
+import java.lang.{Thread, SecurityException}
import java.net.{InetAddress, ServerSocket, Socket, UnknownHostException}
import scala.collection.mutable.HashMap
@@ -29,10 +29,11 @@ object TcpService {
def apply(port: Int): TcpService =
ports.get(port) match {
- case Some(service) => service
+ case Some(service) =>
+ service
case None =>
val service = new TcpService(port)
- ports += port -> service
+ ports += Pair(port, service)
service.start()
service
}
@@ -79,14 +80,14 @@ class TcpService(port: Int) extends Thread with Service {
*/
def send(node: Node, data: Array[Byte]): Unit = synchronized {
- def bufferMsg(t: Throwable) = {
+ def bufferMsg(t: Throwable) {
// buffer message, so that it can be re-sent
// when remote net kernel comes up
- pendingSends.get(node) match {
+ (pendingSends.get(node): @unchecked) match {
case None =>
- pendingSends += node -> (data :: Nil)
+ pendingSends += Pair(node, List(data))
case Some(msgs) if msgs.length < TcpService.BufSize =>
- pendingSends += node -> (data :: msgs)
+ pendingSends += Pair(node, data :: msgs)
}
}
@@ -162,7 +163,7 @@ class TcpService(port: Int) extends Thread with Service {
new scala.collection.mutable.HashMap[Node, TcpServiceWorker]
private[actors] def addConnection(node: Node, worker: TcpServiceWorker) = synchronized {
- connections += node -> worker
+ connections += Pair(node, worker)
}
def getConnection(n: Node) = synchronized {
diff --git a/src/compiler/scala/tools/nsc/Interpreter.scala b/src/compiler/scala/tools/nsc/Interpreter.scala
index 79b80e28b5..42c54a759b 100644
--- a/src/compiler/scala/tools/nsc/Interpreter.scala
+++ b/src/compiler/scala/tools/nsc/Interpreter.scala
@@ -1,5 +1,5 @@
/* NSC -- new Scala compiler
- * Copyright 2005-2007 LAMP/EPFL
+ * Copyright 2005-2008 LAMP/EPFL
* @author Martin Odersky
*/
// $Id$
@@ -781,7 +781,7 @@ class Interpreter(val settings: Settings, out: PrintWriter) {
val names1 = getTypes(valAndVarNames, n=>compiler.nme.getterToLocal(n))
val names2 = getTypes(defNames, identity)
- names1.incl(names2)
+ names1 ++ names2
}
/** load and run the code using reflection */
@@ -794,13 +794,11 @@ class Interpreter(val settings: Settings, out: PrintWriter) {
(resultValMethod.invoke(interpreterResultObject, null).toString(),
true)
} catch {
- case e => {
+ case e =>
def caus(e: Throwable): Throwable =
if (e.getCause eq null) e else caus(e.getCause)
- val orig = caus(e)
- (stringFrom(str => orig.printStackTrace(str)),
- false)
- }
+ val orig = caus(e)
+ (stringFrom(str => orig.printStackTrace(str)), false)
}
}
diff --git a/src/compiler/scala/tools/nsc/ast/Trees.scala b/src/compiler/scala/tools/nsc/ast/Trees.scala
index 613377518d..61b73a0d45 100644
--- a/src/compiler/scala/tools/nsc/ast/Trees.scala
+++ b/src/compiler/scala/tools/nsc/ast/Trees.scala
@@ -1,5 +1,5 @@
/* NSC -- new Scala compiler
- * Copyright 2005-2007 LAMP/EPFL
+ * Copyright 2005-2008 LAMP/EPFL
* @author Martin Odersky
*/
// $Id$
@@ -8,10 +8,10 @@ package scala.tools.nsc.ast
import java.io.{PrintWriter, StringWriter}
+import scala.collection.mutable.ListBuffer
import scala.tools.nsc.symtab.{Flags, SymbolTable}
import scala.tools.nsc.symtab.Flags._
import scala.tools.nsc.util.{FreshNameCreator, HashSet, Position, NoPosition, SourceFile}
-import scala.collection.mutable.ListBuffer
trait Trees {
@@ -125,7 +125,7 @@ trait Trees {
def isErroneous = (tpe ne null) && tpe.isErroneous
/** Apply `f' to each subtree */
- def foreach(f: Tree => Unit): Unit = new ForeachTreeTraverser(f).traverse(this)
+ def foreach(f: Tree => Unit) { new ForeachTreeTraverser(f).traverse(this) }
/** Find all subtrees matching predicate `p' */
def filter(f: Tree => Boolean): List[Tree] = {
@@ -160,7 +160,7 @@ trait Trees {
case t: Tree => this eq t
case _ => false
}
- def hashCodeStructure : Int = {
+ def hashCodeStructure: Int = {
var hc = getClass.hashCode
def f(what : Any) : Unit = what match {
case what : Tree => hc += what.hashCodeStructure
@@ -169,7 +169,7 @@ trait Trees {
case null =>
case what => hc += what.hashCode
}
- def g(what : Product) : Unit = {
+ def g(what: Product) {
hc += what.productArity
var i = 0
while (i < what.productArity) {
@@ -436,7 +436,7 @@ trait Trees {
/** Abstract type, type parameter, or type alias */
case class TypeDef(mods: Modifiers, name: Name, tparams: List[TypeDef], rhs: Tree)
extends MemberDef {
- def namePos = pos.offset.map(n => n - name.length).get(-1)
+ def namePos = pos.offset.map(n => n - name.length).getOrElse(-1)
}
/** A TypeDef node which defines given `sym' with given tight hand side `rhs'. */
diff --git a/src/compiler/scala/tools/nsc/ast/parser/Scanners.scala b/src/compiler/scala/tools/nsc/ast/parser/Scanners.scala
index 2ac58e4a0d..6c2c5f36ba 100644
--- a/src/compiler/scala/tools/nsc/ast/parser/Scanners.scala
+++ b/src/compiler/scala/tools/nsc/ast/parser/Scanners.scala
@@ -1,5 +1,5 @@
/* NSC -- new Scala compiler
- * Copyright 2005-2007 LAMP/EPFL
+ * Copyright 2005-2008 LAMP/EPFL
* @author Martin Odersky
*/
// $Id$
@@ -961,7 +961,7 @@ trait Scanners {
// XML lexing----------------------------------------------------------------
def xSync = {
- token = NEWLINE; // avoid getting NEWLINE from nextToken if last was RBRACE
+ token = NEWLINE // avoid getting NEWLINE from nextToken if last was RBRACE
//in.next
nextToken
}
@@ -1030,7 +1030,7 @@ trait Scanners {
def error (pos: Int, msg: String) = unit. error(pos, msg)
def incompleteInputError(pos: Int, msg: String) = unit.incompleteInputError(pos, msg)
def deprecationWarning(pos: Int, msg: String) = unit.deprecationWarning(pos, msg)
- implicit def p2g(pos: Position): Int = pos.offset.get(-1)
+ implicit def p2g(pos: Position): Int = pos.offset.getOrElse(-1)
implicit def g2p(pos: Int): Position = new OffsetPosition(unit.source, pos)
}
}
diff --git a/src/compiler/scala/tools/nsc/backend/icode/analysis/Liveness.scala b/src/compiler/scala/tools/nsc/backend/icode/analysis/Liveness.scala
index 72c74804fb..9192f9c043 100644
--- a/src/compiler/scala/tools/nsc/backend/icode/analysis/Liveness.scala
+++ b/src/compiler/scala/tools/nsc/backend/icode/analysis/Liveness.scala
@@ -1,5 +1,5 @@
/* NSC -- new Scala compiler
- * Copyright 2005-2007 LAMP/EPFL
+ * Copyright 2005-2008 LAMP/EPFL
* @author Martin Odersky
*/
@@ -13,6 +13,8 @@ import scala.collection.immutable.{Set, ListSet}
/**
* Compute liveness information for local variables.
+ *
+ * @author Iulian Dragos
*/
abstract class Liveness {
val global: Global
@@ -31,7 +33,7 @@ abstract class Liveness {
override def equals(that: Any): Boolean = this eq that.asInstanceOf[AnyRef]
}
- def lub2(a: Elem, b: Elem): Elem = a incl b
+ def lub2(a: Elem, b: Elem): Elem = a ++ b
}
final class LivenessAnalysis extends DataFlowAnalysis[livenessLattice.type] {
@@ -43,13 +45,13 @@ abstract class Liveness {
val gen: Map[BasicBlock, Set[Local]] = new HashMap()
val kill:Map[BasicBlock, Set[Local]] = new HashMap()
- def init(m: IMethod): Unit = {
+ def init(m: IMethod) {
this.method = m
gen.clear
kill.clear
- for (val b <- m.code.blocks.toList;
- val Pair(g, k) = genAndKill(b)) {
+ for (b <- m.code.blocks.toList;
+ (g, k) = genAndKill(b)) {
gen += b -> g
kill += b -> k
}
@@ -66,10 +68,10 @@ abstract class Liveness {
import opcodes._
/** Return the gen and kill sets for this block. */
- def genAndKill(b: BasicBlock): Pair[Set[Local], Set[Local]] = {
+ def genAndKill(b: BasicBlock): (Set[Local], Set[Local]) = {
var genSet = new ListSet[Local]
var killSet = new ListSet[Local]
- for (val i <- b.toList) i match {
+ for (i <- b.toList) i match {
case LOAD_LOCAL(local) if (!killSet(local)) => genSet = genSet + local
case STORE_LOCAL(local) if (!genSet(local)) => killSet = killSet + local
case _ => ()
@@ -77,7 +79,7 @@ abstract class Liveness {
Pair(genSet, killSet)
}
- override def run: Unit = {
+ override def run {
backwardAnalysis(blockTransfer)
if (settings.debug.value) {
linearizer.linearize(method).foreach(b => if (b != method.code.startBlock)
@@ -87,7 +89,7 @@ abstract class Liveness {
}
def blockTransfer(b: BasicBlock, out: lattice.Elem): lattice.Elem =
- gen(b) incl (out excl kill(b))
+ gen(b) ++ (out excl kill(b))
/** Abstract interpretation for one instruction. Very important:
* liveness is a backward DFA, so this method should be used to compute
diff --git a/src/compiler/scala/tools/nsc/symtab/Symbols.scala b/src/compiler/scala/tools/nsc/symtab/Symbols.scala
index ca854b2aaf..35440ec24a 100644
--- a/src/compiler/scala/tools/nsc/symtab/Symbols.scala
+++ b/src/compiler/scala/tools/nsc/symtab/Symbols.scala
@@ -1,15 +1,16 @@
/* NSC -- new Scala compiler
- * Copyright 2005-2007 LAMP/EPFL
+ * Copyright 2005-2008 LAMP/EPFL
* @author Martin Odersky
*/
// $Id$
package scala.tools.nsc.symtab
+import java.util.regex.Pattern
+
import scala.tools.nsc.io.AbstractFile
import scala.tools.nsc.util.{Position, NoPosition, SourceFile, BatchSourceFile}
import Flags._
-import java.util.regex.Pattern
import nsc.util.RegexCache
trait Symbols {
@@ -53,7 +54,7 @@ trait Symbols {
def setPos(pos: Position): this.type = { this.rawpos = pos; this }
def namePos(source: BatchSourceFile) = {
- val pos: Int = this.pos.offset.get(-1)
+ val pos: Int = this.pos.offset.getOrElse(-1)
val buf = source.content
if (pos == -1) -1
else if (isTypeParameter) pos - name.length
diff --git a/src/compiler/scala/tools/nsc/transform/TypingTransformers.scala b/src/compiler/scala/tools/nsc/transform/TypingTransformers.scala
index b775d95ecf..bfe0a279c2 100644
--- a/src/compiler/scala/tools/nsc/transform/TypingTransformers.scala
+++ b/src/compiler/scala/tools/nsc/transform/TypingTransformers.scala
@@ -1,5 +1,5 @@
/* NSC -- new Scala compiler
- * Copyright 2005-2007 LAMP/EPFL
+ * Copyright 2005-2008 LAMP/EPFL
* @author Martin Odersky
*/
// $Id$
@@ -29,7 +29,7 @@ trait TypingTransformers {
def atOwner[A](tree: Tree, owner: Symbol)(trans: => A): A = {
val savedLocalTyper = localTyper
localTyper = localTyper.atOwner(tree, owner)
- typers += owner -> localTyper
+ typers += Pair(owner, localTyper)
val result = super.atOwner(owner)(trans)
localTyper = savedLocalTyper
typers -= owner
diff --git a/src/compiler/scala/tools/nsc/util/Position.scala b/src/compiler/scala/tools/nsc/util/Position.scala
index 91c437ee8a..4c58ef00a2 100644
--- a/src/compiler/scala/tools/nsc/util/Position.scala
+++ b/src/compiler/scala/tools/nsc/util/Position.scala
@@ -1,5 +1,5 @@
/* NSC -- new Scala compiler
- * Copyright 2005-2007 LAMP/EPFL
+ * Copyright 2005-2008 LAMP/EPFL
* @author Martin Odersky
*/
// $Id$
@@ -13,29 +13,31 @@ object Position {
trait Position {
import Position.tabInc
- def offset : Option[Int] = None
- def source : Option[SourceFile] = None
+ def offset: Option[Int] = None
+ def source: Option[SourceFile] = None
def line: Option[Int] =
if (offset.isEmpty || source.isEmpty) None
else Some(source.get.offsetToLine(offset.get) + 1)
- def column: Option[Int] = {
- if (offset.isEmpty || source.isEmpty) return None
- var column = 1
- // find beginning offset for line
- val line = source.get.offsetToLine(offset.get)
- var coffset = source.get.lineToOffset(line)
- var continue = true
- while (continue) {
- if (coffset == offset.get(-1)) continue = false
- else if (source.get.asInstanceOf[BatchSourceFile].content(coffset) == '\t')
- column = ((column - 1) / tabInc * tabInc) + tabInc + 1
- else column += 1
- coffset += 1
+ def column: Option[Int] =
+ if (offset.isEmpty || source.isEmpty)
+ None
+ else {
+ var column = 1
+ // find beginning offset for line
+ val line = source.get.offsetToLine(offset.get)
+ var coffset = source.get.lineToOffset(line)
+ var continue = true
+ while (continue) {
+ if (coffset == offset.getOrElse(-1)) continue = false
+ else if (source.get.asInstanceOf[BatchSourceFile].content(coffset) == '\t')
+ column = ((column - 1) / tabInc * tabInc) + tabInc + 1
+ else column += 1
+ coffset += 1
+ }
+ Some(column)
}
- Some(column)
- }
def lineContent: String = {
val line = this.line
diff --git a/src/library/scala/collection/mutable/Map.scala b/src/library/scala/collection/mutable/Map.scala
index 0b5504a5e8..c502dd478c 100644
--- a/src/library/scala/collection/mutable/Map.scala
+++ b/src/library/scala/collection/mutable/Map.scala
@@ -1,6 +1,6 @@
/* __ *\
** ________ ___ / / ___ Scala API **
-** / __/ __// _ | / / / _ | (c) 2003-2007, LAMP/EPFL **
+** / __/ __// _ | / / / _ | (c) 2003-2008, LAMP/EPFL **
** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
** /____/\___/_/ |_/____/_/ | | **
** |/ **
@@ -230,9 +230,9 @@ trait Map[A, B] extends AnyRef
/** This method defines syntactic sugar for adding or modifying
* mappings. It is typically used in the following way:
* <pre>
- * map += key -> value;
+ * map += key -> value
* </pre>
- * @deprecated use <code>+={key, value}</code>
+ * @deprecated use <code>+= Pair(key, value)</code>
*/
@deprecated
def +=(key: A): MapTo = new MapTo(key)
diff --git a/src/library/scala/util/parsing/ast/Binders.scala b/src/library/scala/util/parsing/ast/Binders.scala
index 0c2283f3cf..0cc1c7be0f 100644
--- a/src/library/scala/util/parsing/ast/Binders.scala
+++ b/src/library/scala/util/parsing/ast/Binders.scala
@@ -1,6 +1,6 @@
/* __ *\
** ________ ___ / / ___ Scala API **
-** / __/ __// _ | / / / _ | (c) 2006-2007, LAMP/EPFL **
+** / __/ __// _ | / / / _ | (c) 2006-2008, LAMP/EPFL **
** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
** /____/\___/_/ |_/____/_/ | | **
** |/ **
@@ -27,8 +27,8 @@ import scala.collection.mutable.Map
* @author Adriaan Moors
*/
trait Mappable {
- trait Mapper { def apply[t <% Mappable[t]](x :t): t } /* TODO: having type `Forall t. t => t' is too strict:
- sometimes we want to allow `Forall t >: precision. t => t' for some type `precision', so that,
+ trait Mapper { def apply[T <% Mappable[T]](x: T): T } /* TODO: having type `Forall T. T => T' is too strict:
+ sometimes we want to allow `Forall T >: precision. T => T' for some type `precision', so that,
beneath a certain threshold, we have some leeway.
concretely: to use gmap for substitution, we simply require that ast nodes are mapped to ast nodes,
we can't require that the type is preserved precisely: a Name may map to e.g., a MethodCall
@@ -49,12 +49,12 @@ trait Mappable {
implicit def ListIsMappable[t <% Mappable[t]](xs: List[t]): Mappable[List[t]] =
new Mappable[List[t]] {
- def gmap(f: Mapper): List[t] = (for(val x <- xs) yield f(x)).toList
+ def gmap(f: Mapper): List[t] = (for (x <- xs) yield f(x)).toList
}
implicit def OptionIsMappable[t <% Mappable[t]](xs: Option[t]): Mappable[Option[t]] =
new Mappable[Option[t]] {
- def gmap(f: Mapper): Option[t] = (for(val x <- xs) yield f(x))
+ def gmap(f: Mapper): Option[t] = (for (x <- xs) yield f(x))
}
}
@@ -113,12 +113,12 @@ trait Binders extends AbstractSyntax with Mappable {
def indexFor(b: binderType): Option[Int] = {
val iter = elements.counted
- (for(val that <- iter) {
- if(that.name == b.name) // TODO: why do name equals and structural equals differ?
+ for (that <- iter) {
+ if (that.name == b.name) // TODO: why do name equals and structural equals differ?
return Some(iter.count)
else
Console.println(that+"!="+b)
- })
+ }
None
}
@@ -132,7 +132,7 @@ trait Binders extends AbstractSyntax with Mappable {
* @post binds(b)
* @post getElementFor(b) eq b
*/
- def addBinder(b: binderType) = substitution += b -> b
+ def addBinder(b: binderType) { substitution += Pair(b, b) }
/** `canAddElement' indicates whether `b' may be added to this scope.
*
@@ -160,7 +160,7 @@ trait Binders extends AbstractSyntax with Mappable {
/** Returns the current value for the bound occurrences of `b'.
*
* @param b the contained binder whose current value should be returned
- * @pre binds(b)
+ * @pre binds(b)
*/
def getElementFor(b: binderType): Element = substitution(b)
@@ -212,7 +212,7 @@ trait Binders extends AbstractSyntax with Mappable {
/** A variable that escaped its scope (i.e., a free variable) -- we don't deal very well with these yet
*/
- class UnboundElement[n <: NameElement](private val el: n) extends NameElement {
+ class UnboundElement[N <: NameElement](private val el: N) extends NameElement {
def name = el.name+"@??"
}
@@ -255,7 +255,7 @@ trait Binders extends AbstractSyntax with Mappable {
}})
// TODO
- def cloneElementNoBoundElements = element.gmap(new Mapper { def apply[t <% Mappable[t]](x :t): t = x match{
+ def cloneElementNoBoundElements = element.gmap(new Mapper { def apply[t <% Mappable[t]](x :t): t = x match{
case BoundElement(el, _) => new UnboundElement(el).asInstanceOf[t] // TODO: precision stuff
case x => x
}})
@@ -303,12 +303,12 @@ trait Binders extends AbstractSyntax with Mappable {
* @pre !orig.isEmpty implies orig.forall(ub => ub.scope eq orig(0).scope)
*
*/
- def sequence[bt <: NameElement, st <% Mappable[st]](orig: List[UnderBinder[bt, st]]): UnderBinder[bt, List[st]] =
+ def sequence[bt <: NameElement, st <% Mappable[st]](orig: List[UnderBinder[bt, st]]): UnderBinder[bt, List[st]] =
if(orig.isEmpty) UnderBinder.unit(Nil)
else UnderBinder(orig(0).scope, orig.map(_.element))
// couldn't come up with a better name...
- def unsequence[bt <: NameElement, st <% Mappable[st]](orig: UnderBinder[bt, List[st]]): List[UnderBinder[bt, st]] =
+ def unsequence[bt <: NameElement, st <% Mappable[st]](orig: UnderBinder[bt, List[st]]): List[UnderBinder[bt, st]] =
orig.element.map(sc => UnderBinder(orig.scope, sc))
/** An environment that maps a `NameElement' to the scope in which it is bound.
@@ -319,9 +319,8 @@ trait Binders extends AbstractSyntax with Mappable {
*
* TODO: more documentation
*/
- abstract class BinderEnv
- {
- def apply[a <: NameElement](v : a): Option[Scope[a]]
+ abstract class BinderEnv {
+ def apply[A <: NameElement](v: A): Option[Scope[A]]
def extend[a <: NameElement](v : a, x : Scope[a]) = new BinderEnv {
def apply[b <: NameElement](w : b): Option[Scope[b]] =
if(w == v) Some(x.asInstanceOf[Scope[b]])