diff options
author | Martin Odersky <odersky@gmail.com> | 2006-07-24 15:38:59 +0000 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2006-07-24 15:38:59 +0000 |
commit | b2455fcc388e35125adc527a4b4f8021f0b95523 (patch) | |
tree | 2da5321b6b3e7e829e88420cf1b895ac578d6668 /src | |
parent | 3f8fefbe721758ceb6918a4db37a8e28f807e518 (diff) | |
download | scala-b2455fcc388e35125adc527a4b4f8021f0b95523.tar.gz scala-b2455fcc388e35125adc527a4b4f8021f0b95523.tar.bz2 scala-b2455fcc388e35125adc527a4b4f8021f0b95523.zip |
Diffstat (limited to 'src')
-rw-r--r-- | src/compiler/scala/tools/nsc/typechecker/Namers.scala | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Namers.scala b/src/compiler/scala/tools/nsc/typechecker/Namers.scala index 87d2dcf400..42f073402e 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Namers.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Namers.scala @@ -383,9 +383,21 @@ trait Namers requires Analyzer { private def templateSig(templ: Template): Type = { val clazz = context.owner; - val parents = typer.parentTypes(templ) map (p => if (p.tpe.isError) AnyRefClass.tpe else p.tpe); + def checkParent(tpt: Tree): Type = { + val tp = tpt.tpe + if (tp.symbol == context.owner) { + context.error(tpt.pos, ""+tp.symbol+" inherits itself"); + AnyRefClass.tpe + } else if (tp.isError) { + AnyRefClass.tpe + } else { + tp + } + } + val parents = typer.parentTypes(templ) map checkParent val decls = new Scope(); new Namer(context.make(templ, clazz, decls)).enterSyms(templ.body); + ClassInfoType(parents, decls, clazz) } |