diff options
author | Martin Odersky <odersky@gmail.com> | 2006-12-01 15:05:39 +0000 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2006-12-01 15:05:39 +0000 |
commit | e7b359918653a3eb8e45a5556ea0e49da69443f3 (patch) | |
tree | 8213f1ffdb9cbdbe471f3c7087cc671acc4d9a1e /src | |
parent | 4fe80dadef50cfa2d5ca20a5dbae92403d64fba3 (diff) | |
download | scala-e7b359918653a3eb8e45a5556ea0e49da69443f3.tar.gz scala-e7b359918653a3eb8e45a5556ea0e49da69443f3.tar.bz2 scala-e7b359918653a3eb8e45a5556ea0e49da69443f3.zip |
fixed bugs 857, 838, 836
Diffstat (limited to 'src')
-rw-r--r-- | src/compiler/scala/tools/nsc/symtab/Symbols.scala | 8 | ||||
-rw-r--r-- | src/compiler/scala/tools/nsc/symtab/Types.scala | 10 | ||||
-rw-r--r-- | src/compiler/scala/tools/nsc/typechecker/Contexts.scala | 9 |
3 files changed, 16 insertions, 11 deletions
diff --git a/src/compiler/scala/tools/nsc/symtab/Symbols.scala b/src/compiler/scala/tools/nsc/symtab/Symbols.scala index 919066b22f..454264c61c 100644 --- a/src/compiler/scala/tools/nsc/symtab/Symbols.scala +++ b/src/compiler/scala/tools/nsc/symtab/Symbols.scala @@ -517,10 +517,11 @@ trait Symbols requires SymbolTable { throw new Error("typeConstructor inapplicable for " + this) /** The type parameters of this symbol */ - def unsafeTypeParams: List[Symbol] = { + def unsafeTypeParams: List[Symbol] = rawInfo.typeParams + /* val limit = phaseId(validTo) (if (limit < phase.id) infos.info else rawInfo).typeParams - } + */ def typeParams: List[Symbol] = { rawInfo.load(this); rawInfo.typeParams @@ -993,7 +994,7 @@ trait Symbols requires SymbolTable { else "" /** String representation of symbol's definition */ - final def defString: String = { + def defString: String = { val f = if (settings.debug.value) flags else if (owner.isRefinementClass) flags & ExplicitFlags & ~OVERRIDE else flags & ExplicitFlags @@ -1266,6 +1267,7 @@ trait Symbols requires SymbolTable { validTo = currentPeriod this } + override def defString: String = toString override def enclClass: Symbol = this override def toplevelClass: Symbol = this override def enclMethod: Symbol = this diff --git a/src/compiler/scala/tools/nsc/symtab/Types.scala b/src/compiler/scala/tools/nsc/symtab/Types.scala index d08d35467c..e7f2549649 100644 --- a/src/compiler/scala/tools/nsc/symtab/Types.scala +++ b/src/compiler/scala/tools/nsc/symtab/Types.scala @@ -1128,7 +1128,7 @@ trait Types requires SymbolTable { if (pre1 ne pre) sym1 = rebind(pre1, sym1) if (checkMalformedSwitch && !pre1.isStable && !pre1.isError) { if (variance == 1) pre.memberType(sym).resultType - else if (variance == -1) AllClass.tpe +// else if (variance == -1) AllClass.tpe else throw new MalformedType(pre, sym.nameString) } else { unique(new SingleType(pre1, sym1) with UniqueType) @@ -1213,7 +1213,7 @@ trait Types requires SymbolTable { def transform(tp: Type): Type = tp.asSeenFrom(pre, sym1.owner).subst(sym1.typeParams, args) if (variance == 1 && !(sym1.info.bounds.hi contains sym1)) transform(sym1.info.bounds.hi) - else if (variance == -1 && !(sym1.info.bounds.lo contains sym1)) transform(sym1.info.bounds.lo) + //else if (variance == -1 && !(sym1.info.bounds.lo contains sym1)) transform(sym1.info.bounds.lo) else throw new MalformedType(pre, sym1.nameString) } else { rawTypeRef(pre, sym1, args) @@ -1492,13 +1492,13 @@ trait Types requires SymbolTable { if (symclazz == clazz && (pre.widen.symbol isNonBottomSubClass symclazz)) pre.baseType(symclazz) match { case TypeRef(_, basesym, baseargs) => -// Console.println("instantiating " + sym + " from " + basesym + " with " + basesym.typeParams + " and " + baseargs);//DEBUG + //Console.println("instantiating " + sym + " from " + basesym + " with " + basesym.typeParams + " and " + baseargs+", pre = "+pre+", symclazz = "+symclazz);//DEBUG if (basesym.typeParams.length != baseargs.length) throw new TypeError( "something is wrong (wrong class file?): "+basesym+ " with type parameters "+ basesym.typeParams.map(.name).mkString("[",",","]")+ - " gets applied to arguments "+baseargs.mkString("(",",",")")) + " gets applied to arguments "+baseargs.mkString("(",",",")")+", phase = "+phase) instParam(basesym.typeParams, baseargs); case _ => throwError @@ -1867,7 +1867,7 @@ trait Types requires SymbolTable { def isSubType(tp1: Type, tp2: Type): boolean = try { stc = stc + 1 - if (stc == 20) throw new Error("recursive <:<") + if (stc == 100) throw new Error("recursive <:<") isSubType0(tp1, tp2) } finally { stc = stc - 1 diff --git a/src/compiler/scala/tools/nsc/typechecker/Contexts.scala b/src/compiler/scala/tools/nsc/typechecker/Contexts.scala index 7d13a8f347..5ae728448b 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Contexts.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Contexts.scala @@ -294,11 +294,14 @@ trait Contexts requires Analyzer { " " + scope.toList + "\n:: " + outer.toString() } - /** Return closest enclosing context that defines a superclass of `clazz', or NoContext - * if none exists */ + private def moduleToLinkedClass(sym: Symbol) = + if (sym.isModuleClass) sym.linkedClassOfModule else sym + + /** Return closest enclosing context that defines a superclass of `clazz', or a + * companion module of a superclass of `clazz', or NoContext if none exists */ def enclosingSuperClassContext(clazz: Symbol): Context = { var c = this.enclClass - while (c != NoContext && !clazz.isNonBottomSubClass(c.owner)) + while (c != NoContext && !clazz.isNonBottomSubClass(moduleToLinkedClass(c.owner))) c = c.outer.enclClass c } |