diff options
author | Martin Odersky <odersky@gmail.com> | 2008-01-25 15:33:18 +0000 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2008-01-25 15:33:18 +0000 |
commit | 2fd65e0fd34d13c355deeea982f30dce714b6528 (patch) | |
tree | 03aa3b83d890338fe982d62fa01be802de9bb0d8 /src/compiler/scala/tools/nsc/typechecker/Typers.scala | |
parent | bb99cc66c9006735ebf29d8f30f253408f5bc027 (diff) | |
download | scala-2fd65e0fd34d13c355deeea982f30dce714b6528.tar.gz scala-2fd65e0fd34d13c355deeea982f30dce714b6528.tar.bz2 scala-2fd65e0fd34d13c355deeea982f30dce714b6528.zip |
case classes can now inherit from case classes.
Diffstat (limited to 'src/compiler/scala/tools/nsc/typechecker/Typers.scala')
-rw-r--r-- | src/compiler/scala/tools/nsc/typechecker/Typers.scala | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala index 6d57902b4b..240bc297cb 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala @@ -691,7 +691,9 @@ trait Typers { self: Analyzer => // @M: don't check tree.tpe.symbol.typeParams. check tree.tpe.typeParams!!! // (e.g., m[Int] --> tree.tpe.symbol.typeParams.length == 1, tree.tpe.typeParams.length == 0!) tree.tpe.typeParams.length != pt.typeParams.length && - !(tree.tpe.typeSymbol==AnyClass || tree.tpe.typeSymbol==AllClass || pt == WildcardType )) { + !(tree.tpe.typeSymbol==AnyClass || + tree.tpe.typeSymbol==AllClass || + pt == WildcardType )) { // Check that the actual kind arity (tree.symbol.typeParams.length) conforms to the expected // kind-arity (pt.typeParams.length). Full checks are done in checkKindBounds in Infer. // Note that we treat Any and Nothing as kind-polymorphic. @@ -711,7 +713,8 @@ trait Typers { self: Analyzer => val unapply = unapplyMember(extractor.tpe) val clazz = if (unapply.tpe.paramTypes.length == 1) unapply.tpe.paramTypes.head.typeSymbol else NoSymbol - if ((unapply hasFlag CASE) && (clazz hasFlag CASE)) { + if ((unapply hasFlag CASE) && (clazz hasFlag CASE) && + !(clazz.info.baseClasses.tail exists (_ hasFlag CASE))) { if (!phase.erasedTypes) checkStable(tree) //todo: do we need to demand this? // convert synthetic unapply of case class to case class constructor val prefix = tree.tpe.prefix |