diff options
author | Paul Phillips <paulp@improving.org> | 2009-09-11 15:23:05 +0000 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2009-09-11 15:23:05 +0000 |
commit | 61ff261346289f7886350a8a4da5688574070e59 (patch) | |
tree | 4869fbb98aebf26b97b473ba27a0ea0deba72874 /src | |
parent | 8871528f60958a45eb119a5cc487f87215e4e92f (diff) | |
download | scala-61ff261346289f7886350a8a4da5688574070e59.tar.gz scala-61ff261346289f7886350a8a4da5688574070e59.tar.bz2 scala-61ff261346289f7886350a8a4da5688574070e59.zip |
Deprecated case classes inheriting from other c...
Deprecated case classes inheriting from other case classes, and updated
all the tests which did so.
Diffstat (limited to 'src')
-rw-r--r-- | src/compiler/scala/tools/nsc/typechecker/Typers.scala | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala index d9471c6008..790e7e99ca 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala @@ -1143,6 +1143,17 @@ trait Typers { self: Analyzer => if (psym hasFlag FINAL) { error(parent.pos, "illegal inheritance from final "+psym) } + // XXX I think this should issue a sharper warning of some kind like + // "change your code now!" as there are material bugs (which will not be fixed) + // associated with case class inheritance. + if ((context.owner hasFlag CASE) && !phase.erasedTypes) { + for (ancestor <- parent.tpe.baseClasses find (_ hasFlag CASE)) + unit.deprecationWarning(parent.pos, ( + "case class `%s' has case class ancestor `%s'. This has been deprecated " + + "for unduly complicating both usage and implementation. You should instead " + + "use extractors for pattern matching on non-leaf nodes." ).format(context.owner, ancestor) + ) + } if (psym.isSealed && !phase.erasedTypes) { if (context.unit.source.file != psym.sourceFile) error(parent.pos, "illegal inheritance from sealed "+psym) |