summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/typechecker/Namers.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2009-02-15 16:43:36 +0000
committerMartin Odersky <odersky@gmail.com>2009-02-15 16:43:36 +0000
commit266df9f05ecd11e67166e57cc58236646f2f50bb (patch)
tree6325a682f6b0d2101928a8eca047477f09e2db57 /src/compiler/scala/tools/nsc/typechecker/Namers.scala
parentf2032c958854476587f6e78668b16216a28dc9a8 (diff)
downloadscala-266df9f05ecd11e67166e57cc58236646f2f50bb.tar.gz
scala-266df9f05ecd11e67166e57cc58236646f2f50bb.tar.bz2
scala-266df9f05ecd11e67166e57cc58236646f2f50bb.zip
Fixed an ambiguity problem with implcits, and a...
Fixed an ambiguity problem with implcits, and a spurious cyclic reference error mentioned by Jorge. Tightened overriding checks (test case is new collection libraries).
Diffstat (limited to 'src/compiler/scala/tools/nsc/typechecker/Namers.scala')
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Namers.scala25
1 files changed, 14 insertions, 11 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Namers.scala b/src/compiler/scala/tools/nsc/typechecker/Namers.scala
index f3fe615e80..6e648371ea 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Namers.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Namers.scala
@@ -27,17 +27,20 @@ trait Namers { self: Analyzer =>
* 2. The skolem is a method parameter which appears in parameter `tparams'
*/
class DeSkolemizeMap(tparams: List[Symbol]) extends TypeMap {
- def apply(tp: Type): Type = tp match {
- case TypeRef(pre, sym, args)
- if (sym.isTypeSkolem && (tparams contains sym.deSkolemize)) =>
- mapOver(rawTypeRef(NoPrefix, sym.deSkolemize, args))
- case PolyType(tparams1, restpe) =>
- new DeSkolemizeMap(tparams1 ::: tparams).mapOver(tp)
- case ClassInfoType(parents, decls, clazz) =>
- val parents1 = List.mapConserve(parents)(this)
+ def apply(tp: Type): Type = if (tparams.isEmpty) tp
+ else {
+ tp match {
+ case TypeRef(pre, sym, args)
+ if (sym.isTypeSkolem && (tparams contains sym.deSkolemize)) =>
+ mapOver(rawTypeRef(NoPrefix, sym.deSkolemize, args))
+ case PolyType(tparams1, restpe) =>
+ new DeSkolemizeMap(tparams1 ::: tparams).mapOver(tp)
+ case ClassInfoType(parents, decls, clazz) =>
+ val parents1 = List.mapConserve(parents)(this)
if (parents1 eq parents) tp else ClassInfoType(parents1, decls, clazz)
- case _ =>
- mapOver(tp)
+ case _ =>
+ mapOver(tp)
+ }
}
}
private class NormalNamer(context : Context) extends Namer(context)
@@ -415,7 +418,7 @@ trait Namers { self: Analyzer =>
// --- Lazy Type Assignment --------------------------------------------------
def typeCompleter(tree: Tree) = mkTypeCompleter(tree) { sym =>
- if (settings.debug.value) log("defining " + sym + Flags.flagsToString(sym.flags));
+ if (settings.debug.value) log("defining " + sym + Flags.flagsToString(sym.flags)+sym.locationString)
val tp = typeSig(tree)
tp match {
case TypeBounds(lo, hi) =>