diff options
author | Martin Odersky <odersky@gmail.com> | 2006-02-01 13:21:09 +0000 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2006-02-01 13:21:09 +0000 |
commit | c9a4b1fd73e4900814f32fca4c740aa027036230 (patch) | |
tree | 8def0dad1e08cf73c3ad074b6476e457d1b1c684 /src/compiler/scala/tools/nsc/typechecker/Typers.scala | |
parent | dc4e5a3fbd5e524c57cc9651cc4b7043ea110150 (diff) | |
download | scala-c9a4b1fd73e4900814f32fca4c740aa027036230.tar.gz scala-c9a4b1fd73e4900814f32fca4c740aa027036230.tar.bz2 scala-c9a4b1fd73e4900814f32fca4c740aa027036230.zip |
Diffstat (limited to 'src/compiler/scala/tools/nsc/typechecker/Typers.scala')
-rw-r--r-- | src/compiler/scala/tools/nsc/typechecker/Typers.scala | 22 |
1 files changed, 6 insertions, 16 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala index aff80d4812..87ddef778e 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala @@ -534,9 +534,6 @@ mixin class Typers requires Analyzer { * - no two parents define same symbol. */ def validateParentClasses(parents: List[Tree], selfType: Type): unit = { - var c = context - do { c = c.outer } while (c.owner == context.owner) - val defscope = c.scope def validateParentClass(parent: Tree, isFirst: boolean): unit = if (!parent.tpe.isError) { @@ -550,20 +547,13 @@ mixin class Typers requires Analyzer { error(parent.pos, ""+psym+" is not declared to be a mixin class") else if (psym.hasFlag(FINAL)) error(parent.pos, "illegal inheritance from final class") - else if (psym.isSealed && !phase.erasedTypes) { - // are we in same scope as base type definition? - val e = defscope.lookupEntry(psym.name) - if (c.owner.isPackageClass || !(e != null && e.sym == psym && e.owner == defscope)) { - // we are not within same statement sequence - var c = context - while (c != NoContext && c.owner != psym) c = c.outer.enclClass - if (c == NoContext) error(parent.pos, "illegal inheritance from sealed "+psym) - } - } + else if (!phase.erasedTypes && psym.isSealed && + context.unit.source.file != psym.sourceFile) + error(parent.pos, "illegal inheritance from sealed "+psym) if (!(selfType <:< parent.tpe.typeOfThis) && !phase.erasedTypes) { - System.out.println(context.owner);//debug - System.out.println(context.owner.unsafeTypeParams);//debug - System.out.println(List.fromArray(context.owner.info.closure));//debug + //System.out.println(context.owner);//DEBUG + //System.out.println(context.owner.unsafeTypeParams);//DEBUG + //System.out.println(List.fromArray(context.owner.info.closure));//DEBUG error(parent.pos, "illegal inheritance;\n self-type "+ selfType+" does not conform to "+parent + "'s selftype "+parent.tpe.typeOfThis) |