summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2006-12-01 15:47:29 +0000
committerMartin Odersky <odersky@gmail.com>2006-12-01 15:47:29 +0000
commit9924a48040753103f6f88ef120c322ce1ae1a4fe (patch)
tree2b3c31001e5d4630eb5dd723d1b6860d4969ac27 /src/compiler/scala/tools/nsc
parente7b359918653a3eb8e45a5556ea0e49da69443f3 (diff)
downloadscala-9924a48040753103f6f88ef120c322ce1ae1a4fe.tar.gz
scala-9924a48040753103f6f88ef120c322ce1ae1a4fe.tar.bz2
scala-9924a48040753103f6f88ef120c322ce1ae1a4fe.zip
fixed problem with protected
Diffstat (limited to 'src/compiler/scala/tools/nsc')
-rw-r--r--src/compiler/scala/tools/nsc/symtab/Types.scala5
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Contexts.scala7
2 files changed, 6 insertions, 6 deletions
diff --git a/src/compiler/scala/tools/nsc/symtab/Types.scala b/src/compiler/scala/tools/nsc/symtab/Types.scala
index e7f2549649..01cf3fdec0 100644
--- a/src/compiler/scala/tools/nsc/symtab/Types.scala
+++ b/src/compiler/scala/tools/nsc/symtab/Types.scala
@@ -48,6 +48,7 @@ trait Types requires SymbolTable {
private var explainSwitch = false
private var checkMalformedSwitch = true
private var globalVariance = 1
+ private final val healTypes = false
val emptyTypeArray = new Array[Type](0)
@@ -1127,7 +1128,7 @@ trait Types requires SymbolTable {
val pre1 = removeSuper(pre, sym1)
if (pre1 ne pre) sym1 = rebind(pre1, sym1)
if (checkMalformedSwitch && !pre1.isStable && !pre1.isError) {
- if (variance == 1) pre.memberType(sym).resultType
+ if (healTypes && variance == 1) pre.memberType(sym).resultType
// else if (variance == -1) AllClass.tpe
else throw new MalformedType(pre, sym.nameString)
} else {
@@ -1212,7 +1213,7 @@ trait Types requires SymbolTable {
} else if (checkMalformedSwitch && sym1.isAbstractType && !pre.isStable && !pre.isError) {
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)
+ if (healTypes && 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 throw new MalformedType(pre, sym1.nameString)
} else {
diff --git a/src/compiler/scala/tools/nsc/typechecker/Contexts.scala b/src/compiler/scala/tools/nsc/typechecker/Contexts.scala
index 5ae728448b..2e4742e94c 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Contexts.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Contexts.scala
@@ -294,14 +294,13 @@ trait Contexts requires Analyzer {
" " + scope.toList + "\n:: " + outer.toString()
}
- 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(moduleToLinkedClass(c.owner)))
+ while (c != NoContext &&
+ !clazz.isNonBottomSubClass(c.owner) &&
+ !(c.owner.isModuleClass && clazz.isNonBottomSubClass(c.owner.linkedClassOfModule)))
c = c.outer.enclClass
c
}