aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/core
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2013-11-29 16:59:22 +0100
committerMartin Odersky <odersky@gmail.com>2013-11-29 16:59:22 +0100
commit0581e8bac449ac720bd666e7f7fdb010d810a3cd (patch)
tree16808e80e7d87eac80d3c4d646c82f90ed47dddd /src/dotty/tools/dotc/core
parentb508185cc3fe5c740d5ff6ecfd0dc1482596018b (diff)
downloaddotty-0581e8bac449ac720bd666e7f7fdb010d810a3cd.tar.gz
dotty-0581e8bac449ac720bd666e7f7fdb010d810a3cd.tar.bz2
dotty-0581e8bac449ac720bd666e7f7fdb010d810a3cd.zip
SimpleMap.foreachKey -> foreachBinding
Diffstat (limited to 'src/dotty/tools/dotc/core')
-rw-r--r--src/dotty/tools/dotc/core/Constraint.scala18
-rw-r--r--src/dotty/tools/dotc/core/TypeOps.scala8
2 files changed, 13 insertions, 13 deletions
diff --git a/src/dotty/tools/dotc/core/Constraint.scala b/src/dotty/tools/dotc/core/Constraint.scala
index c32c9ce42..a1f52cad7 100644
--- a/src/dotty/tools/dotc/core/Constraint.scala
+++ b/src/dotty/tools/dotc/core/Constraint.scala
@@ -165,17 +165,17 @@ class Constraint(val myMap: SimpleMap[PolyType, Array[Type]]) extends AnyVal wit
/** Perform operation `op` on all typevars, or only on uninstantiated
* typevars, depending on whether `uninstOnly` is set or not.
*/
- def foreachTypeVar(op: TypeVar => Unit, uninstOnly: Boolean = false): Unit = myMap.foreachKey { poly =>
- val entries = myMap(poly)
- for (i <- 0 until paramCount(entries)) {
- def qualifies(tv: TypeVar) =
- if (uninstOnly) isBounds(entries(i)) else !tv.inst.exists
- typeVar(entries, i) match {
- case tv: TypeVar if qualifies(tv) => op(tv)
- case _ =>
+ def foreachTypeVar(op: TypeVar => Unit, uninstOnly: Boolean = false): Unit =
+ myMap.foreachBinding { (poly, entries) =>
+ for (i <- 0 until paramCount(entries)) {
+ def qualifies(tv: TypeVar) =
+ if (uninstOnly) isBounds(entries(i)) else !tv.inst.exists
+ typeVar(entries, i) match {
+ case tv: TypeVar if qualifies(tv) => op(tv)
+ case _ =>
+ }
}
}
- }
/** Perform operation `op` on all uninstantiated typevars.
*/
diff --git a/src/dotty/tools/dotc/core/TypeOps.scala b/src/dotty/tools/dotc/core/TypeOps.scala
index 4c4e8face..d9e5d7f96 100644
--- a/src/dotty/tools/dotc/core/TypeOps.scala
+++ b/src/dotty/tools/dotc/core/TypeOps.scala
@@ -154,15 +154,15 @@ trait TypeOps { this: Context =>
throw new TypeError(s"unexpected parent type: $tp")
}
val parentRefs = parents map normalizeToRef
- refinements foreachKey { name =>
+ refinements foreachBinding { (name, refinedInfo) =>
assert(decls.lookup(name) == NoSymbol, // DEBUG
s"redefinition of ${decls.lookup(name).debugString} in ${cls.showLocated}")
- enterArgBinding(formals(name), refinements(name))
+ enterArgBinding(formals(name), refinedInfo)
}
// These two loops cannot be fused because second loop assumes that
// all arguments have been entered in `decls`.
- refinements foreachKey { name =>
- forwardRefs(formals(name), refinements(name), parentRefs)
+ refinements foreachBinding { (name, refinedInfo) =>
+ forwardRefs(formals(name), refinedInfo, parentRefs)
}
parentRefs
}